Clean up some resources and change switch-case to if-else block.
Preparatory CL for upcoming shared lib change.
Test: basic sanity
Bug: 144806641
Merged-in: I8f81195b72c6329844a450ce28d76f949f41e2d8
Change-Id: I8f81195b72c6329844a450ce28d76f949f41e2d8
(cherry picked from commit 28a499cd7154e1aba7eaa8bd592c143e56e118c1)
diff --git a/res/values/styles.xml b/res/values/styles.xml
index 1d5e7dc..fc95803 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -189,15 +189,6 @@
<item name="android:textColor">?android:attr/textColorPrimaryInverseDisableOnly</item>
</style>
- <style name="NetworkOperatorsSettingsTheme" parent="@android:style/Theme.DeviceDefault.Settings">
- <item name="android:forceDarkAllowed">true</item>
- <item name="android:switchPreferenceStyle">@style/SettingsSwitchPreference</item>
- <item name="android:preferenceCategoryStyle">@style/SettingsPreferenceCategory</item>
- <item name="android:preferenceStyle">@style/SettingsPreference</item>
- <item name="android:dialogPreferenceStyle">@style/SettingsDialogPreference</item>
- <item name="android:preferenceScreenStyle">@style/SettingsPreferenceScreen</item>
- </style>
-
<style name="TrimmedHorizontalProgressBar" parent="android:Widget.Material.ProgressBar.Horizontal">
<item name="android:indeterminateDrawable">@drawable/progress_indeterminate_horizontal_material_trimmed</item>
<item name="android:minHeight">3dip</item>
diff --git a/res/values/styles_preference.xml b/res/values/styles_preference.xml
index ceea4a6..fef4f72 100644
--- a/res/values/styles_preference.xml
+++ b/res/values/styles_preference.xml
@@ -29,10 +29,6 @@
<item name="android:singleLineTitle">false</item>
</style>
- <style name="SettingsPreferenceCategory" parent="@*android:style/Preference.DeviceDefault.Category">
- <item name="android:layout">@layout/preference_category_material_settings_with_divider</item>
- </style>
-
<style name="SettingsDialogPreference" parent="@*android:style/Preference.DeviceDefault.DialogPreference">
<item name="android:singleLineTitle">false</item>
<item name="android:iconSpaceReserved">true</item>
diff --git a/res/xml/callbarring_options.xml b/res/xml/callbarring_options.xml
index 6f2c48a..6506031 100644
--- a/res/xml/callbarring_options.xml
+++ b/res/xml/callbarring_options.xml
@@ -14,7 +14,7 @@
limitations under the License.
-->
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:phone="http://schemas.android.com/apk/res/com.android.phone"
+ xmlns:phone="http://schemas.android.com/apk/res-auto"
android:title="@string/call_barring_settings">
<!-- Note for all com.android.phone.EditPinPreference objects
diff --git a/res/xml/callforward_options.xml b/res/xml/callforward_options.xml
index 0ff1e90..775151e 100644
--- a/res/xml/callforward_options.xml
+++ b/res/xml/callforward_options.xml
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:phone="http://schemas.android.com/apk/res/com.android.phone"
+ xmlns:phone="http://schemas.android.com/apk/res-auto"
android:title="@string/call_forwarding_settings">
diff --git a/res/xml/voicemail_settings.xml b/res/xml/voicemail_settings.xml
index 021a764..cbe1cf4 100644
--- a/res/xml/voicemail_settings.xml
+++ b/res/xml/voicemail_settings.xml
@@ -15,7 +15,7 @@
-->
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:phone="http://schemas.android.com/apk/res/com.android.phone"
+ xmlns:phone="http://schemas.android.com/apk/res-auto"
android:title="@string/voicemail">
<com.android.phone.settings.VoicemailProviderListPreference
diff --git a/src/com/android/phone/EmergencyActionGroup.java b/src/com/android/phone/EmergencyActionGroup.java
index c090af7..53ec1eb 100644
--- a/src/com/android/phone/EmergencyActionGroup.java
+++ b/src/com/android/phone/EmergencyActionGroup.java
@@ -157,24 +157,19 @@
public void onClick(View v) {
Intent intent = (Intent) v.getTag(R.id.tag_intent);
- switch (v.getId()) {
- case R.id.action1:
- case R.id.action2:
- case R.id.action3:
- AccessibilityManager accessibilityMgr =
- (AccessibilityManager) mContext.getSystemService(
- Context.ACCESSIBILITY_SERVICE);
- if (accessibilityMgr.isTouchExplorationEnabled()) {
- getContext().startActivity(intent);
- } else {
- revealTheButton(v);
- }
- break;
- case R.id.selected_container:
- if (!mHiding) {
- getContext().startActivity(intent);
- }
- break;
+ if (v.getId() == R.id.action1 || v.getId() == R.id.action2 || v.getId() == R.id.action3) {
+ AccessibilityManager accessibilityMgr =
+ (AccessibilityManager) mContext.getSystemService(
+ Context.ACCESSIBILITY_SERVICE);
+ if (accessibilityMgr.isTouchExplorationEnabled()) {
+ getContext().startActivity(intent);
+ } else {
+ revealTheButton(v);
+ }
+ } else if (v.getId() == R.id.selected_container) {
+ if (!mHiding) {
+ getContext().startActivity(intent);
+ }
}
}
diff --git a/src/com/android/phone/EmergencyDialer.java b/src/com/android/phone/EmergencyDialer.java
index c20281a..7531aca 100644
--- a/src/com/android/phone/EmergencyDialer.java
+++ b/src/com/android/phone/EmergencyDialer.java
@@ -461,16 +461,15 @@
@Override
public boolean onKey(View view, int keyCode, KeyEvent event) {
- switch (view.getId()) {
- case R.id.digits:
- // Happen when "Done" button of the IME is pressed. This can happen when this
- // Activity is forced into landscape mode due to a desk dock.
- if (keyCode == KeyEvent.KEYCODE_ENTER
- && event.getAction() == KeyEvent.ACTION_UP) {
- placeCall();
- return true;
- }
- break;
+ if (view.getId()
+ == R.id.digits) { // Happen when "Done" button of the IME is pressed. This can
+ // happen when this
+ // Activity is forced into landscape mode due to a desk dock.
+ if (keyCode == KeyEvent.KEYCODE_ENTER
+ && event.getAction() == KeyEvent.ACTION_UP) {
+ placeCall();
+ return true;
+ }
}
return false;
}
@@ -510,27 +509,22 @@
@Override
public void onClick(View view) {
- switch (view.getId()) {
- case R.id.deleteButton: {
- keyPressed(KeyEvent.KEYCODE_DEL);
- return;
+ if (view.getId() == R.id.deleteButton) {
+ keyPressed(KeyEvent.KEYCODE_DEL);
+ return;
+ } else if (view.getId() == R.id.floating_action_button) {
+ view.performHapticFeedback(HapticFeedbackConstants.VIRTUAL_KEY);
+ placeCall();
+ return;
+ } else if (view.getId() == R.id.digits) {
+ if (mDigits.length() != 0) {
+ mDigits.setCursorVisible(true);
}
- case R.id.floating_action_button: {
- view.performHapticFeedback(HapticFeedbackConstants.VIRTUAL_KEY);
- placeCall();
- return;
- }
- case R.id.digits: {
- if (mDigits.length() != 0) {
- mDigits.setCursorVisible(true);
- }
- return;
- }
- case R.id.floating_action_button_dialpad: {
- mDigits.getText().clear();
- switchView(mDialpadView, mEmergencyShortcutView, true);
- return;
- }
+ return;
+ } else if (view.getId() == R.id.floating_action_button_dialpad) {
+ mDigits.getText().clear();
+ switchView(mDialpadView, mEmergencyShortcutView, true);
+ return;
}
}
@@ -539,67 +533,54 @@
if (!pressed) {
return;
}
- switch (view.getId()) {
- case R.id.one: {
- playTone(ToneGenerator.TONE_DTMF_1);
- keyPressed(KeyEvent.KEYCODE_1);
- return;
- }
- case R.id.two: {
- playTone(ToneGenerator.TONE_DTMF_2);
- keyPressed(KeyEvent.KEYCODE_2);
- return;
- }
- case R.id.three: {
- playTone(ToneGenerator.TONE_DTMF_3);
- keyPressed(KeyEvent.KEYCODE_3);
- return;
- }
- case R.id.four: {
- playTone(ToneGenerator.TONE_DTMF_4);
- keyPressed(KeyEvent.KEYCODE_4);
- return;
- }
- case R.id.five: {
- playTone(ToneGenerator.TONE_DTMF_5);
- keyPressed(KeyEvent.KEYCODE_5);
- return;
- }
- case R.id.six: {
- playTone(ToneGenerator.TONE_DTMF_6);
- keyPressed(KeyEvent.KEYCODE_6);
- return;
- }
- case R.id.seven: {
- playTone(ToneGenerator.TONE_DTMF_7);
- keyPressed(KeyEvent.KEYCODE_7);
- return;
- }
- case R.id.eight: {
- playTone(ToneGenerator.TONE_DTMF_8);
- keyPressed(KeyEvent.KEYCODE_8);
- return;
- }
- case R.id.nine: {
- playTone(ToneGenerator.TONE_DTMF_9);
- keyPressed(KeyEvent.KEYCODE_9);
- return;
- }
- case R.id.zero: {
- playTone(ToneGenerator.TONE_DTMF_0);
- keyPressed(KeyEvent.KEYCODE_0);
- return;
- }
- case R.id.pound: {
- playTone(ToneGenerator.TONE_DTMF_P);
- keyPressed(KeyEvent.KEYCODE_POUND);
- return;
- }
- case R.id.star: {
- playTone(ToneGenerator.TONE_DTMF_S);
- keyPressed(KeyEvent.KEYCODE_STAR);
- return;
- }
+ if (view.getId() == R.id.one) {
+ playTone(ToneGenerator.TONE_DTMF_1);
+ keyPressed(KeyEvent.KEYCODE_1);
+ return;
+ } else if (view.getId() == R.id.two) {
+ playTone(ToneGenerator.TONE_DTMF_2);
+ keyPressed(KeyEvent.KEYCODE_2);
+ return;
+ } else if (view.getId() == R.id.three) {
+ playTone(ToneGenerator.TONE_DTMF_3);
+ keyPressed(KeyEvent.KEYCODE_3);
+ return;
+ } else if (view.getId() == R.id.four) {
+ playTone(ToneGenerator.TONE_DTMF_4);
+ keyPressed(KeyEvent.KEYCODE_4);
+ return;
+ } else if (view.getId() == R.id.five) {
+ playTone(ToneGenerator.TONE_DTMF_5);
+ keyPressed(KeyEvent.KEYCODE_5);
+ return;
+ } else if (view.getId() == R.id.six) {
+ playTone(ToneGenerator.TONE_DTMF_6);
+ keyPressed(KeyEvent.KEYCODE_6);
+ return;
+ } else if (view.getId() == R.id.seven) {
+ playTone(ToneGenerator.TONE_DTMF_7);
+ keyPressed(KeyEvent.KEYCODE_7);
+ return;
+ } else if (view.getId() == R.id.eight) {
+ playTone(ToneGenerator.TONE_DTMF_8);
+ keyPressed(KeyEvent.KEYCODE_8);
+ return;
+ } else if (view.getId() == R.id.nine) {
+ playTone(ToneGenerator.TONE_DTMF_9);
+ keyPressed(KeyEvent.KEYCODE_9);
+ return;
+ } else if (view.getId() == R.id.zero) {
+ playTone(ToneGenerator.TONE_DTMF_0);
+ keyPressed(KeyEvent.KEYCODE_0);
+ return;
+ } else if (view.getId() == R.id.pound) {
+ playTone(ToneGenerator.TONE_DTMF_P);
+ keyPressed(KeyEvent.KEYCODE_POUND);
+ return;
+ } else if (view.getId() == R.id.star) {
+ playTone(ToneGenerator.TONE_DTMF_S);
+ keyPressed(KeyEvent.KEYCODE_STAR);
+ return;
}
}
@@ -609,16 +590,13 @@
@Override
public boolean onLongClick(View view) {
int id = view.getId();
- switch (id) {
- case R.id.deleteButton: {
- mDigits.getText().clear();
- return true;
- }
- case R.id.zero: {
- removePreviousDigitIfPossible();
- keyPressed(KeyEvent.KEYCODE_PLUS);
- return true;
- }
+ if (id == R.id.deleteButton) {
+ mDigits.getText().clear();
+ return true;
+ } else if (id == R.id.zero) {
+ removePreviousDigitIfPossible();
+ keyPressed(KeyEvent.KEYCODE_PLUS);
+ return true;
}
return false;
}
diff --git a/src/com/android/phone/EmergencyInfoGroup.java b/src/com/android/phone/EmergencyInfoGroup.java
index 186de03..f5aca7f 100644
--- a/src/com/android/phone/EmergencyInfoGroup.java
+++ b/src/com/android/phone/EmergencyInfoGroup.java
@@ -207,26 +207,21 @@
@Override
public void onClick(View view) {
- switch (view.getId()) {
- case R.id.emergency_info_view:
- AccessibilityManager accessibilityMgr =
- (AccessibilityManager) mContext.getSystemService(
- Context.ACCESSIBILITY_SERVICE);
- if (accessibilityMgr.isTouchExplorationEnabled()) {
- if (mOnConfirmClickListener != null) {
- mOnConfirmClickListener.onConfirmClick(this);
- }
- } else {
- revealSelectedButton();
- }
- break;
- case R.id.emergency_info_confirm_view:
+ if (view.getId() == R.id.emergency_info_view) {
+ AccessibilityManager accessibilityMgr =
+ (AccessibilityManager) mContext.getSystemService(
+ Context.ACCESSIBILITY_SERVICE);
+ if (accessibilityMgr.isTouchExplorationEnabled()) {
if (mOnConfirmClickListener != null) {
mOnConfirmClickListener.onConfirmClick(this);
}
- break;
- default:
- break;
+ } else {
+ revealSelectedButton();
+ }
+ } else if (view.getId() == R.id.emergency_info_confirm_view) {
+ if (mOnConfirmClickListener != null) {
+ mOnConfirmClickListener.onConfirmClick(this);
+ }
}
}
diff --git a/src/com/android/phone/EmergencyShortcutButton.java b/src/com/android/phone/EmergencyShortcutButton.java
index 9e51e82..d147ce4 100644
--- a/src/com/android/phone/EmergencyShortcutButton.java
+++ b/src/com/android/phone/EmergencyShortcutButton.java
@@ -182,26 +182,23 @@
@Override
public void onClick(View view) {
- switch (view.getId()) {
- case R.id.emergency_call_number_info_view:
- AccessibilityManager accessibilityMgr =
- (AccessibilityManager) mContext.getSystemService(
- Context.ACCESSIBILITY_SERVICE);
- if (accessibilityMgr.isTouchExplorationEnabled()) {
- // TalkBack itself includes a prompt to confirm click action implicitly,
- // so we don't need an additional confirmation with second tap on button.
- if (mOnConfirmClickListener != null) {
- mOnConfirmClickListener.onConfirmClick(this);
- }
- } else {
- revealSelectedButton();
- }
- break;
- case R.id.emergency_call_confirm_view:
+ if (view.getId() == R.id.emergency_call_number_info_view) {
+ AccessibilityManager accessibilityMgr =
+ (AccessibilityManager) mContext.getSystemService(
+ Context.ACCESSIBILITY_SERVICE);
+ if (accessibilityMgr.isTouchExplorationEnabled()) {
+ // TalkBack itself includes a prompt to confirm click action implicitly,
+ // so we don't need an additional confirmation with second tap on button.
if (mOnConfirmClickListener != null) {
mOnConfirmClickListener.onConfirmClick(this);
}
- break;
+ } else {
+ revealSelectedButton();
+ }
+ } else if (view.getId() == R.id.emergency_call_confirm_view) {
+ if (mOnConfirmClickListener != null) {
+ mOnConfirmClickListener.onConfirmClick(this);
+ }
}
}