Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9e6d39e7 authored by Daniel Nishi's avatar Daniel Nishi
Browse files

Turn in the work profile's badge.

The badge is no longer part of the preferred work profile UX. By
removing the code which badges the preferences for the individual
storage items, we can avoid placing the no longer needed tiny badges.

Change-Id: I6fd2ec28d3cf55e3a95b877f4c7b9b51c94e12d8
Fixes: 64475406
Test: Manual
parent c3b47925
Loading
Loading
Loading
Loading
+9 −14
Original line number Diff line number Diff line
@@ -208,23 +208,18 @@ public class StorageItemPreferenceController extends AbstractPreferenceControlle
    public void setUserId(UserHandle userHandle) {
        mUserId = userHandle.getIdentifier();

        PackageManager pm = mContext.getPackageManager();
        badgePreference(pm, userHandle, mPhotoPreference);
        badgePreference(pm, userHandle, mMoviesPreference);
        badgePreference(pm, userHandle, mAudioPreference);
        badgePreference(pm, userHandle, mGamePreference);
        badgePreference(pm, userHandle, mAppPreference);
        badgePreference(pm, userHandle, mSystemPreference);
        badgePreference(pm, userHandle, mFilePreference);
        tintPreference(mPhotoPreference);
        tintPreference(mMoviesPreference);
        tintPreference(mAudioPreference);
        tintPreference(mGamePreference);
        tintPreference(mAppPreference);
        tintPreference(mSystemPreference);
        tintPreference(mFilePreference);
    }

    private void badgePreference(PackageManager pm, UserHandle userHandle, Preference preference) {
    private void tintPreference(Preference preference) {
        if (preference != null) {
            Drawable currentIcon = preference.getIcon();
            // Sigh... Applying the badge to the icon clobbers the tint on the base drawable.
            // For some reason, reapplying it here means the tint remains.
            currentIcon = applyTint(mContext, currentIcon);
            preference.setIcon(pm.getUserBadgedIcon(currentIcon, userHandle));
            preference.setIcon(applyTint(mContext, preference.getIcon()));
        }
    }