Fix crash when changing led color
This commit is contained in:
parent
4700c757a8
commit
d76d6990fd
|
@ -311,7 +311,7 @@ public class Helper {
|
|||
public static final Pattern hashtagPattern = Pattern.compile("(#[\\w_A-zÀ-ÿ]+)");
|
||||
public static final Pattern groupPattern = Pattern.compile("(![\\w_]+)");
|
||||
public static final Pattern mentionPattern = Pattern.compile("(@[\\w_]+)");
|
||||
public static final Pattern mentionLongPattern = Pattern.compile("(@[\\w_-]+@[a-zA-Z0-9][a-zA-Z0-9-]{1,61}[a-zA-Z0-9](?:\\.[a-zA-Z]{2,})+)");
|
||||
public static final Pattern mentionLongPattern = Pattern.compile("(@[\\w_-]+@[a-zA-Z0-9][a-zA-Z0-9.-]{1,61}[a-zA-Z0-9](?:\\.[a-zA-Z]{2,})+)");
|
||||
|
||||
public static final Pattern twitterPattern = Pattern.compile("((@[\\w]+)@twitter\\.com)");
|
||||
public static final Pattern youtubePattern = Pattern.compile("(www\\.|m\\.)?(youtube\\.com|youtu\\.be|youtube-nocookie\\.com)/(((?!([\"'<])).)*)");
|
||||
|
@ -1486,11 +1486,7 @@ public class Helper {
|
|||
.setContentText(message);
|
||||
int ledColour = Color.BLUE;
|
||||
int prefColor;
|
||||
try {
|
||||
prefColor = sharedpreferences.getInt(context.getString(R.string.SET_LED_COLOUR_VAL), LED_COLOUR);
|
||||
} catch (ClassCastException e) {
|
||||
prefColor = Integer.parseInt(sharedpreferences.getString(context.getString(R.string.SET_LED_COLOUR_VAL), String.valueOf(LED_COLOUR)));
|
||||
}
|
||||
prefColor = Integer.parseInt(sharedpreferences.getString(context.getString(R.string.SET_LED_COLOUR_VAL_N), String.valueOf(LED_COLOUR)));
|
||||
switch (prefColor) {
|
||||
case 1: // CYAN
|
||||
ledColour = Color.CYAN;
|
||||
|
|
|
@ -750,6 +750,9 @@ public class ComposeAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder
|
|||
} else {
|
||||
holder.binding.characterCount.setTextColor(holder.binding.content.getTextColors());
|
||||
}
|
||||
if (holder.getBindingAdapterPosition() < 0) {
|
||||
return;
|
||||
}
|
||||
statusList.get(holder.getBindingAdapterPosition()).text = s.toString();
|
||||
if (s.toString().trim().length() < 2) {
|
||||
buttonVisibility(holder);
|
||||
|
|
|
@ -217,21 +217,7 @@ public class FragmentNotificationsSettings extends PreferenceFragmentCompat impl
|
|||
createPref();
|
||||
PushHelper.setRepeat(requireActivity());
|
||||
}
|
||||
if (key.compareToIgnoreCase(getString(R.string.SET_LED_COLOUR_VAL)) == 0) {
|
||||
try {
|
||||
int value = sharedPreferences.getInt(key, 0);
|
||||
sharedPreferences.edit().putInt(getString(R.string.SET_LED_COLOUR_VAL), value).apply();
|
||||
} catch (Exception e) {
|
||||
try {
|
||||
String value = sharedPreferences.getString(key, "0");
|
||||
sharedPreferences.edit().putInt(getString(R.string.SET_LED_COLOUR_VAL), Integer.parseInt(value)).apply();
|
||||
} catch (Exception e2) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
if (key.compareToIgnoreCase(getString(R.string.SET_PUSH_DISTRIBUTOR)) == 0) {
|
||||
String distributor = sharedPreferences.getString(key, "");
|
||||
UnifiedPush.saveDistributor(requireActivity(), distributor);
|
||||
|
|
|
@ -892,7 +892,7 @@
|
|||
<string name="SET_DISPLAY_COUNTERS" translatable="false">SET_DISPLAY_COUNTERS</string>
|
||||
<string name="SET_TIMELINES_IN_A_LIST" translatable="false">SET_TIMELINES_IN_A_LIST</string>
|
||||
<string name="SET_DISPLAY_ADMIN_STATUSES" translatable="false">SET_DISPLAY_ADMIN_STATUSES</string>
|
||||
<string name="SET_LED_COLOUR_VAL" translatable="false">SET_LED_COLOUR_VAL</string>
|
||||
<string name="SET_LED_COLOUR_VAL_N" translatable="false">SET_LED_COLOUR_VAL_N</string>
|
||||
<string name="SET_SHOW_BOOSTS" translatable="false">SET_SHOW_BOOSTS</string>
|
||||
<string name="SET_SHOW_REPLIES" translatable="false">SET_SHOW_REPLIES</string>
|
||||
<string name="SET_DISABLE_ANIMATED_EMOJI" translatable="false">SET_DISABLE_ANIMATED_EMOJI</string>
|
||||
|
|
|
@ -128,7 +128,7 @@
|
|||
app:entries="@array/led_colours"
|
||||
app:entryValues="@array/SET_LED_COLOUR_VALUES"
|
||||
app:iconSpaceReserved="false"
|
||||
app:key="@string/SET_LED_COLOUR_VAL"
|
||||
app:key="@string/SET_LED_COLOUR_VAL_N"
|
||||
app:title="@string/set_led_colour"
|
||||
app:useSimpleSummaryProvider="true" />
|
||||
</PreferenceCategory>
|
||||
|
|
Loading…
Reference in New Issue