We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
/** * @param onReloadListener 拿到重试的监听 * @return r */ @OverRide public Callback setCallback(Context context, OnReloadListener onReloadListener) { this.onReloadListener = onReloadListener; return super.setCallback(context, onReloadListener); }
/** * @param context c * @param view v * @return true or false 返回true 则覆盖注册时的onReload,如果返回false则两者都执行,先执行onReloadEvent */ @Override protected boolean onReloadEvent(Context context, View view) { Log.d("token-", "onReloadEvent: " + System.currentTimeMillis()); (view.findViewById(R.id.tv_reload)).setOnClickListener(v -> { Log.d("token-2", "onReloadEvent: " + System.currentTimeMillis()); onReloadListener.onReload(v);//去重试 }); return true; }
第一次点击 log都出不来 点击第二次才触发点击事件
The text was updated successfully, but these errors were encountered:
一样
Sorry, something went wrong.
rootView.setOnClickListener(v -> { if (onReloadEvent(context, rootView)) { return; } if (onReloadListener != null) { onReloadListener.onReload(v); } }); 在第一次点击之后才注册了 按钮的点击事件 //将Callback添加到当前视图时的回调,View为当前Callback的布局View @OverRide public void onAttach(Context context, View view) { super.onAttach(context, view); (view.findViewById(R.id.tv_reload)).setOnClickListener(v -> { Log.d("token-2", "onReloadEvent: " + System.currentTimeMillis()); onReloadListener.onReload(v);//去重试 }); }
解决方案 在这里使用点击事件 loadService.setCallBack(EmptyCallback.class, new Transport() { @OverRide public void order(Context context, View view) { Button btn= (TextView) view.findViewById(R.id.btn); btn.setOnClickListener(new View.OnClickListener() { @OverRide public void onClick(View v) { Toast.makeText(context.getApplicationContext(), "It's your gift! :p", Toast.LENGTH_SHORT).show(); } }); } });
No branches or pull requests
/**
* @param onReloadListener 拿到重试的监听
* @return r
*/
@OverRide
public Callback setCallback(Context context, OnReloadListener onReloadListener) {
this.onReloadListener = onReloadListener;
return super.setCallback(context, onReloadListener);
}
第一次点击 log都出不来 点击第二次才触发点击事件
The text was updated successfully, but these errors were encountered: