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

Commit 2f6f9324 authored by Michael W's avatar Michael W Committed by Abhisek Devkota
Browse files

Remove "Apps" category when empty

In "notification light" settings there is a single line
"Apps", when as no apps are added to the group.
This patch removes the line until apps are added.

Change-Id: Ic603fb67a667717795455a7abf6612cc51f7de55
parent e92f0241
Loading
Loading
Loading
Loading
+14 −1
Original line number Diff line number Diff line
@@ -154,6 +154,7 @@ public class NotificationLightSettings extends SettingsPreferenceFragment implem

        mApplicationPrefList = (PreferenceGroup) findPreference("applications_list");
        mApplicationPrefList.setOrderingAsAdded(false);
        prefSet.removePreference(mApplicationPrefList);

        // Get launch-able applications
        mPackageManager = getPackageManager();
@@ -239,7 +240,6 @@ public class NotificationLightSettings extends SettingsPreferenceFragment implem
            mVoicemailPref.setAllValues(vmailColor, vmailTimeOn, vmailTimeOff);
        }

        mApplicationPrefList = (PreferenceGroup) findPreference("applications_list");
        mApplicationPrefList.setOrderingAsAdded(false);
    }

@@ -272,6 +272,19 @@ public class NotificationLightSettings extends SettingsPreferenceFragment implem
                    // Do nothing
                }
            }

            // Check if "Apps" Group should be shown
            PreferenceScreen prefSet = getPreferenceScreen();
            PreferenceGroup prefGrp = (PreferenceGroup) findPreference("applications_list");
            if (mApplicationPrefList.getPreferenceCount() == 0) {
                if (prefGrp != null) {
                    prefSet.removePreference(mApplicationPrefList);
                }
            } else {
                if (prefGrp == null) {
                    prefSet.addPreference(mApplicationPrefList);
                }
            }
        }
    }