修改防抖点击问题

This commit is contained in:
18401019693 2023-05-22 16:48:55 +08:00
parent 055d002a34
commit 4f103dadc9
3 changed files with 35 additions and 22 deletions

View File

@ -12,6 +12,7 @@ import com.lxj.xpopup.animator.PopupAnimator;
import com.lxj.xpopup.core.CenterPopupView; import com.lxj.xpopup.core.CenterPopupView;
import com.yunbao.common.R; import com.yunbao.common.R;
import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.ToastUtil;
import com.yunbao.common.views.weight.ViewClicksAntiShake;
/** /**
* 输入弹窗 * 输入弹窗
@ -54,15 +55,21 @@ public class InputCustomPopup extends CenterPopupView {
findViewById(R.id.btn_confirm).setOnClickListener(new OnClickListener() { findViewById(R.id.btn_confirm).setOnClickListener(new OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
String textContent = content.getText().toString(); ViewClicksAntiShake.clicksAntiShake(v, new ViewClicksAntiShake.ViewClicksCallBack() {
if (TextUtils.isEmpty(textContent)) { @Override
ToastUtil.show("输入内容不可为空"); public void onViewClicks() {
return; String textContent = content.getText().toString();
} if (TextUtils.isEmpty(textContent)) {
if (listener != null) { ToastUtil.show("输入内容不可为空");
listener.onConfirm(textContent); return;
} }
dismiss(); // 关闭弹窗 if (listener != null) {
listener.onConfirm(textContent);
}
dismiss(); // 关闭弹窗
}
});
} }
}); });
} }

View File

@ -32,12 +32,11 @@
android:layout_width="30dp" android:layout_width="30dp"
android:layout_height="30dp" android:layout_height="30dp"
android:layout_alignParentRight="true" android:layout_alignParentRight="true"
android:layout_marginRight="20dp"
android:layout_marginTop="50dp" android:layout_marginTop="50dp"
android:layout_marginRight="20dp"
android:padding="5dp" android:padding="5dp"
android:src="@mipmap/icon_live_ready_close" android:src="@mipmap/icon_live_ready_close"
android:tint="@color/white" android:tint="@color/white" />
/>
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"

View File

@ -52,6 +52,7 @@ import com.yunbao.common.manager.imrongcloud.RongcloudIMManager;
import com.yunbao.common.utils.RouteUtil; import com.yunbao.common.utils.RouteUtil;
import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.ToastUtil;
import com.yunbao.common.utils.WordUtil; import com.yunbao.common.utils.WordUtil;
import com.yunbao.common.views.weight.ViewClicksAntiShake;
import com.yunbao.live.http.LiveHttpUtil; import com.yunbao.live.http.LiveHttpUtil;
import com.yunbao.live.presenter.LiveRoomCheckLivePresenter; import com.yunbao.live.presenter.LiveRoomCheckLivePresenter;
import com.yunbao.main.R; import com.yunbao.main.R;
@ -168,18 +169,24 @@ public class LoginActivity extends AbsActivity {
public void loginClick(View v) { public void loginClick(View v) {
int i = v.getId(); ViewClicksAntiShake.clicksAntiShake(v, new ViewClicksAntiShake.ViewClicksCallBack() {
if (i == R.id.btn_login) { @Override
login(); public void onViewClicks() {
int i = v.getId();
if (i == R.id.btn_login) {
login();
} else if (i == R.id.btn_register) { } else if (i == R.id.btn_register) {
register(); register();
} else if (i == R.id.btn_forget_pwd) { } else if (i == R.id.btn_forget_pwd) {
forgetPwd(); forgetPwd();
} else if (i == R.id.btn_tip) {
forwardTip();
}
}
});
} else if (i == R.id.btn_tip) {
forwardTip();
}
} }
//注册 //注册