Skip to content
This repository has been archived by the owner on Dec 22, 2023. It is now read-only.

Commit

Permalink
* [b] Fixes material dialog issues
Browse files Browse the repository at this point in the history
  • Loading branch information
shahsurajk committed Sep 30, 2020
1 parent 5423cda commit 43f9bfc
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ dependencies {
implementation 'androidx.core:core-ktx:1.5.0-alpha03'
implementation 'androidx.constraintlayout:constraintlayout:2.0.1'
implementation 'com.google.android.material:material:1.3.0-alpha02'
implementation 'com.afollestad.material-dialogs:core:3.1.1'
implementation 'com.afollestad.material-dialogs:input:3.0.1'
implementation 'com.afollestad.material-dialogs:core:3.3.0'
implementation 'com.afollestad.material-dialogs:input:3.3.0'
// https://mvnrepository.com/artifact/com.google.code.gson/gson
implementation 'com.google.code.gson:gson:2.8.6'
testImplementation 'junit:junit:4.13'
Expand Down
22 changes: 12 additions & 10 deletions app/src/main/java/io/qtalk/qgamejsinterfacetester/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,9 @@ import android.widget.Toast
import androidx.appcompat.app.AppCompatActivity
import com.afollestad.materialdialogs.MaterialDialog
import com.afollestad.materialdialogs.callbacks.onDismiss
import com.afollestad.materialdialogs.checkbox.checkBoxPrompt
import com.afollestad.materialdialogs.checkbox.isCheckPromptChecked
import com.afollestad.materialdialogs.input.getInputField
import com.afollestad.materialdialogs.input.input
import com.afollestad.materialdialogs.list.SingleChoiceListener
import com.afollestad.materialdialogs.list.listItems
import com.afollestad.materialdialogs.list.listItemsSingleChoice
import io.qtalk.qgamejsinterfacetester.core.InteractionType
Expand Down Expand Up @@ -80,15 +79,18 @@ class MainActivity : AppCompatActivity() {
.listItemsSingleChoice(
R.array.interactionTypes,
initialSelection = 1,
waitForPositiveButton = false
) { dialog: MaterialDialog, index: Int, text: String ->
interactionType = when (index) {
0 -> InteractionType.WEB_SHARING
1 -> InteractionType.IN_CALL
2 -> InteractionType.WEBRTC
else -> InteractionType.IN_CALL
waitForPositiveButton = false,
selection = object: SingleChoiceListener {
override fun invoke(dialog: MaterialDialog, index: Int, text: CharSequence) {
interactionType = when (index) {
0 -> InteractionType.WEB_SHARING
1 -> InteractionType.IN_CALL
2 -> InteractionType.WEBRTC
else -> InteractionType.IN_CALL
}
}
}
}
)
.input(prefill = getUrlFromPrefOrIntent())
.positiveButton { materialDialog ->

Expand Down

0 comments on commit 43f9bfc

Please sign in to comment.