Revise homepage highlight mechanism
- Create TopLevelHighlightMixin to handle highlight actions and simplify TopLevelSettings - Fix the error highlight and the flicker after screen rotation - Postpone creating the fragment until it's needed to accelerate the initialization and to fix the search highlight function breakage after toggling light/dark mode - Register activity embedding rules only once for injection and wallpaper - Do not highlight Tips & support since it's full screen - Refactor ActivityEmbeddingRulesController Bug: 207316936 Test: manual, robotest build pass Change-Id: If322ec180b03ee123987c70779a25c6a570d9faf
This commit is contained in:
@@ -21,6 +21,8 @@ import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.DialogInterface.OnCancelListener;
|
||||
import android.content.DialogInterface.OnClickListener;
|
||||
import android.content.DialogInterface.OnDismissListener;
|
||||
import android.content.DialogInterface.OnShowListener;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.os.UserHandle;
|
||||
@@ -45,23 +47,30 @@ public class ProfileSelectDialog extends DialogFragment implements OnClickListen
|
||||
|
||||
private int mSourceMetricCategory;
|
||||
private Tile mSelectedTile;
|
||||
private OnShowListener mOnShowListener;
|
||||
private OnCancelListener mOnCancelListener;
|
||||
private OnDismissListener mOnDismissListener;
|
||||
|
||||
/**
|
||||
* 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.
|
||||
* @param onShowListener The listener listens to the dialog showing event.
|
||||
* @param onDismissListener The listener listens to the dialog dismissing event.
|
||||
* @param onCancelListener The listener listens to the dialog cancelling event.
|
||||
*/
|
||||
public static void show(FragmentManager manager, Tile tile, int sourceMetricCategory,
|
||||
OnCancelListener listener) {
|
||||
OnShowListener onShowListener, OnDismissListener onDismissListener,
|
||||
OnCancelListener onCancelListener) {
|
||||
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.mOnShowListener = onShowListener;
|
||||
dialog.mOnDismissListener = onDismissListener;
|
||||
dialog.mOnCancelListener = onCancelListener;
|
||||
dialog.show(manager, "select_profile");
|
||||
}
|
||||
|
||||
@@ -96,13 +105,31 @@ public class ProfileSelectDialog extends DialogFragment implements OnClickListen
|
||||
getActivity().startActivityAsUser(intent, user);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart() {
|
||||
super.onStart();
|
||||
// The fragment shows the dialog within onStart()
|
||||
if (mOnShowListener != null) {
|
||||
mOnShowListener.onShow(getDialog());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCancel(DialogInterface dialog) {
|
||||
super.onCancel(dialog);
|
||||
if (mOnCancelListener != null) {
|
||||
mOnCancelListener.onCancel(dialog);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDismiss(DialogInterface dialog) {
|
||||
super.onDismiss(dialog);
|
||||
if (mOnDismissListener != null) {
|
||||
mOnDismissListener.onDismiss(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