AchievementUnlocked
Animated pop-ups inspired by XBOX.
Download APK (for Android KitKat+)License
GPL (for the companion App)
Library (MIT)
How to add to my app
Copy AchievementUnlocked.Java class to your app. That's it!
How to show popups
- Initialize achievementUnlocked object
AchievementUnlocked achievementUnlocked = new AchievementUnlocked(getApplicationContext());
- Customize appearance
achievementUnlocked.setRounded(rounded).setLarge(large).setTopAligned(top).setDismissible(dismiss)
- Supply the aforementioned object with (array of) AcheievementData
AchievementData data0 = new AchievementData(); data0.setTitle(title); data0.setSubTitle(title); data0.setIcon(iconFinal); data0.setTextColor(textColor); data0.setIconBackgroundColor(iconBG); data0.setBackgroundColor(bg); data0.setPopUpOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { } });
- Pop your data!
achievementUnlocked.show(data0, data1, data2, data3);
Phones with large status bars and/or Android Oreo+
achievementUnlocked.setNotchMode(Integer statusBarHeight)
Use the above method to vertically shift top-aligned popups. 'statusBarHeight' will be the vertical shift of the popup. If you supply a null value, 'status_bar_height' dimen from 'android' package will be used instead. You don't need to use the ViewCompat.setOnApplyWindowInsetsListener to get the statusbar height since the popup will be drawn over all apps and using the hardcoded status bar height is sufficient. This is the default behaviour on devices running Android Oreo+ since it prevents apps from drawing over the status bar.
In the latest version, new method to control scrolling speed has been added. To set speed rate, use the code below: New: control subtitle scrolling speed
achievementUnlocked.setScrollingPxPerSeconds(float);
Higher values will result in faster scrolling. This method should be used alongside setReadingDelay method to assign rates that best fit your application nature