|
@@ -0,0 +1,115 @@
|
|
|
+package com.cooleshow.chatmodule.ui;
|
|
|
+
|
|
|
+import android.content.Intent;
|
|
|
+import android.net.Uri;
|
|
|
+import android.os.Bundle;
|
|
|
+import android.text.Editable;
|
|
|
+import android.text.TextUtils;
|
|
|
+import android.text.TextWatcher;
|
|
|
+import android.view.View;
|
|
|
+import android.widget.EditText;
|
|
|
+import android.widget.ImageView;
|
|
|
+
|
|
|
+import com.alibaba.android.arouter.facade.annotation.Route;
|
|
|
+import com.cooleshow.base.router.RouterPath;
|
|
|
+import com.cooleshow.base.ui.activity.BaseMVPActivity;
|
|
|
+import com.cooleshow.base.utils.LogUtils;
|
|
|
+import com.cooleshow.base.utils.ToastUtil;
|
|
|
+import com.cooleshow.base.utils.helper.QMUIStatusBarHelper;
|
|
|
+import com.cooleshow.chatmodule.R;
|
|
|
+import com.cooleshow.chatmodule.constants.TCChatRouterPath;
|
|
|
+import com.cooleshow.chatmodule.contract.SetRemarksContract;
|
|
|
+import com.cooleshow.chatmodule.databinding.ActivitySetRemarkBinding;
|
|
|
+import com.cooleshow.chatmodule.presenter.SetRemarksPresenter;
|
|
|
+
|
|
|
+import androidx.annotation.Nullable;
|
|
|
+
|
|
|
+/**
|
|
|
+ * 创建日期:2022/6/13 11:15
|
|
|
+ *
|
|
|
+ * @author Ryan
|
|
|
+ * 类说明:
|
|
|
+ */
|
|
|
+@Route(path = TCChatRouterPath.CHAT_GROUP_SET_REMARK)
|
|
|
+public class SetRemarksActivity extends BaseMVPActivity<ActivitySetRemarkBinding, SetRemarksPresenter> implements SetRemarksContract.SetRemarksView, View.OnClickListener {
|
|
|
+ @Override
|
|
|
+ public void onClick(View v) {
|
|
|
+ int id = v.getId();
|
|
|
+ if (id == com.cooleshow.base.R.id.tv_right_text) {
|
|
|
+ remarks = et_remarks.getText().toString().trim();
|
|
|
+ if (TextUtils.isEmpty(remarks)) {
|
|
|
+ ToastUtil.getInstance().showShort("请输入备注名");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ presenter.updateGroupInfo(targetId, remarks);
|
|
|
+ } else if (id == R.id.iv_close) {
|
|
|
+ et_remarks.setText("");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private EditText et_remarks;
|
|
|
+ private String targetId;
|
|
|
+ private String remarks;
|
|
|
+ private ImageView iv_close;
|
|
|
+
|
|
|
+ @Override
|
|
|
+ protected void onCreate(@Nullable Bundle savedInstanceState) {
|
|
|
+ super.onCreate(savedInstanceState);
|
|
|
+ QMUIStatusBarHelper.setStatusBarLightMode(this);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ protected void initView() {
|
|
|
+ initMidTitleToolBar(viewBinding.toolbarInclude.toolbar, "设置备注名");
|
|
|
+ viewBinding.toolbarInclude.tvRightText.setText("完成");
|
|
|
+ viewBinding.toolbarInclude.tvRightText.setTextColor(getResources().getColor(com.cooleshow.base.R.color.color_2dc7aa));
|
|
|
+ viewBinding.toolbarInclude.tvRightText.setVisibility(View.VISIBLE);
|
|
|
+ viewBinding.toolbarInclude.tvRightText.setOnClickListener(this);
|
|
|
+ et_remarks = viewBinding.etRemarks;
|
|
|
+ iv_close = viewBinding.ivClose;
|
|
|
+ iv_close.setOnClickListener(this);
|
|
|
+ Intent intent = getIntent();
|
|
|
+ targetId = intent.getStringExtra("targetId");
|
|
|
+ remarks = intent.getStringExtra("remarks");
|
|
|
+ et_remarks.setText(remarks);
|
|
|
+ et_remarks.addTextChangedListener(new TextWatcher() {
|
|
|
+ @Override
|
|
|
+ public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onTextChanged(CharSequence s, int start, int before, int count) {
|
|
|
+ if (et_remarks.getText().toString().length() > 0) {
|
|
|
+ iv_close.setVisibility(View.VISIBLE);
|
|
|
+ } else {
|
|
|
+ iv_close.setVisibility(View.GONE);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void afterTextChanged(Editable s) {
|
|
|
+
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ protected ActivitySetRemarkBinding getLayoutView() {
|
|
|
+ return ActivitySetRemarkBinding.inflate(getLayoutInflater());
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ protected SetRemarksPresenter createPresenter() {
|
|
|
+ return new SetRemarksPresenter();
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void updateGroupInfoSuccess(String targetId, String title) {
|
|
|
+ ToastUtil.getInstance().showShort("设置成功");
|
|
|
+ Intent intent = new Intent();
|
|
|
+ intent.putExtra("remarks", remarks);
|
|
|
+ setResult(RESULT_OK, intent);
|
|
|
+ finish();
|
|
|
+ }
|
|
|
+}
|