c# - Detecting isSticky in Android custom keyboards -
i have custom keyboard buttons issticky enabled have problem detecting if turned on or off (true / false) , disabling them after key pressed if turned on (true).
the problem can't find way detect keys , appending current edittext functions (all sticky buttons has specific functions).
this should happen in onkey function,
here keyboard class:
public class mykeyboardlistener : java.lang.object, keyboardview.ionkeyboardactionlistener{ private readonly activity _activity; public mykeyboardlistener(activity activity){ _activity = activity; } public void onkey(android.views.keycode primarycode, android.views.keycode[] keycodes){ var eventtime = datetime.now.ticks; var keyevent = new keyevent(eventtime, eventtime, keyeventactions.down, primarycode, 0); switch ((int)primarycode) { case 1005: break; case 1006: break; default: _activity.dispatchkeyevent(keyevent); break; } } public void onpress(android.views.keycode primarycode){ } public void onrelease(android.views.keycode primarycode){ } public void ontext(java.lang.icharsequence text){ } public void swipedown(){ } public void swipeleft(){ } public void swiperight(){ } public void swipeup(){ } }
keyboard.axml
<keyboard xmlns:android="http://schemas.android.com/apk/res/android" android:keywidth="100%" android:keyheight="6%p"> <row> <key android:codes="1000" android:keylabel="a" android:keyedgeflags="left" android:ismodifier="true" android:issticky="true" android:horizontalgap="1%p" /> <key android:codes="1001" android:keylabel="b" android:ismodifier="true" android:issticky="true" android:horizontalgap="1%p" /> <key android:codes="1002" android:keylabel="c" android:ismodifier="true" android:issticky="true" android:horizontalgap="1%p" /> <key android:codes="1003" android:keylabel="d" android:ismodifier="true" android:issticky="true" android:horizontalgap="1%p" /> <key android:codes="1004" android:keylabel="e" android:keyedgeflags="right" android:ismodifier="true" android:issticky="true" android:horizontalgap="1%p" /> </row> <row> <key android:codes="8" android:keylabel="1" android:keyedgeflags="left" android:horizontalgap="1%p" /> <key android:codes="9" android:keylabel="2" android:horizontalgap="1%p" /> <key android:codes="1005" android:keylabel="f" android:horizontalgap="1%p" /> <key android:codes="1006" android:keylabel="g46" android:horizontalgap="1%p" /> <key android:codes="67" android:keylabel="delete" android:keyedgeflags="right" android:horizontalgap="1%p" /> </row> </keyboard>
Comments
Post a Comment