diff options
author | calderwoodra <calderwoodra@google.com> | 2017-08-22 17:14:49 -0700 |
---|---|---|
committer | Eric Erfanian <erfanian@google.com> | 2017-08-30 21:28:14 +0000 |
commit | e851821a851b9b97a846a1c8babca5c7e114fc88 (patch) | |
tree | 5b098f6a2586e1db0dd41a07536ca55537a1fb59 /java/com/android/incallui/incall/impl/InCallPagerAdapter.java | |
parent | cf531214d1c8a671d2097e31bb69cc8a9f54c8f6 (diff) |
Created FakeInCallActivity for making EC w/ images.
video (slow/3g): https://drive.google.com/open?id=0B2Hce9qilHmvMnZZbE90TTlNSTQ
video (average): https://drive.google.com/open?id=0B2Hce9qilHmvazZNeVJjbU5Db0k
video (cancelling): https://drive.google.com/open?id=0B2Hce9qilHmvRi1JUXQ3OHZOYXM
Future CLs or updates to this CL will include activity transition improvements
and testing.
Bug: 38189742
Test: CallComposerActivityIntegrationTest
PiperOrigin-RevId: 166137133
Change-Id: Iada3e96c83495fd9a1554b4556be968670513163
Diffstat (limited to 'java/com/android/incallui/incall/impl/InCallPagerAdapter.java')
-rw-r--r-- | java/com/android/incallui/incall/impl/InCallPagerAdapter.java | 29 |
1 files changed, 23 insertions, 6 deletions
diff --git a/java/com/android/incallui/incall/impl/InCallPagerAdapter.java b/java/com/android/incallui/incall/impl/InCallPagerAdapter.java index d4b04feff..ead35344f 100644 --- a/java/com/android/incallui/incall/impl/InCallPagerAdapter.java +++ b/java/com/android/incallui/incall/impl/InCallPagerAdapter.java @@ -21,6 +21,7 @@ import android.support.v4.app.Fragment; import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentStatePagerAdapter; import android.support.v4.view.PagerAdapter; +import com.android.dialer.common.Assert; import com.android.dialer.multimedia.MultimediaData; import com.android.incallui.sessiondata.MultimediaFragment; @@ -28,28 +29,44 @@ import com.android.incallui.sessiondata.MultimediaFragment; public class InCallPagerAdapter extends FragmentStatePagerAdapter { @Nullable private MultimediaData attachments; + private final boolean showInCallButtonGrid; - public InCallPagerAdapter(FragmentManager fragmentManager, @Nullable MultimediaData attachments) { + public InCallPagerAdapter( + FragmentManager fragmentManager, + @Nullable MultimediaData attachments, + boolean showInCallButtonGrid) { super(fragmentManager); this.attachments = attachments; + this.showInCallButtonGrid = showInCallButtonGrid; } @Override public Fragment getItem(int position) { - if (position == getButtonGridPosition()) { + if (!showInCallButtonGrid) { + // TODO(calderwoodra): handle fragment invalidation for when the data changes. + return MultimediaFragment.newInstance( + attachments, true /* isInteractive */, false /* showAvatar */, false /* isSpam */); + + } else if (position == getButtonGridPosition()) { return InCallButtonGridFragment.newInstance(); + } else { - // TODO(calderwoodra): handle fragment invalidation for when the data changes. - return MultimediaFragment.newInstance(attachments, true, false, false); + return MultimediaFragment.newInstance( + attachments, true /* isInteractive */, false /* showAvatar */, false /* isSpam */); } } @Override public int getCount() { + int count = 0; + if (showInCallButtonGrid) { + count++; + } if (attachments != null && attachments.hasData()) { - return 2; + count++; } - return 1; + Assert.checkArgument(count > 0, "InCallPager adapter doesn't have any pages."); + return count; } public void setAttachments(@Nullable MultimediaData attachments) { |