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
Choose a base branch
from
Open

kotlin sample app #322

wants to merge 1 commit into from

Conversation

richard457
Copy link

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!"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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!"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

R

}

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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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())
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 :(")
}
})
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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() {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Formatting, move object onto its own line

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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants