Merge "Dynamically checks if screen lock suggestion is needed"
diff --git a/res/drawable/accessibility_screen_magnification_background.xml b/res/drawable/accessibility_screen_magnification_background.xml
new file mode 100644
index 0000000..e22cfec
--- /dev/null
+++ b/res/drawable/accessibility_screen_magnification_background.xml
@@ -0,0 +1,31 @@
+<!--
+ ~ Copyright (C) 2016 The Android Open Source Project
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
+ ~ you may not use this file except in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License
+ -->
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="360dp"
+ android:height="184dp"
+ android:viewportWidth="360"
+ android:viewportHeight="184">
+
+ <path
+ android:fillColor="#E9F0F9"
+ android:pathData="M 0 0 H 360 V 184 H 0 V 0 Z" />
+ <path
+ android:fillColor="#444445"
+ android:pathData="M217.6,179h-75.1c-5,0-9-4-9-9V14c0-5,4-9,9-9h75.1c5,0,9,4,9,9V170C226.6,174.9,222.5,179,217.6,179z" />
+ <path
+ android:fillColor="#000000"
+ android:pathData="M 180 9.6 C 181.1045695 9.6 182 10.4954305003 182 11.6 C 182 12.7045694997 181.1045695 13.6 180 13.6 C 178.8954305 13.6 178 12.7045694997 178 11.6 C 178 10.4954305003 178.8954305 9.6 180 9.6 Z" />
+</vector>
diff --git a/res/layout/text_description_preference.xml b/res/layout/text_description_preference.xml
index d71f078..6b8594b 100644
--- a/res/layout/text_description_preference.xml
+++ b/res/layout/text_description_preference.xml
@@ -13,11 +13,10 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-
<TextView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/summary"
- android:layout_width="fill_parent"
+ android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAppearance="@android:style/TextAppearance.Material.Body1"
android:padding="16dip" />
diff --git a/res/layout/video_preference.xml b/res/layout/video_preference.xml
new file mode 100644
index 0000000..a6fde76
--- /dev/null
+++ b/res/layout/video_preference.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2016 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<RelativeLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@+id/video_background"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content">
+
+ <VideoView
+ android:id="@+id/video"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content" />
+
+</RelativeLayout>
\ No newline at end of file
diff --git a/res/raw/accessibility_screen_magnification.mp4 b/res/raw/accessibility_screen_magnification.mp4
new file mode 100644
index 0000000..1e60fc5
--- /dev/null
+++ b/res/raw/accessibility_screen_magnification.mp4
Binary files differ
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index 30aa52f..12bdfaa 100755
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -268,4 +268,11 @@
<!-- Accessibility, Font size -->
<dimen name="font_size_preview_height">240dp</dimen>
+
+ <!-- Accessibility, Screen magnification. These values are meant to be relative values and the actual layout value will be set programmatically. -->
+ <dimen name="screen_magnification_video_background_width">750dp</dimen>
+ <dimen name="screen_magnification_video_background_height">383dp</dimen>
+ <dimen name="screen_magnification_video_width">170dp</dimen>
+ <dimen name="screen_magnification_video_height">311dp</dimen>
+ <dimen name="screen_magnification_video_margin_top">40dp</dimen>
</resources>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 399db32..0ef31a7 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -3765,8 +3765,6 @@
<string name="accessibility_global_gesture_preference_summary_off">Off</string>
<!-- Description for the preference screen to enable the global geture taht turns on accessibility. [CHAR LIMIT=none] -->
<string name="accessibility_global_gesture_preference_description">When this feature is turned on, you can quickly enable accessibility features in two steps:\n\nStep 1: Press and hold the power button until you hear a sound or feel a vibration.\n\nStep 2: Touch and hold two fingers until you hear audio confirmation.\n\nIf the device has multiple users, using this shortcut on the lock screen temporarily enables accessibility until the device is unlocked.</string>
- <!-- Title for the accessibility preference to enable large text. [CHAR LIMIT=35] -->
- <string name="accessibility_toggle_large_text_preference_title">Large text</string>
<!-- Title for the accessibility preference to high contrast text. [CHAR LIMIT=35] -->
<string name="accessibility_toggle_high_text_contrast_preference_title">High contrast text</string>
<!-- Title for the accessibility preference to enable screen magnification. [CHAR LIMIT=35] -->
diff --git a/res/xml/accessibility_settings.xml b/res/xml/accessibility_settings.xml
index 54a5a17..a59fbdc 100644
--- a/res/xml/accessibility_settings.xml
+++ b/res/xml/accessibility_settings.xml
@@ -43,17 +43,16 @@
android:key="font_size_preference_screen"
android:title="@string/title_font_size"/>
+ <com.android.settings.display.ScreenZoomPreference
+ android:key="screen_zoom"
+ android:title="@string/screen_zoom_title"/>
+
<PreferenceScreen
android:fragment="com.android.settings.accessibility.ToggleAutoclickPreferenceFragment"
android:key="autoclick_preference_screen"
android:title="@string/accessibility_autoclick_preference_title"/>
<SwitchPreference
- android:key="toggle_large_text_preference"
- android:title="@string/accessibility_toggle_large_text_preference_title"
- android:persistent="false"/>
-
- <SwitchPreference
android:key="toggle_high_text_contrast_preference"
android:title="@string/accessibility_toggle_high_text_contrast_preference_title"
android:summary="@string/experimental_preference"
diff --git a/res/xml/display_settings.xml b/res/xml/display_settings.xml
index 1780765..0543ac1 100644
--- a/res/xml/display_settings.xml
+++ b/res/xml/display_settings.xml
@@ -91,14 +91,11 @@
android:summary="@string/tap_to_wake_summary"
android:persistent="false" />
- <DropDownPreference
+ <PreferenceScreen
android:key="font_size"
android:title="@string/title_font_size"
- settings:keywords="@string/keywords_display_font_size"
- android:persistent="false"
- android:summary="%s"
- android:entries="@array/entries_font_size"
- android:entryValues="@array/entryvalues_font_size" />
+ android:fragment="com.android.settings.accessibility.ToggleFontSizePreferenceFragment"
+ settings:keywords="@string/keywords_display_font_size" />
<com.android.settings.display.ScreenZoomPreference
android:key="screen_zoom"
diff --git a/src/com/android/settings/CustomDialogPreference.java b/src/com/android/settings/CustomDialogPreference.java
index edd5416..383163f 100644
--- a/src/com/android/settings/CustomDialogPreference.java
+++ b/src/com/android/settings/CustomDialogPreference.java
@@ -29,7 +29,8 @@
private CustomPreferenceDialogFragment mFragment;
- public CustomDialogPreference(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
+ public CustomDialogPreference(Context context, AttributeSet attrs, int defStyleAttr,
+ int defStyleRes) {
super(context, attrs, defStyleAttr, defStyleRes);
}
diff --git a/src/com/android/settings/DisplaySettings.java b/src/com/android/settings/DisplaySettings.java
index 31e8d89..5e7407b 100644
--- a/src/com/android/settings/DisplaySettings.java
+++ b/src/com/android/settings/DisplaySettings.java
@@ -17,7 +17,6 @@
package com.android.settings;
import android.app.Activity;
-import android.app.ActivityManagerNative;
import android.app.UiModeManager;
import android.app.admin.DevicePolicyManager;
import android.content.ContentResolver;
@@ -29,7 +28,6 @@
import android.hardware.SensorManager;
import android.os.Build;
import android.os.Bundle;
-import android.os.RemoteException;
import android.os.SystemProperties;
import android.provider.SearchIndexableResource;
import android.provider.Settings;
@@ -44,6 +42,7 @@
import com.android.internal.logging.MetricsLogger;
import com.android.internal.logging.MetricsProto.MetricsEvent;
import com.android.internal.view.RotationPolicy;
+import com.android.settings.accessibility.ToggleFontSizePreferenceFragment;
import com.android.settings.dashboard.SummaryLoader;
import com.android.settings.search.BaseSearchIndexProvider;
import com.android.settings.search.Indexable;
@@ -85,7 +84,7 @@
private static final String KEY_CAMERA_DOUBLE_TAP_POWER_GESTURE
= "camera_double_tap_power_gesture";
- private DropDownPreference mFontSizePref;
+ private Preference mFontSizePref;
private final Configuration mCurConfig = new Configuration();
@@ -121,8 +120,7 @@
mScreenTimeoutPreference = (RestrictedListPreference) findPreference(KEY_SCREEN_TIMEOUT);
- mFontSizePref = (DropDownPreference) findPreference(KEY_FONT_SIZE);
- mFontSizePref.setOnPreferenceChangeListener(this);
+ mFontSizePref = findPreference(KEY_FONT_SIZE);
if (isAutomaticBrightnessAvailable(getResources())) {
mAutoBrightnessPreference = (SwitchPreference) findPreference(KEY_AUTO_BRIGHTNESS);
@@ -339,37 +337,6 @@
}
}
- int floatToIndex(float val) {
- String[] indices = getResources().getStringArray(R.array.entryvalues_font_size);
- float lastVal = Float.parseFloat(indices[0]);
- for (int i=1; i<indices.length; i++) {
- float thisVal = Float.parseFloat(indices[i]);
- if (val < (lastVal + (thisVal-lastVal)*.5f)) {
- return i-1;
- }
- lastVal = thisVal;
- }
- return indices.length-1;
- }
-
- public void readFontSizePreference(ListPreference pref) {
- try {
- mCurConfig.updateFrom(ActivityManagerNative.getDefault().getConfiguration());
- } catch (RemoteException e) {
- Log.w(TAG, "Unable to retrieve font size");
- }
-
- // mark the appropriate item in the preferences list
- int index = floatToIndex(mCurConfig.fontScale);
- pref.setValueIndex(index);
-
- // report the current size in the summary text
- final Resources res = getResources();
- String[] fontSizeNames = res.getStringArray(R.array.entries_font_size);
- pref.setSummary(String.format(res.getString(R.string.summary_font_size),
- fontSizeNames[index]));
- }
-
@Override
public void onResume() {
super.onResume();
@@ -384,7 +351,7 @@
}
private void updateState() {
- readFontSizePreference(mFontSizePref);
+ updateFontSizeSummary();
updateScreenSaverSummary();
// Update auto brightness if it is available.
@@ -433,13 +400,13 @@
}
}
- public void writeFontSizePreference(Object objValue) {
- try {
- mCurConfig.fontScale = Float.parseFloat(objValue.toString());
- ActivityManagerNative.getDefault().updatePersistentConfiguration(mCurConfig);
- } catch (RemoteException e) {
- Log.w(TAG, "Unable to save font size");
- }
+ private void updateFontSizeSummary() {
+ final Resources res = mFontSizePref.getContext().getResources();
+ final String[] entries = res.getStringArray(R.array.entries_font_size);
+ final String[] strEntryValues = res.getStringArray(R.array.entryvalues_font_size);
+ final int index = ToggleFontSizePreferenceFragment.fontSizeValueToIndex(
+ res.getConfiguration().fontScale, strEntryValues);
+ mFontSizePref.setSummary(entries[index]);
}
@Override
@@ -454,9 +421,6 @@
Log.e(TAG, "could not persist screen timeout setting", e);
}
}
- if (KEY_FONT_SIZE.equals(key)) {
- writeFontSizePreference(objValue);
- }
if (preference == mAutoBrightnessPreference) {
boolean auto = (Boolean) objValue;
Settings.System.putInt(getContentResolver(), SCREEN_BRIGHTNESS_MODE,
diff --git a/src/com/android/settings/RestrictedListPreference.java b/src/com/android/settings/RestrictedListPreference.java
index 35ee30d..77af19e 100644
--- a/src/com/android/settings/RestrictedListPreference.java
+++ b/src/com/android/settings/RestrictedListPreference.java
@@ -146,11 +146,10 @@
ImageView padlock = (ImageView) root.findViewById(R.id.restricted_lock_icon);
if (isRestrictedForEntry(entry)) {
text.setEnabled(false);
+ text.setChecked(false);
padlock.setVisibility(View.VISIBLE);
} else {
- if (position == mSelectedIndex) {
- text.setChecked(true);
- }
+ text.setChecked(position == mSelectedIndex);
text.setEnabled(true);
padlock.setVisibility(View.GONE);
}
diff --git a/src/com/android/settings/accessibility/AccessibilitySettings.java b/src/com/android/settings/accessibility/AccessibilitySettings.java
index 1ca32d8..5ce5cfc 100644
--- a/src/com/android/settings/accessibility/AccessibilitySettings.java
+++ b/src/com/android/settings/accessibility/AccessibilitySettings.java
@@ -71,15 +71,11 @@
public class AccessibilitySettings extends SettingsPreferenceFragment implements DialogCreatable,
Preference.OnPreferenceChangeListener, Indexable {
- private static final float LARGE_FONT_SCALE = 1.3f;
-
// Preference categories
private static final String SERVICES_CATEGORY = "services_category";
private static final String SYSTEM_CATEGORY = "system_category";
// Preferences
- private static final String TOGGLE_LARGE_TEXT_PREFERENCE =
- "toggle_large_text_preference";
private static final String TOGGLE_HIGH_TEXT_CONTRAST_PREFERENCE =
"toggle_high_text_contrast_preference";
private static final String TOGGLE_INVERSION_PREFERENCE =
@@ -127,8 +123,6 @@
private final Map<String, String> mLongPressTimeoutValuetoTitleMap = new HashMap<>();
- private final Configuration mCurConfig = new Configuration();
-
private final Handler mHandler = new Handler();
private final Runnable mUpdateRunnable = new Runnable() {
@@ -185,7 +179,6 @@
private PreferenceCategory mServicesCategory;
private PreferenceCategory mSystemsCategory;
- private SwitchPreference mToggleLargeTextPreference;
private SwitchPreference mToggleHighTextContrastPreference;
private SwitchPreference mTogglePowerButtonEndsCallPreference;
private SwitchPreference mToggleLockScreenRotationPreference;
@@ -274,10 +267,7 @@
@Override
public boolean onPreferenceTreeClick(Preference preference) {
- if (mToggleLargeTextPreference == preference) {
- handleToggleLargeTextPreferenceClick();
- return true;
- } else if (mToggleHighTextContrastPreference == preference) {
+ if (mToggleHighTextContrastPreference == preference) {
handleToggleTextContrastPreferenceClick();
return true;
} else if (mTogglePowerButtonEndsCallPreference == preference) {
@@ -302,15 +292,6 @@
return super.onPreferenceTreeClick(preference);
}
- private void handleToggleLargeTextPreferenceClick() {
- try {
- mCurConfig.fontScale = mToggleLargeTextPreference.isChecked() ? LARGE_FONT_SCALE : 1;
- ActivityManagerNative.getDefault().updatePersistentConfiguration(mCurConfig);
- } catch (RemoteException re) {
- /* ignore */
- }
- }
-
private void handleToggleTextContrastPreferenceClick() {
Settings.Secure.putInt(getContentResolver(),
Settings.Secure.ACCESSIBILITY_HIGH_TEXT_CONTRAST_ENABLED,
@@ -368,10 +349,6 @@
mServicesCategory = (PreferenceCategory) findPreference(SERVICES_CATEGORY);
mSystemsCategory = (PreferenceCategory) findPreference(SYSTEM_CATEGORY);
- // Large text.
- mToggleLargeTextPreference =
- (SwitchPreference) findPreference(TOGGLE_LARGE_TEXT_PREFERENCE);
-
// Text contrast.
mToggleHighTextContrastPreference =
(SwitchPreference) findPreference(TOGGLE_HIGH_TEXT_CONTRAST_PREFERENCE);
@@ -564,14 +541,6 @@
}
private void updateSystemPreferences() {
- // Large text.
- try {
- mCurConfig.updateFrom(ActivityManagerNative.getDefault().getConfiguration());
- } catch (RemoteException re) {
- /* ignore */
- }
- mToggleLargeTextPreference.setChecked(mCurConfig.fontScale == LARGE_FONT_SCALE);
-
// Text contrast.
mToggleHighTextContrastPreference.setChecked(
Settings.Secure.getInt(getContentResolver(),
@@ -658,7 +627,7 @@
final Resources res = getContext().getResources();
final String[] entries = res.getStringArray(R.array.entries_font_size);
final String[] strEntryValues = res.getStringArray(R.array.entryvalues_font_size);
- final int index = ToggleFontSizePreferenceFragment.floatToIndex(
+ final int index = ToggleFontSizePreferenceFragment.fontSizeValueToIndex(
res.getConfiguration().fontScale, strEntryValues);
pref.setSummary(entries[index]);
}
diff --git a/src/com/android/settings/accessibility/AccessibilitySettingsForSetupWizard.java b/src/com/android/settings/accessibility/AccessibilitySettingsForSetupWizard.java
index 052f6fb..eaab57d 100644
--- a/src/com/android/settings/accessibility/AccessibilitySettingsForSetupWizard.java
+++ b/src/com/android/settings/accessibility/AccessibilitySettingsForSetupWizard.java
@@ -188,7 +188,7 @@
final Resources res = getContext().getResources();
final String[] entries = res.getStringArray(R.array.entries_font_size);
final String[] strEntryValues = res.getStringArray(R.array.entryvalues_font_size);
- final int index = ToggleFontSizePreferenceFragment.floatToIndex(
+ final int index = ToggleFontSizePreferenceFragment.fontSizeValueToIndex(
res.getConfiguration().fontScale, strEntryValues);
pref.setSummary(entries[index]);
}
diff --git a/src/com/android/settings/accessibility/ToggleFontSizePreferenceFragment.java b/src/com/android/settings/accessibility/ToggleFontSizePreferenceFragment.java
index 4a8cd32..1c5d8dc 100644
--- a/src/com/android/settings/accessibility/ToggleFontSizePreferenceFragment.java
+++ b/src/com/android/settings/accessibility/ToggleFontSizePreferenceFragment.java
@@ -48,7 +48,7 @@
final Configuration origConfig = res.getConfiguration();
mEntries = res.getStringArray(R.array.entries_font_size);
final String[] strEntryValues = res.getStringArray(R.array.entryvalues_font_size);
- mInitialIndex = floatToIndex(origConfig.fontScale, strEntryValues);
+ mInitialIndex = fontSizeValueToIndex(origConfig.fontScale, strEntryValues);
mValues = new float[strEntryValues.length];
for (int i = 0; i < strEntryValues.length; ++i) {
mValues[i] = Float.parseFloat(strEntryValues[i]);
@@ -86,7 +86,7 @@
* Utility function that returns the index in a string array with which the represented value is
* the closest to a given float value.
*/
- static int floatToIndex(float val, String[] indices) {
+ public static int fontSizeValueToIndex(float val, String[] indices) {
float lastVal = Float.parseFloat(indices[0]);
for (int i=1; i<indices.length; i++) {
float thisVal = Float.parseFloat(indices[i]);
diff --git a/src/com/android/settings/accessibility/ToggleScreenMagnificationPreferenceFragment.java b/src/com/android/settings/accessibility/ToggleScreenMagnificationPreferenceFragment.java
index 80719b2..041fed8 100644
--- a/src/com/android/settings/accessibility/ToggleScreenMagnificationPreferenceFragment.java
+++ b/src/com/android/settings/accessibility/ToggleScreenMagnificationPreferenceFragment.java
@@ -16,15 +16,111 @@
package com.android.settings.accessibility;
+import android.content.ContentResolver;
+import android.content.Context;
+import android.content.res.Resources;
+import android.graphics.Point;
+import android.os.Bundle;
import android.provider.Settings;
+import android.media.MediaPlayer;
+import android.media.MediaPlayer.OnPreparedListener;
+import android.net.Uri;
+import android.support.v7.preference.Preference;
+import android.support.v7.preference.PreferenceScreen;
+import android.support.v7.preference.PreferenceViewHolder;
+import android.view.Display;
+import android.view.Gravity;
+import android.view.WindowManager;
+import android.widget.MediaController;
+import android.widget.RelativeLayout;
+import android.widget.VideoView;
import com.android.internal.logging.MetricsProto.MetricsEvent;
+import com.android.settings.R;
import com.android.settings.widget.ToggleSwitch;
import com.android.settings.widget.ToggleSwitch.OnBeforeCheckedChangeListener;
public class ToggleScreenMagnificationPreferenceFragment
extends ToggleFeaturePreferenceFragment {
+ protected class VideoPreference extends Preference {
+ public VideoPreference(Context context) {
+ super(context);
+ }
+
+ @Override
+ public void onBindViewHolder(PreferenceViewHolder view) {
+ super.onBindViewHolder(view);
+ view.setDividerAllowedAbove(false);
+ view.setDividerAllowedBelow(false);
+ final RelativeLayout background =
+ (RelativeLayout) view.findViewById(R.id.video_background);
+ final VideoView videoView = (VideoView) view.findViewById(R.id.video);
+
+ // Hacky adjustment for using VideoView in recycle view and positioning
+ // it on the background image
+ Resources res = getPrefContext().getResources();
+ final int backgroundWidth = res.getDimensionPixelSize(
+ R.dimen.screen_magnification_video_background_width);
+ final int backgroundHeight = res.getDimensionPixelSize(
+ R.dimen.screen_magnification_video_background_height);
+ final int videoWidth = res.getDimensionPixelSize(
+ R.dimen.screen_magnification_video_width);
+ final int videoHeight = res.getDimensionPixelSize(
+ R.dimen.screen_magnification_video_height);
+ final int videoMarginTop = res.getDimensionPixelSize(
+ R.dimen.screen_magnification_video_margin_top);
+ final int screenWidth = getScreenWidth(getPrefContext());
+
+ RelativeLayout.LayoutParams videoLp = new RelativeLayout.LayoutParams(
+ screenWidth * videoWidth / backgroundWidth,
+ screenWidth * videoHeight / backgroundWidth);
+ videoLp.setMargins(0, screenWidth * videoMarginTop / backgroundWidth, 0, 0);
+ videoView.setLayoutParams(videoLp);
+
+ RelativeLayout.LayoutParams backgroundLp = new RelativeLayout.LayoutParams(
+ screenWidth,
+ screenWidth * backgroundHeight / backgroundWidth);
+ background.setLayoutParams(backgroundLp);
+ background.setBackgroundResource(
+ R.drawable.accessibility_screen_magnification_background);
+ background.setGravity(Gravity.CENTER_HORIZONTAL);
+
+ // Loop the video.
+ videoView.setOnPreparedListener(new OnPreparedListener() {
+ @Override
+ public void onPrepared(MediaPlayer mediaPlayer) {
+ mediaPlayer.setLooping(true);
+ }
+ });
+
+ videoView.setVideoURI(Uri.parse(String.format("%s://%s/%s",
+ ContentResolver.SCHEME_ANDROID_RESOURCE,
+ getPrefContext().getPackageName(),
+ R.raw.accessibility_screen_magnification)));
+ videoView.setMediaController(new MediaController(getPrefContext()));
+ videoView.start();
+ }
+ }
+
+ protected VideoPreference mVideoPreference;
+
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+
+ mVideoPreference = new VideoPreference(getPrefContext());
+ mVideoPreference.setSelectable(false);
+ mVideoPreference.setPersistent(false);
+ mVideoPreference.setLayoutResource(R.layout.video_preference);
+
+ final PreferenceScreen preferenceScreen = getPreferenceManager().getPreferenceScreen();
+ preferenceScreen.setOrderingAsAdded(false);
+ mVideoPreference.setOrder(0);
+ mSummaryPreference.setOrder(1);
+ preferenceScreen.addPreference(mVideoPreference);
+ }
+
@Override
protected void onPreferenceToggled(String preferenceKey, boolean enabled) {
// Do nothing.
@@ -34,7 +130,7 @@
protected void onInstallSwitchBarToggleSwitch() {
super.onInstallSwitchBarToggleSwitch();
mToggleSwitch.setOnBeforeCheckedChangeListener(new OnBeforeCheckedChangeListener() {
- @Override
+ @Override
public boolean onBeforeCheckedChanged(ToggleSwitch toggleSwitch, boolean checked) {
mSwitchBar.setCheckedInternal(checked);
getArguments().putBoolean(AccessibilitySettings.EXTRA_CHECKED, checked);
@@ -72,4 +168,12 @@
protected int getMetricsCategory() {
return MetricsEvent.ACCESSIBILITY_TOGGLE_SCREEN_MAGNIFICATION;
}
+
+ private static int getScreenWidth(Context context) {
+ WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
+ Display display = wm.getDefaultDisplay();
+ Point size = new Point();
+ display.getSize(size);
+ return size.x;
+ }
}
diff --git a/src/com/android/settings/datausage/CellDataPreference.java b/src/com/android/settings/datausage/CellDataPreference.java
index fa333f1..d64bef4 100644
--- a/src/com/android/settings/datausage/CellDataPreference.java
+++ b/src/com/android/settings/datausage/CellDataPreference.java
@@ -48,7 +48,7 @@
private static final String TAG = "CellDataPreference";
- public int mSubId;
+ public int mSubId = SubscriptionManager.INVALID_SUBSCRIPTION_ID;
public boolean mChecked;
public boolean mMultiSimDialog;
private TelephonyManager mTelephonyManager;
@@ -65,8 +65,10 @@
mTelephonyManager = TelephonyManager.from(getContext());
mChecked = state.mChecked;
mMultiSimDialog = state.mMultiSimDialog;
- mSubId = state.mSubId;
- setKey(getKey() + mSubId);
+ if (mSubId == SubscriptionManager.INVALID_SUBSCRIPTION_ID) {
+ mSubId = state.mSubId;
+ setKey(getKey() + mSubId);
+ }
notifyChanged();
}
@@ -110,7 +112,6 @@
@Override
protected void performClick(View view) {
- super.performClick(view);
MetricsLogger.action(getContext(), MetricsEvent.ACTION_CELL_DATA_TOGGLE, !mChecked);
if (mChecked) {
// disabling data; show confirmation dialog which eventually
diff --git a/src/com/android/settings/datausage/DataUsageSummary.java b/src/com/android/settings/datausage/DataUsageSummary.java
index e1936ed..3195641 100644
--- a/src/com/android/settings/datausage/DataUsageSummary.java
+++ b/src/com/android/settings/datausage/DataUsageSummary.java
@@ -138,6 +138,7 @@
TemplatePreferenceCategory category = (TemplatePreferenceCategory)
inflatePreferences(R.xml.data_usage_cellular);
category.setTemplate(getNetworkTemplate(subId), subId, services);
+ category.pushTemplates(services);
}
private void addWifiSection() {
diff --git a/src/com/android/settings/inputmethod/InputMethodAndLanguageSettings.java b/src/com/android/settings/inputmethod/InputMethodAndLanguageSettings.java
index 838989e..1318a1b 100644
--- a/src/com/android/settings/inputmethod/InputMethodAndLanguageSettings.java
+++ b/src/com/android/settings/inputmethod/InputMethodAndLanguageSettings.java
@@ -348,7 +348,9 @@
private static String getLocaleNames(Context context) {
final LocaleList locales = LocalePicker.getLocales();
- return LocaleHelper.getDisplayLocaleList(locales, Locale.getDefault());
+ final Locale displayLocale = Locale.getDefault();
+ return LocaleHelper.toSentenceCase(
+ LocaleHelper.getDisplayLocaleList(locales, displayLocale), displayLocale);
}
private void saveInputMethodSelectorVisibility(String value) {
diff --git a/src/com/android/settings/localepicker/LocaleListEditor.java b/src/com/android/settings/localepicker/LocaleListEditor.java
index 24e5e53..8161036 100644
--- a/src/com/android/settings/localepicker/LocaleListEditor.java
+++ b/src/com/android/settings/localepicker/LocaleListEditor.java
@@ -155,7 +155,7 @@
final MenuItem menuItem =
menu.add(Menu.NONE, MENU_ID_REMOVE, 0, R.string.locale_remove_menu);
menuItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_WITH_TEXT);
- menuItem.setIcon(android.R.drawable.ic_menu_delete);
+ menuItem.setIcon(R.drawable.ic_delete);
super.onCreateOptionsMenu(menu, inflater);
mMenu = menu;
}