Download APK (for Android KitKat+)
Animated pop-ups inspired by XBOX.
The original library is here
repositories {
jcenter()
}
compile 'com.geniusforapp.achievementunlocked:achievement:0.0.1'
private void showAchievement() {
AchievementUnlocked test = new AchievementUnlocked(MainActivity.this).setReadingDelay(5000).setDismissible(true);
AchievementData achievementData = new AchievementData();
achievementData.setTitle("Replace with your own action");
achievementData.setState(AchievementIconView.AchievementIconViewStates.FADE_DRAWABLE);
achievementData.setBackgroundColor(getResources().getColor(R.color.colorAccent));
achievementData.setIcon(getResources().getDrawable(android.R.drawable.ic_dialog_alert));
achievementData.setTextColor(getResources().getColor(android.R.color.white));
test.show(achievementData);
}
public boolean checkDrawOverlayPermission() {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) {
return true;
}
if (!Settings.canDrawOverlays(this)) {
Intent intent = new Intent(Settings.ACTION_MANAGE_OVERLAY_PERMISSION, Uri.parse("package:" + getPackageName()));
startActivityForResult(intent, REQUEST_CODE);
return false;
} else {
return true;
}
}
// add this to your activity
@Override
@TargetApi(Build.VERSION_CODES.M)
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == REQUEST_CODE) {
if (Settings.canDrawOverlays(this)) {
showAchievement();
}
}
}
tips will help the developer to program more library
Feel free to contribute to AchievementUnlocked-library.
If you've fixed a bug or have a feature you've added, just create a pull request. If you've found a bug, want a new feature, or have other questions, file an issue. I will try to answer as soon as possible.
Please send a pull request if you would like to be added here.
Copyright 2017 Ahmad Najar
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.