|
|
|
@ -17,7 +17,6 @@ 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 { |
|
|
|
@ -29,6 +28,9 @@ class NumericKey : RowRepresentable { |
|
|
|
|
|
|
|
|
|
|
|
constructor(type: Type) { |
|
|
|
constructor(type: Type) { |
|
|
|
this.type = type |
|
|
|
this.type = type |
|
|
|
|
|
|
|
if (type == Type.DECIMAL) { |
|
|
|
|
|
|
|
this.value = DecimalFormatSymbols.getInstance().decimalSeparator.toString() |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
constructor(number: Int) : this(Type.NUMBER) { |
|
|
|
constructor(number: Int) : this(Type.NUMBER) { |
|
|
|
@ -106,6 +108,7 @@ class KeyboardAmountView(context: Context) : AbstractKeyboardView(context), |
|
|
|
editText.setText(amount?.noGroupingFormatted) |
|
|
|
editText.setText(amount?.noGroupingFormatted) |
|
|
|
|
|
|
|
|
|
|
|
this.inputConnection = editText.onCreateInputConnection(EditorInfo()) |
|
|
|
this.inputConnection = editText.onCreateInputConnection(EditorInfo()) |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
override fun adapterRows(): List<RowRepresentable>? { |
|
|
|
override fun adapterRows(): List<RowRepresentable>? { |
|
|
|
@ -132,15 +135,15 @@ class KeyboardAmountView(context: Context) : AbstractKeyboardView(context), |
|
|
|
when { |
|
|
|
when { |
|
|
|
key.isBackSpace -> { it.deleteSurroundingText(1, 0) } |
|
|
|
key.isBackSpace -> { it.deleteSurroundingText(1, 0) } |
|
|
|
key.isDecimalSeparator -> { |
|
|
|
key.isDecimalSeparator -> { |
|
|
|
val text = it.getSelectedText(0) |
|
|
|
val text = this.editText.text.toString() |
|
|
|
if (text != null && !text.contains(key.value)) { |
|
|
|
if (!text.contains(key.value)) { |
|
|
|
it.commitText(key.value, 1) |
|
|
|
it.commitText(key.value, 1) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
else -> { it.commitText(key.value, 1) } |
|
|
|
else -> { it.commitText(key.value, 1) } |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
Timber.d(">>> text = ${this.editText.text.toString()}") |
|
|
|
// Timber.d(">>> text = ${this.editText.text.toString()}") |
|
|
|
// this.editText?.setText(this.editText?.text) |
|
|
|
// this.editText?.setText(this.editText?.text) |
|
|
|
|
|
|
|
|
|
|
|
// this.editText?.forceLayout() |
|
|
|
// this.editText?.forceLayout() |
|
|
|
|