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

Commit 541ead98 authored by Michael W's avatar Michael W Committed by Michael Bestas
Browse files

Settings: Fix notification light app hint

* The old code doesn't work when the entry in the database is not
  available, because it will cause parsePackageList() to return false,
  resulting in no execution of the code taking care of displaying the hint
* Move the hint to a new function and call it at the appropriate places
  to display the hint when no entry to the database was ever made

Thanks to @mikeioannina for noticing the missing hint

Change-Id: Ie3fb39cfa7e7b04a3536f98e93e2168d7367961d
parent 4c0e497b
Loading
Loading
Loading
Loading
+17 −11
Original line number Diff line number Diff line
@@ -237,6 +237,7 @@ public class NotificationLightSettings extends SettingsPreferenceFragment implem
        Context context = getActivity();

        if (!parsePackageList()) {
            maybeDisplayApplicationHint(context);
            return;
        }

@@ -263,8 +264,14 @@ public class NotificationLightSettings extends SettingsPreferenceFragment implem
                }
            }

            maybeDisplayApplicationHint(context);
        }
    }

    private void maybeDisplayApplicationHint(Context context)
    {
        /* Display a pref explaining how to add apps */
            if (mApplicationPrefList.getPreferenceCount() == 0) {
        if (mApplicationPrefList != null && mApplicationPrefList.getPreferenceCount() == 0) {
            String summary = getResources().getString(
                    R.string.notification_light_no_apps_summary);
            String useCustom = getResources().getString(
@@ -275,7 +282,6 @@ public class NotificationLightSettings extends SettingsPreferenceFragment implem
            mApplicationPrefList.addPreference(pref);
        }
    }
    }

    private void addCustomApplicationPref(String packageName) {
        Package pkg = mPackages.get(packageName);