Skip to content

Commit

Permalink
some issues fixes for onclick listeners2
Browse files Browse the repository at this point in the history
  • Loading branch information
msayanece committed Jun 13, 2019
1 parent c2491d4 commit 5032741
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 2 additions & 0 deletions app/src/main/res/layout/custom_recycler_child.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
android:layout_marginStart="10dp"
android:layout_marginEnd="10dp"
android:layout_marginTop="5dp"
android:clickable="false"
android:text="Title goes here"
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
app:layout_constraintTop_toTopOf="parent"
Expand All @@ -50,6 +51,7 @@
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:clickable="false"
android:text="Description goes here hereDescription goes here"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
app:layout_constraintStart_toStartOf="@id/titleTextView"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,8 @@ private void setOnClickListenersToChild(EasyListView.OnItemClickListener onClick
if (isViewGroup) {
for (int i = 0; i < itemViewGroup.getChildCount(); i++) {
View child = itemViewGroup.getChildAt(i);
child.setOnClickListener(new CustomOnClickListener(onClickListener, position));
if (child.isClickable() || child.isFocusable())
child.setOnClickListener(new CustomOnClickListener(onClickListener, position));
setOnClickListenersToChild(onClickListener, child, position);
}
}
Expand All @@ -109,11 +110,12 @@ private static class CustomOnClickListener implements View.OnClickListener {
private final EasyListView.OnItemClickListener onClickListener;
private final int finalPosition;

CustomOnClickListener(EasyListView.OnItemClickListener onClickListener, int finalPosition){
CustomOnClickListener(EasyListView.OnItemClickListener onClickListener, int finalPosition) {

this.onClickListener = onClickListener;
this.finalPosition = finalPosition;
}

@Override
public void onClick(View v) {
onClickListener.onClick(v, finalPosition);
Expand Down

0 comments on commit 5032741

Please sign in to comment.