Update logic to check two pane resolution
Prior to this cl, we checked the app bounds for deciding app in two pane or not. However, this might be broken in some certain sceanrios. Currently, api will check the entire task bounds. If the width of task bounds is larger than two pane criteria, then we treat it as in two pane mode. Test: Highlighted behavior works correct. Fix: 203763572 Change-Id: Ib14851b1e3e097328874c7956bb653f50820f877
This commit is contained in:
@@ -16,6 +16,7 @@
|
||||
|
||||
package com.android.settings.widget;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.text.TextUtils;
|
||||
@@ -53,6 +54,7 @@ public class HighlightableTopLevelPreferenceAdapter extends PreferenceGroupAdapt
|
||||
final int mIconColorHighlight;
|
||||
|
||||
private final Context mContext;
|
||||
private final Activity mActivity;
|
||||
private final RecyclerView mRecyclerView;
|
||||
private final int mNormalBackgroundRes;
|
||||
private String mHighlightKey;
|
||||
@@ -61,12 +63,13 @@ public class HighlightableTopLevelPreferenceAdapter extends PreferenceGroupAdapt
|
||||
private boolean mHighlightNeeded;
|
||||
private boolean mScrolled;
|
||||
|
||||
public HighlightableTopLevelPreferenceAdapter(PreferenceGroup preferenceGroup,
|
||||
RecyclerView recyclerView, String key) {
|
||||
public HighlightableTopLevelPreferenceAdapter(Activity activity,
|
||||
PreferenceGroup preferenceGroup, RecyclerView recyclerView, String key) {
|
||||
super(preferenceGroup);
|
||||
mRecyclerView = recyclerView;
|
||||
mHighlightKey = key;
|
||||
mContext = preferenceGroup.getContext();
|
||||
mActivity = activity;
|
||||
final TypedValue outValue = new TypedValue();
|
||||
mContext.getTheme().resolveAttribute(android.R.attr.selectableItemBackground,
|
||||
outValue, true /* resolveRefs */);
|
||||
@@ -233,6 +236,6 @@ public class HighlightableTopLevelPreferenceAdapter extends PreferenceGroupAdapt
|
||||
}
|
||||
|
||||
private boolean isHighlightNeeded() {
|
||||
return ActivityEmbeddingUtils.isTwoPaneResolution(mContext);
|
||||
return ActivityEmbeddingUtils.isTwoPaneResolution(mActivity);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user