Skip to content
This repository has been archived by the owner on Feb 16, 2021. It is now read-only.

DarkionAvey/AchievementUnlocked-library

Repository files navigation

AchievementUnlocked app demo

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

  1. Initialize achievementUnlocked object
    AchievementUnlocked achievementUnlocked = new AchievementUnlocked(getApplicationContext());
  2. Customize appearance
      achievementUnlocked.setRounded(rounded).setLarge(large).setTopAligned(top).setDismissible(dismiss)
  3. 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) {
                     
                    }
                });
  4. 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.

New: control subtitle scrolling speed

In the latest version, new method to control scrolling speed has been added. To set speed rate, use the code below:
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

About

[Android] AchievementUnlocked is an open-source Android library that creates "XBOX Achievement Unlocked"-like alerts.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages