diff options
40 files changed, 80 insertions, 26 deletions
diff --git a/res/drawable-hdpi/avatar_default_1.png b/res/drawable-hdpi/avatar_default_1.png Binary files differnew file mode 100644 index 0000000..39ffd73 --- /dev/null +++ b/res/drawable-hdpi/avatar_default_1.png diff --git a/res/drawable-hdpi/avatar_default_2.png b/res/drawable-hdpi/avatar_default_2.png Binary files differnew file mode 100644 index 0000000..79203c5 --- /dev/null +++ b/res/drawable-hdpi/avatar_default_2.png diff --git a/res/drawable-hdpi/avatar_default_3.png b/res/drawable-hdpi/avatar_default_3.png Binary files differnew file mode 100644 index 0000000..4d179b3 --- /dev/null +++ b/res/drawable-hdpi/avatar_default_3.png diff --git a/res/drawable-hdpi/avatar_default_4.png b/res/drawable-hdpi/avatar_default_4.png Binary files differnew file mode 100644 index 0000000..1a0332f --- /dev/null +++ b/res/drawable-hdpi/avatar_default_4.png diff --git a/res/drawable-hdpi/avatar_default_5.png b/res/drawable-hdpi/avatar_default_5.png Binary files differnew file mode 100644 index 0000000..2487e66 --- /dev/null +++ b/res/drawable-hdpi/avatar_default_5.png diff --git a/res/drawable-hdpi/avatar_default_6.png b/res/drawable-hdpi/avatar_default_6.png Binary files differnew file mode 100644 index 0000000..f57e1eb --- /dev/null +++ b/res/drawable-hdpi/avatar_default_6.png diff --git a/res/drawable-hdpi/avatar_default_7.png b/res/drawable-hdpi/avatar_default_7.png Binary files differnew file mode 100644 index 0000000..dc4b2ce --- /dev/null +++ b/res/drawable-hdpi/avatar_default_7.png diff --git a/res/drawable-hdpi/avatar_default_8.png b/res/drawable-hdpi/avatar_default_8.png Binary files differnew file mode 100644 index 0000000..64e7936 --- /dev/null +++ b/res/drawable-hdpi/avatar_default_8.png diff --git a/res/drawable-hdpi/ic_settings_multiuser.png b/res/drawable-hdpi/ic_settings_multiuser.png Binary files differnew file mode 100644 index 0000000..74af8ae --- /dev/null +++ b/res/drawable-hdpi/ic_settings_multiuser.png diff --git a/res/drawable-mdpi/avatar_default_1.png b/res/drawable-mdpi/avatar_default_1.png Binary files differnew file mode 100644 index 0000000..0d8e3a2 --- /dev/null +++ b/res/drawable-mdpi/avatar_default_1.png diff --git a/res/drawable-mdpi/avatar_default_2.png b/res/drawable-mdpi/avatar_default_2.png Binary files differnew file mode 100644 index 0000000..0cc4c3d --- /dev/null +++ b/res/drawable-mdpi/avatar_default_2.png diff --git a/res/drawable-mdpi/avatar_default_3.png b/res/drawable-mdpi/avatar_default_3.png Binary files differnew file mode 100644 index 0000000..c43ad6f --- /dev/null +++ b/res/drawable-mdpi/avatar_default_3.png diff --git a/res/drawable-mdpi/avatar_default_4.png b/res/drawable-mdpi/avatar_default_4.png Binary files differnew file mode 100644 index 0000000..6906489 --- /dev/null +++ b/res/drawable-mdpi/avatar_default_4.png diff --git a/res/drawable-mdpi/avatar_default_5.png b/res/drawable-mdpi/avatar_default_5.png Binary files differnew file mode 100644 index 0000000..857f277 --- /dev/null +++ b/res/drawable-mdpi/avatar_default_5.png diff --git a/res/drawable-mdpi/avatar_default_6.png b/res/drawable-mdpi/avatar_default_6.png Binary files differnew file mode 100644 index 0000000..9d0f968 --- /dev/null +++ b/res/drawable-mdpi/avatar_default_6.png diff --git a/res/drawable-mdpi/avatar_default_7.png b/res/drawable-mdpi/avatar_default_7.png Binary files differnew file mode 100644 index 0000000..7db8864 --- /dev/null +++ b/res/drawable-mdpi/avatar_default_7.png diff --git a/res/drawable-mdpi/avatar_default_8.png b/res/drawable-mdpi/avatar_default_8.png Binary files differnew file mode 100644 index 0000000..98d67d9 --- /dev/null +++ b/res/drawable-mdpi/avatar_default_8.png diff --git a/res/drawable-mdpi/ic_settings_multiuser.png b/res/drawable-mdpi/ic_settings_multiuser.png Binary files differnew file mode 100644 index 0000000..758c9ec --- /dev/null +++ b/res/drawable-mdpi/ic_settings_multiuser.png diff --git a/res/drawable-xhdpi/avatar_default_1.png b/res/drawable-xhdpi/avatar_default_1.png Binary files differnew file mode 100644 index 0000000..6caa06a --- /dev/null +++ b/res/drawable-xhdpi/avatar_default_1.png diff --git a/res/drawable-xhdpi/avatar_default_2.png b/res/drawable-xhdpi/avatar_default_2.png Binary files differnew file mode 100644 index 0000000..faf3b15 --- /dev/null +++ b/res/drawable-xhdpi/avatar_default_2.png diff --git a/res/drawable-xhdpi/avatar_default_3.png b/res/drawable-xhdpi/avatar_default_3.png Binary files differnew file mode 100644 index 0000000..63a80ff --- /dev/null +++ b/res/drawable-xhdpi/avatar_default_3.png diff --git a/res/drawable-xhdpi/avatar_default_4.png b/res/drawable-xhdpi/avatar_default_4.png Binary files differnew file mode 100644 index 0000000..d743dc6 --- /dev/null +++ b/res/drawable-xhdpi/avatar_default_4.png diff --git a/res/drawable-xhdpi/avatar_default_5.png b/res/drawable-xhdpi/avatar_default_5.png Binary files differnew file mode 100644 index 0000000..b7b822b --- /dev/null +++ b/res/drawable-xhdpi/avatar_default_5.png diff --git a/res/drawable-xhdpi/avatar_default_6.png b/res/drawable-xhdpi/avatar_default_6.png Binary files differnew file mode 100644 index 0000000..f5b5e84 --- /dev/null +++ b/res/drawable-xhdpi/avatar_default_6.png diff --git a/res/drawable-xhdpi/avatar_default_7.png b/res/drawable-xhdpi/avatar_default_7.png Binary files differnew file mode 100644 index 0000000..4271c0d --- /dev/null +++ b/res/drawable-xhdpi/avatar_default_7.png diff --git a/res/drawable-xhdpi/avatar_default_8.png b/res/drawable-xhdpi/avatar_default_8.png Binary files differnew file mode 100644 index 0000000..27261a5 --- /dev/null +++ b/res/drawable-xhdpi/avatar_default_8.png diff --git a/res/drawable-xhdpi/ic_settings_multiuser.png b/res/drawable-xhdpi/ic_settings_multiuser.png Binary files differnew file mode 100644 index 0000000..dbf8cd4 --- /dev/null +++ b/res/drawable-xhdpi/ic_settings_multiuser.png diff --git a/res/drawable/ic_user.png b/res/drawable/ic_user.png Binary files differdeleted file mode 100644 index dc4c390..0000000 --- a/res/drawable/ic_user.png +++ /dev/null diff --git a/res/drawable/ic_user_cyan.png b/res/drawable/ic_user_cyan.png Binary files differdeleted file mode 100644 index c212615..0000000 --- a/res/drawable/ic_user_cyan.png +++ /dev/null diff --git a/res/drawable/ic_user_green.png b/res/drawable/ic_user_green.png Binary files differdeleted file mode 100644 index ca09f85..0000000 --- a/res/drawable/ic_user_green.png +++ /dev/null diff --git a/res/drawable/ic_user_orange.png b/res/drawable/ic_user_orange.png Binary files differdeleted file mode 100644 index 789d892..0000000 --- a/res/drawable/ic_user_orange.png +++ /dev/null diff --git a/res/drawable/ic_user_purple.png b/res/drawable/ic_user_purple.png Binary files differdeleted file mode 100644 index b7bdeb2..0000000 --- a/res/drawable/ic_user_purple.png +++ /dev/null diff --git a/res/drawable/ic_user_red.png b/res/drawable/ic_user_red.png Binary files differdeleted file mode 100644 index c4b4e29..0000000 --- a/res/drawable/ic_user_red.png +++ /dev/null diff --git a/res/drawable/ic_user_yellow.png b/res/drawable/ic_user_yellow.png Binary files differdeleted file mode 100644 index c46838c..0000000 --- a/res/drawable/ic_user_yellow.png +++ /dev/null diff --git a/res/xml/settings_headers.xml b/res/xml/settings_headers.xml index 6251590..05fa31f 100644 --- a/res/xml/settings_headers.xml +++ b/res/xml/settings_headers.xml @@ -100,7 +100,7 @@ <!-- Manage users --> <header android:fragment="com.android.settings.users.UserSettings" - android:icon="@drawable/ic_settings_sync" + android:icon="@drawable/ic_settings_multiuser" android:title="@string/user_settings_title" android:id="@+id/user_settings" /> diff --git a/src/com/android/settings/SettingsPreferenceFragment.java b/src/com/android/settings/SettingsPreferenceFragment.java index a5f021f..c0440c8 100644 --- a/src/com/android/settings/SettingsPreferenceFragment.java +++ b/src/com/android/settings/SettingsPreferenceFragment.java @@ -182,6 +182,10 @@ public class SettingsPreferenceFragment extends PreferenceFragment implements Di } } + public void onDialogShowing() { + // override in subclass to attach a dismiss listener, for instance + } + public static class SettingsDialogFragment extends DialogFragment { private static final String KEY_DIALOG_ID = "key_dialog_id"; private static final String KEY_PARENT_FRAGMENT_ID = "key_parent_fragment_id"; @@ -216,6 +220,15 @@ public class SettingsPreferenceFragment extends PreferenceFragment implements Di } @Override + public void onStart() { + super.onStart(); + + if (mParentFragment != null && mParentFragment instanceof SettingsPreferenceFragment) { + ((SettingsPreferenceFragment) mParentFragment).onDialogShowing(); + } + } + + @Override public Dialog onCreateDialog(Bundle savedInstanceState) { if (savedInstanceState != null) { mDialogId = savedInstanceState.getInt(KEY_DIALOG_ID, 0); diff --git a/src/com/android/settings/SoundSettings.java b/src/com/android/settings/SoundSettings.java index 3b02739..587acab 100644 --- a/src/com/android/settings/SoundSettings.java +++ b/src/com/android/settings/SoundSettings.java @@ -170,8 +170,11 @@ public class SoundSettings extends SettingsPreferenceFragment implements Vibrator vibrator = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE); if (vibrator == null || !vibrator.hasVibrator()) { - getPreferenceScreen().removePreference(mVibrateWhenRinging); - getPreferenceScreen().removePreference(mHapticFeedback); + removePreference(KEY_VIBRATE); + removePreference(KEY_HAPTIC_FEEDBACK); + } + if (!Utils.isVoiceCapable(getActivity())) { + removePreference(KEY_VIBRATE); } if (TelephonyManager.PHONE_TYPE_CDMA == activePhoneType) { diff --git a/src/com/android/settings/accounts/AddAccountSettings.java b/src/com/android/settings/accounts/AddAccountSettings.java index c5f2a9b..dffb1ee 100644 --- a/src/com/android/settings/accounts/AddAccountSettings.java +++ b/src/com/android/settings/accounts/AddAccountSettings.java @@ -55,7 +55,7 @@ import java.io.IOException; */ public class AddAccountSettings extends Activity { /** - * + * */ private static final String KEY_ADD_CALLED = "AddAccountCalled"; @@ -71,6 +71,9 @@ public class AddAccountSettings extends Activity { /* package */ static final String EXTRA_SELECTED_ACCOUNT = "selected_account"; + // show additional info regarding the use of a device with multiple users + static final String EXTRA_HAS_MULTIPLE_USERS = "hasMultipleUsers"; + private static final int CHOOSE_ACCOUNT_REQUEST = 1; private static final int DLG_MULTIUSER_WARNING = 1; @@ -193,6 +196,7 @@ public class AddAccountSettings extends Activity { Bundle addAccountOptions = new Bundle(); mPendingIntent = PendingIntent.getBroadcast(this, 0, new Intent(), 0); addAccountOptions.putParcelable(KEY_CALLER_IDENTITY, mPendingIntent); + addAccountOptions.putBoolean(EXTRA_HAS_MULTIPLE_USERS, Utils.hasMultipleUsers(this)); AccountManager.get(this).addAccount( accountType, null, /* authTokenType */ diff --git a/src/com/android/settings/applications/InstalledAppDetails.java b/src/com/android/settings/applications/InstalledAppDetails.java index 7588c1a..c5b3f8c 100644 --- a/src/com/android/settings/applications/InstalledAppDetails.java +++ b/src/com/android/settings/applications/InstalledAppDetails.java @@ -605,7 +605,7 @@ public class InstalledAppDetails extends Fragment Log.i(TAG, "Have " + prefActList.size() + " number of activities in preferred list"); boolean hasUsbDefaults = false; try { - hasUsbDefaults = mUsbManager.hasDefaults(packageName); + hasUsbDefaults = mUsbManager.hasDefaults(packageName, UserHandle.myUserId()); } catch (RemoteException e) { Log.e(TAG, "mUsbManager.hasDefaults", e); } @@ -1218,7 +1218,7 @@ public class InstalledAppDetails extends Fragment } else if(v == mActivitiesButton) { mPm.clearPackagePreferredActivities(packageName); try { - mUsbManager.clearDefaults(packageName); + mUsbManager.clearDefaults(packageName, UserHandle.myUserId()); } catch (RemoteException e) { Log.e(TAG, "mUsbManager.clearDefaults", e); } diff --git a/src/com/android/settings/users/UserSettings.java b/src/com/android/settings/users/UserSettings.java index 33b4195..984ac08 100644 --- a/src/com/android/settings/users/UserSettings.java +++ b/src/com/android/settings/users/UserSettings.java @@ -56,6 +56,7 @@ import com.android.settings.R; import com.android.settings.SelectableEditTextPreference; import com.android.settings.SettingsPreferenceFragment; import com.android.settings.Utils; +import com.android.settings.SettingsPreferenceFragment.SettingsDialogFragment; import java.util.ArrayList; import java.util.List; @@ -66,6 +67,11 @@ public class UserSettings extends SettingsPreferenceFragment private static final String TAG = "UserSettings"; + /** UserId of the user being removed */ + private static final String SAVE_REMOVING_USER = "removing_user"; + /** UserId of the user that was just added */ + private static final String SAVE_ADDING_USER = "adding_user"; + private static final String KEY_USER_NICKNAME = "user_nickname"; private static final String KEY_USER_LIST = "user_list"; private static final String KEY_USER_ME = "user_me"; @@ -85,12 +91,14 @@ public class UserSettings extends SettingsPreferenceFragment "key_add_user_long_message_displayed"; private static final int[] USER_DRAWABLES = { - R.drawable.ic_user_orange, - R.drawable.ic_user_cyan, - R.drawable.ic_user_green, - R.drawable.ic_user_purple, - R.drawable.ic_user_red, - R.drawable.ic_user_yellow + R.drawable.avatar_default_1, + R.drawable.avatar_default_2, + R.drawable.avatar_default_3, + R.drawable.avatar_default_4, + R.drawable.avatar_default_5, + R.drawable.avatar_default_6, + R.drawable.avatar_default_7, + R.drawable.avatar_default_8 }; private PreferenceGroup mUserListCategory; @@ -140,6 +148,15 @@ public class UserSettings extends SettingsPreferenceFragment public void onCreate(Bundle icicle) { super.onCreate(icicle); + if (icicle != null) { + if (icicle.containsKey(SAVE_ADDING_USER)) { + mAddedUserId = icicle.getInt(SAVE_ADDING_USER); + } + if (icicle.containsKey(SAVE_REMOVING_USER)) { + mRemovingUserId = icicle.getInt(SAVE_REMOVING_USER); + } + } + mUserManager = (UserManager) getActivity().getSystemService(Context.USER_SERVICE); addPreferencesFromResource(R.xml.user_settings); mUserListCategory = (PreferenceGroup) findPreference(KEY_USER_LIST); @@ -180,6 +197,14 @@ public class UserSettings extends SettingsPreferenceFragment } @Override + public void onSaveInstanceState(Bundle outState) { + super.onSaveInstanceState(outState); + + outState.putInt(SAVE_ADDING_USER, mAddedUserId); + outState.putInt(SAVE_REMOVING_USER, mRemovingUserId); + } + + @Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { if (mIsOwner) { if (UserManager.getMaxSupportedUsers() > mUserManager.getUsers(false).size()) { @@ -245,7 +270,6 @@ public class UserSettings extends SettingsPreferenceFragment synchronized (mUserLock) { if (mRemovingUserId == -1 && !mAddingUser) { showDialog(DIALOG_ADD_USER); - setOnDismissListener(this); } } } @@ -255,7 +279,6 @@ public class UserSettings extends SettingsPreferenceFragment if (mRemovingUserId == -1 && !mAddingUser) { mRemovingUserId = userId; showDialog(DIALOG_CONFIRM_REMOVE); - setOnDismissListener(this); } } } @@ -266,10 +289,17 @@ public class UserSettings extends SettingsPreferenceFragment } @Override + public void onDialogShowing() { + super.onDialogShowing(); + + setOnDismissListener(this); + } + + @Override public Dialog onCreateDialog(int dialogId) { switch (dialogId) { - case DIALOG_CONFIRM_REMOVE: - return new AlertDialog.Builder(getActivity()) + case DIALOG_CONFIRM_REMOVE: { + Dialog dlg = new AlertDialog.Builder(getActivity()) .setTitle(UserHandle.myUserId() == mRemovingUserId ? R.string.user_confirm_remove_self_title : R.string.user_confirm_remove_title) @@ -284,12 +314,14 @@ public class UserSettings extends SettingsPreferenceFragment }) .setNegativeButton(android.R.string.cancel, null) .create(); + return dlg; + } case DIALOG_USER_CANNOT_MANAGE: return new AlertDialog.Builder(getActivity()) .setMessage(R.string.user_cannot_manage_message) .setPositiveButton(android.R.string.ok, null) .create(); - case DIALOG_ADD_USER: + case DIALOG_ADD_USER: { final SharedPreferences preferences = getActivity().getPreferences( Context.MODE_PRIVATE); final boolean longMessageDisplayed = preferences.getBoolean( @@ -297,7 +329,7 @@ public class UserSettings extends SettingsPreferenceFragment final int messageResId = longMessageDisplayed ? R.string.user_add_user_message_short : R.string.user_add_user_message_long; - return new AlertDialog.Builder(getActivity()) + Dialog dlg = new AlertDialog.Builder(getActivity()) .setTitle(R.string.user_add_user_title) .setMessage(messageResId) .setPositiveButton(android.R.string.ok, @@ -312,8 +344,10 @@ public class UserSettings extends SettingsPreferenceFragment }) .setNegativeButton(android.R.string.cancel, null) .create(); - case DIALOG_SETUP_USER: - return new AlertDialog.Builder(getActivity()) + return dlg; + } + case DIALOG_SETUP_USER: { + Dialog dlg = new AlertDialog.Builder(getActivity()) .setTitle(R.string.user_setup_dialog_title) .setMessage(R.string.user_setup_dialog_message) .setPositiveButton(R.string.user_setup_button_setup_now, @@ -324,7 +358,8 @@ public class UserSettings extends SettingsPreferenceFragment }) .setNegativeButton(R.string.user_setup_button_setup_later, null) .create(); - + return dlg; + } default: return null; } @@ -396,9 +431,7 @@ public class UserSettings extends SettingsPreferenceFragment final ArrayList<Integer> missingIcons = new ArrayList<Integer>(); for (UserInfo user : users) { Preference pref; - if (user.id == mRemovingUserId) { - continue; - } else if (user.id == UserHandle.myUserId()) { + if (user.id == UserHandle.myUserId()) { pref = mMePreference; mNicknamePreference.setText(user.name); mNicknamePreference.setSummary(user.name); @@ -419,7 +452,7 @@ public class UserSettings extends SettingsPreferenceFragment if (user.iconPath != null) { if (mUserIcons.get(user.id) == null) { missingIcons.add(user.id); - pref.setIcon(R.drawable.ic_user); + pref.setIcon(R.drawable.avatar_default_1); } else { setPhotoId(pref, user); } @@ -432,7 +465,7 @@ public class UserSettings extends SettingsPreferenceFragment pref.setEnabled(false); pref.setTitle(R.string.user_new_user_name); pref.setSummary(R.string.user_adding_new_user); - pref.setIcon(R.drawable.ic_user); + pref.setIcon(R.drawable.avatar_default_1); mUserListCategory.addPreference(pref); } getActivity().invalidateOptionsMenu(); @@ -544,6 +577,7 @@ public class UserSettings extends SettingsPreferenceFragment synchronized (mUserLock) { mAddingUser = false; mRemovingUserId = -1; + updateUserList(); } } |