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:
@@ -252,10 +252,10 @@ public class ManageApplications extends Fragment implements
|
|||||||
: R.layout.manage_applications_apps, null);
|
: R.layout.manage_applications_apps, null);
|
||||||
mPinnedHeader = (ViewGroup) mRootView.findViewById(R.id.pinned_header);
|
mPinnedHeader = (ViewGroup) mRootView.findViewById(R.id.pinned_header);
|
||||||
if (mOwner.mProfileSpinnerAdapter != null) {
|
if (mOwner.mProfileSpinnerAdapter != null) {
|
||||||
Spinner spinner = (Spinner) inflater.inflate(R.layout.spinner_view, null);
|
mOwner.mSpinner = (Spinner) inflater.inflate(R.layout.spinner_view, null);
|
||||||
spinner.setAdapter(mOwner.mProfileSpinnerAdapter);
|
mOwner.mSpinner.setAdapter(mOwner.mProfileSpinnerAdapter);
|
||||||
spinner.setOnItemSelectedListener(mOwner);
|
mOwner.mSpinner.setOnItemSelectedListener(mOwner);
|
||||||
mPinnedHeader.addView(spinner);
|
mPinnedHeader.addView(mOwner.mSpinner);
|
||||||
mPinnedHeader.setVisibility(View.VISIBLE);
|
mPinnedHeader.setVisibility(View.VISIBLE);
|
||||||
}
|
}
|
||||||
mLoadingContainer = mRootView.findViewById(R.id.loading_container);
|
mLoadingContainer = mRootView.findViewById(R.id.loading_container);
|
||||||
@@ -483,6 +483,7 @@ public class ManageApplications extends Fragment implements
|
|||||||
private View mRootView;
|
private View mRootView;
|
||||||
private ViewPager mViewPager;
|
private ViewPager mViewPager;
|
||||||
private UserSpinnerAdapter mProfileSpinnerAdapter;
|
private UserSpinnerAdapter mProfileSpinnerAdapter;
|
||||||
|
private Spinner mSpinner;
|
||||||
private Context mContext;
|
private Context mContext;
|
||||||
|
|
||||||
AlertDialog mResetDialog;
|
AlertDialog mResetDialog;
|
||||||
@@ -1045,6 +1046,9 @@ public class ManageApplications extends Fragment implements
|
|||||||
int currentTab = mViewPager.getCurrentItem();
|
int currentTab = mViewPager.getCurrentItem();
|
||||||
intent.putExtra(EXTRA_LIST_TYPE, mTabs.get(currentTab).mListType);
|
intent.putExtra(EXTRA_LIST_TYPE, mTabs.get(currentTab).mListType);
|
||||||
mContext.startActivityAsUser(intent, selectedUser);
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -94,6 +94,7 @@ public class NotificationAppList extends PinnedHeaderListFragment
|
|||||||
private Parcelable mListViewState;
|
private Parcelable mListViewState;
|
||||||
private Backend mBackend = new Backend();
|
private Backend mBackend = new Backend();
|
||||||
private UserSpinnerAdapter mProfileSpinnerAdapter;
|
private UserSpinnerAdapter mProfileSpinnerAdapter;
|
||||||
|
private Spinner mSpinner;
|
||||||
|
|
||||||
private PackageManager mPM;
|
private PackageManager mPM;
|
||||||
private UserManager mUM;
|
private UserManager mUM;
|
||||||
@@ -122,11 +123,11 @@ public class NotificationAppList extends PinnedHeaderListFragment
|
|||||||
super.onViewCreated(view, savedInstanceState);
|
super.onViewCreated(view, savedInstanceState);
|
||||||
mProfileSpinnerAdapter = Utils.createUserSpinnerAdapter(mUM, mContext);
|
mProfileSpinnerAdapter = Utils.createUserSpinnerAdapter(mUM, mContext);
|
||||||
if (mProfileSpinnerAdapter != null) {
|
if (mProfileSpinnerAdapter != null) {
|
||||||
Spinner spinner = (Spinner) getActivity().getLayoutInflater().inflate(
|
mSpinner = (Spinner) getActivity().getLayoutInflater().inflate(
|
||||||
R.layout.spinner_view, null);
|
R.layout.spinner_view, null);
|
||||||
spinner.setAdapter(mProfileSpinnerAdapter);
|
mSpinner.setAdapter(mProfileSpinnerAdapter);
|
||||||
spinner.setOnItemSelectedListener(this);
|
mSpinner.setOnItemSelectedListener(this);
|
||||||
setPinnedHeaderView(spinner);
|
setPinnedHeaderView(mSpinner);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -164,6 +165,9 @@ public class NotificationAppList extends PinnedHeaderListFragment
|
|||||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||||
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
|
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
|
||||||
mContext.startActivityAsUser(intent, selectedUser);
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -124,6 +124,7 @@ public class PrintSettingsFragment extends SettingsPreferenceFragment
|
|||||||
|
|
||||||
private PrintJobsController mPrintJobsController;
|
private PrintJobsController mPrintJobsController;
|
||||||
private UserSpinnerAdapter mProfileSpinnerAdapter;
|
private UserSpinnerAdapter mProfileSpinnerAdapter;
|
||||||
|
private Spinner mSpinner;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle icicle) {
|
public void onCreate(Bundle icicle) {
|
||||||
@@ -184,11 +185,11 @@ public class PrintSettingsFragment extends SettingsPreferenceFragment
|
|||||||
final UserManager um = (UserManager) getSystemService(Context.USER_SERVICE);
|
final UserManager um = (UserManager) getSystemService(Context.USER_SERVICE);
|
||||||
mProfileSpinnerAdapter = Utils.createUserSpinnerAdapter(um, getActivity());
|
mProfileSpinnerAdapter = Utils.createUserSpinnerAdapter(um, getActivity());
|
||||||
if (mProfileSpinnerAdapter != null) {
|
if (mProfileSpinnerAdapter != null) {
|
||||||
Spinner spinner = (Spinner) getActivity().getLayoutInflater().inflate(
|
mSpinner = (Spinner) getActivity().getLayoutInflater().inflate(
|
||||||
R.layout.spinner_view, null);
|
R.layout.spinner_view, null);
|
||||||
spinner.setAdapter(mProfileSpinnerAdapter);
|
mSpinner.setAdapter(mProfileSpinnerAdapter);
|
||||||
spinner.setOnItemSelectedListener(this);
|
mSpinner.setOnItemSelectedListener(this);
|
||||||
setPinnedHeaderView(spinner);
|
setPinnedHeaderView(mSpinner);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -300,6 +301,8 @@ public class PrintSettingsFragment extends SettingsPreferenceFragment
|
|||||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||||
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
|
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
|
||||||
getActivity().startActivityAsUser(intent, selectedUser);
|
getActivity().startActivityAsUser(intent, selectedUser);
|
||||||
|
// Go back to default selection, which is the first one
|
||||||
|
mSpinner.setSelection(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user