diff options
Diffstat (limited to 'java/com/android/incallui/incall')
4 files changed, 36 insertions, 10 deletions
diff --git a/java/com/android/incallui/incall/impl/InCallFragment.java b/java/com/android/incallui/incall/impl/InCallFragment.java index 7e39ceb40..f9abf2044 100644 --- a/java/com/android/incallui/incall/impl/InCallFragment.java +++ b/java/com/android/incallui/incall/impl/InCallFragment.java @@ -241,7 +241,7 @@ public class InCallFragment extends Fragment @Override public void setPrimary(@NonNull PrimaryInfo primaryInfo) { LogUtil.i("InCallFragment.setPrimary", primaryInfo.toString()); - setAdapterMedia(primaryInfo.multimediaData); + setAdapterMedia(primaryInfo.multimediaData, primaryInfo.showInCallButtonGrid); contactGridManager.setPrimary(primaryInfo); if (primaryInfo.shouldShowLocation) { @@ -267,9 +267,10 @@ public class InCallFragment extends Fragment } } - private void setAdapterMedia(MultimediaData multimediaData) { + private void setAdapterMedia(MultimediaData multimediaData, boolean showInCallButtonGrid) { if (adapter == null) { - adapter = new InCallPagerAdapter(getChildFragmentManager(), multimediaData); + adapter = + new InCallPagerAdapter(getChildFragmentManager(), multimediaData, showInCallButtonGrid); pager.setAdapter(adapter); } else { adapter.setAttachments(multimediaData); 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) { diff --git a/java/com/android/incallui/incall/protocol/PrimaryCallState.java b/java/com/android/incallui/incall/protocol/PrimaryCallState.java index 791f22ea7..1afa66a91 100644 --- a/java/com/android/incallui/incall/protocol/PrimaryCallState.java +++ b/java/com/android/incallui/incall/protocol/PrimaryCallState.java @@ -66,8 +66,12 @@ public class PrimaryCallState { // TODO: Convert to autovalue. b/34502119 public static PrimaryCallState createEmptyPrimaryCallState() { + return createEmptyPrimaryCallStateWithState(DialerCall.State.IDLE); + } + + public static PrimaryCallState createEmptyPrimaryCallStateWithState(int state) { return new PrimaryCallState( - DialerCall.State.IDLE, + state, false, /* isVideoCall */ SessionModificationState.NO_REQUEST, new DisconnectCause(DisconnectCause.UNKNOWN), diff --git a/java/com/android/incallui/incall/protocol/PrimaryInfo.java b/java/com/android/incallui/incall/protocol/PrimaryInfo.java index 761dd9a81..7fe0a0f6a 100644 --- a/java/com/android/incallui/incall/protocol/PrimaryInfo.java +++ b/java/com/android/incallui/incall/protocol/PrimaryInfo.java @@ -41,6 +41,7 @@ public class PrimaryInfo { // Used for consistent LetterTile coloring. @Nullable public final String contactInfoLookupKey; @Nullable public final MultimediaData multimediaData; + public final boolean showInCallButtonGrid; public final int numberPresentation; // TODO: Convert to autovalue. b/34502119 @@ -61,6 +62,7 @@ public class PrimaryInfo { false, null, null, + true, -1); } @@ -80,6 +82,7 @@ public class PrimaryInfo { boolean shouldShowLocation, @Nullable String contactInfoLookupKey, @Nullable MultimediaData multimediaData, + boolean showInCallButtonGrid, int numberPresentation) { this.number = number; this.name = name; @@ -96,6 +99,7 @@ public class PrimaryInfo { this.shouldShowLocation = shouldShowLocation; this.contactInfoLookupKey = contactInfoLookupKey; this.multimediaData = multimediaData; + this.showInCallButtonGrid = showInCallButtonGrid; this.numberPresentation = numberPresentation; } |