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

Commit 4afa6a86 authored by Steve Kondik's avatar Steve Kondik
Browse files

cmparts: Custom LED notifications for dual-led devices

This allows phones which only have an amber/green LED to customize
the color used for different applications.

Overlay has_dual_notification_led to use this feature.

Change-Id: Icd3058598259555adbfdd6509013314259194b86
parent a104fae0
Loading
Loading
Loading
Loading
+49 −37
Original line number Diff line number Diff line
@@ -138,6 +138,18 @@
        <item>none</item>
    </string-array>

    <string-array name="entries_dual_led_colors">
        <item>Green</item>
        <item>Amber</item>
        <item>None</item>
    </string-array>

    <string-array name="values_dual_led_colors" translatable="false">
        <item>green</item>
        <item>red</item>
        <item>none</item>
    </string-array>

    <string-array name="pref_trackball_blink_rate_entries">
        <item>2 (Fast)</item>
        <item>3</item>
+1 −0
Original line number Diff line number Diff line
@@ -3,6 +3,7 @@
    <!-- Whether or not to display the trackball settings -->
    <bool name="has_trackball">true</bool>
    <bool name="has_rgb_notification_led">false</bool>
    <bool name="has_dual_notification_led">false</bool>

    <!-- LED Flashlight -->
    <bool name="has_led_flash">false</bool>
+64 −54
Original line number Diff line number Diff line
@@ -76,7 +76,7 @@ public class TrackballNotificationActivity extends PreferenceActivity implements

    public List<String> uniqueArray(String[] array) {
        Set<String> set = new HashSet<String>(Arrays.asList(array));
        List array2 = new ArrayList<String>(set);
        List<String> array2 = new ArrayList<String>(set);
        return array2;
    }

@@ -373,6 +373,8 @@ public class TrackballNotificationActivity extends PreferenceActivity implements
        removeCatList.setOnPreferenceChangeListener(this);
        catScreen.addPreference(removeCatList);

        // Advanced options only relevant to RGB lights
        if (!getResources().getBoolean(R.bool.has_dual_notification_led)) {
            CheckBoxPreference alwaysPulse = new CheckBoxPreference(this);
            alwaysPulse.setKey(ALWAYS_PULSE);
            alwaysPulse.setSummary(R.string.pref_trackball_screen_summary);
@@ -406,6 +408,7 @@ public class TrackballNotificationActivity extends PreferenceActivity implements
            orderPulse.setTitle(R.string.pref_trackball_order_title);
            orderPulse.setEnabled(Settings.System.getInt(getContentResolver(), Settings.System.TRACKBALL_NOTIFICATION_BLEND_COLOR, 0) == 1 ? false : true);
            advancedScreen.addPreference(orderPulse);
        }

        Preference resetColors = new Preference(this);
        resetColors.setKey(RESET_NOTIFS);
@@ -469,11 +472,17 @@ public class TrackballNotificationActivity extends PreferenceActivity implements
                colorList.setTitle(R.string.color_trackball_flash_title);
                colorList.setSummary(R.string.color_trackball_flash_summary);
                colorList.setDialogTitle(R.string.dialog_color_trackball);
                if (getResources().getBoolean(R.bool.has_dual_notification_led)) {
                    colorList.setEntries(R.array.entries_dual_led_colors);
                    colorList.setEntryValues(R.array.values_dual_led_colors);
                } else {
                    colorList.setEntries(R.array.entries_trackball_colors);
                    colorList.setEntryValues(R.array.pref_trackball_colors_values);
                }
                colorList.setOnPreferenceChangeListener(this);
                appName.addPreference(colorList);

                if (!getResources().getBoolean(R.bool.has_dual_notification_led)) {
                    ListPreference blinkList = new ListPreference(this);
                    blinkList.setKey(pkg + "_blink");
                    blinkList.setTitle(R.string.color_trackball_blink_title);
@@ -493,6 +502,7 @@ public class TrackballNotificationActivity extends PreferenceActivity implements
                        customColor.setEnabled(!packageValues[1].equals("none"));
                    }
                    appName.addPreference(customColor);
                }

                Preference testColor = new Preference(this);
                testColor.setKey(pkg + "_test");
+4 −3
Original line number Diff line number Diff line
@@ -95,7 +95,8 @@ public class UIActivity extends PreferenceActivity implements OnPreferenceChange
            ((PreferenceCategory)prefSet.findPreference(GENERAL_CATEGORY)).removePreference(mBacklightScreen);
        }

        if (!getResources().getBoolean(R.bool.has_rgb_notification_led)) {
        if (!getResources().getBoolean(R.bool.has_rgb_notification_led) &&
                !getResources().getBoolean(R.bool.has_dual_notification_led)) {
            ((PreferenceCategory)prefSet.findPreference(GENERAL_CATEGORY)).removePreference(mTrackballScreen);
        }