Merge "Sharesheet - 4->8 direct share expansion fix" into qt-dev

am: 43e9ec2354

Change-Id: I1fb4fb1cd87eb15a0e20703bd54bdbd4a5b082ee
This commit is contained in:
Matt Pietal
2019-04-11 08:48:05 -07:00
committed by android-build-merger

View File

@@ -2545,8 +2545,8 @@ public class ChooserActivity extends ResolverActivity {
if (isDirectShare) {
DirectShareViewHolder dsvh = (DirectShareViewHolder) holder;
setViewHeight(dsvh.getRow(0), holder.getMeasuredRowHeight());
setViewHeight(dsvh.getRow(1), holder.getMeasuredRowHeight());
setViewHeight(dsvh.getRow(0), dsvh.getMinRowHeight());
setViewHeight(dsvh.getRow(1), dsvh.getMinRowHeight());
}
viewGroup.setTag(holder);
@@ -2828,6 +2828,10 @@ public class ChooserActivity extends ResolverActivity {
return mDirectShareCurrHeight;
}
public int getMinRowHeight() {
return mDirectShareMinHeight;
}
public void setViewVisibility(int i, int visibility) {
final View v = getView(i);
if (visibility == View.VISIBLE) {
@@ -2850,15 +2854,20 @@ public class ChooserActivity extends ResolverActivity {
}
public void handleScroll(AbsListView view, int y, int oldy, int maxTargetsPerRow) {
if (mHideDirectShareExpansion) {
return;
}
// only exit early if fully collapsed, otherwise onListRebuilt() with shifting
// targets can lock us into an expanded mode
boolean notExpanded = mDirectShareCurrHeight == mDirectShareMinHeight;
if (notExpanded) {
if (mHideDirectShareExpansion) {
return;
}
// only expand if we have more than maxTargetsPerRow, and delay that decision
// until they start to scroll
if (mChooserListAdapter.getSelectableServiceTargetCount() <= maxTargetsPerRow) {
mHideDirectShareExpansion = true;
return;
// only expand if we have more than maxTargetsPerRow, and delay that decision
// until they start to scroll
if (mChooserListAdapter.getSelectableServiceTargetCount() <= maxTargetsPerRow) {
mHideDirectShareExpansion = true;
return;
}
}
int yDiff = (int) ((oldy - y) * DIRECT_SHARE_EXPANSION_RATE);