X Tutup
The Wayback Machine - https://web.archive.org/web/20201022205544/https://github.com/KeepSafe/TapTargetView/pull/322
Skip to content
New issue

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

kotlin sample app #322

Open
wants to merge 1 commit into
base: master
from
Open

kotlin sample app #322

wants to merge 1 commit into from

Conversation

@richard457
Copy link

@richard457 richard457 commented Oct 8, 2018

Provide a Quick Kotlin sample application.

// This listener will tell us when interesting(tm) events happen in regards
// to the sequence
override fun onSequenceFinish() {
(findViewById<View>(R.id.educated) as TextView).text = "Congratulations! You're educated now!"

This comment has been minimized.

@xiphirx

xiphirx Dec 7, 2018
Collaborator

Suggested change
(findViewById<View>(R.id.educated) as TextView).text = "Congratulations! You're educated now!"
findViewById<TextView>(R.id.educated).text = "Congratulations! You're educated now!"
}

override fun onSequenceStep(lastTarget: TapTarget, targetClicked: Boolean) {
Log.d("TapTargetView", "Clicked on " + lastTarget.id())

This comment has been minimized.

@xiphirx

xiphirx Dec 7, 2018
Collaborator

Suggested change
Log.d("TapTargetView", "Clicked on " + lastTarget.id())
Log.d("TapTargetView", "Clicked on ${lastTarget.id()}")
.setMessage("You canceled the sequence")
.setPositiveButton("Oops", null).show()
TapTargetView.showFor(dialog,
TapTarget.forView(dialog.getButton(DialogInterface.BUTTON_POSITIVE), "Uh oh!", "You canceled the sequence at step " + lastTarget.id())

This comment has been minimized.

@xiphirx

xiphirx Dec 7, 2018
Collaborator

Suggested change
TapTarget.forView(dialog.getButton(DialogInterface.BUTTON_POSITIVE), "Uh oh!", "You canceled the sequence at step " + lastTarget.id())
TapTarget.forView(dialog.getButton(DialogInterface.BUTTON_POSITIVE), "Uh oh!", "You canceled the sequence at step ${lastTarget.id()}")
override fun onTargetDismissed(view: TapTargetView, userInitiated: Boolean) {
Log.d("TapTargetViewSample", "You dismissed me :(")
}
})

This comment has been minimized.

@xiphirx

xiphirx Dec 7, 2018
Collaborator

Formatting:

        TapTargetView.showFor(
                this, 
                TapTarget.forView(findViewById<View>(R.id.fab), "Hello, world!", spannedDesc)
                        .cancelable(false)
                        .drawShadow(true)
                        .titleTextDimen(R.dimen.title_text_size)
                        .tintTarget(false), 
               object : TapTargetView.Listener() {
                   override fun onTargetClick(view: TapTargetView) {
                       super.onTargetClick(view)
                       // .. which evidently starts the sequence we defined earlier
                      sequence.start()
                  }
                  override fun onOuterCircleClick(view: TapTargetView) {
                      super.onOuterCircleClick(view)
                     Toast.makeText(view.context, "You clicked the outer circle!", Toast.LENGTH_SHORT).show()
                 }
                 override fun onTargetDismissed(view: TapTargetView, userInitiated: Boolean) {
                     Log.d("TapTargetViewSample", "You dismissed me :(")
                 }
              }
        )
TapTargetView.showFor(dialog,
TapTarget.forView(dialog.getButton(DialogInterface.BUTTON_POSITIVE), "Uh oh!", "You canceled the sequence at step " + lastTarget.id())
.cancelable(false)
.tintTarget(false), object : TapTargetView.Listener() {

This comment has been minimized.

@xiphirx

xiphirx Dec 7, 2018
Collaborator

Formatting, move object onto its own line

@@ -1,4 +1,5 @@
buildscript {
ext.kotlin_version = '1.2.71'

This comment has been minimized.

@xiphirx

xiphirx Dec 7, 2018
Collaborator

Move this version definition to the ext block below.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants
You can’t perform that action at this time.
X Tutup