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

Commit 7d914f50 authored by Julia Reynolds's avatar Julia Reynolds
Browse files

Fix legacy app notification pages

Test: view legacy app notification page
Change-Id: Id0d7ac53bc0d9e4d7084bea7ff44d4d8a082cb74
Fixes: 124453411
parent ad6cc282
Loading
Loading
Loading
Loading
+9 −12
Original line number Diff line number Diff line
@@ -51,6 +51,8 @@ public class AppNotificationSettings extends NotificationSettingsBase {
    private static String KEY_ADVANCED_CATEGORY = "app_advanced";
    private static String KEY_BADGE = "badge";
    private static String KEY_APP_LINK = "app_link";
    private static String KEY_BUBBLE = "bubble";
    private static String[] LEGACY_NON_ADVANCED_KEYS = {KEY_BADGE, KEY_APP_LINK, KEY_BUBBLE};

    private List<NotificationChannelGroup> mChannelGroupList;

@@ -65,21 +67,16 @@ public class AppNotificationSettings extends NotificationSettingsBase {
        final PreferenceScreen screen = getPreferenceScreen();
        if (mShowLegacyChannelConfig && screen != null) {
            // if showing legacy settings, pull advanced settings out of the advanced category
            Preference badge = findPreference(KEY_BADGE);
            Preference appLink = findPreference(KEY_APP_LINK);
            PreferenceGroup advanced = (PreferenceGroup) findPreference(KEY_ADVANCED_CATEGORY);
            removePreference(KEY_ADVANCED_CATEGORY);
            if (badge != null) {
            if (advanced != null) {
                    advanced.removePreference(badge);
                for (String key : LEGACY_NON_ADVANCED_KEYS) {
                    Preference pref = advanced.findPreference(key);
                    advanced.removePreference(pref);
                    if (pref != null) {
                        screen.addPreference(pref);
                    }
                screen.addPreference(badge);
                }
            if (appLink != null) {
                if (advanced != null) {
                    advanced.removePreference(appLink);
                }
                screen.addPreference(appLink);
            }
        }
    }