Support highlightable Settings homepage menu for 2-pane
1. Add a preference group adapter to perform highlighting 2. Add a class for mapping highlighable menu keys and preference keys 3. Add an API to determine if the screen is in split mode Bug: 199017944 Test: manual, build Change-Id: I8e3fe5fb96480a31ee0f3b3afb6ad78999d3d2bc
This commit is contained in:
@@ -19,6 +19,7 @@ package com.android.settings.dashboard.profileselector;
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.DialogInterface.OnCancelListener;
|
||||
import android.content.DialogInterface.OnClickListener;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
@@ -44,19 +45,23 @@ public class ProfileSelectDialog extends DialogFragment implements OnClickListen
|
||||
|
||||
private int mSourceMetricCategory;
|
||||
private Tile mSelectedTile;
|
||||
private OnCancelListener mOnCancelListener;
|
||||
|
||||
/**
|
||||
* Display the profile select dialog, adding the fragment to the given FragmentManager.
|
||||
* @param manager The FragmentManager this fragment will be added to.
|
||||
* @param tile The tile for this fragment.
|
||||
* @param sourceMetricCategory The source metric category.
|
||||
* @param listener The listener listens to the dialog cancelling event.
|
||||
*/
|
||||
public static void show(FragmentManager manager, Tile tile, int sourceMetricCategory) {
|
||||
public static void show(FragmentManager manager, Tile tile, int sourceMetricCategory,
|
||||
OnCancelListener listener) {
|
||||
final ProfileSelectDialog dialog = new ProfileSelectDialog();
|
||||
final Bundle args = new Bundle();
|
||||
args.putParcelable(ARG_SELECTED_TILE, tile);
|
||||
args.putInt(ARG_SOURCE_METRIC_CATEGORY, sourceMetricCategory);
|
||||
dialog.setArguments(args);
|
||||
dialog.mOnCancelListener = listener;
|
||||
dialog.show(manager, "select_profile");
|
||||
}
|
||||
|
||||
@@ -91,6 +96,13 @@ public class ProfileSelectDialog extends DialogFragment implements OnClickListen
|
||||
getActivity().startActivityAsUser(intent, user);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCancel(DialogInterface dialog) {
|
||||
if (mOnCancelListener != null) {
|
||||
mOnCancelListener.onCancel(dialog);
|
||||
}
|
||||
}
|
||||
|
||||
public static void updateUserHandlesIfNeeded(Context context, Tile tile) {
|
||||
final List<UserHandle> userHandles = tile.userHandle;
|
||||
if (tile.userHandle == null || tile.userHandle.size() <= 1) {
|
||||
|
Reference in New Issue
Block a user