Add double edit text management

dev_raz_wip
Aurelien Hubert 7 years ago
parent 8e2ed30b40
commit 3c8ca3171a
  1. 8
      app/src/main/java/net/pokeranalytics/android/ui/fragment/NewSessionFragment.kt
  2. 17
      app/src/main/java/net/pokeranalytics/android/ui/fragment/components/BottomSheetDoubleEditTextFragment.kt

@ -52,6 +52,10 @@ class NewSessionFragment : PokerAnalyticsFragment(), DynamicRowCallback, BottomS
SessionRow.GAME -> currentSession.game = null
SessionRow.BANKROLL -> currentSession.bankroll = null
SessionRow.LOCATION -> currentSession.location = null
SessionRow.BLINDS -> {
currentSession.cgSmallBlind = null
currentSession.cgBigBlind = null
}
}
sessionAdapter.notifyItemChanged(SessionRow.values().indexOf(row))
}
@ -65,6 +69,10 @@ class NewSessionFragment : PokerAnalyticsFragment(), DynamicRowCallback, BottomS
SessionRow.GAME -> if (value is Game) currentSession.game = value
SessionRow.BANKROLL -> if (value is Bankroll) currentSession.bankroll = value
SessionRow.LOCATION -> if (value is Location) currentSession.location = value
SessionRow.BLINDS -> if (value is ArrayList<*>) {
currentSession.cgSmallBlind = (value[0] as String? ?: "0").toDouble()
currentSession.cgBigBlind = (value[1] as String? ?: "0").toDouble()
}
}
sessionAdapter.notifyItemChanged(SessionRow.values().indexOf(row))
}

@ -4,6 +4,7 @@ import android.os.Bundle
import android.text.InputType
import android.view.LayoutInflater
import android.view.View
import android.view.inputmethod.EditorInfo
import kotlinx.android.synthetic.main.bottom_sheet_double_edit_text.*
import kotlinx.android.synthetic.main.fragment_bottom_sheet.view.*
import net.pokeranalytics.android.R
@ -35,7 +36,8 @@ class BottomSheetDoubleEditTextFragment : BottomSheetFragment() {
val data = getData()
LayoutInflater.from(requireContext()).inflate(R.layout.bottom_sheet_double_edit_text, view?.bottomSheetContainer, true)
LayoutInflater.from(requireContext())
.inflate(R.layout.bottom_sheet_double_edit_text, view?.bottomSheetContainer, true)
if (data.size == 2) {
@ -46,8 +48,21 @@ class BottomSheetDoubleEditTextFragment : BottomSheetFragment() {
editText2.hint = data[1].hint
editText2.setText((data[1].defaultValue ?: "").toString())
editText2.inputType = data[1].inputType ?: InputType.TYPE_CLASS_TEXT
editText2.setOnEditorActionListener { v, actionId, event ->
if (actionId == EditorInfo.IME_ACTION_DONE) {
val values = ArrayList<String>()
values.add(editText1.text.toString())
values.add(editText2.text.toString())
bottomSheetDelegate.setValue(values, row)
dismiss()
true
} else {
false
}
}
}
}

Loading…
Cancel
Save