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

Commit eb0de823 authored by Michael W's avatar Michael W
Browse files

Parts: 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 efd75af3
Loading
Loading
Loading
Loading
+17 −11
Original line number Diff line number Diff line
@@ -272,6 +272,7 @@ public class NotificationLightSettings extends SettingsPreferenceFragment implem
        Context context = getActivity();

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

@@ -299,8 +300,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(
@@ -311,7 +318,6 @@ public class NotificationLightSettings extends SettingsPreferenceFragment implem
            mApplicationPrefList.addPreference(pref);
        }
    }
    }

    private int getInitialColorForPackage(String packageName) {
        boolean autoColor = CMSettings.System.getInt(getActivity().getContentResolver(),