Reset spinner selection
This makes sure that when you go back to the spinner screen, the selection is the one corresponding to the current profile. Bug: 17378446 Change-Id: I536cc2701f9481986a63df1b01a38151edf2fa83
This commit is contained in:
@@ -94,6 +94,7 @@ public class NotificationAppList extends PinnedHeaderListFragment
|
||||
private Parcelable mListViewState;
|
||||
private Backend mBackend = new Backend();
|
||||
private UserSpinnerAdapter mProfileSpinnerAdapter;
|
||||
private Spinner mSpinner;
|
||||
|
||||
private PackageManager mPM;
|
||||
private UserManager mUM;
|
||||
@@ -122,11 +123,11 @@ public class NotificationAppList extends PinnedHeaderListFragment
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
mProfileSpinnerAdapter = Utils.createUserSpinnerAdapter(mUM, mContext);
|
||||
if (mProfileSpinnerAdapter != null) {
|
||||
Spinner spinner = (Spinner) getActivity().getLayoutInflater().inflate(
|
||||
mSpinner = (Spinner) getActivity().getLayoutInflater().inflate(
|
||||
R.layout.spinner_view, null);
|
||||
spinner.setAdapter(mProfileSpinnerAdapter);
|
||||
spinner.setOnItemSelectedListener(this);
|
||||
setPinnedHeaderView(spinner);
|
||||
mSpinner.setAdapter(mProfileSpinnerAdapter);
|
||||
mSpinner.setOnItemSelectedListener(this);
|
||||
setPinnedHeaderView(mSpinner);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -164,6 +165,9 @@ public class NotificationAppList extends PinnedHeaderListFragment
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
|
||||
mContext.startActivityAsUser(intent, selectedUser);
|
||||
// Go back to default selection, which is the first one; this makes sure that pressing
|
||||
// the back button takes you into a consistent state
|
||||
mSpinner.setSelection(0);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user