Skip to content
This repository was archived by the owner on Aug 22, 2024. It is now read-only.

Commit 68cede8

Browse files
committed
[ADDED] Simple touch listener to button.
Fixed #98
1 parent 1c178b9 commit 68cede8

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

app/src/main/java/com/hossainkhan/android/demo/ui/functionaldemo/TedTalkPlaybackActivity.kt

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@ package com.hossainkhan.android.demo.ui.functionaldemo
1818

1919
import android.os.Bundle
2020
import android.view.View
21+
import android.widget.ImageButton
2122
import android.widget.Toast
23+
import com.hossainkhan.android.demo.R
2224
import com.hossainkhan.android.demo.ui.layoutpreview.LayoutPreviewBaseActivity
2325

2426
class TedTalkPlaybackActivity : LayoutPreviewBaseActivity() {
@@ -29,5 +31,19 @@ class TedTalkPlaybackActivity : LayoutPreviewBaseActivity() {
2931
override fun onCreate(savedInstanceState: Bundle?) {
3032
super.onCreate(savedInstanceState)
3133

34+
// Apply generic toast listener to touchable views so that user gets feedback when they tap it
35+
applyToastListener(
36+
findViewById<ImageButton>(R.id.action_prev_track),
37+
findViewById<ImageButton>(R.id.action_rewind15),
38+
findViewById<ImageButton>(R.id.action_play_pause),
39+
findViewById<ImageButton>(R.id.action_forward15),
40+
findViewById<ImageButton>(R.id.action_next_track)
41+
)
42+
}
43+
44+
private fun applyToastListener(vararg views: View) {
45+
views.forEach {
46+
it.setOnClickListener(generalClickListener)
47+
}
3248
}
3349
}

0 commit comments

Comments
 (0)