Merge "ChooserActivity direct share jank fixes" into nyc-dev

This commit is contained in:
Adam Powell
2016-02-12 21:14:37 +00:00
committed by Android (Google) Code Review

View File

@@ -129,6 +129,7 @@ public class ChooserActivity extends ResolverActivity {
if (mServiceConnections.isEmpty()) {
mChooserHandler.removeMessages(CHOOSER_TARGET_SERVICE_WATCHDOG_TIMEOUT);
sendVoiceChoicesIfNeeded();
mChooserListAdapter.setShowServiceTargets(true);
}
break;
@@ -138,6 +139,7 @@ public class ChooserActivity extends ResolverActivity {
}
unbindRemainingServices();
sendVoiceChoicesIfNeeded();
mChooserListAdapter.setShowServiceTargets(true);
break;
default:
@@ -766,6 +768,7 @@ public class ChooserActivity extends ResolverActivity {
private final List<ChooserTargetInfo> mServiceTargets = new ArrayList<>();
private final List<TargetInfo> mCallerTargets = new ArrayList<>();
private boolean mShowServiceTargets;
private float mLateFee = 1.f;
@@ -866,6 +869,9 @@ public class ChooserActivity extends ResolverActivity {
}
public int getServiceTargetCount() {
if (!mShowServiceTargets) {
return 0;
}
return Math.min(mServiceTargets.size(), MAX_SERVICE_TARGETS);
}
@@ -955,6 +961,14 @@ public class ChooserActivity extends ResolverActivity {
notifyDataSetChanged();
}
/**
* Set to true to reveal all service targets at once.
*/
public void setShowServiceTargets(boolean show) {
mShowServiceTargets = show;
notifyDataSetChanged();
}
private void insertServiceTarget(ChooserTargetInfo chooserTargetInfo) {
final float newScore = chooserTargetInfo.getModifiedScore();
for (int i = 0, N = mServiceTargets.size(); i < N; i++) {