|
|
|
@ -2,12 +2,12 @@ package net.pokeranalytics.android.ui.modules.session |
|
|
|
|
|
|
|
|
|
|
|
import android.app.Activity |
|
|
|
import android.app.Activity |
|
|
|
import android.widget.Button |
|
|
|
import android.widget.Button |
|
|
|
import android.widget.PopupWindow |
|
|
|
import android.widget.TextView |
|
|
|
import com.google.android.material.chip.Chip |
|
|
|
import com.google.android.material.chip.Chip |
|
|
|
import com.google.android.material.chip.ChipGroup |
|
|
|
import com.google.android.material.chip.ChipGroup |
|
|
|
import net.pokeranalytics.android.R |
|
|
|
import net.pokeranalytics.android.R |
|
|
|
import net.pokeranalytics.android.exceptions.PAIllegalStateException |
|
|
|
|
|
|
|
import net.pokeranalytics.android.model.realm.ResultCaptureType |
|
|
|
import net.pokeranalytics.android.model.realm.ResultCaptureType |
|
|
|
|
|
|
|
import net.pokeranalytics.android.ui.view.BasePopupWindow |
|
|
|
|
|
|
|
|
|
|
|
interface ResultCaptureTypeDelegate { |
|
|
|
interface ResultCaptureTypeDelegate { |
|
|
|
fun resultCaptureTypeSelected(resultCaptureType: ResultCaptureType, applyBankroll: Boolean) |
|
|
|
fun resultCaptureTypeSelected(resultCaptureType: ResultCaptureType, applyBankroll: Boolean) |
|
|
|
@ -17,7 +17,7 @@ class ResultCaptureSelectionPopup( |
|
|
|
private var delegate: ResultCaptureTypeDelegate, |
|
|
|
private var delegate: ResultCaptureTypeDelegate, |
|
|
|
var type: ResultCaptureType?, |
|
|
|
var type: ResultCaptureType?, |
|
|
|
activity: Activity |
|
|
|
activity: Activity |
|
|
|
) : PopupWindow(activity) { |
|
|
|
) : BasePopupWindow(activity) { |
|
|
|
|
|
|
|
|
|
|
|
init { |
|
|
|
init { |
|
|
|
|
|
|
|
|
|
|
|
@ -28,6 +28,9 @@ class ResultCaptureSelectionPopup( |
|
|
|
this.contentView = view |
|
|
|
this.contentView = view |
|
|
|
this.isFocusable = true |
|
|
|
this.isFocusable = true |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
val titleTextView = view.findViewById<TextView>(R.id.title) |
|
|
|
|
|
|
|
titleTextView.text = activity.getString(R.string.change_result_capture_method).toUpperCase() |
|
|
|
|
|
|
|
|
|
|
|
val netResultChip = view.findViewById<Chip>(R.id.chip_net_result) |
|
|
|
val netResultChip = view.findViewById<Chip>(R.id.chip_net_result) |
|
|
|
netResultChip.isChecked = type == ResultCaptureType.NET_RESULT |
|
|
|
netResultChip.isChecked = type == ResultCaptureType.NET_RESULT |
|
|
|
netResultChip.isCheckedIconVisible = true |
|
|
|
netResultChip.isCheckedIconVisible = true |
|
|
|
@ -59,9 +62,11 @@ class ResultCaptureSelectionPopup( |
|
|
|
val rct = when (chipGroup.checkedChipId) { |
|
|
|
val rct = when (chipGroup.checkedChipId) { |
|
|
|
R.id.chip_net_result -> ResultCaptureType.NET_RESULT |
|
|
|
R.id.chip_net_result -> ResultCaptureType.NET_RESULT |
|
|
|
R.id.chip_buyin_cashout -> ResultCaptureType.BUYIN_CASHEDOUT |
|
|
|
R.id.chip_buyin_cashout -> ResultCaptureType.BUYIN_CASHEDOUT |
|
|
|
else -> throw PAIllegalStateException("cannot happen / not managed") |
|
|
|
else -> null |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
rct?.let { |
|
|
|
|
|
|
|
this.delegate.resultCaptureTypeSelected(rct, applyBankroll) |
|
|
|
} |
|
|
|
} |
|
|
|
this.delegate.resultCaptureTypeSelected(rct, applyBankroll) |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |