Skip to content
Projetos

Sobre

🔥 Animação de "+1" semelhante a uma curtida para Android, com texto e imagens. Escrito em Kotlin e utilizável a partir de Java

Design e mídia

Como estes números são medidos

Crescimento medido de estrelas

em 24 h
0
em 7 dias
0
em 15 dias
+1
em 1 mês
-1

Variações líquidas em períodos sobrepostos, não totais diários. Medições ausentes ficam em branco. Estrelas indicam interesse, não qualidade.

README.md

Original

GoodView

English | 简体中文

JitPack CI API

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

ScreenShot

GoodView demo
Home Dark mode Feed Images
Animation lab Combo Check-in

The sample app shows every API above, with light and dark themes.

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:3.0.0'
Gradle Kotlin DSL:
// settings.gradle.kts
dependencyResolutionManagement {
    repositories {
        google()
        mavenCentral()
        maven("https://jitpack.io")
    }
}

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

Demo

The library is written in Kotlin and can be called directly from both Java and Kotlin. It depends on kotlin-stdlib.

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

Credits

The sample app bundles these fonts, both licensed under the SIL Open Font License 1.1 (license texts in sample/licenses/):

The library itself bundles no fonts.

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.

Explore projetos relacionados

Carregando…