Loading core/java/com/android/internal/app/ChooserActivity.java +47 −9 Original line number Diff line number Diff line Loading @@ -2885,6 +2885,13 @@ public class ChooserActivity extends ResolverActivity implements return METRICS_CATEGORY_CHOOSER; } @Override protected void onProfileTabSelected() { ChooserGridAdapter currentRootAdapter = mChooserMultiProfilePagerAdapter.getCurrentRootAdapter(); currentRootAdapter.updateDirectShareExpansion(); } /** * Adapter for all types of items and targets in ShareSheet. * Note that ranked sections like Direct Share - while appearing grid-like - are handled on the Loading Loading @@ -3357,15 +3364,7 @@ public class ChooserActivity extends ResolverActivity implements } public void handleScroll(View v, int y, int oldy) { // Only expand direct share area if there is a minimum number of shortcuts, // which will help reduce the amount of visible shuffling due to older-style // direct share targets. int orientation = getResources().getConfiguration().orientation; boolean canExpandDirectShare = mChooserListAdapter.getNumShortcutResults() > getMaxTargetsPerRow() && orientation == Configuration.ORIENTATION_PORTRAIT && !isInMultiWindowMode(); boolean canExpandDirectShare = canExpandDirectShare(); if (mDirectShareViewHolder != null && canExpandDirectShare) { mDirectShareViewHolder.handleScroll( mChooserMultiProfilePagerAdapter.getActiveAdapterView(), y, oldy, Loading @@ -3373,6 +3372,18 @@ public class ChooserActivity extends ResolverActivity implements } } /** * Only expand direct share area if there is a minimum number of shortcuts, * which will help reduce the amount of visible shuffling due to older-style * direct share targets. */ private boolean canExpandDirectShare() { int orientation = getResources().getConfiguration().orientation; return mChooserListAdapter.getNumShortcutResults() > getMaxTargetsPerRow() && orientation == Configuration.ORIENTATION_PORTRAIT && !isInMultiWindowMode(); } public ChooserListAdapter getListAdapter() { return mChooserListAdapter; } Loading @@ -3380,6 +3391,19 @@ public class ChooserActivity extends ResolverActivity implements boolean shouldCellSpan(int position) { return getItemViewType(position) == VIEW_TYPE_NORMAL; } void updateDirectShareExpansion() { if (mDirectShareViewHolder == null || !canExpandDirectShare()) { return; } RecyclerView activeAdapterView = mChooserMultiProfilePagerAdapter.getActiveAdapterView(); if (mResolverDrawerLayout.isCollapsed()) { mDirectShareViewHolder.collapse(activeAdapterView); } else { mDirectShareViewHolder.expand(activeAdapterView); } } } /** Loading Loading @@ -3577,6 +3601,20 @@ public class ChooserActivity extends ResolverActivity implements newHeight = Math.max(newHeight, mDirectShareMinHeight); yDiff = newHeight - prevHeight; updateDirectShareRowHeight(view, yDiff, newHeight); } void expand(RecyclerView view) { updateDirectShareRowHeight(view, mDirectShareMaxHeight - mDirectShareCurrHeight, mDirectShareMaxHeight); } void collapse(RecyclerView view) { updateDirectShareRowHeight(view, mDirectShareMinHeight - mDirectShareCurrHeight, mDirectShareMinHeight); } private void updateDirectShareRowHeight(RecyclerView view, int yDiff, int newHeight) { if (view == null || view.getChildCount() == 0 || yDiff == 0) { return; } Loading core/java/com/android/internal/app/ResolverActivity.java +7 −0 Original line number Diff line number Diff line Loading @@ -1622,6 +1622,7 @@ public class ResolverActivity extends Activity implements } setupViewVisibilities(); maybeLogProfileChange(); onProfileTabSelected(); DevicePolicyEventLogger .createEvent(DevicePolicyEnums.RESOLVER_SWITCH_TABS) .setInt(viewPager.getCurrentItem()) Loading @@ -1640,6 +1641,12 @@ public class ResolverActivity extends Activity implements findViewById(R.id.resolver_tab_divider).setVisibility(View.VISIBLE); } /** * Callback called when user changes the profile tab. * <p>This method is intended to be overridden by subclasses. */ protected void onProfileTabSelected() { } private void resetCheckedItem() { if (!isIntentPicker()) { return; Loading Loading
core/java/com/android/internal/app/ChooserActivity.java +47 −9 Original line number Diff line number Diff line Loading @@ -2885,6 +2885,13 @@ public class ChooserActivity extends ResolverActivity implements return METRICS_CATEGORY_CHOOSER; } @Override protected void onProfileTabSelected() { ChooserGridAdapter currentRootAdapter = mChooserMultiProfilePagerAdapter.getCurrentRootAdapter(); currentRootAdapter.updateDirectShareExpansion(); } /** * Adapter for all types of items and targets in ShareSheet. * Note that ranked sections like Direct Share - while appearing grid-like - are handled on the Loading Loading @@ -3357,15 +3364,7 @@ public class ChooserActivity extends ResolverActivity implements } public void handleScroll(View v, int y, int oldy) { // Only expand direct share area if there is a minimum number of shortcuts, // which will help reduce the amount of visible shuffling due to older-style // direct share targets. int orientation = getResources().getConfiguration().orientation; boolean canExpandDirectShare = mChooserListAdapter.getNumShortcutResults() > getMaxTargetsPerRow() && orientation == Configuration.ORIENTATION_PORTRAIT && !isInMultiWindowMode(); boolean canExpandDirectShare = canExpandDirectShare(); if (mDirectShareViewHolder != null && canExpandDirectShare) { mDirectShareViewHolder.handleScroll( mChooserMultiProfilePagerAdapter.getActiveAdapterView(), y, oldy, Loading @@ -3373,6 +3372,18 @@ public class ChooserActivity extends ResolverActivity implements } } /** * Only expand direct share area if there is a minimum number of shortcuts, * which will help reduce the amount of visible shuffling due to older-style * direct share targets. */ private boolean canExpandDirectShare() { int orientation = getResources().getConfiguration().orientation; return mChooserListAdapter.getNumShortcutResults() > getMaxTargetsPerRow() && orientation == Configuration.ORIENTATION_PORTRAIT && !isInMultiWindowMode(); } public ChooserListAdapter getListAdapter() { return mChooserListAdapter; } Loading @@ -3380,6 +3391,19 @@ public class ChooserActivity extends ResolverActivity implements boolean shouldCellSpan(int position) { return getItemViewType(position) == VIEW_TYPE_NORMAL; } void updateDirectShareExpansion() { if (mDirectShareViewHolder == null || !canExpandDirectShare()) { return; } RecyclerView activeAdapterView = mChooserMultiProfilePagerAdapter.getActiveAdapterView(); if (mResolverDrawerLayout.isCollapsed()) { mDirectShareViewHolder.collapse(activeAdapterView); } else { mDirectShareViewHolder.expand(activeAdapterView); } } } /** Loading Loading @@ -3577,6 +3601,20 @@ public class ChooserActivity extends ResolverActivity implements newHeight = Math.max(newHeight, mDirectShareMinHeight); yDiff = newHeight - prevHeight; updateDirectShareRowHeight(view, yDiff, newHeight); } void expand(RecyclerView view) { updateDirectShareRowHeight(view, mDirectShareMaxHeight - mDirectShareCurrHeight, mDirectShareMaxHeight); } void collapse(RecyclerView view) { updateDirectShareRowHeight(view, mDirectShareMinHeight - mDirectShareCurrHeight, mDirectShareMinHeight); } private void updateDirectShareRowHeight(RecyclerView view, int yDiff, int newHeight) { if (view == null || view.getChildCount() == 0 || yDiff == 0) { return; } Loading
core/java/com/android/internal/app/ResolverActivity.java +7 −0 Original line number Diff line number Diff line Loading @@ -1622,6 +1622,7 @@ public class ResolverActivity extends Activity implements } setupViewVisibilities(); maybeLogProfileChange(); onProfileTabSelected(); DevicePolicyEventLogger .createEvent(DevicePolicyEnums.RESOLVER_SWITCH_TABS) .setInt(viewPager.getCurrentItem()) Loading @@ -1640,6 +1641,12 @@ public class ResolverActivity extends Activity implements findViewById(R.id.resolver_tab_divider).setVisibility(View.VISIBLE); } /** * Callback called when user changes the profile tab. * <p>This method is intended to be overridden by subclasses. */ protected void onProfileTabSelected() { } private void resetCheckedItem() { if (!isIntentPicker()) { return; Loading