That fuck shit the fascists are using
at master 76 lines 2.2 kB view raw
1package org.tm.archive.components 2 3import android.content.Context 4import android.util.AttributeSet 5import android.widget.ImageView 6import android.widget.TextView 7import androidx.constraintlayout.widget.ConstraintLayout 8import org.tm.archive.R 9 10/** 11 * A "forced" EN US Numeric keyboard designed solely for SMS code entry. This 12 * "upgrade" over KeyboardView will ensure that the keyboard is navigable via 13 * TalkBack and will read out keys as they are selected by the user. This is 14 * not a perfect solution, but save being able to force the system keyboard to 15 * appear in EN US, this is the best we can do for the time being. 16 */ 17class NumericKeyboardView @JvmOverloads constructor( 18 context: Context, 19 attrs: AttributeSet? = null 20) : ConstraintLayout(context, attrs) { 21 22 var listener: Listener? = null 23 24 init { 25 layoutDirection = LAYOUT_DIRECTION_LTR 26 inflate(context, R.layout.numeric_keyboard_view, this) 27 28 findViewById<TextView>(R.id.numeric_keyboard_1).setOnClickListener { 29 listener?.onKeyPress(1) 30 } 31 32 findViewById<TextView>(R.id.numeric_keyboard_2).setOnClickListener { 33 listener?.onKeyPress(2) 34 } 35 36 findViewById<TextView>(R.id.numeric_keyboard_3).setOnClickListener { 37 listener?.onKeyPress(3) 38 } 39 40 findViewById<TextView>(R.id.numeric_keyboard_4).setOnClickListener { 41 listener?.onKeyPress(4) 42 } 43 44 findViewById<TextView>(R.id.numeric_keyboard_5).setOnClickListener { 45 listener?.onKeyPress(5) 46 } 47 48 findViewById<TextView>(R.id.numeric_keyboard_6).setOnClickListener { 49 listener?.onKeyPress(6) 50 } 51 52 findViewById<TextView>(R.id.numeric_keyboard_7).setOnClickListener { 53 listener?.onKeyPress(7) 54 } 55 56 findViewById<TextView>(R.id.numeric_keyboard_8).setOnClickListener { 57 listener?.onKeyPress(8) 58 } 59 60 findViewById<TextView>(R.id.numeric_keyboard_9).setOnClickListener { 61 listener?.onKeyPress(9) 62 } 63 64 findViewById<TextView>(R.id.numeric_keyboard_0).setOnClickListener { 65 listener?.onKeyPress(0) 66 } 67 68 findViewById<ImageView>(R.id.numeric_keyboard_back).setOnClickListener { 69 listener?.onKeyPress(-1) 70 } 71 } 72 73 interface Listener { 74 fun onKeyPress(keyCode: Int) 75 } 76}