dialogplus
dialogplus copied to clipboard
on click listeners on item inside a custom view
when i have a dialog with my custom view this library recursively overwrites all onClickListeners. why??? and how can i avoid this. my custom view has some functionality which is embeded inside and i don't want to change them.
same problem here
Same Problem HeRE!!!!!!!!!!
same here. As a workaround I have forked the project and modified DialogPlus.java createView() function following way:
private View createView(LayoutInflater inflater, View headerView, View footerView, BaseAdapter adapter) {
View view = holder.getView(inflater, rootView);
// if (holder instanceof ViewHolder) {
// assignClickListenerRecursively(view);
// }
assignClickListenerRecursively(headerView);
holder.addHeader(headerView);
assignClickListenerRecursively(footerView);
holder.addFooter(footerView);
if (adapter != null && holder instanceof HolderAdapter) {
HolderAdapter holderAdapter = (HolderAdapter) holder;
holderAdapter.setAdapter(adapter);
holderAdapter.setOnItemClickListener(new OnHolderListener() {
@Override
public void onItemClick(Object item, View view, int position) {
if (onItemClickListener == null) {
return;
}
onItemClickListener.onItemClick(DialogPlus.this, item, view, position);
}
});
}
return view;
}
I've set onTouchListener of the component (Button) inside my custom view, and it worked by now,..
bt.setOnTouchListener((arg0, arg1) -> {
int action = arg1.getAction();
if (action == MotionEvent.ACTION_UP) {
editCall();
}
return true;
});
👍 As I remember, we thought that it might be useful to propagate all click events through DialogPlus item click listener, but definitely there are cases it should not do that. Maybe this feature should be opt-in.