Skip to content

Commit 3eb977e

Browse files
committed
Fixed onClickListener
1 parent 3e0f890 commit 3eb977e

3 files changed

Lines changed: 8 additions & 25 deletions

File tree

multipleselectionview/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ android {
1010
defaultConfig {
1111
minSdk 21
1212
targetSdk 32
13-
versionCode 6
14-
versionName "1.0.5"
13+
versionCode 7
14+
versionName "1.0.6"
1515

1616
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
1717
consumerProguardFiles "consumer-rules.pro"

multipleselectionview/src/main/java/ge/rogavactive/multipleselectionview/MultipleSelectionView.kt

Lines changed: 3 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,9 @@ class MultipleSelectionView<I> @JvmOverloads constructor(
6161

6262
mAdapter = defaultAdapter
6363
}
64+
setOnClickListener {
65+
mModal.show()
66+
}
6467
}
6568

6669
/**
@@ -85,26 +88,4 @@ class MultipleSelectionView<I> @JvmOverloads constructor(
8588
mAdapter = newAdapter
8689
}
8790

88-
override fun dispatchTouchEvent(event: MotionEvent?): Boolean {
89-
if (event?.action == MotionEvent.ACTION_DOWN) {
90-
listener?.onClick(this)
91-
mModal.show()
92-
}
93-
return super.dispatchTouchEvent(event)
94-
}
95-
96-
override fun dispatchKeyEvent(event: KeyEvent): Boolean {
97-
if (event.action == KeyEvent.ACTION_DOWN &&
98-
(event.keyCode == KeyEvent.KEYCODE_DPAD_CENTER || event.keyCode == KeyEvent.KEYCODE_ENTER)
99-
) {
100-
listener?.onClick(this)
101-
mModal.show()
102-
}
103-
return super.dispatchKeyEvent(event)
104-
}
105-
106-
override fun setOnClickListener(listener: OnClickListener?) {
107-
this.listener = listener
108-
}
109-
11091
}

multipleselectionview/src/main/res/layout/item_list.xml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
33
android:layout_width="match_parent"
4-
android:layout_height="match_parent">
4+
android:layout_height="match_parent"
5+
android:clickable="true"
6+
android:focusable="true">
57
<CheckBox
68
android:id="@+id/item_checkbox"
79
android:layout_width="match_parent"

0 commit comments

Comments
 (0)