Skip to content
프로젝트

소개

🔥 텍스트와 이미지를 지원하는 Android용 "+1" 스타일 애니메이션입니다. Kotlin으로 작성되었으며 Java에서 호출할 수 있습니다.

창작 및 미디어

이 수치를 측정하는 방법

측정된 스타 증가

in 24h
0
in 7 days
+1
in 15 days
0
in 1 month
기록 수집 중

서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.

README.md

Original

GoodView

English | 简体中文

JitPack CI API

A "+1" like animation for Android, supporting both text and images.

Download the sample APK

ScreenShot

Usage

Gradle:
  1. Add the JitPack repository to settings.gradle:
dependencyResolutionManagement {
    repositories {
        google()
        mavenCentral()
        maven { url = 'https://jitpack.io' }
    }
}
  1. Add the dependency to your module's build.gradle:
implementation 'com.github.venshine:GoodView:2.0.1'
Gradle Kotlin DSL:
// settings.gradle.kts
dependencyResolutionManagement {
    repositories {
        google()
        mavenCentral()
        maven("https://jitpack.io")
    }
}

// build.gradle.kts
implementation("com.github.venshine:GoodView:2.0.1")

Demo

The library is written in Java and can be called directly from both Java and Kotlin. It adds no Kotlin dependency to your project.

Kotlin:
class MainActivity : AppCompatActivity() {
    private lateinit var goodView: GoodView

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)

        goodView = GoodView(this)
        findViewById<ImageView>(R.id.good).setOnClickListener { v ->
            goodView.setText("+1")
            goodView.show(v)
        }
        findViewById<ImageView>(R.id.collection).setOnClickListener { v ->
            goodView.setTextInfo("Saved", Color.parseColor("#f66467"), 12) // text, color, size (dp)
            goodView.show(v)
        }
        findViewById<ImageView>(R.id.like).setOnClickListener { v ->
            goodView.setImage(R.mipmap.good_checked) // image
            goodView.show(v)
        }
    }
}
Java:
public class MainActivity extends Activity {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        final GoodView goodView = new GoodView(this);
        findViewById(R.id.good).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                goodView.setText("+1");
                goodView.show(v);
            }
        });
    }
}
Methods:

| method | description | |:--- |:---| | void setText(String text) | Set the text (optional) | | void setTextInfo(String text, int textColor, int textSize) | Set the text, color and size (optional) | | void setTextColor(int color) | Set the text color (optional) | | void setTextSize(int textSize) | Set the text size in dp (optional) | | void setImage(int resId) | Set the image (optional) | | void setImage(Drawable drawable) | Set the image (optional) | | void setDistance(int dis) | Set the moving distance | | void setTranslateY(int fromY, int toY) | Set the Y-axis translation | | void setAlpha(float fromAlpha, float toAlpha) | Set the alpha animation | | void setDuration(int duration) | Set the animation duration | | void reset() | Reset all properties | | void show(View v) | Show the animation above the view (required) |

About

License

Copyright (C) 2016 [email protected]

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

관련 프로젝트 살펴보기

불러오는 중…