Loading java/com/android/incallui/CallCardPresenter.java +6 −1 Original line number Diff line number Diff line Loading @@ -36,6 +36,8 @@ import android.support.v4.content.ContextCompat; import android.telecom.Call.Details; import android.telecom.StatusHints; import android.telecom.TelecomManager; import android.text.BidiFormatter; import android.text.TextDirectionHeuristics; import android.text.TextUtils; import android.view.Display; import android.view.View; Loading Loading @@ -987,7 +989,10 @@ public class CallCardPresenter ContactDisplayUtils.getPreferredDisplayName( contactInfo.namePrimary, contactInfo.nameAlternative, contactsPreferences); if (TextUtils.isEmpty(preferredName)) { return contactInfo.number; return TextUtils.isEmpty(contactInfo.number) ? null : BidiFormatter.getInstance() .unicodeWrap(contactInfo.number, TextDirectionHeuristics.LTR); } return preferredName; } Loading java/com/android/incallui/rtt/impl/RttChatAdapter.java +8 −1 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ package com.android.incallui.rtt.impl; import android.content.Context; import android.graphics.drawable.Drawable; import android.os.Bundle; import android.support.annotation.NonNull; import android.support.annotation.Nullable; Loading @@ -32,6 +33,8 @@ import java.util.List; /** Adapter class for holding RTT chat data. */ public class RttChatAdapter extends RecyclerView.Adapter<RttChatMessageViewHolder> { private Drawable avatarDrawable; interface MessageListener { void onUpdateRemoteMessage(int position); Loading Loading @@ -75,7 +78,7 @@ public class RttChatAdapter extends RecyclerView.Adapter<RttChatMessageViewHolde if (i > 0) { isSameGroup = rttMessages.get(i).isRemote == rttMessages.get(i - 1).isRemote; } rttChatMessageViewHolder.setMessage(rttMessages.get(i), isSameGroup); rttChatMessageViewHolder.setMessage(rttMessages.get(i), isSameGroup, avatarDrawable); } @Override Loading Loading @@ -169,4 +172,8 @@ public class RttChatAdapter extends RecyclerView.Adapter<RttChatMessageViewHolde bundle.putParcelableArrayList(KEY_MESSAGE_DATA, (ArrayList<RttChatMessage>) rttMessages); bundle.putInt(KEY_LAST_LOCAL_MESSAGE, lastIndexOfLocalMessage); } void setAvatarDrawable(Drawable drawable) { avatarDrawable = drawable; } } java/com/android/incallui/rtt/impl/RttChatFragment.java +32 −1 Original line number Diff line number Diff line Loading @@ -48,9 +48,12 @@ import com.android.dialer.common.Assert; import com.android.dialer.common.FragmentUtils; import com.android.dialer.common.LogUtil; import com.android.dialer.common.UiUtil; import com.android.dialer.lettertile.LetterTileDrawable; import com.android.dialer.util.DrawableConverter; import com.android.incallui.audioroute.AudioRouteSelectorDialogFragment.AudioRouteSelectorPresenter; import com.android.incallui.call.DialerCall.State; import com.android.incallui.hold.OnHoldFragment; import com.android.incallui.incall.protocol.ContactPhotoType; import com.android.incallui.incall.protocol.InCallButtonIds; import com.android.incallui.incall.protocol.InCallButtonUi; import com.android.incallui.incall.protocol.InCallButtonUiDelegate; Loading Loading @@ -95,7 +98,8 @@ public class RttChatFragment extends Fragment private RttOverflowMenu overflowMenu; private SecondaryInfo savedSecondaryInfo; private TextView statusBanner; private PrimaryInfo primaryInfo; private PrimaryInfo primaryInfo = PrimaryInfo.empty(); private PrimaryCallState primaryCallState = PrimaryCallState.empty(); private boolean isUserScrolling; private boolean shouldAutoScrolling; Loading Loading @@ -366,9 +370,35 @@ public class RttChatFragment extends Fragment public void setPrimary(@NonNull PrimaryInfo primaryInfo) { LogUtil.i("RttChatFragment.setPrimary", primaryInfo.toString()); nameTextView.setText(primaryInfo.name()); updateAvatar(primaryInfo); this.primaryInfo = primaryInfo; } private void updateAvatar(PrimaryInfo primaryInfo) { boolean hasPhoto = primaryInfo.photo() != null && primaryInfo.photoType() == ContactPhotoType.CONTACT; // Contact has a photo, don't render a letter tile. if (hasPhoto) { int avatarSize = getResources().getDimensionPixelSize(R.dimen.rtt_avatar_size); adapter.setAvatarDrawable( DrawableConverter.getRoundedDrawable( getContext(), primaryInfo.photo(), avatarSize, avatarSize)); } else { LetterTileDrawable letterTile = new LetterTileDrawable(getResources()); letterTile.setCanonicalDialerLetterTileDetails( primaryInfo.name(), primaryInfo.contactInfoLookupKey(), LetterTileDrawable.SHAPE_CIRCLE, LetterTileDrawable.getContactTypeFromPrimitives( primaryCallState.isVoiceMailNumber(), primaryInfo.isSpam(), primaryCallState.isBusinessNumber(), primaryInfo.numberPresentation(), primaryCallState.isConference())); adapter.setAvatarDrawable(letterTile); } } @Override public void onAttach(Context context) { super.onAttach(context); Loading Loading @@ -404,6 +434,7 @@ public class RttChatFragment extends Fragment @Override public void setCallState(@NonNull PrimaryCallState primaryCallState) { LogUtil.i("RttChatFragment.setCallState", primaryCallState.toString()); this.primaryCallState = primaryCallState; if (!isTimerStarted && primaryCallState.state() == State.ACTIVE) { LogUtil.i( "RttChatFragment.setCallState", "starting timer with base: %d", chronometer.getBase()); Loading java/com/android/incallui/rtt/impl/RttChatMessageViewHolder.java +3 −2 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ package com.android.incallui.rtt.impl; import android.content.res.Resources; import android.graphics.drawable.Drawable; import android.support.v7.widget.RecyclerView.ViewHolder; import android.view.Gravity; import android.view.View; Loading @@ -41,7 +42,7 @@ public class RttChatMessageViewHolder extends ViewHolder { resources = view.getResources(); } void setMessage(RttChatMessage message, boolean isSameGroup) { void setMessage(RttChatMessage message, boolean isSameGroup, Drawable imageDrawable) { messageTextView.setText(message.getContent()); LinearLayout.LayoutParams params = (LayoutParams) container.getLayoutParams(); params.gravity = message.isRemote ? Gravity.START : Gravity.END; Loading @@ -56,7 +57,7 @@ public class RttChatMessageViewHolder extends ViewHolder { avatarImageView.setVisibility(View.INVISIBLE); } else { avatarImageView.setVisibility(View.VISIBLE); avatarImageView.setImageResource(R.drawable.product_logo_avatar_anonymous_white_color_120); avatarImageView.setImageDrawable(imageDrawable); } } else { avatarImageView.setVisibility(View.GONE); Loading java/com/android/incallui/rtt/impl/res/layout/rtt_chat_list_item.xml +2 −2 Original line number Diff line number Diff line Loading @@ -26,8 +26,8 @@ android:orientation="horizontal"> <ImageView android:id="@+id/rtt_chat_avatar" android:layout_width="40dp" android:layout_height="40dp" android:layout_width="@dimen/rtt_avatar_size" android:layout_height="@dimen/rtt_avatar_size" android:layout_marginStart="8dp" android:layout_marginEnd="8dp" android:visibility="gone" Loading Loading
java/com/android/incallui/CallCardPresenter.java +6 −1 Original line number Diff line number Diff line Loading @@ -36,6 +36,8 @@ import android.support.v4.content.ContextCompat; import android.telecom.Call.Details; import android.telecom.StatusHints; import android.telecom.TelecomManager; import android.text.BidiFormatter; import android.text.TextDirectionHeuristics; import android.text.TextUtils; import android.view.Display; import android.view.View; Loading Loading @@ -987,7 +989,10 @@ public class CallCardPresenter ContactDisplayUtils.getPreferredDisplayName( contactInfo.namePrimary, contactInfo.nameAlternative, contactsPreferences); if (TextUtils.isEmpty(preferredName)) { return contactInfo.number; return TextUtils.isEmpty(contactInfo.number) ? null : BidiFormatter.getInstance() .unicodeWrap(contactInfo.number, TextDirectionHeuristics.LTR); } return preferredName; } Loading
java/com/android/incallui/rtt/impl/RttChatAdapter.java +8 −1 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ package com.android.incallui.rtt.impl; import android.content.Context; import android.graphics.drawable.Drawable; import android.os.Bundle; import android.support.annotation.NonNull; import android.support.annotation.Nullable; Loading @@ -32,6 +33,8 @@ import java.util.List; /** Adapter class for holding RTT chat data. */ public class RttChatAdapter extends RecyclerView.Adapter<RttChatMessageViewHolder> { private Drawable avatarDrawable; interface MessageListener { void onUpdateRemoteMessage(int position); Loading Loading @@ -75,7 +78,7 @@ public class RttChatAdapter extends RecyclerView.Adapter<RttChatMessageViewHolde if (i > 0) { isSameGroup = rttMessages.get(i).isRemote == rttMessages.get(i - 1).isRemote; } rttChatMessageViewHolder.setMessage(rttMessages.get(i), isSameGroup); rttChatMessageViewHolder.setMessage(rttMessages.get(i), isSameGroup, avatarDrawable); } @Override Loading Loading @@ -169,4 +172,8 @@ public class RttChatAdapter extends RecyclerView.Adapter<RttChatMessageViewHolde bundle.putParcelableArrayList(KEY_MESSAGE_DATA, (ArrayList<RttChatMessage>) rttMessages); bundle.putInt(KEY_LAST_LOCAL_MESSAGE, lastIndexOfLocalMessage); } void setAvatarDrawable(Drawable drawable) { avatarDrawable = drawable; } }
java/com/android/incallui/rtt/impl/RttChatFragment.java +32 −1 Original line number Diff line number Diff line Loading @@ -48,9 +48,12 @@ import com.android.dialer.common.Assert; import com.android.dialer.common.FragmentUtils; import com.android.dialer.common.LogUtil; import com.android.dialer.common.UiUtil; import com.android.dialer.lettertile.LetterTileDrawable; import com.android.dialer.util.DrawableConverter; import com.android.incallui.audioroute.AudioRouteSelectorDialogFragment.AudioRouteSelectorPresenter; import com.android.incallui.call.DialerCall.State; import com.android.incallui.hold.OnHoldFragment; import com.android.incallui.incall.protocol.ContactPhotoType; import com.android.incallui.incall.protocol.InCallButtonIds; import com.android.incallui.incall.protocol.InCallButtonUi; import com.android.incallui.incall.protocol.InCallButtonUiDelegate; Loading Loading @@ -95,7 +98,8 @@ public class RttChatFragment extends Fragment private RttOverflowMenu overflowMenu; private SecondaryInfo savedSecondaryInfo; private TextView statusBanner; private PrimaryInfo primaryInfo; private PrimaryInfo primaryInfo = PrimaryInfo.empty(); private PrimaryCallState primaryCallState = PrimaryCallState.empty(); private boolean isUserScrolling; private boolean shouldAutoScrolling; Loading Loading @@ -366,9 +370,35 @@ public class RttChatFragment extends Fragment public void setPrimary(@NonNull PrimaryInfo primaryInfo) { LogUtil.i("RttChatFragment.setPrimary", primaryInfo.toString()); nameTextView.setText(primaryInfo.name()); updateAvatar(primaryInfo); this.primaryInfo = primaryInfo; } private void updateAvatar(PrimaryInfo primaryInfo) { boolean hasPhoto = primaryInfo.photo() != null && primaryInfo.photoType() == ContactPhotoType.CONTACT; // Contact has a photo, don't render a letter tile. if (hasPhoto) { int avatarSize = getResources().getDimensionPixelSize(R.dimen.rtt_avatar_size); adapter.setAvatarDrawable( DrawableConverter.getRoundedDrawable( getContext(), primaryInfo.photo(), avatarSize, avatarSize)); } else { LetterTileDrawable letterTile = new LetterTileDrawable(getResources()); letterTile.setCanonicalDialerLetterTileDetails( primaryInfo.name(), primaryInfo.contactInfoLookupKey(), LetterTileDrawable.SHAPE_CIRCLE, LetterTileDrawable.getContactTypeFromPrimitives( primaryCallState.isVoiceMailNumber(), primaryInfo.isSpam(), primaryCallState.isBusinessNumber(), primaryInfo.numberPresentation(), primaryCallState.isConference())); adapter.setAvatarDrawable(letterTile); } } @Override public void onAttach(Context context) { super.onAttach(context); Loading Loading @@ -404,6 +434,7 @@ public class RttChatFragment extends Fragment @Override public void setCallState(@NonNull PrimaryCallState primaryCallState) { LogUtil.i("RttChatFragment.setCallState", primaryCallState.toString()); this.primaryCallState = primaryCallState; if (!isTimerStarted && primaryCallState.state() == State.ACTIVE) { LogUtil.i( "RttChatFragment.setCallState", "starting timer with base: %d", chronometer.getBase()); Loading
java/com/android/incallui/rtt/impl/RttChatMessageViewHolder.java +3 −2 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ package com.android.incallui.rtt.impl; import android.content.res.Resources; import android.graphics.drawable.Drawable; import android.support.v7.widget.RecyclerView.ViewHolder; import android.view.Gravity; import android.view.View; Loading @@ -41,7 +42,7 @@ public class RttChatMessageViewHolder extends ViewHolder { resources = view.getResources(); } void setMessage(RttChatMessage message, boolean isSameGroup) { void setMessage(RttChatMessage message, boolean isSameGroup, Drawable imageDrawable) { messageTextView.setText(message.getContent()); LinearLayout.LayoutParams params = (LayoutParams) container.getLayoutParams(); params.gravity = message.isRemote ? Gravity.START : Gravity.END; Loading @@ -56,7 +57,7 @@ public class RttChatMessageViewHolder extends ViewHolder { avatarImageView.setVisibility(View.INVISIBLE); } else { avatarImageView.setVisibility(View.VISIBLE); avatarImageView.setImageResource(R.drawable.product_logo_avatar_anonymous_white_color_120); avatarImageView.setImageDrawable(imageDrawable); } } else { avatarImageView.setVisibility(View.GONE); Loading
java/com/android/incallui/rtt/impl/res/layout/rtt_chat_list_item.xml +2 −2 Original line number Diff line number Diff line Loading @@ -26,8 +26,8 @@ android:orientation="horizontal"> <ImageView android:id="@+id/rtt_chat_avatar" android:layout_width="40dp" android:layout_height="40dp" android:layout_width="@dimen/rtt_avatar_size" android:layout_height="@dimen/rtt_avatar_size" android:layout_marginStart="8dp" android:layout_marginEnd="8dp" android:visibility="gone" Loading