Add it to your build.gradle with:
allprojects {
repositories {
maven { url "https://jitpack.io" }
}
}
and:
dependencies {
compile 'com.github.RafaelBarbosatec:AchievementView:0.1.5'
}
<com.rafaelbarbosatec.archivimentview.AchievementView
android:id="@+id/achievementView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:ac_tittle="Parabéns"
app:ac_mensage="Acabou de ganhar 50 coins"
app:ac_icon="@drawable/ic_news"
app:ac_color="@color/colorPrimaryDark"
app:ac_text_color="@color/colorAccent">
</com.rafaelbarbosatec.archivimentview.AchievementView>
achievementView = (AchievementView) findViewById(R.id.achievementView);
achievementView
.setTitle("Treino Finalizado")
.setMensage("Você ganhou 50 pontos de força!")
//.setBorderRetangle()
.setColor(R.color.colorAccent)
.setIcon(R.drawable.ic_sun)
//.setScaleTypeIcon(ImageView.ScaleType.CENTER_INSIDE)
.setDuration(AchievementView.TIMER_INDETERMINATE) // or time in milliseconds
.setClick(new View.OnClickListener() {
@Override
public void onClick(View view) {
Toast.makeText(MainActivity.this,"Click AchievementView",Toast.LENGTH_SHORT).show();
//if duration TIMER_INDETERMINATE call dimiss() to hide achievement
achievementView.dimiss();
}
})
.setShowListern(new ShowListern() {
@Override
public void start() {
Log.i("LOG","start");
}
@Override
public void show() {
Log.i("LOG","show");
}
@Override
public void dimiss() {
Log.i("LOG","dimiss");
}
@Override
public void end() {
Log.i("LOG","end");
}
})
.show();
achievementView = (AchievementView) findViewById(R.id.achievementView);
achievementView.show();
This library is licensed under the Apache Software License, Version 2.0.
See LICENSE
for full of the license text.
Copyright (C) 2017 Rafael Almeida
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
https://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.