package com.cottondb.android.keyboard import android.app.Activity import android.os.Bundle import android.view.inputmethod.InputMethodManager import android.widget.Button import android.widget.EditText import android.widget.LinearLayout /** Debug-only synthetic native editor used to drive the production IME process. */ class KeyboardEditorHarnessActivity : Activity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) val editor = EditText(this).apply { contentDescription = "Keyboard editor" setText("Acorn") isSingleLine = false } fun showKeyboard() { editor.requestFocus() editor.setSelection(editor.text.length) editor.post { getSystemService(InputMethodManager::class.java).showSoftInput(editor, InputMethodManager.SHOW_IMPLICIT) } } setContentView(LinearLayout(this).apply { orientation = LinearLayout.VERTICAL setPadding(24, 100, 24, 0) addView(editor) addView(Button(this@KeyboardEditorHarnessActivity).apply { text = "Show keyboard" isAllCaps = false setOnClickListener { showKeyboard() } }) }) showKeyboard() } }