Reconcile with jb-mr1.1-release - do not merge
Change-Id: I3ce5c84d693ade39f0ffa17313acf7b0df85b934
diff --git a/src/com/android/settings/ApnSettings.java b/src/com/android/settings/ApnSettings.java
index 56ee7a9..de1ce63 100644
--- a/src/com/android/settings/ApnSettings.java
+++ b/src/com/android/settings/ApnSettings.java
@@ -209,7 +209,8 @@
super.onCreateOptionsMenu(menu);
menu.add(0, MENU_NEW, 0,
getResources().getString(R.string.menu_new))
- .setIcon(android.R.drawable.ic_menu_add);
+ .setIcon(android.R.drawable.ic_menu_add)
+ .setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
menu.add(0, MENU_RESTORE, 0,
getResources().getString(R.string.menu_restore))
.setIcon(android.R.drawable.ic_menu_upload);
diff --git a/src/com/android/settings/DateTimeSettings.java b/src/com/android/settings/DateTimeSettings.java
index 65a34f4..b7bbc67 100644
--- a/src/com/android/settings/DateTimeSettings.java
+++ b/src/com/android/settings/DateTimeSettings.java
@@ -119,6 +119,10 @@
if (currentFormat == null) {
currentFormat = "";
}
+
+ // Prevents duplicated values on date format selector.
+ mDummyDate.set(mDummyDate.get(Calendar.YEAR), mDummyDate.DECEMBER, 31, 13, 0, 0);
+
for (int i = 0; i < formattedDates.length; i++) {
String formatted =
DateFormat.getDateFormatForSetting(getActivity(), dateFormats[i])
diff --git a/src/com/android/settings/DreamSettings.java b/src/com/android/settings/DreamSettings.java
index 32328d9..23285c0 100644
--- a/src/com/android/settings/DreamSettings.java
+++ b/src/com/android/settings/DreamSettings.java
@@ -316,7 +316,7 @@
ImageView settingsButton = (ImageView) row.findViewById(android.R.id.button2);
settingsButton.setVisibility(showSettings ? View.VISIBLE : View.INVISIBLE);
- settingsButton.setAlpha(dreamInfo.isActive ? 1f : 0.33f);
+ settingsButton.setAlpha(dreamInfo.isActive ? 1f : Utils.DISABLED_ALPHA);
settingsButton.setEnabled(dreamInfo.isActive);
settingsButton.setOnClickListener(new OnClickListener(){
@Override
diff --git a/src/com/android/settings/Utils.java b/src/com/android/settings/Utils.java
index e6d63bd..8829825 100644
--- a/src/com/android/settings/Utils.java
+++ b/src/com/android/settings/Utils.java
@@ -80,6 +80,11 @@
public static final int UPDATE_PREFERENCE_FLAG_SET_TITLE_TO_MATCHING_ACTIVITY = 1;
/**
+ * The opacity level of a disabled icon.
+ */
+ public static final float DISABLED_ALPHA = 0.4f;
+
+ /**
* Name of the meta-data item that should be set in the AndroidManifest.xml
* to specify the icon that should be displayed for the preference.
*/
diff --git a/src/com/android/settings/deviceinfo/Status.java b/src/com/android/settings/deviceinfo/Status.java
index 5297245..6a15027 100644
--- a/src/com/android/settings/deviceinfo/Status.java
+++ b/src/com/android/settings/deviceinfo/Status.java
@@ -381,8 +381,11 @@
private void updateNetworkType() {
// Whether EDGE, UMTS, etc...
- setSummaryText(KEY_NETWORK_TYPE, mTelephonyManager.getNetworkTypeName() +
- ":" + mTelephonyManager.getNetworkType());
+ String networktype = null;
+ if (TelephonyManager.NETWORK_TYPE_UNKNOWN != mTelephonyManager.getNetworkType()) {
+ networktype = mTelephonyManager.getNetworkTypeName();
+ }
+ setSummaryText(KEY_NETWORK_TYPE, networktype);
}
private void updateDataState() {
diff --git a/src/com/android/settings/deviceinfo/StorageMeasurement.java b/src/com/android/settings/deviceinfo/StorageMeasurement.java
index 772ac0d..a22ba77 100644
--- a/src/com/android/settings/deviceinfo/StorageMeasurement.java
+++ b/src/com/android/settings/deviceinfo/StorageMeasurement.java
@@ -422,7 +422,7 @@
}
// Measure misc files not counted under media
- if (mIsInternal || mIsPrimary) {
+ if (measureMedia) {
final File path = mIsInternal ? currentEnv.getExternalStorageDirectory()
: mVolume.getPathFile();
details.miscSize = measureMisc(imcs, path);
diff --git a/src/com/android/settings/deviceinfo/StorageVolumePreferenceCategory.java b/src/com/android/settings/deviceinfo/StorageVolumePreferenceCategory.java
index 1599ec7..61188ec 100644
--- a/src/com/android/settings/deviceinfo/StorageVolumePreferenceCategory.java
+++ b/src/com/android/settings/deviceinfo/StorageVolumePreferenceCategory.java
@@ -194,8 +194,9 @@
}
final boolean isRemovable = mVolume != null ? mVolume.isRemovable() : false;
+ // Always create the preference since many code rely on it existing
+ mMountTogglePreference = new Preference(context);
if (isRemovable) {
- mMountTogglePreference = new Preference(context);
mMountTogglePreference.setTitle(R.string.sd_eject);
mMountTogglePreference.setSummary(R.string.sd_eject_summary);
addPreference(mMountTogglePreference);
@@ -240,12 +241,12 @@
final String state = mStorageManager.getVolumeState(mVolume.getPath());
if (Environment.MEDIA_MOUNTED_READ_ONLY.equals(state)) {
- mItemAvailable.setSummary(R.string.memory_available_read_only);
+ mItemAvailable.setTitle(R.string.memory_available_read_only);
if (mFormatPreference != null) {
removePreference(mFormatPreference);
}
} else {
- mItemAvailable.setSummary(R.string.memory_available);
+ mItemAvailable.setTitle(R.string.memory_available);
}
if (Environment.MEDIA_MOUNTED.equals(state)
@@ -310,7 +311,9 @@
private static long totalValues(HashMap<String, Long> map, String... keys) {
long total = 0;
for (String key : keys) {
- total += map.get(key);
+ if (map.containsKey(key)) {
+ total += map.get(key);
+ }
}
return total;
}
diff --git a/src/com/android/settings/inputmethod/CheckBoxAndSettingsPreference.java b/src/com/android/settings/inputmethod/CheckBoxAndSettingsPreference.java
index 28b8616..f440bc8 100644
--- a/src/com/android/settings/inputmethod/CheckBoxAndSettingsPreference.java
+++ b/src/com/android/settings/inputmethod/CheckBoxAndSettingsPreference.java
@@ -18,6 +18,7 @@
import com.android.settings.R;
import com.android.settings.SettingsPreferenceFragment;
+import com.android.settings.Utils;
import android.content.Context;
import android.content.Intent;
@@ -29,7 +30,6 @@
import android.widget.TextView;
public class CheckBoxAndSettingsPreference extends CheckBoxPreference {
- private static final float DISABLED_ALPHA = 0.4f;
private SettingsPreferenceFragment mFragment;
private TextView mTitleText;
@@ -103,7 +103,7 @@
mSettingsButton.setClickable(checked);
mSettingsButton.setFocusable(checked);
if (!checked) {
- mSettingsButton.setAlpha(DISABLED_ALPHA);
+ mSettingsButton.setAlpha(Utils.DISABLED_ALPHA);
}
}
}
diff --git a/src/com/android/settings/inputmethod/InputMethodPreference.java b/src/com/android/settings/inputmethod/InputMethodPreference.java
index 103481e..f064c08 100644
--- a/src/com/android/settings/inputmethod/InputMethodPreference.java
+++ b/src/com/android/settings/inputmethod/InputMethodPreference.java
@@ -18,6 +18,7 @@
import com.android.settings.R;
import com.android.settings.SettingsPreferenceFragment;
+import com.android.settings.Utils;
import android.app.AlertDialog;
import android.app.Fragment;
@@ -47,7 +48,6 @@
public class InputMethodPreference extends CheckBoxPreference
implements Comparator<InputMethodPreference> {
private static final String TAG = InputMethodPreference.class.getSimpleName();
- private static final float DISABLED_ALPHA = 0.4f;
private final SettingsPreferenceFragment mFragment;
private final InputMethodInfo mImi;
private final InputMethodManager mImm;
@@ -172,7 +172,7 @@
mInputMethodSettingsButton.setClickable(checked);
mInputMethodSettingsButton.setFocusable(checked);
if (!checked) {
- mInputMethodSettingsButton.setAlpha(DISABLED_ALPHA);
+ mInputMethodSettingsButton.setAlpha(Utils.DISABLED_ALPHA);
}
}
if (mTitleText != null) {
diff --git a/src/com/android/settings/inputmethod/SingleSpellCheckerPreference.java b/src/com/android/settings/inputmethod/SingleSpellCheckerPreference.java
index 5b28142..5ea8bd7 100644
--- a/src/com/android/settings/inputmethod/SingleSpellCheckerPreference.java
+++ b/src/com/android/settings/inputmethod/SingleSpellCheckerPreference.java
@@ -17,6 +17,7 @@
package com.android.settings.inputmethod;
import com.android.settings.R;
+import com.android.settings.Utils;
import android.app.AlertDialog;
import android.content.ActivityNotFoundException;
@@ -37,7 +38,6 @@
import android.widget.Toast;
public class SingleSpellCheckerPreference extends Preference {
- private static final float DISABLED_ALPHA = 0.4f;
private static final String TAG = SingleSpellCheckerPreference.class.getSimpleName();
private static final boolean DBG = false;
@@ -198,7 +198,7 @@
mSettingsButton.setClickable(enabled);
mSettingsButton.setFocusable(enabled);
if (!enabled) {
- mSettingsButton.setAlpha(DISABLED_ALPHA);
+ mSettingsButton.setAlpha(Utils.DISABLED_ALPHA);
}
}
}
@@ -210,7 +210,7 @@
mSubtypeButton.setClickable(enabled);
mSubtypeButton.setFocusable(enabled);
if (!enabled) {
- mSubtypeButton.setAlpha(DISABLED_ALPHA);
+ mSubtypeButton.setAlpha(Utils.DISABLED_ALPHA);
}
}
}
diff --git a/src/com/android/settings/tts/TtsEnginePreference.java b/src/com/android/settings/tts/TtsEnginePreference.java
index 3d612f0..21ef81d 100644
--- a/src/com/android/settings/tts/TtsEnginePreference.java
+++ b/src/com/android/settings/tts/TtsEnginePreference.java
@@ -30,6 +30,7 @@
import com.android.settings.R;
+import com.android.settings.Utils;
public class TtsEnginePreference extends Preference {
@@ -136,6 +137,9 @@
// Will be enabled only the engine has passed the voice check, and
// is currently enabled.
mSettingsIcon.setEnabled(isChecked && mVoiceCheckData != null);
+ if (!isChecked) {
+ mSettingsIcon.setAlpha(Utils.DISABLED_ALPHA);
+ }
mSettingsIcon.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
@@ -169,7 +173,12 @@
// case mSettingsIcon && mRadioButton will be null. In this case
// getView will set the right values.
if (mSettingsIcon != null && mRadioButton != null) {
- mSettingsIcon.setEnabled(mRadioButton.isChecked());
+ if (mRadioButton.isChecked()) {
+ mSettingsIcon.setEnabled(true);
+ } else {
+ mSettingsIcon.setEnabled(false);
+ mSettingsIcon.setAlpha(Utils.DISABLED_ALPHA);
+ }
}
}