防抖时间改成0.5秒

This commit is contained in:
18401019693 2022-08-19 10:32:03 +08:00
parent b5aa768f5b
commit 2779fedc3b
3 changed files with 20 additions and 1 deletions

View File

@ -18,6 +18,9 @@ import com.yunbao.common.utils.Bus;
import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.ToastUtil;
import com.yunbao.common.views.weight.ViewClicksAntiShake; import com.yunbao.common.views.weight.ViewClicksAntiShake;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;
import java.util.List; import java.util.List;
/** /**
@ -45,6 +48,7 @@ public class LiveTotalDialog extends AbsDialogFragment {
@Override @Override
public void onActivityCreated(Bundle savedInstanceState) { public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState); super.onActivityCreated(savedInstanceState);
Bus.getOn(this);
funGamesList = (RecyclerView) findViewById(R.id.fun_games_list); funGamesList = (RecyclerView) findViewById(R.id.fun_games_list);
gamesAdapter = new FunGamesAdapter(); gamesAdapter = new FunGamesAdapter();
funGamesList.setLayoutManager(new LinearLayoutManager(getContext(), LinearLayoutManager.HORIZONTAL, false)); funGamesList.setLayoutManager(new LinearLayoutManager(getContext(), LinearLayoutManager.HORIZONTAL, false));
@ -116,4 +120,18 @@ public class LiveTotalDialog extends AbsDialogFragment {
window.setAttributes(params); window.setAttributes(params);
} }
@Override
public void onDestroy() {
super.onDestroy();
Bus.getOff(this);
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void onOpenDrawer(LiveAudienceEvent event) {
switch (event.getType()) {
case CURRENT_ACTIVITY:
dismiss();
break;
}
}
} }

View File

@ -39,4 +39,5 @@ public class FunGamesViewHolder extends RecyclerView.ViewHolder {
.setModel(model)); .setModel(model));
}); });
} }
} }

View File

@ -24,7 +24,7 @@ public class ViewClicksAntiShake {
*/ */
public static void clicksAntiShake(View view, ViewClicksCallBack callBack) { public static void clicksAntiShake(View view, ViewClicksCallBack callBack) {
RxView.clicks(view) RxView.clicks(view)
.throttleFirst(2, TimeUnit.SECONDS) .throttleFirst(500, TimeUnit.MILLISECONDS)
.subscribe(new Observer<Unit>() { .subscribe(new Observer<Unit>() {
@Override @Override
public void onSubscribe(Disposable d) { public void onSubscribe(Disposable d) {