|
|
|
@ -17,6 +17,7 @@ import net.pokeranalytics.android.ui.view.GridSpacingItemDecoration |
|
|
|
import net.pokeranalytics.android.ui.view.RowRepresentable |
|
|
|
import net.pokeranalytics.android.ui.view.RowRepresentable |
|
|
|
import net.pokeranalytics.android.ui.view.RowViewType |
|
|
|
import net.pokeranalytics.android.ui.view.RowViewType |
|
|
|
import net.pokeranalytics.android.util.extensions.noGroupingFormatted |
|
|
|
import net.pokeranalytics.android.util.extensions.noGroupingFormatted |
|
|
|
|
|
|
|
import timber.log.Timber |
|
|
|
import java.text.DecimalFormatSymbols |
|
|
|
import java.text.DecimalFormatSymbols |
|
|
|
|
|
|
|
|
|
|
|
class NumericKey : RowRepresentable { |
|
|
|
class NumericKey : RowRepresentable { |
|
|
|
@ -64,10 +65,16 @@ class NumericKey : RowRepresentable { |
|
|
|
class KeyboardAmountView(context: Context) : AbstractKeyboardView(context), |
|
|
|
class KeyboardAmountView(context: Context) : AbstractKeyboardView(context), |
|
|
|
StaticRowRepresentableDataSource, RowRepresentableDelegate { |
|
|
|
StaticRowRepresentableDataSource, RowRepresentableDelegate { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*** |
|
|
|
|
|
|
|
* The adapter managing the grid displayed keyboard |
|
|
|
|
|
|
|
*/ |
|
|
|
private var dataAdapter: RowRepresentableAdapter |
|
|
|
private var dataAdapter: RowRepresentableAdapter |
|
|
|
|
|
|
|
|
|
|
|
private lateinit var editText: EditText |
|
|
|
private lateinit var editText: EditText |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*** |
|
|
|
|
|
|
|
* The interface linking the keyboard to the EditText |
|
|
|
|
|
|
|
*/ |
|
|
|
private var inputConnection: InputConnection? = null |
|
|
|
private var inputConnection: InputConnection? = null |
|
|
|
|
|
|
|
|
|
|
|
init { |
|
|
|
init { |
|
|
|
@ -94,7 +101,7 @@ class KeyboardAmountView(context: Context) : AbstractKeyboardView(context), |
|
|
|
|
|
|
|
|
|
|
|
this.clearButton.setOnClickListener { |
|
|
|
this.clearButton.setOnClickListener { |
|
|
|
this.editText.text = null |
|
|
|
this.editText.text = null |
|
|
|
this.keyboardListener?.clearAmount() |
|
|
|
this.keyboardListener?.amountCleared() |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
this.closeButton.setOnClickListener { |
|
|
|
this.closeButton.setOnClickListener { |
|
|
|
@ -103,11 +110,18 @@ class KeyboardAmountView(context: Context) : AbstractKeyboardView(context), |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
fun setEditText(editText: EditText, amount: Double?) { |
|
|
|
fun setEditText(editText: EditText, amount: Double?) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Timber.d("edit text = $editText") |
|
|
|
|
|
|
|
|
|
|
|
this.editText = editText |
|
|
|
this.editText = editText |
|
|
|
|
|
|
|
|
|
|
|
editText.setText(amount?.noGroupingFormatted) |
|
|
|
editText.setText(amount?.noGroupingFormatted) |
|
|
|
|
|
|
|
// editText.requestFocus() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
editText.onCreateInputConnection(EditorInfo())?.let { |
|
|
|
|
|
|
|
this.inputConnection = it |
|
|
|
|
|
|
|
} ?: run { throw PAIllegalStateException("EditText did not return an input Connection") } |
|
|
|
|
|
|
|
|
|
|
|
this.inputConnection = editText.onCreateInputConnection(EditorInfo()) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|