Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
ahd2254 committed Jul 24, 2021
1 parent 05eb683 commit c69f156
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -189,8 +189,9 @@ public class ChatActivity extends AppCompatActivity


//views
private Button btConnect;
private Button btConnect, btSendMsg, btChangeThreadId, btSettoken;
private TextView tvState, tvUserInfo, tvServerType;
private EditText et_text;

//other variables
private Map<String, List<Method>> categoryMap;
Expand Down Expand Up @@ -649,6 +650,10 @@ private void getHeaderAndChild(List<Method> movieList) {
private void setListeners() {
//new
btConnect.setOnClickListener(this);
btSendMsg.setOnClickListener(this::sendMessage);
btChangeThreadId.setOnClickListener(this::setThreadId);
btSettoken.setOnClickListener(this::setToken);

// end new

//
Expand All @@ -673,6 +678,10 @@ private void init() {
tvState = findViewById(R.id.tvState);
tvUserInfo = findViewById(R.id.tvUserInfo);
tvServerType = findViewById(R.id.tvServerType);
et_text = findViewById(R.id.et_text);
btSendMsg = findViewById(R.id.btSendMsg);
btChangeThreadId = findViewById(R.id.btChangeThreadId);
btSettoken = findViewById(R.id.btSettoken);
// end of

presenter = new ChatPresenter(this, this, this);
Expand Down Expand Up @@ -1864,7 +1873,7 @@ public void sendMessage(View view) {
.build();
//
//
// presenter.sendTextMessage(editText.getText().toString(), TEST_THREAD_ID, TextMessageType.Constants.TEXT, meta, null);
presenter.sendTextMessage(et_text.getText().toString(), TEST_THREAD_ID, TextMessageType.Constants.TEXT, meta, null);
//
//
// editText.setText("");
Expand Down Expand Up @@ -2876,14 +2885,20 @@ public void onFinish(String imageJson, FileUpload fileImageUpload) {
}
}

public void SetThreadId(View view) {
public void setThreadId(View view) {


String tId = et_text.getText().toString();

// String tId = editTextThread.getText().toString();
if (!tId.isEmpty())
TEST_THREAD_ID = Integer.valueOf(tId);

// if (!tId.isEmpty())
// TEST_THREAD_ID = Integer.valueOf(tId);
}

public void setToken(View view) {
String tId = et_text.getText().toString();
if (!tId.isEmpty())
TOKEN = tId;
}

@Override
Expand Down
7 changes: 4 additions & 3 deletions app/src/main/res/layout/activity_chat.xml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@
android:id="@+id/btSettoken"
android:layout_width="135dp"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:text="SetToken"
app:layout_constraintEnd_toStartOf="@+id/btChangeThreadId"
Expand All @@ -102,21 +103,21 @@
android:id="@+id/btSendMsg"
android:layout_width="136dp"
android:layout_height="wrap_content"
android:text="Button"
android:text="SendMessage"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toEndOf="@+id/btChangeThreadId"
app:layout_constraintTop_toTopOf="@+id/btChangeThreadId" />

<EditText
android:id="@+id/editTextTextPersonName"
android:id="@+id/et_text"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
android:ems="10"
android:hint="msg - threadid"
android:hint="msg - threadid - token"
android:inputType="textPersonName"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="@+id/btSettoken"
Expand Down

0 comments on commit c69f156

Please sign in to comment.