forked from upstream-mirrors/quik
Start using string switches (Java 1.7)
This commit is contained in:
@@ -150,16 +150,22 @@ public class ApnUtils {
|
|||||||
for (int i = 0; i < parser.getAttributeCount(); i++) {
|
for (int i = 0; i < parser.getAttributeCount(); i++) {
|
||||||
String name = parser.getAttributeName(i);
|
String name = parser.getAttributeName(i);
|
||||||
String value = parser.getAttributeValue(i);
|
String value = parser.getAttributeValue(i);
|
||||||
if ("mmsc".equals(name)) {
|
switch (name) {
|
||||||
apn.mmsc = value;
|
case "mmsc":
|
||||||
} else if ("mmsproxy".equals(name)) {
|
apn.mmsc = value;
|
||||||
apn.proxy = value;
|
break;
|
||||||
} else if ("mmsport".equals(name)) {
|
case "mmsproxy":
|
||||||
apn.port = value;
|
apn.proxy = value;
|
||||||
} else if ("carrier".equals(name)) {
|
break;
|
||||||
apn.name = value;
|
case "mmsport":
|
||||||
} else if ("port".equals(name)) {
|
apn.port = value;
|
||||||
port = value;
|
break;
|
||||||
|
case "carrier":
|
||||||
|
apn.name = value;
|
||||||
|
break;
|
||||||
|
case "port":
|
||||||
|
port = value;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -405,66 +405,86 @@ public class SettingsFragment extends PreferenceFragment implements
|
|||||||
valueString
|
valueString
|
||||||
);
|
);
|
||||||
|
|
||||||
if (key.equals(BACKGROUND)) {
|
switch (key) {
|
||||||
ThemeManager.setTheme(ThemeManager.Theme.fromString((String) newValue));
|
case BACKGROUND:
|
||||||
} else if (key.equals(STATUS_TINT)) {
|
ThemeManager.setTheme(ThemeManager.Theme.fromString((String) newValue));
|
||||||
ThemeManager.setStatusBarTintEnabled((Boolean) newValue);
|
break;
|
||||||
} else if (key.equals(FONT_FAMILY)) {
|
case STATUS_TINT:
|
||||||
preference.setSummary(mFontFamilies[Integer.parseInt("" + newValue)]);
|
ThemeManager.setStatusBarTintEnabled((Boolean) newValue);
|
||||||
} else if (key.equals(FONT_SIZE)) {
|
break;
|
||||||
preference.setSummary(mFontSizes[Integer.parseInt("" + newValue)]);
|
case FONT_FAMILY:
|
||||||
} else if (key.equals(FONT_WEIGHT)) {
|
preference.setSummary(mFontFamilies[Integer.parseInt("" + newValue)]);
|
||||||
int i = Integer.parseInt("" + newValue);
|
break;
|
||||||
preference.setSummary(mFontWeights[i == 2 ? 0 : 1]);
|
case FONT_SIZE:
|
||||||
} else if (key.equals(COLOUR_SENT)) {
|
preference.setSummary(mFontSizes[Integer.parseInt("" + newValue)]);
|
||||||
ThemeManager.setSentBubbleColored((Boolean) newValue);
|
break;
|
||||||
} else if (key.equals(COLOUR_RECEIVED)) {
|
case FONT_WEIGHT:
|
||||||
ThemeManager.setReceivedBubbleColored((Boolean) newValue);
|
int i = Integer.parseInt("" + newValue);
|
||||||
} else if (key.equals(NIGHT_AUTO)) {
|
preference.setSummary(mFontWeights[i == 2 ? 0 : 1]);
|
||||||
updateAlarmManager(mContext, (Boolean) newValue);
|
break;
|
||||||
} else if (key.equals(DAY_START) || key.equals(NIGHT_START)) {
|
case COLOUR_SENT:
|
||||||
updateAlarmManager(mContext, true);
|
ThemeManager.setSentBubbleColored((Boolean) newValue);
|
||||||
} else if (key.equals(SLIDING_TAB)) {
|
break;
|
||||||
mContext.setSlidingTabEnabled((Boolean) newValue);
|
case COLOUR_RECEIVED:
|
||||||
} else if (key.equals(YAPPY)) {
|
ThemeManager.setReceivedBubbleColored((Boolean) newValue);
|
||||||
if ((Boolean) newValue) {
|
break;
|
||||||
|
case NIGHT_AUTO:
|
||||||
|
updateAlarmManager(mContext, (Boolean) newValue);
|
||||||
|
break;
|
||||||
|
case NIGHT_START:
|
||||||
|
updateAlarmManager(mContext, true);
|
||||||
|
break;
|
||||||
|
case SLIDING_TAB:
|
||||||
|
mContext.setSlidingTabEnabled((Boolean) newValue);
|
||||||
|
break;
|
||||||
|
case YAPPY:
|
||||||
|
if ((Boolean) newValue) {
|
||||||
|
try {
|
||||||
|
EndlessJabberInterface.EnableIntegration(mContext, EndlessJabber.class, true, false);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
if (!EndlessJabberInterface.IsInstalled(mContext)) {
|
||||||
|
EndlessJabberInterface.OpenGooglePlayLink(mContext);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
try {
|
||||||
|
EndlessJabberInterface.DisableIntegration(mContext, EndlessJabber.class);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case QUICKCOMPOSE:
|
||||||
|
NotificationManager.initQuickCompose(getActivity(), (Boolean) newValue, !(Boolean) newValue);
|
||||||
|
break;
|
||||||
|
case MMSC_URL:
|
||||||
|
case MMS_PROXY:
|
||||||
|
case MMS_PORT:
|
||||||
|
preference.setSummary(newValue.toString());
|
||||||
|
break;
|
||||||
|
case MAX_MMS_ATTACHMENT_SIZE:
|
||||||
|
// Update the summary in the list preference
|
||||||
|
ListPreference listpref = (ListPreference) preference;
|
||||||
|
int index = listpref.findIndexOfValue((String) newValue);
|
||||||
|
preference.setSummary(mMaxMmsAttachmentSizes[index]);
|
||||||
|
// Update the SMS helper static class with the new option
|
||||||
|
SmsHelper.setMaxAttachmentSizeSetting(mContext, (String) newValue);
|
||||||
|
break;
|
||||||
|
case SYSTEM_BAR_FLAT:
|
||||||
|
ThemeManager.setSystemBarFlatEnabled((Boolean) newValue);
|
||||||
|
break;
|
||||||
|
case STATUS_COMPAT:
|
||||||
|
ThemeManager.setStatusBarTintCompat((Boolean) newValue);
|
||||||
|
break;
|
||||||
|
case DELAY_DURATION:
|
||||||
try {
|
try {
|
||||||
EndlessJabberInterface.EnableIntegration(mContext, EndlessJabber.class, true, false);
|
int duration = Integer.parseInt((String) newValue);
|
||||||
|
if (duration < 1 || duration > 30) throw new Exception("Duration out of bounds");
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
Toast.makeText(mContext, R.string.delayed_duration_bounds_error, Toast.LENGTH_SHORT).show();
|
||||||
}
|
}
|
||||||
if (!EndlessJabberInterface.IsInstalled(mContext)) {
|
break;
|
||||||
EndlessJabberInterface.OpenGooglePlayLink(mContext);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
try {
|
|
||||||
EndlessJabberInterface.DisableIntegration(mContext, EndlessJabber.class);
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if (key.equals(QUICKCOMPOSE)) {
|
|
||||||
NotificationManager.initQuickCompose(getActivity(), (Boolean) newValue, !(Boolean) newValue);
|
|
||||||
} else if (key.equals(MMSC_URL) || key.equals(MMS_PROXY) || key.equals(MMS_PORT)) {
|
|
||||||
preference.setSummary(newValue.toString());
|
|
||||||
} else if (key.equals(MAX_MMS_ATTACHMENT_SIZE)) {
|
|
||||||
// Update the summary in the list preference
|
|
||||||
ListPreference listpref = (ListPreference) preference;
|
|
||||||
int index = listpref.findIndexOfValue((String) newValue);
|
|
||||||
preference.setSummary(mMaxMmsAttachmentSizes[index]);
|
|
||||||
// Update the SMS helper static class with the new option
|
|
||||||
SmsHelper.setMaxAttachmentSizeSetting(mContext, (String) newValue);
|
|
||||||
} else if (key.equals(SYSTEM_BAR_FLAT)) {
|
|
||||||
ThemeManager.setSystemBarFlatEnabled((Boolean) newValue);
|
|
||||||
} else if (key.equals(STATUS_COMPAT)) {
|
|
||||||
ThemeManager.setStatusBarTintCompat((Boolean) newValue);
|
|
||||||
} else if (key.equals(DELAY_DURATION)) {
|
|
||||||
try {
|
|
||||||
int duration = Integer.parseInt((String) newValue);
|
|
||||||
if (duration < 1 || duration > 30) throw new Exception("Duration out of bounds");
|
|
||||||
} catch (Exception e) {
|
|
||||||
Toast.makeText(mContext, R.string.delayed_duration_bounds_error, Toast.LENGTH_SHORT).show();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
Reference in New Issue
Block a user