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
This commit is contained in:
Amith Yamasani
2014-07-25 12:52:29 -07:00
parent 2d4d9a9067
commit 247520c369
15 changed files with 90 additions and 37 deletions

View File

@@ -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);