Don't dismiss remove work profile dialog on orientation change.
Use a DialogFragment. BUG:19635753 Change-Id: I6ef34e3eea3e55e0e827b77d4f2cc7d22f7cc8b5
This commit is contained in:
@@ -228,14 +228,8 @@ public class AccountSettings extends SettingsPreferenceFragment
|
|||||||
}
|
}
|
||||||
if (preference == profileData.removeWorkProfilePreference) {
|
if (preference == profileData.removeWorkProfilePreference) {
|
||||||
final int userId = profileData.userInfo.id;
|
final int userId = profileData.userInfo.id;
|
||||||
UserDialogs.createRemoveDialog(getActivity(), userId,
|
RemoveUserFragment.newInstance(userId).show(getActivity().getFragmentManager(),
|
||||||
new DialogInterface.OnClickListener() {
|
"removeUser");
|
||||||
@Override
|
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
|
||||||
mUm.removeUser(userId);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
).show();
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (preference == profileData.managedProfilePreference) {
|
if (preference == profileData.managedProfilePreference) {
|
||||||
@@ -621,6 +615,32 @@ public class AccountSettings extends SettingsPreferenceFragment
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static class RemoveUserFragment extends DialogFragment {
|
||||||
|
private static final String ARG_USER_ID = "userId";
|
||||||
|
|
||||||
|
static RemoveUserFragment newInstance(int userId) {
|
||||||
|
Bundle args = new Bundle();
|
||||||
|
args.putInt(ARG_USER_ID, userId);
|
||||||
|
RemoveUserFragment fragment = new RemoveUserFragment();
|
||||||
|
fragment.setArguments(args);
|
||||||
|
return fragment;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
||||||
|
final int userId = getArguments().getInt(ARG_USER_ID);
|
||||||
|
return UserDialogs.createRemoveDialog(getActivity(), userId,
|
||||||
|
new DialogInterface.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
|
UserManager um = (UserManager)
|
||||||
|
getActivity().getSystemService(Context.USER_SERVICE);
|
||||||
|
um.removeUser(userId);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Dialog to inform user about changing auto-sync setting
|
* Dialog to inform user about changing auto-sync setting
|
||||||
*/
|
*/
|
||||||
|
Reference in New Issue
Block a user