diff options
-rw-r--r-- | java/com/android/incallui/rtt/impl/RttChatAdapter.java | 16 | ||||
-rw-r--r-- | java/com/android/incallui/rtt/impl/RttChatMessage.java | 4 |
2 files changed, 10 insertions, 10 deletions
diff --git a/java/com/android/incallui/rtt/impl/RttChatAdapter.java b/java/com/android/incallui/rtt/impl/RttChatAdapter.java index 69837188a..42bd2c60c 100644 --- a/java/com/android/incallui/rtt/impl/RttChatAdapter.java +++ b/java/com/android/incallui/rtt/impl/RttChatAdapter.java @@ -24,7 +24,6 @@ import android.view.View; import android.view.ViewGroup; import com.android.dialer.common.LogUtil; import java.util.ArrayList; -import java.util.Arrays; import java.util.List; /** Adapter class for holding RTT chat data. */ @@ -76,21 +75,22 @@ public class RttChatAdapter extends RecyclerView.Adapter<RttChatMessageViewHolde if (lastIndexOfRemoteMessage >= 0) { rttChatMessage = rttMessages.get(lastIndexOfRemoteMessage); } - RttChatMessage[] newMessages = RttChatMessage.getRemoteRttChatMessage(rttChatMessage, newText); + List<RttChatMessage> newMessages = + RttChatMessage.getRemoteRttChatMessage(rttChatMessage, newText); if (rttChatMessage == null) { lastIndexOfRemoteMessage = rttMessages.size(); - rttMessages.add(lastIndexOfRemoteMessage, newMessages[0]); - rttMessages.addAll(Arrays.asList(newMessages).subList(1, newMessages.length)); - notifyItemRangeInserted(lastIndexOfRemoteMessage, newMessages.length); + rttMessages.add(lastIndexOfRemoteMessage, newMessages.get(0)); + rttMessages.addAll(newMessages.subList(1, newMessages.size())); + notifyItemRangeInserted(lastIndexOfRemoteMessage, newMessages.size()); lastIndexOfRemoteMessage = rttMessages.size() - 1; } else { - rttMessages.set(lastIndexOfRemoteMessage, newMessages[0]); + rttMessages.set(lastIndexOfRemoteMessage, newMessages.get(0)); int lastIndex = rttMessages.size(); - rttMessages.addAll(Arrays.asList(newMessages).subList(1, newMessages.length)); + rttMessages.addAll(newMessages.subList(1, newMessages.size())); notifyItemChanged(lastIndexOfRemoteMessage); - notifyItemRangeInserted(lastIndex, newMessages.length); + notifyItemRangeInserted(lastIndex, newMessages.size()); } if (rttMessages.get(lastIndexOfRemoteMessage).isFinished()) { lastIndexOfRemoteMessage = -1; diff --git a/java/com/android/incallui/rtt/impl/RttChatMessage.java b/java/com/android/incallui/rtt/impl/RttChatMessage.java index b2974ef97..fe30364b8 100644 --- a/java/com/android/incallui/rtt/impl/RttChatMessage.java +++ b/java/com/android/incallui/rtt/impl/RttChatMessage.java @@ -87,7 +87,7 @@ final class RttChatMessage { } /** Convert remote input text into an array of {@code RttChatMessage}. */ - static RttChatMessage[] getRemoteRttChatMessage( + static List<RttChatMessage> getRemoteRttChatMessage( @Nullable RttChatMessage currentMessage, @NonNull String text) { Iterator<String> splitText = SPLITTER.split(text).iterator(); List<RttChatMessage> messageList = new ArrayList<>(); @@ -118,6 +118,6 @@ final class RttChatMessage { messageList.add(message); } - return messageList.toArray(new RttChatMessage[0]); + return messageList; } } |