Dear Tsukishiro,
Let me start with the bottom line which are
1. You need to have your own KeyboardView.
    - Either extend from Android KeyboardView or make your own based
on Android KeyboardView.
    - For example
http://grepcode.com/file/repository.grepcode.com/java/ext/com.google.android/android/4.0.3_r1/android/inputmethodservice/KeyboardView.java#KeyboardView

2. Intercept GestureDetector.onTouchEvent(me) in the onTouchEvent()
    - You need to grab the x, y of the ACTION_DOWN and identify which
key is actually pressed (before swiping)

3. Distinguish keyboard-level swipe and key-level swipe using your own
method
    (Mine uses the swipe distance. Short = key-level, Long=keyboard-
level)

To actually implement your own view, you will need to tell the OS you
want to use your (keyboard) view instead
    - Check out the method onCreateInputView()
    - Don't forget to edit the xml/input.xml  and change the class
name from Android KeyboardView to yours.
      (Mine is
      <com.solution9420.android.thaikeyboard9420.ThaiKeyboardViewNew
            xmlns:android="http://schemas.android.com/apk/res/android";
            android:id="@+id/keyboard"
            android:layout_alignParentBottom="true"
            ....
            ....


I started by study the Android KeyboardView code.
In summary, there are two main portions
a. the drawing part - look into onDraw()   but you can skip this part
for now.
b. Input capturing part
    - the main logic is at  onTouchEvent() and
GestureDetector.onTouchEvent(me)
    - also this important one.  detectAndSendKey()

Once you reach step #2, you can then start to dump out the x,y of the
actions you do on the keyboard.

Cheers,
Solution 9420


On Mar 14, 8:42 am, tsukishiro yamazaki <[email protected]>
wrote:
> Hello again Solution 9420,
>
> I just downloaded the 9420 Tablet Keyboard to my device and had a taste of
> your IME. It's nice and swiping clearly works. For example, swipeRight
> changes keyboard type between English and Thai. But I'm afraid I was not
> able to find a way to check Key-level fling. So can you help me with the
> following questions :
>
> 1.) How did you enable swiping on the keyboard?
> 2.) How to enable key-level fling? Example, if I fling a key upwards, a
> different character will be printed.
>
> Hoping for your guidance.
> Thanks and best regards,
> - tsukishiro
>
>
>
>
>
>
>
> On Wednesday, March 14, 2012 9:34:16 AM UTC+9, tsukishiro yamazaki wrote:
>
> > Hi Solution 9420,
>
> > Thanks so much for your reply! I have been trying SoftKeyboard (Demo API)
> > and I wanted to verify if the method swipeLeft(), which has been
> > implemented to do backspace or delete function, is actually working. So I
> > deployed SoftKeyboard.apk to my device and have been swiping my finger on
> > the keyboard. But as I mentioned above, all I get is a bunch of letters
> > being printed out because of the "swipe: motion over the row of keys.
>
> > I will check your application to see how you made swiping and especially
> > key-level fling (I really wanted to implement this on my IME too) to work.
> > Thank you again and best regards,
>
> > P.S. Your English is perfectly fine and understandable :)
>
> > On Tuesday, March 13, 2012 6:39:40 PM UTC+9, Solution 9420 wrote:
>
> >> Hi there,
> >> I am the creator of 9420 Tablet Keyboard (and 9420 Thai Keyboard).
> >> Pretty much familiar with this matter.
> >> For swipe, you can only trap the outcome of the swipe thru the method
> >> swipeDown/Left/Up/Right() and it is the swipe at keyboard level. You
> >> can change the action of the swipe, for example, from delete to
> >> anything else).
> >> If you want to trap the MotionEvent, you will need to create your own
> >> keyboardView.
> >> That way, you can implement anything you want such as  key-level
> >> flingUp.
>
> >> I'm poor on English. Please check out my application.
> >> It supports
> >> - configurable keyboard-level swipe
> >> - Key-level fling
> >> - MultiTap
> >> - LongPress
> >> All are done thru custom keyboard view.
> >> Seewww.solution9420.com
>
> >> Cheers,
> >> Solution 9420
>
> >> On Mar 13, 3:57 pm, tsukishiro yamazaki <[email protected]>
> >> wrote:
> >> > Hello everyone,
>
> >> > I wanted to implement swiping for the custom IME I am developing.
> >> Looking
> >> > into SoftKeyboard sample code, it seems this can be handled by the
> >> swipe
> >> > methods under OnKeyboardActionListener. However when I tried to test if
> >> the
> >> > swipe methods in SoftKeyboard were working, I found myself having a
> >> hard
> >> > time catching the event. For example, swipeLeft() method in
> >> SoftKeyboard
> >> > will perform a backspace. But I never get to pull this off. I usually
> >> just
> >> > get some random letters being printed out to the input field whenever I
> >> do
> >> > swipe left aciton.
>
> >> > Can someone tell me how to get swipe methods to work?
> >> > Thanks and best regards,
> >> > - tsukishiro

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to