Loading core/java/com/android/internal/app/ChooserActivity.java +33 −8 Original line number Diff line number Diff line Loading @@ -200,7 +200,6 @@ public class ChooserActivity extends ResolverActivity { private ChooserListAdapter mChooserListAdapter; private ChooserRowAdapter mChooserRowAdapter; private Drawable mChooserRowLayer; private int mChooserRowServiceSpacing; /** {@link ChooserActivity#getBaseScore} */ Loading Loading @@ -468,7 +467,6 @@ public class ChooserActivity extends ResolverActivity { .registerPredictionUpdates(this.getMainExecutor(), mAppPredictorCallback); } mChooserRowLayer = getResources().getDrawable(R.drawable.chooser_row_layer_list, null); mChooserRowServiceSpacing = getResources() .getDimensionPixelSize(R.dimen.chooser_service_spacing); Loading Loading @@ -1952,6 +1950,7 @@ public class ChooserActivity extends ResolverActivity { int offset = 0; int rowsToShow = mChooserRowAdapter.getContentPreviewRowCount() + mChooserRowAdapter.getProfileRowCount() + mChooserRowAdapter.getServiceTargetRowCount() + mChooserRowAdapter.getCallerAndRankedTargetRowCount(); Loading @@ -1971,7 +1970,7 @@ public class ChooserActivity extends ResolverActivity { } int lastHeight = 0; rowsToShow = Math.max(3, rowsToShow); rowsToShow = Math.min(4, rowsToShow); for (int i = 0; i < Math.min(rowsToShow, mAdapterView.getChildCount()); i++) { lastHeight = mAdapterView.getChildAt(i).getHeight(); offset += lastHeight; Loading Loading @@ -2447,6 +2446,7 @@ public class ChooserActivity extends ResolverActivity { private static final int VIEW_TYPE_DIRECT_SHARE = 0; private static final int VIEW_TYPE_NORMAL = 1; private static final int VIEW_TYPE_CONTENT_PREVIEW = 2; private static final int VIEW_TYPE_PROFILE = 3; private static final int MAX_TARGETS_PER_ROW_PORTRAIT = 4; private static final int MAX_TARGETS_PER_ROW_LANDSCAPE = 8; Loading Loading @@ -2502,9 +2502,9 @@ public class ChooserActivity extends ResolverActivity { @Override public int getCount() { return (int) ( getContentPreviewRowCount() + getProfileRowCount() + getServiceTargetRowCount() + getCallerAndRankedTargetRowCount() + Math.ceil( Loading @@ -2525,6 +2525,10 @@ public class ChooserActivity extends ResolverActivity { return 1; } public int getProfileRowCount() { return mChooserListAdapter.getOtherProfile() == null ? 0 : 1; } public int getCallerAndRankedTargetRowCount() { return (int) Math.ceil( ((float) mChooserListAdapter.getCallerTargetCount() Loading Loading @@ -2560,6 +2564,10 @@ public class ChooserActivity extends ResolverActivity { return createContentPreviewView(convertView, parent); } if (viewType == VIEW_TYPE_PROFILE) { return createProfileView(convertView, parent); } if (convertView == null) { holder = createViewHolder(viewType, parent); } else { Loading @@ -2577,6 +2585,10 @@ public class ChooserActivity extends ResolverActivity { return VIEW_TYPE_CONTENT_PREVIEW; } if (getProfileRowCount() == 1 && position == getContentPreviewRowCount()) { return VIEW_TYPE_PROFILE; } final int start = getFirstRowPosition(position); final int startType = mChooserListAdapter.getPositionTargetType(start); Loading @@ -2589,7 +2601,7 @@ public class ChooserActivity extends ResolverActivity { @Override public int getViewTypeCount() { return 3; return 4; } private ViewGroup createContentPreviewView(View convertView, ViewGroup parent) { Loading @@ -2605,6 +2617,17 @@ public class ChooserActivity extends ResolverActivity { (ViewGroup) convertView, parent); } private View createProfileView(View convertView, ViewGroup parent) { View profileRow = convertView != null ? convertView : mLayoutInflater.inflate( R.layout.chooser_profile_row, parent, false); profileRow.setBackground( getResources().getDrawable(R.drawable.chooser_row_layer_list, null)); mProfileView = profileRow.findViewById(R.id.profile_button); mProfileView.setOnClickListener(ChooserActivity.this::onProfileClick); bindProfileView(); return profileRow; } private RowViewHolder loadViewsIntoRow(RowViewHolder holder) { final int spec = MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED); final int exactSpec = MeasureSpec.makeMeasureSpec(mChooserTargetWidth, Loading Loading @@ -2723,8 +2746,10 @@ public class ChooserActivity extends ResolverActivity { final ViewGroup row = holder.getViewGroup(); if (startType != lastStartType || rowPosition == getContentPreviewRowCount()) { row.setBackground(mChooserRowLayer); if (startType != lastStartType || rowPosition == getContentPreviewRowCount() + getProfileRowCount()) { row.setBackground( getResources().getDrawable(R.drawable.chooser_row_layer_list, null)); } else { row.setBackground(null); } Loading Loading @@ -2774,7 +2799,7 @@ public class ChooserActivity extends ResolverActivity { } int getFirstRowPosition(int row) { row -= getContentPreviewRowCount(); row -= getContentPreviewRowCount() + getProfileRowCount(); final int serviceCount = mChooserListAdapter.getServiceTargetCount(); final int serviceRows = (int) Math.ceil((float) serviceCount Loading core/java/com/android/internal/app/ResolverActivity.java +24 −27 Original line number Diff line number Diff line Loading @@ -108,7 +108,7 @@ public class ResolverActivity extends Activity { private Button mAlwaysButton; private Button mOnceButton; private Button mSettingsButton; private View mProfileView; protected View mProfileView; private int mIconDpi; private int mLastSelected = AbsListView.INVALID_POSITION; private boolean mResolvingHome = false; Loading Loading @@ -142,10 +142,8 @@ public class ResolverActivity extends Activity { private final PackageMonitor mPackageMonitor = new PackageMonitor() { @Override public void onSomePackagesChanged() { mAdapter.handlePackagesChanged(); if (mProfileView != null) { bindProfileView(); } } @Override public boolean onPackageChanged(String packageName, int uid, String[] components) { Loading Loading @@ -336,21 +334,7 @@ public class ResolverActivity extends Activity { mProfileView = findViewById(R.id.profile_button); if (mProfileView != null) { mProfileView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { final DisplayResolveInfo dri = mAdapter.getOtherProfile(); if (dri == null) { return; } // Do not show the profile switch message anymore. mProfileSwitchMessageId = -1; onTargetSelected(dri, false); finish(); } }); mProfileView.setOnClickListener(this::onProfileClick); bindProfileView(); } Loading @@ -367,6 +351,19 @@ public class ResolverActivity extends Activity { + (categories != null ? Arrays.toString(categories.toArray()) : "")); } protected void onProfileClick(View v) { final DisplayResolveInfo dri = mAdapter.getOtherProfile(); if (dri == null) { return; } // Do not show the profile switch message anymore. mProfileSwitchMessageId = -1; onTargetSelected(dri, false); finish(); } @Override public void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); Loading Loading @@ -445,7 +442,11 @@ public class ResolverActivity extends Activity { return R.layout.resolver_list; } void bindProfileView() { protected void bindProfileView() { if (mProfileView == null) { return; } final DisplayResolveInfo dri = mAdapter.getOtherProfile(); if (dri != null) { mProfileView.setVisibility(View.VISIBLE); Loading Loading @@ -709,10 +710,8 @@ public class ResolverActivity extends Activity { mRegistered = true; } mAdapter.handlePackagesChanged(); if (mProfileView != null) { bindProfileView(); } } @Override protected void onStop() { Loading Loading @@ -1737,9 +1736,7 @@ public class ResolverActivity extends Activity { @Override protected void onPostExecute(List<ResolvedComponentInfo> sortedComponents) { processSortedList(sortedComponents); if (mProfileView != null) { bindProfileView(); } notifyDataSetChanged(); } }; Loading Loading @@ -2148,7 +2145,7 @@ public class ResolverActivity extends Activity { @Override protected void onPostExecute(Drawable d) { if (mProfileView != null && mAdapter.getOtherProfile() == mDisplayResolveInfo) { if (mAdapter.getOtherProfile() == mDisplayResolveInfo) { bindProfileView(); } else { mDisplayResolveInfo.setDisplayIcon(d); Loading core/res/res/layout/chooser_grid.xml +1 −16 Original line number Diff line number Diff line Loading @@ -41,21 +41,6 @@ android:layout_centerHorizontal="true" android:layout_alignParentTop="true" /> <TextView android:id="@+id/profile_button" android:layout_width="wrap_content" android:layout_height="48dp" android:layout_marginEnd="8dp" android:paddingStart="8dp" android:paddingEnd="8dp" android:visibility="gone" style="?attr/borderlessButtonStyle" android:textAppearance="?attr/textAppearanceButton" android:textColor="?attr/colorAccent" android:gravity="center_vertical" android:layout_below="@id/drag" android:layout_alignParentRight="true" android:singleLine="true"/> <TextView android:id="@+id/title" android:layout_height="wrap_content" android:layout_width="wrap_content" Loading @@ -67,7 +52,7 @@ android:paddingBottom="@dimen/chooser_view_spacing" android:paddingLeft="24dp" android:paddingRight="24dp" android:layout_below="@id/profile_button" android:layout_below="@id/drag" android:layout_centerHorizontal="true"/> </RelativeLayout> Loading core/res/res/layout/chooser_profile_row.xml 0 → 100644 +32 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- /* ** Copyright 2019, The Android Open Source Project ** ** Licensed under the Apache License, Version 2.0 (the "License"); ** you may not use this file except in compliance with the License. ** You may obtain a copy of the License at ** ** http://www.apache.org/licenses/LICENSE-2.0 ** ** Unless required by applicable law or agreed to in writing, software ** distributed under the License is distributed on an "AS IS" BASIS, ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ** See the License for the specific language governing permissions and ** limitations under the License. */ --> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="wrap_content" android:gravity="center"> <TextView android:id="@+id/profile_button" android:layout_width="wrap_content" android:layout_height="48dp" style="?attr/borderlessButtonStyle" android:textAppearance="?attr/textAppearanceButton" android:textColor="?attr/colorAccent" android:singleLine="true"/> </LinearLayout> core/res/res/values/symbols.xml +1 −0 Original line number Diff line number Diff line Loading @@ -2794,6 +2794,7 @@ <java-symbol type="drawable" name="scroll_indicator_material" /> <java-symbol type="layout" name="chooser_row" /> <java-symbol type="layout" name="chooser_profile_row" /> <java-symbol type="color" name="chooser_row_divider" /> <java-symbol type="layout" name="chooser_row_direct_share" /> <java-symbol type="bool" name="config_supportDoubleTapWake" /> Loading Loading
core/java/com/android/internal/app/ChooserActivity.java +33 −8 Original line number Diff line number Diff line Loading @@ -200,7 +200,6 @@ public class ChooserActivity extends ResolverActivity { private ChooserListAdapter mChooserListAdapter; private ChooserRowAdapter mChooserRowAdapter; private Drawable mChooserRowLayer; private int mChooserRowServiceSpacing; /** {@link ChooserActivity#getBaseScore} */ Loading Loading @@ -468,7 +467,6 @@ public class ChooserActivity extends ResolverActivity { .registerPredictionUpdates(this.getMainExecutor(), mAppPredictorCallback); } mChooserRowLayer = getResources().getDrawable(R.drawable.chooser_row_layer_list, null); mChooserRowServiceSpacing = getResources() .getDimensionPixelSize(R.dimen.chooser_service_spacing); Loading Loading @@ -1952,6 +1950,7 @@ public class ChooserActivity extends ResolverActivity { int offset = 0; int rowsToShow = mChooserRowAdapter.getContentPreviewRowCount() + mChooserRowAdapter.getProfileRowCount() + mChooserRowAdapter.getServiceTargetRowCount() + mChooserRowAdapter.getCallerAndRankedTargetRowCount(); Loading @@ -1971,7 +1970,7 @@ public class ChooserActivity extends ResolverActivity { } int lastHeight = 0; rowsToShow = Math.max(3, rowsToShow); rowsToShow = Math.min(4, rowsToShow); for (int i = 0; i < Math.min(rowsToShow, mAdapterView.getChildCount()); i++) { lastHeight = mAdapterView.getChildAt(i).getHeight(); offset += lastHeight; Loading Loading @@ -2447,6 +2446,7 @@ public class ChooserActivity extends ResolverActivity { private static final int VIEW_TYPE_DIRECT_SHARE = 0; private static final int VIEW_TYPE_NORMAL = 1; private static final int VIEW_TYPE_CONTENT_PREVIEW = 2; private static final int VIEW_TYPE_PROFILE = 3; private static final int MAX_TARGETS_PER_ROW_PORTRAIT = 4; private static final int MAX_TARGETS_PER_ROW_LANDSCAPE = 8; Loading Loading @@ -2502,9 +2502,9 @@ public class ChooserActivity extends ResolverActivity { @Override public int getCount() { return (int) ( getContentPreviewRowCount() + getProfileRowCount() + getServiceTargetRowCount() + getCallerAndRankedTargetRowCount() + Math.ceil( Loading @@ -2525,6 +2525,10 @@ public class ChooserActivity extends ResolverActivity { return 1; } public int getProfileRowCount() { return mChooserListAdapter.getOtherProfile() == null ? 0 : 1; } public int getCallerAndRankedTargetRowCount() { return (int) Math.ceil( ((float) mChooserListAdapter.getCallerTargetCount() Loading Loading @@ -2560,6 +2564,10 @@ public class ChooserActivity extends ResolverActivity { return createContentPreviewView(convertView, parent); } if (viewType == VIEW_TYPE_PROFILE) { return createProfileView(convertView, parent); } if (convertView == null) { holder = createViewHolder(viewType, parent); } else { Loading @@ -2577,6 +2585,10 @@ public class ChooserActivity extends ResolverActivity { return VIEW_TYPE_CONTENT_PREVIEW; } if (getProfileRowCount() == 1 && position == getContentPreviewRowCount()) { return VIEW_TYPE_PROFILE; } final int start = getFirstRowPosition(position); final int startType = mChooserListAdapter.getPositionTargetType(start); Loading @@ -2589,7 +2601,7 @@ public class ChooserActivity extends ResolverActivity { @Override public int getViewTypeCount() { return 3; return 4; } private ViewGroup createContentPreviewView(View convertView, ViewGroup parent) { Loading @@ -2605,6 +2617,17 @@ public class ChooserActivity extends ResolverActivity { (ViewGroup) convertView, parent); } private View createProfileView(View convertView, ViewGroup parent) { View profileRow = convertView != null ? convertView : mLayoutInflater.inflate( R.layout.chooser_profile_row, parent, false); profileRow.setBackground( getResources().getDrawable(R.drawable.chooser_row_layer_list, null)); mProfileView = profileRow.findViewById(R.id.profile_button); mProfileView.setOnClickListener(ChooserActivity.this::onProfileClick); bindProfileView(); return profileRow; } private RowViewHolder loadViewsIntoRow(RowViewHolder holder) { final int spec = MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED); final int exactSpec = MeasureSpec.makeMeasureSpec(mChooserTargetWidth, Loading Loading @@ -2723,8 +2746,10 @@ public class ChooserActivity extends ResolverActivity { final ViewGroup row = holder.getViewGroup(); if (startType != lastStartType || rowPosition == getContentPreviewRowCount()) { row.setBackground(mChooserRowLayer); if (startType != lastStartType || rowPosition == getContentPreviewRowCount() + getProfileRowCount()) { row.setBackground( getResources().getDrawable(R.drawable.chooser_row_layer_list, null)); } else { row.setBackground(null); } Loading Loading @@ -2774,7 +2799,7 @@ public class ChooserActivity extends ResolverActivity { } int getFirstRowPosition(int row) { row -= getContentPreviewRowCount(); row -= getContentPreviewRowCount() + getProfileRowCount(); final int serviceCount = mChooserListAdapter.getServiceTargetCount(); final int serviceRows = (int) Math.ceil((float) serviceCount Loading
core/java/com/android/internal/app/ResolverActivity.java +24 −27 Original line number Diff line number Diff line Loading @@ -108,7 +108,7 @@ public class ResolverActivity extends Activity { private Button mAlwaysButton; private Button mOnceButton; private Button mSettingsButton; private View mProfileView; protected View mProfileView; private int mIconDpi; private int mLastSelected = AbsListView.INVALID_POSITION; private boolean mResolvingHome = false; Loading Loading @@ -142,10 +142,8 @@ public class ResolverActivity extends Activity { private final PackageMonitor mPackageMonitor = new PackageMonitor() { @Override public void onSomePackagesChanged() { mAdapter.handlePackagesChanged(); if (mProfileView != null) { bindProfileView(); } } @Override public boolean onPackageChanged(String packageName, int uid, String[] components) { Loading Loading @@ -336,21 +334,7 @@ public class ResolverActivity extends Activity { mProfileView = findViewById(R.id.profile_button); if (mProfileView != null) { mProfileView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { final DisplayResolveInfo dri = mAdapter.getOtherProfile(); if (dri == null) { return; } // Do not show the profile switch message anymore. mProfileSwitchMessageId = -1; onTargetSelected(dri, false); finish(); } }); mProfileView.setOnClickListener(this::onProfileClick); bindProfileView(); } Loading @@ -367,6 +351,19 @@ public class ResolverActivity extends Activity { + (categories != null ? Arrays.toString(categories.toArray()) : "")); } protected void onProfileClick(View v) { final DisplayResolveInfo dri = mAdapter.getOtherProfile(); if (dri == null) { return; } // Do not show the profile switch message anymore. mProfileSwitchMessageId = -1; onTargetSelected(dri, false); finish(); } @Override public void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); Loading Loading @@ -445,7 +442,11 @@ public class ResolverActivity extends Activity { return R.layout.resolver_list; } void bindProfileView() { protected void bindProfileView() { if (mProfileView == null) { return; } final DisplayResolveInfo dri = mAdapter.getOtherProfile(); if (dri != null) { mProfileView.setVisibility(View.VISIBLE); Loading Loading @@ -709,10 +710,8 @@ public class ResolverActivity extends Activity { mRegistered = true; } mAdapter.handlePackagesChanged(); if (mProfileView != null) { bindProfileView(); } } @Override protected void onStop() { Loading Loading @@ -1737,9 +1736,7 @@ public class ResolverActivity extends Activity { @Override protected void onPostExecute(List<ResolvedComponentInfo> sortedComponents) { processSortedList(sortedComponents); if (mProfileView != null) { bindProfileView(); } notifyDataSetChanged(); } }; Loading Loading @@ -2148,7 +2145,7 @@ public class ResolverActivity extends Activity { @Override protected void onPostExecute(Drawable d) { if (mProfileView != null && mAdapter.getOtherProfile() == mDisplayResolveInfo) { if (mAdapter.getOtherProfile() == mDisplayResolveInfo) { bindProfileView(); } else { mDisplayResolveInfo.setDisplayIcon(d); Loading
core/res/res/layout/chooser_grid.xml +1 −16 Original line number Diff line number Diff line Loading @@ -41,21 +41,6 @@ android:layout_centerHorizontal="true" android:layout_alignParentTop="true" /> <TextView android:id="@+id/profile_button" android:layout_width="wrap_content" android:layout_height="48dp" android:layout_marginEnd="8dp" android:paddingStart="8dp" android:paddingEnd="8dp" android:visibility="gone" style="?attr/borderlessButtonStyle" android:textAppearance="?attr/textAppearanceButton" android:textColor="?attr/colorAccent" android:gravity="center_vertical" android:layout_below="@id/drag" android:layout_alignParentRight="true" android:singleLine="true"/> <TextView android:id="@+id/title" android:layout_height="wrap_content" android:layout_width="wrap_content" Loading @@ -67,7 +52,7 @@ android:paddingBottom="@dimen/chooser_view_spacing" android:paddingLeft="24dp" android:paddingRight="24dp" android:layout_below="@id/profile_button" android:layout_below="@id/drag" android:layout_centerHorizontal="true"/> </RelativeLayout> Loading
core/res/res/layout/chooser_profile_row.xml 0 → 100644 +32 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- /* ** Copyright 2019, The Android Open Source Project ** ** Licensed under the Apache License, Version 2.0 (the "License"); ** you may not use this file except in compliance with the License. ** You may obtain a copy of the License at ** ** http://www.apache.org/licenses/LICENSE-2.0 ** ** Unless required by applicable law or agreed to in writing, software ** distributed under the License is distributed on an "AS IS" BASIS, ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ** See the License for the specific language governing permissions and ** limitations under the License. */ --> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="wrap_content" android:gravity="center"> <TextView android:id="@+id/profile_button" android:layout_width="wrap_content" android:layout_height="48dp" style="?attr/borderlessButtonStyle" android:textAppearance="?attr/textAppearanceButton" android:textColor="?attr/colorAccent" android:singleLine="true"/> </LinearLayout>
core/res/res/values/symbols.xml +1 −0 Original line number Diff line number Diff line Loading @@ -2794,6 +2794,7 @@ <java-symbol type="drawable" name="scroll_indicator_material" /> <java-symbol type="layout" name="chooser_row" /> <java-symbol type="layout" name="chooser_profile_row" /> <java-symbol type="color" name="chooser_row_divider" /> <java-symbol type="layout" name="chooser_row_direct_share" /> <java-symbol type="bool" name="config_supportDoubleTapWake" /> Loading