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

Commit b3d587bc authored by Pedlar's avatar Pedlar Committed by Steve Kondik
Browse files

Fix error with Arrays caused by new users to the setup. Use to clear all colors.

This was set in place because when someone would try and change something, there was no [3].
I have corrected the bad idea, and made it so it will not force it into the default category.
parent 762c6d25
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -147,6 +147,7 @@
    <string name="trackball_category_remove_summary">Remove a category from the list</string>
    <string name="trackball_remove_default_toast">Can\'t remove this category as its the default one.</string>
    <string name="trackball_reset_all">Reset all colors and categories.</string>
    <string name="trackball_array_error">Unfortunately there was an array error. This package has been forced into Miscellaneous category.</string>

    <!-- Trackball Settings : Warning dialog -->
    <string name="notification_battery_warning_title">WARNING: May Cause Battery Drain</string>
+5 −6
Original line number Diff line number Diff line
@@ -142,7 +142,7 @@ public class TrackballNotificationActivity extends PreferenceActivity implements
        String[] temp = getArray(stringtemp);
        int i;
        String[] temp2;
        temp2 = new String[temp.length];
        temp2 = new String[5];
        boolean found = false;
        for (i = 0; i < temp.length; i++) {
            temp2 = getPackageAndColorAndBlink(temp[i]);
@@ -167,14 +167,13 @@ public class TrackballNotificationActivity extends PreferenceActivity implements
                temp[i] = tempcolor;
            } catch (ArrayIndexOutOfBoundsException e) {
                // Making array changes, if they aren't new, they will error.
                // Have to force them to be reset unfortunately.
                Settings.System.putString(getContentResolver(),
                                          Settings.System.NOTIFICATION_PACKAGE_COLORS, "");
                // So we force the category to go to Miscelaneous and inform them.
                String tempcolor = temp2[0] + "=" + temp2[1] + "=" + temp2[2] + "=" + CAT_PRIMARY;
                temp[i] = tempcolor;
                Toast.makeText(
                    this,
                    "Unfortunately there was an array error. Your colors have been reset, we apologize for any inconveience.",
                    R.string.trackball_array_error,
                    Toast.LENGTH_LONG).show();
                return; // we want to end it here, no need to continue
            }
        } else {
            int x = 0;