Skip to content

Commit

Permalink
Updated sample usage.
Browse files Browse the repository at this point in the history
  • Loading branch information
iamporus committed Jul 19, 2019
1 parent eb9bf66 commit 5b8de07
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.prush.bndrsntchoicelayoutsample

import android.os.Bundle
import android.support.v4.content.ContextCompat
import android.support.v7.app.AppCompatActivity
import android.util.Log
import com.prush.bndrsntchoicelayout.BndrsntChoiceLayout
Expand All @@ -12,6 +13,14 @@ class MainActivity : AppCompatActivity() {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)

bndrnstChoiceLayout.numberOfChoices = 3
bndrnstChoiceLayout.choiceOneText = "Yes"
bndrnstChoiceLayout.choiceTwoText = "No"
bndrnstChoiceLayout.choiceThreeText = "Whatever"
bndrnstChoiceLayout.bRandomizeChoice = true
bndrnstChoiceLayout.bRevealMode = true
bndrnstChoiceLayout.defaultChoiceColor = ContextCompat.getColor(applicationContext, android.R.color.holo_blue_light)

if (savedInstanceState == null) {
bndrnstChoiceLayout.postDelayed({

Expand All @@ -23,7 +32,7 @@ class MainActivity : AppCompatActivity() {

}, 2000)
}
bndrnstChoiceLayout.setOnChoiceSelectedListener(object : BndrsntChoiceLayout.OnChoiceSelectedListener {
bndrnstChoiceLayout.onChoiceSelectedListener = (object : BndrsntChoiceLayout.OnChoiceSelectedListener {
override fun onChoiceSelected(id: Int, choiceText: String) {
Log.d("MainActivity", "selected: $choiceText")

Expand Down
5 changes: 0 additions & 5 deletions app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:no_of_choices="three_choices"
app:choice_one_text="YES"
app:choice_two_text="NO"
app:choice_three_text="WHATEVER"
app:randomize_choice="true"
android:background="@android:color/black"
app:reveal_mode="false"
android:id="@+id/bndrnstChoiceLayout"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
Expand Down

0 comments on commit 5b8de07

Please sign in to comment.