Skip to content
A custom view to show achievements on Android
Kotlin Java
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.idea Minor fixes Jun 4, 2017
achievementview Increase version number Jun 4, 2017
app Minor fixes Jun 4, 2017
art Add gif to README Jun 4, 2017
gradle/wrapper
.gitignore Merge gitignore files Jun 4, 2017
LICENSE Initial commit Jun 4, 2017
README.md Update README.md Dec 11, 2018
build.gradle
gradle.properties Initial commit Jun 4, 2017
gradlew Initial commit Jun 4, 2017
gradlew.bat Initial commit Jun 4, 2017
settings.gradle Initial commit Jun 4, 2017

README.md

AchievementView for Android

A custom view for achievements pop-ups written in Kotlin.

The basic properties can be changed through XML like its size, color, drawable, duration. If this isn't enough then feel free to customize as you wish!

gif

Installation

You can import the achievementview module into your project or just grab it via Gradle,

compile 'com.cdev.android:achievement-view:0.9.1'

Usage

1. Include into your layout

<com.cdev.achievementview.AchievementView
        android:id="@+id/achievement_view"
        android:layout_width="match_parent"
        android:layout_height="50dp"
        custom:collapseStartDelay="3500"
        custom:colorLeft="@color/green_light"
        custom:colorRight="@color/green_dark"
        custom:drawableLeft="@drawable/trophy"/>

2. Get a reference and call show

Java

AchievementView achievementView = (AchievementView) findViewById(R.id.achievement_view);

// show the achievement with a single line
achievementView.show("Single line text");

// show the achievement with two lines
achievementView.show("First line", "Second line");

Kotlin

val achievementView = findViewById(R.id.achievement_view) as AchievementView

// show the achievement with a single line
achievementView.show("Single line text")

// show the achievement with two lines
achievementView.show("First line", "Second line")

3. Clear animation

You need to call clearAnimation() to cancel any ongoing animation when you intend to, also consider to call it in onPause() or onStop().

Customize

The following attributes can be changed,

custom:rightPartWidth="250dp"                   // default 300 dp
custom:revealDuration="300"                     // default 500 ms
custom:concealStartDelay="1000"                 // default 500 ms
custom:expandDuration="300"                     // default 500 ms
custom:collapseStartDelay="3500"                // default 1500 ms
custom:colorLeft="@color/green_light"           // default #607D8B
custom:colorRight="@color/green_dark"           // default #455A64
custom:drawableLeft="@drawable/trophy"          // default not set
custom:firstLine="First line"                   // default not set
custom:secondLine="Second line"                 // default not set
custom:textColorFirstLine="@color/colorPrimary" // default white
custom:textColorSecondLine="@color/colorAccent" // default white
custom:textSizeFirstLine="10sp"                 // default not set
custom:textSizeSecondLine="8sp"                 // default not set

If you doesn't specify an attribute, then a default value will be set.

License

This project is licensed under the MIT License - see the License.md file for details

You can’t perform that action at this time.