More User Settings improvements
Add a menu checkbox to allow creation of users from lockscreen. Add a delete icon in restricted profiles settings. Other little fixes to icons. Update some strings based on feedback. Bug: 15761405 Bug: 16550371 Bug: 16298824 Change-Id: Ib876bd57f15c6ce2d71856f72571c6b8b0e3102d
Before Width: | Height: | Size: 244 B After Width: | Height: | Size: 244 B |
Before Width: | Height: | Size: 162 B After Width: | Height: | Size: 162 B |
Before Width: | Height: | Size: 208 B After Width: | Height: | Size: 208 B |
Before Width: | Height: | Size: 294 B After Width: | Height: | Size: 294 B |
Before Width: | Height: | Size: 319 B After Width: | Height: | Size: 319 B |
@@ -71,7 +71,7 @@
|
||||
android:layout_height="fill_parent"
|
||||
android:paddingStart="12dip"
|
||||
android:paddingEnd="12dp"
|
||||
android:src="@drawable/ic_menu_delete_holo_dark"
|
||||
android:src="@drawable/ic_menu_delete"
|
||||
android:contentDescription="@string/home_app_uninstall_button"
|
||||
android:layout_gravity="center"
|
||||
android:clickable="true"
|
||||
|
@@ -50,7 +50,7 @@
|
||||
android:layout_height="fill_parent"
|
||||
android:paddingStart="16dip"
|
||||
android:paddingEnd="16dip"
|
||||
android:src="@drawable/ic_menu_delete_holo_dark"
|
||||
android:src="@drawable/ic_menu_delete"
|
||||
android:contentDescription="@string/user_delete_user_description"
|
||||
android:layout_gravity="center"
|
||||
android:background="?android:attr/selectableItemBackground" />
|
||||
|
@@ -80,13 +80,15 @@
|
||||
android:maxLines="4" />
|
||||
</RelativeLayout>
|
||||
<ImageView
|
||||
android:id="@+id/delete"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="fill_parent"
|
||||
android:paddingStart="16dip"
|
||||
android:paddingEnd="16dip"
|
||||
android:src="@drawable/ic_sysbar_quicksettings"
|
||||
android:contentDescription="@string/settings_label"
|
||||
android:layout_gravity="center"/>
|
||||
android:src="@drawable/ic_menu_delete"
|
||||
android:contentDescription="@string/user_delete_user_description"
|
||||
android:layout_gravity="center"
|
||||
android:background="?android:attr/selectableItemBackground" />
|
||||
</LinearLayout>
|
||||
<View android:layout_width="match_parent"
|
||||
android:layout_height="2dp"
|
||||
|
@@ -5171,11 +5171,11 @@
|
||||
<!-- Button text for adding a restricted profile [CHAR LIMIT=25] -->
|
||||
<string name="user_add_profile_item_title">Restricted profile</string>
|
||||
<!-- Title for add user confirmation dialog [CHAR LIMIT=30] -->
|
||||
<string name="user_add_user_title">Add new user</string>
|
||||
<string name="user_add_user_title">Add new user?</string>
|
||||
<!-- Message for add user confirmation dialog - long version. [CHAR LIMIT=none] -->
|
||||
<string name="user_add_user_message_long">You can share this device with other people by creating additional users. Each user has their own space, which they can customize with their own apps, wallpaper, and so on. Users can also adjust tablet settings like Wi\u2011Fi that affect everyone.\n\nAfter you create a new user, that person needs to go through a setup process.\n\nAny user can accept updated app permissions on behalf of all other users.</string>
|
||||
<string name="user_add_user_message_long">You can share this device with other people by creating additional users. Each user has their own space, which they can customize with their own apps, wallpaper, and so on. Users can also adjust tablet settings like Wi\u2011Fi that affect everyone.\n\nWhen you add a new user, that person needs to set up their space.\n\nAny user can update apps for all other users.</string>
|
||||
<!-- Message for add user confirmation dialog - short version. [CHAR LIMIT=none] -->
|
||||
<string name="user_add_user_message_short">After you create a new user, that person needs to go through a setup process.\n\nAny user can accept updated app permissions on behalf of all other users.</string>
|
||||
<string name="user_add_user_message_short">When you add a new user, that person needs to set up their space.\n\nAny user can update apps for all other users. </string>
|
||||
<!-- Title of dialog to setup a new user [CHAR LIMIT=30] -->
|
||||
<string name="user_setup_dialog_title">Set up user now?</string>
|
||||
<!-- Message in dialog to setup a new user after creation [CHAR LIMIT=none] -->
|
||||
@@ -5195,6 +5195,8 @@
|
||||
|
||||
<!-- User details remove user menu [CHAR LIMIT=20] -->
|
||||
<string name="user_remove_user_menu">Delete <xliff:g id="user_name">%1$s</xliff:g> from this device</string>
|
||||
<!-- User menu to allow creating new users from lockscreen [CHAR LIMIT=30] -->
|
||||
<string name="user_add_on_lockscreen_menu">Add users when device is locked</string>
|
||||
<!-- User details new user name [CHAR LIMIT=30] -->
|
||||
<string name="user_new_user_name">New user</string>
|
||||
<!-- User details new restricted profile name [CHAR LIMIT=30] -->
|
||||
@@ -5202,21 +5204,17 @@
|
||||
<!-- User (self) removal confirmation title [CHAR LIMIT=30] -->
|
||||
<string name="user_confirm_remove_self_title">Delete yourself?</string>
|
||||
<!-- User removal confirmation title [CHAR LIMIT=25] -->
|
||||
<string name="user_confirm_remove_title">Remove user?</string>
|
||||
<string name="user_confirm_remove_title">Remove this user?</string>
|
||||
<!-- Profile removal confirmation title [CHAR LIMIT=25] -->
|
||||
<string name="user_profile_confirm_remove_title">Remove profile?</string>
|
||||
<string name="user_profile_confirm_remove_title">Remove this profile?</string>
|
||||
<!-- User (self) removal confirmation message [CHAR LIMIT=none] -->
|
||||
<string name="user_confirm_remove_self_message" product="tablet">You will lose your space and data on this tablet. You can\'t undo this action.</string>
|
||||
<!-- User (self) removal confirmation message [CHAR LIMIT=none] -->
|
||||
<string name="user_confirm_remove_self_message" product="default">You will lose your space and data on this phone. You can\'t undo this action.</string>
|
||||
<!-- User removal confirmation message [CHAR LIMIT=none] -->
|
||||
<string name="user_confirm_remove_message" product="tablet">This user\'s space and data will disappear from this tablet. You can\'t undo this action.</string>
|
||||
<!-- User removal confirmation message [CHAR LIMIT=none] -->
|
||||
<string name="user_confirm_remove_message" product="default">This user\'s space and data will disappear from this phone. You can\'t undo this action.</string>
|
||||
<string name="user_confirm_remove_message">All apps and data will be deleted.</string>
|
||||
<!-- User profile removal confirmation message [CHAR LIMIT=none] -->
|
||||
<string name="user_profile_confirm_remove_message" product="tablet">This profile\'s space and data will disappear from this tablet. You can\'t undo this action.</string>
|
||||
<!-- User profile removal confirmation message [CHAR LIMIT=none] -->
|
||||
<string name="user_profile_confirm_remove_message" product="default">This profile\'s space and data will disappear from this phone. You can\'t undo this action.</string>
|
||||
<string name="user_profile_confirm_remove_message">All apps and data will be deleted.</string>
|
||||
<!-- Setting label to show that a new user is being added [CHAR LIMIT=30] -->
|
||||
<string name="user_adding_new_user">Adding new user\u2026</string>
|
||||
<!-- Spoken content description for delete icon beside a user [CHAR LIMIT=none] -->
|
||||
@@ -5233,11 +5231,19 @@
|
||||
<string name="user_exit_guest_confirm_message">Ending the guest session will remove local data.</string>
|
||||
|
||||
<!-- Title of preference to enable calling[CHAR LIMIT=35] -->
|
||||
<string name="user_enable_calling">Enable phone calls?</string>
|
||||
<string name="user_enable_calling">Allow phone calls</string>
|
||||
<!-- Title of preference to enable calling and SMS [CHAR LIMIT=35] -->
|
||||
<string name="user_enable_calling_sms">Enable phone calls and SMS?</string>
|
||||
<string name="user_enable_calling_sms">Allow phone calls and SMS</string>
|
||||
<!-- Title of preference to remove the user [CHAR LIMIT=35] -->
|
||||
<string name="user_remove_user">Remove user</string>
|
||||
<!-- Title for confirmation of turning on calls [CHAR LIMIT=35] -->
|
||||
<string name="user_enable_calling_confirm_title">Allow phone calls?</string>
|
||||
<!-- Message for confirmation of turning on calls [CHAR LIMIT=none] -->
|
||||
<string name="user_enable_calling_confirm_message">Call history will be shared with this user.</string>
|
||||
<!-- Title for confirmation of turning on calls and SMS [CHAR LIMIT=35] -->
|
||||
<string name="user_enable_calling_sms_confirm_title">Allow phone calls and SMS?</string>
|
||||
<!-- Message for confirmation of turning on calls and SMS [CHAR LIMIT=none] -->
|
||||
<string name="user_enable_calling_sms_confirm_message">Call and SMS history will be shared with this user.</string>
|
||||
|
||||
<!-- Application Restrictions screen title [CHAR LIMIT=45] -->
|
||||
<string name="application_restrictions">Allow apps and content</string>
|
||||
@@ -5376,7 +5382,7 @@
|
||||
<string name="work_sim_title">Work SIM</string>
|
||||
|
||||
<!-- User app limits screen title [CHAR LIMIT=35] -->
|
||||
<string name="user_restrictions_title">Application and content restrictions</string>
|
||||
<string name="user_restrictions_title">App & content access</string>
|
||||
<!-- User limits screen, user name rename text [CHAR LIMIT=15] -->
|
||||
<string name="user_rename">RENAME</string>
|
||||
<!-- Preference label for custom restrictions [CHAR LIMIT=35] -->
|
||||
|
@@ -446,7 +446,7 @@ public class ApnEditor extends PreferenceActivity
|
||||
// If it's a new APN, then cancel will delete the new entry in onPause
|
||||
if (!mNewApn) {
|
||||
menu.add(0, MENU_DELETE, 0, R.string.menu_delete)
|
||||
.setIcon(R.drawable.ic_menu_delete_holo_dark);
|
||||
.setIcon(R.drawable.ic_menu_delete);
|
||||
}
|
||||
menu.add(0, MENU_SAVE, 0, R.string.menu_save)
|
||||
.setIcon(android.R.drawable.ic_menu_save);
|
||||
|
@@ -242,7 +242,7 @@ public class AccountSyncSettings extends AccountPreferenceBase {
|
||||
if (!um.hasUserRestriction(UserManager.DISALLOW_MODIFY_ACCOUNTS, mUserHandle)) {
|
||||
MenuItem removeAccount = menu.add(0, MENU_REMOVE_ACCOUNT_ID, 0,
|
||||
getString(R.string.remove_account_label))
|
||||
.setIcon(R.drawable.ic_menu_delete_holo_dark);
|
||||
.setIcon(R.drawable.ic_menu_delete);
|
||||
removeAccount.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER |
|
||||
MenuItem.SHOW_AS_ACTION_WITH_TEXT);
|
||||
}
|
||||
|
@@ -988,6 +988,7 @@ public class AppRestrictionsFragment extends SettingsPreferenceFragment implemen
|
||||
+ entry.getKey());
|
||||
mAppList.addPreference(p);
|
||||
p.setOnPreferenceChangeListener(AppRestrictionsFragment.this);
|
||||
p.setIcon(R.drawable.empty_icon);
|
||||
preference.mChildren.add(p);
|
||||
count++;
|
||||
}
|
||||
|
@@ -38,7 +38,14 @@ import android.widget.ImageView;
|
||||
|
||||
import com.android.settings.R;
|
||||
|
||||
/**
|
||||
* This class encapsulates a Dialog for editing the user nickname and photo.
|
||||
*/
|
||||
public class EditUserInfoController {
|
||||
|
||||
private static final String KEY_AWAITING_RESULT = "awaiting_result";
|
||||
private static final String KEY_SAVED_PHOTO = "pending_photo";
|
||||
|
||||
private Dialog mEditUserInfoDialog;
|
||||
private Bitmap mSavedPhoto;
|
||||
private EditUserPhotoController mEditUserPhotoController;
|
||||
@@ -48,7 +55,6 @@ public class EditUserInfoController {
|
||||
|
||||
public interface OnContentChangedCallback {
|
||||
public void onPhotoChanged(Drawable photo);
|
||||
|
||||
public void onLabelChanged(CharSequence label);
|
||||
}
|
||||
|
||||
@@ -62,17 +68,18 @@ public class EditUserInfoController {
|
||||
}
|
||||
|
||||
public void onRestoreInstanceState(Bundle icicle) {
|
||||
mSavedPhoto = (Bitmap) icicle.getParcelable(RestrictedProfileSettings.KEY_SAVED_PHOTO);
|
||||
mSavedPhoto = (Bitmap) icicle.getParcelable(KEY_SAVED_PHOTO);
|
||||
mWaitingForActivityResult = icicle.getBoolean(KEY_AWAITING_RESULT, false);
|
||||
}
|
||||
|
||||
public void onSaveInstanceState(Bundle outState) {
|
||||
if (mEditUserInfoDialog != null && mEditUserInfoDialog.isShowing()
|
||||
&& mEditUserPhotoController != null) {
|
||||
outState.putParcelable(RestrictedProfileSettings.KEY_SAVED_PHOTO,
|
||||
outState.putParcelable(KEY_SAVED_PHOTO,
|
||||
mEditUserPhotoController.getNewUserPhotoBitmap());
|
||||
}
|
||||
if (mWaitingForActivityResult) {
|
||||
outState.putBoolean(RestrictedProfileSettings.KEY_AWAITING_RESULT,
|
||||
outState.putBoolean(KEY_AWAITING_RESULT,
|
||||
mWaitingForActivityResult);
|
||||
}
|
||||
}
|
||||
|
@@ -17,6 +17,7 @@
|
||||
package com.android.settings.users;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.UserInfo;
|
||||
import android.graphics.drawable.Drawable;
|
||||
@@ -28,24 +29,24 @@ import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.Utils;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class RestrictedProfileSettings extends AppRestrictionsFragment
|
||||
implements EditUserInfoController.OnContentChangedCallback {
|
||||
|
||||
static final String KEY_SAVED_PHOTO = "pending_photo";
|
||||
static final String KEY_AWAITING_RESULT = "awaiting_result";
|
||||
static final int DIALOG_ID_EDIT_USER_INFO = 1;
|
||||
public static final String FILE_PROVIDER_AUTHORITY = "com.android.settings.files";
|
||||
static final int DIALOG_ID_EDIT_USER_INFO = 1;
|
||||
private static final int DIALOG_CONFIRM_REMOVE = 2;
|
||||
|
||||
private View mHeaderView;
|
||||
private ImageView mUserIconView;
|
||||
private TextView mUserNameView;
|
||||
private ImageView mDeleteButton;
|
||||
|
||||
private EditUserInfoController mEditUserInfoController =
|
||||
new EditUserInfoController();
|
||||
private boolean mWaitingForActivityResult;
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle icicle) {
|
||||
@@ -53,7 +54,6 @@ public class RestrictedProfileSettings extends AppRestrictionsFragment
|
||||
|
||||
if (icicle != null) {
|
||||
mEditUserInfoController.onRestoreInstanceState(icicle);
|
||||
mWaitingForActivityResult = icicle.getBoolean(KEY_AWAITING_RESULT, false);
|
||||
}
|
||||
|
||||
init(icicle);
|
||||
@@ -68,6 +68,8 @@ public class RestrictedProfileSettings extends AppRestrictionsFragment
|
||||
mHeaderView.setOnClickListener(this);
|
||||
mUserIconView = (ImageView) mHeaderView.findViewById(android.R.id.icon);
|
||||
mUserNameView = (TextView) mHeaderView.findViewById(android.R.id.title);
|
||||
mDeleteButton = (ImageView) mHeaderView.findViewById(R.id.delete);
|
||||
mDeleteButton.setOnClickListener(this);
|
||||
getListView().setFastScrollEnabled(true);
|
||||
}
|
||||
// This is going to bind the preferences.
|
||||
@@ -122,6 +124,8 @@ public class RestrictedProfileSettings extends AppRestrictionsFragment
|
||||
public void onClick(View view) {
|
||||
if (view == mHeaderView) {
|
||||
showDialog(DIALOG_ID_EDIT_USER_INFO);
|
||||
} else if (view == mDeleteButton) {
|
||||
showDialog(DIALOG_CONFIRM_REMOVE);
|
||||
} else {
|
||||
super.onClick(view); // in AppRestrictionsFragment
|
||||
}
|
||||
@@ -133,11 +137,30 @@ public class RestrictedProfileSettings extends AppRestrictionsFragment
|
||||
return mEditUserInfoController.createDialog(this, mUserIconView.getDrawable(),
|
||||
mUserNameView.getText(), R.string.profile_info_settings_title,
|
||||
this, mUser);
|
||||
} else if (dialogId == DIALOG_CONFIRM_REMOVE) {
|
||||
Dialog dlg =
|
||||
Utils.createRemoveConfirmationDialog(getActivity(), mUser.getIdentifier(),
|
||||
new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
removeUser();
|
||||
}
|
||||
}
|
||||
);
|
||||
return dlg;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private void removeUser() {
|
||||
getView().post(new Runnable() {
|
||||
public void run() {
|
||||
mUserManager.removeUser(mUser.getIdentifier());
|
||||
finishFragment();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPhotoChanged(Drawable photo) {
|
||||
mUserIconView.setImageDrawable(photo);
|
||||
|
@@ -50,6 +50,7 @@ import android.os.UserManager;
|
||||
import android.preference.Preference;
|
||||
import android.preference.Preference.OnPreferenceClickListener;
|
||||
import android.preference.PreferenceGroup;
|
||||
import android.provider.Settings;
|
||||
import android.provider.Settings.Secure;
|
||||
import android.util.Log;
|
||||
import android.util.SparseArray;
|
||||
@@ -94,6 +95,7 @@ public class UserSettings extends SettingsPreferenceFragment
|
||||
private static final String KEY_ADD_USER = "user_add";
|
||||
|
||||
private static final int MENU_REMOVE_USER = Menu.FIRST;
|
||||
private static final int MENU_ADD_ON_LOCKSCREEN = Menu.FIRST + 1;
|
||||
|
||||
private static final int DIALOG_CONFIRM_REMOVE = 1;
|
||||
private static final int DIALOG_ADD_USER = 2;
|
||||
@@ -282,13 +284,21 @@ public class UserSettings extends SettingsPreferenceFragment
|
||||
|
||||
@Override
|
||||
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
|
||||
int pos = 0;
|
||||
UserManager um = (UserManager) getActivity().getSystemService(Context.USER_SERVICE);
|
||||
if (!mIsOwner && !um.hasUserRestriction(UserManager.DISALLOW_REMOVE_USER)) {
|
||||
String nickname = mUserManager.getUserName();
|
||||
MenuItem removeThisUser = menu.add(0, MENU_REMOVE_USER, 0,
|
||||
MenuItem removeThisUser = menu.add(0, MENU_REMOVE_USER, pos++,
|
||||
getResources().getString(R.string.user_remove_user_menu, nickname));
|
||||
removeThisUser.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER);
|
||||
}
|
||||
if (mIsOwner && !um.hasUserRestriction(UserManager.DISALLOW_ADD_USER)) {
|
||||
MenuItem allowAddOnLockscreen = menu.add(0, MENU_ADD_ON_LOCKSCREEN, pos++,
|
||||
R.string.user_add_on_lockscreen_menu);
|
||||
allowAddOnLockscreen.setCheckable(true);
|
||||
allowAddOnLockscreen.setChecked(Settings.Global.getInt(getContentResolver(),
|
||||
Settings.Global.ADD_USERS_WHEN_LOCKED, 0) == 1);
|
||||
}
|
||||
super.onCreateOptionsMenu(menu, inflater);
|
||||
}
|
||||
|
||||
@@ -298,6 +308,12 @@ public class UserSettings extends SettingsPreferenceFragment
|
||||
if (itemId == MENU_REMOVE_USER) {
|
||||
onRemoveUserClicked(UserHandle.myUserId());
|
||||
return true;
|
||||
} else if (itemId == MENU_ADD_ON_LOCKSCREEN) {
|
||||
final boolean isChecked = item.isChecked();
|
||||
Settings.Global.putInt(getContentResolver(), Settings.Global.ADD_USERS_WHEN_LOCKED,
|
||||
isChecked ? 0 : 1);
|
||||
item.setChecked(!isChecked);
|
||||
return true;
|
||||
} else {
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
@@ -780,6 +796,7 @@ public class UserSettings extends SettingsPreferenceFragment
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Add a temporary entry for the user being created
|
||||
if (mAddingUser) {
|
||||
Preference pref = new UserPreference(getActivity(), null, UserPreference.USERID_UNKNOWN,
|
||||
@@ -793,7 +810,9 @@ public class UserSettings extends SettingsPreferenceFragment
|
||||
if (!mIsGuest) {
|
||||
// Add a virtual Guest user for guest defaults
|
||||
Preference pref = new UserPreference(getActivity(), null,
|
||||
UserPreference.USERID_GUEST_DEFAULTS, mIsOwner ? this : null, null);
|
||||
UserPreference.USERID_GUEST_DEFAULTS,
|
||||
mIsOwner && voiceCapable? this : null /* settings icon handler */,
|
||||
null /* delete icon handler */);
|
||||
pref.setTitle(R.string.user_guest);
|
||||
pref.setIcon(getEncircledGuestDrawable());
|
||||
pref.setOnPreferenceClickListener(this);
|
||||
@@ -928,11 +947,6 @@ public class UserSettings extends SettingsPreferenceFragment
|
||||
return (user.flags & UserInfo.FLAG_INITIALIZED) != 0;
|
||||
}
|
||||
|
||||
private Drawable encircle(int iconResId) {
|
||||
Bitmap icon = BitmapFactory.decodeResource(getResources(), iconResId);
|
||||
return encircle(icon);
|
||||
}
|
||||
|
||||
private Drawable encircle(Bitmap icon) {
|
||||
Drawable circled = CircleFramedDrawable.getInstance(getActivity(), icon);
|
||||
return circled;
|
||||
|