Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f99226c6 authored by wangqi's avatar wangqi Committed by android-build-merger
Browse files

Merge "Fix bugs of RTT chat."

am: 7efc1f03

Change-Id: Ie18d788210e60f8f2253843b5c5b4ed3eb49de38
parents 1e5922fe 7efc1f03
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -56,6 +56,7 @@ import com.android.incallui.incall.protocol.PrimaryCallState;
import com.android.incallui.incall.protocol.PrimaryInfo;
import com.android.incallui.incall.protocol.SecondaryInfo;
import com.android.incallui.rtt.impl.RttChatAdapter.MessageListener;
import com.android.incallui.rtt.protocol.Constants;
import com.android.incallui.rtt.protocol.RttCallScreen;
import com.android.incallui.rtt.protocol.RttCallScreenDelegate;
import com.android.incallui.rtt.protocol.RttCallScreenDelegateFactory;
@@ -162,6 +163,7 @@ public class RttChatFragment extends Fragment
          isClearingInput = true;
          editText.setText("");
          isClearingInput = false;
          rttCallScreenDelegate.onLocalMessage(Constants.BUBBLE_BREAKER);
        });
    submitButton.setEnabled(false);
    endCallButton = view.findViewById(R.id.rtt_end_call_button);
+8 −17
Original line number Diff line number Diff line
@@ -74,23 +74,14 @@ final class RttChatMessage {
   */
  static String getChangedString(CharSequence s, int start, int before, int count) {
    StringBuilder modify = new StringBuilder();
    if (before > count) {
      int deleteStart = start + count;
      int deleted = before - count;
      int numberUnModifiedCharsAfterDeleted = s.length() - start - count;
    char c = '\b';
      for (int i = 0; i < deleted + numberUnModifiedCharsAfterDeleted; i++) {
    int oldLength = s.length() - count + before;
    for (int i = 0; i < oldLength - start; i++) {
      modify.append(c);
    }
      modify.append(s, deleteStart, s.length());
    } else {
      int insertStart = start + before;
      int numberUnModifiedCharsAfterInserted = s.length() - start - count;
      char c = '\b';
      for (int i = 0; i < numberUnModifiedCharsAfterInserted; i++) {
        modify.append(c);
      }
      modify.append(s, insertStart, s.length());
    modify.append(s, start, start + count);
    if (start + count < s.length()) {
      modify.append(s, start + count, s.length());
    }
    return modify.toString();
  }