|
|
|
@ -9,11 +9,14 @@ import androidx.core.widget.addTextChangedListener |
|
|
|
import kotlinx.android.synthetic.main.bottom_sheet_double_edit_text.* |
|
|
|
import kotlinx.android.synthetic.main.bottom_sheet_double_edit_text.* |
|
|
|
import kotlinx.android.synthetic.main.fragment_bottom_sheet.view.* |
|
|
|
import kotlinx.android.synthetic.main.fragment_bottom_sheet.view.* |
|
|
|
import net.pokeranalytics.android.R |
|
|
|
import net.pokeranalytics.android.R |
|
|
|
|
|
|
|
import net.pokeranalytics.android.ui.view.SessionRow |
|
|
|
|
|
|
|
import net.pokeranalytics.android.util.round |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class BottomSheetDoubleEditTextFragment : BottomSheetFragment() { |
|
|
|
class BottomSheetDoubleEditTextFragment : BottomSheetFragment() { |
|
|
|
|
|
|
|
|
|
|
|
private val values = ArrayList<String>() |
|
|
|
private val values = ArrayList<String>() |
|
|
|
|
|
|
|
private var isEditingBlinds: Boolean = false |
|
|
|
|
|
|
|
|
|
|
|
override fun onViewCreated(view: View, savedInstanceState: Bundle?) { |
|
|
|
override fun onViewCreated(view: View, savedInstanceState: Bundle?) { |
|
|
|
super.onViewCreated(view, savedInstanceState) |
|
|
|
super.onViewCreated(view, savedInstanceState) |
|
|
|
@ -34,6 +37,7 @@ class BottomSheetDoubleEditTextFragment : BottomSheetFragment() { |
|
|
|
* Init data |
|
|
|
* Init data |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private fun initData() { |
|
|
|
private fun initData() { |
|
|
|
|
|
|
|
isEditingBlinds = row == SessionRow.BLINDS |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
@ -55,12 +59,25 @@ class BottomSheetDoubleEditTextFragment : BottomSheetFragment() { |
|
|
|
|
|
|
|
|
|
|
|
data[0].hint?.let { editText1.hint = getString(it) } |
|
|
|
data[0].hint?.let { editText1.hint = getString(it) } |
|
|
|
editText1.inputType = data[0].inputType ?: InputType.TYPE_CLASS_TEXT |
|
|
|
editText1.inputType = data[0].inputType ?: InputType.TYPE_CLASS_TEXT |
|
|
|
editText1.addTextChangedListener { values[0] = it?.toString() ?: "" } |
|
|
|
editText1.addTextChangedListener { |
|
|
|
editText1.setText((data[0].defaultValue ?: "").toString()) |
|
|
|
values[0] = it?.toString() ?: "" |
|
|
|
|
|
|
|
if (isEditingBlinds) { |
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
val smallBlind = values[0].toDouble() |
|
|
|
|
|
|
|
editText2.setText((smallBlind * 2).round()) |
|
|
|
|
|
|
|
} catch (e: Exception) { |
|
|
|
|
|
|
|
editText2.setText("") |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
data[1].hint?.let { editText2.hint = getString(it) } |
|
|
|
data[1].hint?.let { editText2.hint = getString(it) } |
|
|
|
editText2.inputType = data[1].inputType ?: InputType.TYPE_CLASS_TEXT |
|
|
|
editText2.inputType = data[1].inputType ?: InputType.TYPE_CLASS_TEXT |
|
|
|
editText2.addTextChangedListener { values[1] = it?.toString() ?: "" } |
|
|
|
editText2.addTextChangedListener { |
|
|
|
|
|
|
|
values[1] = it?.toString() ?: "" |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
editText1.setText((data[0].defaultValue ?: "").toString()) |
|
|
|
editText2.setText((data[1].defaultValue ?: "").toString()) |
|
|
|
editText2.setText((data[1].defaultValue ?: "").toString()) |
|
|
|
|
|
|
|
|
|
|
|
editText2.setOnEditorActionListener { v, actionId, event -> |
|
|
|
editText2.setOnEditorActionListener { v, actionId, event -> |
|
|
|
|