Как разрешить клавиатуре выводить значения типа string?
Я совсем новичок в разработке под андроид. Меня попросили сделать клавиатуру для одного малочисленного народа. И для реализации некоторых букв нужно за раз выводить ряд символов, для чего подходит androidOutputText. И я столкнулся с проблемой, что моя клавиатура не выводит значения типа string на экран. Как я понимаю, что мной просто где то не прописано "умение" обрабатывать объекты этого типа. Не могли бы вы подсказать, где именно и как это должно?
<Row>
<Key android:codes="49" android:keyLabel="1" android:keyEdgeFlags="left"/>
<Key android:codes="1076" android:keyLabel="д" android:popupKeyboard="@xml/popup"/>
<Key android:codes="51" android:keyLabel="3"/>
<Key android:codes="52" android:keyLabel="4"/>
<Key android:codes="53" android:keyLabel="5"/>
<Key android:codes="54" android:keyLabel="6"/>
<Key android:codes="55" android:keyLabel="7"/>
<Key android:codes="56" android:keyLabel="8"/>
<Key android:codes="57" android:keyLabel="9"/>
<Key android:codes="48" android:keyLabel="0" android:keyEdgeFlags="right"/>
</Row>
<Keyboard xmlns:android="http://schemas.android.com/apk/res/android"
android:keyWidth="15%p"
android:horizontalGap="0px"
android:verticalGap="0px"
android:keyHeight="60dp"
>
<Row android:rowEdgeFlags="top">
<Key android:keyLabel="Д' " android:keyOutputText="Д'"/>
<Key android:keyLabel="D " android:keyOutputText="D "/>
</Row>
package com.example.nakeyboard
import android.inputmethodservice.InputMethodService;
import android.inputmethodservice.Keyboard;
import android.inputmethodservice.KeyboardView;
import android.text.TextUtils;
import android.view.KeyboardShortcutGroup;
import android.view.View;
import android.view.inputmethod.InputConnection;
public class Myinput extends InputMethodService implements KeyboardView.OnKeyboardActionListener {
@Override
public View onCreateInputView () {
KeyboardView keyboardView = (KeyboardView) getLayoutInflater().inflate(R.layout.keyboard_view, null);
Keyboard keyboard = new Keyboard( this, R.xml.number_pad);
keyboardView.setKeyboard(keyboard);
keyboardView.setOnKeyboardActionListener(this);
return keyboardView;
}
@Override
public void onPress(int primaryCode) {
}
@Override
public void onRelease(int primaryCode) {
}
@Override
public void onKey(int primaryCode, int[] keyCodes) {
InputConnection inputConnectionc = getCurrentInputConnection();
if (inputConnectionc!=null) {
switch (primaryCode) {
case Keyboard.KEYCODE_DELETE:
CharSequence selectedText = inputConnectionc.getSelectedText(0);
if (TextUtils.isEmpty(selectedText)) {
inputConnectionc.deleteSurroundingText(1, 0);
} else {
inputConnectionc.commitText("", 1);
}
break;
default:
char code = (char) primaryCode;
inputConnectionc.commitText(String.valueOf(code),1);
}
}
}
@Override
public void onText(CharSequence text) {
}
@Override
public void swipeLeft() {
}
@Override
public void swipeRight() {
}
@Override
public void swipeDown() {
}
@Override
public void swipeUp() {
}