Clam- / TraditionalT9

T9 English IME input for Android using hardware keypad. I am no longer updating this project. You may wish to try out sspanak's fork here: https://github.com/sspanak/tt9
Other
59 stars 46 forks source link

Add support for Ukrainian layout and edit French layout #18

Closed iaros closed 7 years ago

iaros commented 7 years ago

Hello,

I added basic support for the Ukrainian layout (I do not have a dictionary for it yet).

And edited French layout (some letters were missing, and others do not exist in French). I also moved the letters with diacritics in the French layout after the numeral. As far as i remember such was the layout in old phones.

Please consider adding this to your code.

Regards, iaros

P.S. Sorry for weird changes in formatting, my code editor made this...

Clam- commented 7 years ago

Hi,

Awesome work. If you can change your editor settings to use tabs instead of spaces it'll make it easier to go over the diffs. Most things are fine, but when comparing the larger files, the entire file is modified so I can't see exactly what has changed. Sorry about the trouble, and thank you for going to the effort. If you want help on changing your editor settings simply let me know what editor you use and I'll let you know how to do it :)

Thanks again.

iaros commented 7 years ago

Hi,

I am currently using Java-Editor (http://www.javaeditor.org/doku.php?id=start), but it also discards characters with diacrytics, so I am not so pleased with it.
If you can help me with it (or suggest me another lightweight editor with syntax highlight) it would be nice...

iaros commented 7 years ago

I would also like to add the Ukrainian dictionary from here but I do not understand how to make it compatible. If I just add the relevant file renamed to uk-utf8.txt, TraditionalT9 crashes on loading it.

Clam- commented 7 years ago

Opening the file with Notepad++ suggests that the file is "UCS-2 LE BOM". From memory I only specifically handle UTF-8 files, so you might want to try converting that dictionary file to UTF-8 (Notepad++ should be able to do that for you).

Regarding editors, probably the lightest weight editor with syntax highlighting would be SciTe. But that's just an editor and not an IDE (the latter featuring things such as auto-completion).

Clam- commented 7 years ago

Awesome. Thanks so much for restoring the tabs. I'll review this over the weekend and hopefully get back to doing some development work.

Thanks for your contributions.

iaros commented 7 years ago

You are welcome! Also fixed some more stuff I broke ...

iaros commented 7 years ago

The dictionary even converted to UTF-8 crashes the app. Could you please investigate? Regards, iaros

Clam- commented 7 years ago

Do you have a logcat sample you are able to provide of the crash? (adb logcat)

iaros commented 7 years ago

`I/ActivityManager( 489): Starting: Intent { act=android.intent.action.MAIN cmp=com.android.settings/.LanguageSettings } from pid 8328

W/ActivityManager( 489): Unable to start service Intent { act=jp.co.sharp.android.lifelog.database.service.LifeLogService.insert (has extras) }: not found

I/ActivityManager( 489): Displayed com.android.settings/.LanguageSettings: +137ms

I/ActivityManager( 489): Starting: Intent { act=android.intent.action.MAIN cmp=org.nyanya.android.traditionalt9/.TraditionalT9Settings } from pid 8328

W/IInputConnectionWrapper( 8115): showStatusIcon on inactive InputConnection

I/ActivityManager( 489): Displayed org.nyanya.android.traditionalt9/.TraditionalT9Settings: +186ms

W/InputManagerService( 489): Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy@40994530

D/doInBackground( 8115): Adding characters...

W/dalvikvm( 8115): threadid=8: thread exiting with uncaught exception (group=0x4002d560)

E/AndroidRuntime( 8115): FATAL EXCEPTION: AsyncTask #1

E/AndroidRuntime( 8115): java.lang.RuntimeException: An error occured while executing doInBackground()

E/AndroidRuntime( 8115): at android.os.AsyncTask$3.done(AsyncTask.java:200)

E/AndroidRuntime( 8115): at java.util.concurrent.FutureTask$Sync.innerSetException(FutureTask.java:274)

E/AndroidRuntime( 8115): at java.util.concurrent.FutureTask.setException(FutureTask.java:125)

E/AndroidRuntime( 8115): at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:308)

E/AndroidRuntime( 8115): at java.util.concurrent.FutureTask.run(FutureTask.java:138)

E/AndroidRuntime( 8115): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1088)

E/AndroidRuntime( 8115): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:581)

E/AndroidRuntime( 8115): at java.lang.Thread.run(Thread.java:1019)

E/AndroidRuntime( 8115): Caused by: java.lang.IndexOutOfBoundsException: Invalid index 5, size is 5

E/AndroidRuntime( 8115): at java.util.ArrayList.throwIndexOutOfBoundsException(ArrayList.java:257)

E/AndroidRuntime( 8115): at java.util.ArrayList.get(ArrayList.java:311)

E/AndroidRuntime( 8115): at org.nyanya.android.traditionalt9.TraditionalT9Settings$LoadDictTask.processChars(TraditionalT9Settings.java:335)

E/AndroidRuntime( 8115): at org.nyanya.android.traditionalt9.TraditionalT9Settings$LoadDictTask.doInBackground(TraditionalT9Settings.java:248)

E/AndroidRuntime( 8115): at org.nyanya.android.traditionalt9.TraditionalT9Settings$LoadDictTask.doInBackground(TraditionalT9Settings.java:137)

E/AndroidRuntime( 8115): at android.os.AsyncTask$2.call(AsyncTask.java:185)

E/AndroidRuntime( 8115): at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:306)

E/AndroidRuntime( 8115): ... 4 more

W/ActivityManager( 489): Force finishing activity org.nyanya.android.traditionalt9/.TraditionalT9Settings

W/InputManagerService( 489): Starting input on non-focused client com.android.internal.view.IInputMethodClient$Stub$Proxy@4087c588 (uid=10125 pid=8115)

E/WindowManager( 8115): Activity org.nyanya.android.traditionalt9.TraditionalT9Settings has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView@405c3be8 that was originally added here

E/WindowManager( 8115): android.view.WindowLeaked: Activity org.nyanya.android.traditionalt9.TraditionalT9Settings has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView@405c3be8 that was originally added here

E/WindowManager( 8115): at android.view.ViewRoot.(ViewRoot.java:262)

E/WindowManager( 8115): at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:148)

E/WindowManager( 8115): at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:91)

E/WindowManager( 8115): at android.view.Window$LocalWindowManager.addView(Window.java:424)

E/WindowManager( 8115): at android.app.Dialog.show(Dialog.java:247)

E/WindowManager( 8115): at org.nyanya.android.traditionalt9.TraditionalT9Settings$LoadDictTask.onPreExecute(TraditionalT9Settings.java:226)

E/WindowManager( 8115): at android.os.AsyncTask.execute(AsyncTask.java:391)

E/WindowManager( 8115): at org.nyanya.android.traditionalt9.TraditionalT9Settings.preloader(TraditionalT9Settings.java:746)

E/WindowManager( 8115): at org.nyanya.android.traditionalt9.TraditionalT9Settings.onListItemClick(TraditionalT9Settings.java:716)

E/WindowManager( 8115): at android.app.ListActivity$2.onItemClick(ListActivity.java:319)

E/WindowManager( 8115): at android.widget.AdapterView.performItemClick(AdapterView.java:284)

E/WindowManager( 8115): at android.widget.ListView.performItemClick(ListView.java:3648)

E/WindowManager( 8115): at android.widget.AbsListView$PerformClick.run(AbsListView.java:1938)

E/WindowManager( 8115): at android.os.Handler.handleCallback(Handler.java:587)

E/WindowManager( 8115): at android.os.Handler.dispatchMessage(Handler.java:92)

E/WindowManager( 8115): at android.os.Looper.loop(Looper.java:123)

E/WindowManager( 8115): at android.app.ActivityThread.main(ActivityThread.java:3753)

E/WindowManager( 8115): at java.lang.reflect.Method.invokeNative(Native Method)

E/WindowManager( 8115): at java.lang.reflect.Method.invoke(Method.java:507)

E/WindowManager( 8115): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:864)

E/WindowManager( 8115): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:622)

E/WindowManager( 8115): at dalvik.system.NativeStart.main(Native Method)

W/InputManagerService( 489): Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy@409e8120

I/ActivityManager( 489): Process org.nyanya.android.traditionalt9 (pid 8115) has died.

W/ActivityManager( 489): Service crashed 2 times, stopping: ServiceRecord{40a370f0 org.nyanya.android.traditionalt9/.TraditionalT9}

I/WindowManager( 489): WIN DEATH: Window{40bf2a28 InputMethod paused=false}

W/InputManagerService( 489): Session failed to close due to remote exception

W/InputManagerService( 489): android.os.DeadObjectException

W/InputManagerService( 489): at android.os.BinderProxy.transact(Native Method)

W/InputManagerService( 489): at com.android.internal.view.IInputMethodSession$Stub$Proxy.finishSession(IInputMethodSession.java:346)

W/InputManagerService( 489): at com.android.server.InputMethodManagerService.finishSession(InputMethodManagerService.java:901)

W/InputManagerService( 489): at com.android.server.InputMethodManagerService.clearCurMethodLocked(InputMethodManagerService.java:912)

W/InputManagerService( 489): at com.android.server.InputMethodManagerService.onServiceDisconnected(InputMethodManagerService.java:929)

W/InputManagerService( 489): at android.app.LoadedApk$ServiceDispatcher.doDeath(LoadedApk.java:1069)

W/InputManagerService( 489): at android.app.LoadedApk$ServiceDispatcher$RunConnection.run(LoadedApk.java:1083)

W/InputManagerService( 489): at android.os.Handler.handleCallback(Handler.java:587)

W/InputManagerService( 489): at android.os.Handler.dispatchMessage(Handler.java:92)

W/InputManagerService( 489): at android.os.Looper.loop(Looper.java:123)

W/InputManagerService( 489): at com.android.server.ServerThread.run(SystemServer.java:812)

W/InputManagerService( 489): Session failed to close due to remote exception

W/InputManagerService( 489): android.os.DeadObjectException

W/InputManagerService( 489): at android.os.BinderProxy.transact(Native Method)

W/InputManagerService( 489): at com.android.internal.view.IInputMethodSession$Stub$Proxy.finishSession(IInputMethodSession.java:346)

W/InputManagerService( 489): at com.android.server.InputMethodManagerService.finishSession(InputMethodManagerService.java:901)

W/InputManagerService( 489): at com.android.server.InputMethodManagerService.clearCurMethodLocked(InputMethodManagerService.java:912)

W/InputManagerService( 489): at com.android.server.InputMethodManagerService.onServiceDisconnected(InputMethodManagerService.java:929)

W/InputManagerService( 489): at android.app.LoadedApk$ServiceDispatcher.doDeath(LoadedApk.java:1069)

W/InputManagerService( 489): at android.app.LoadedApk$ServiceDispatcher$RunConnection.run(LoadedApk.java:1083)

W/InputManagerService( 489): at android.os.Handler.handleCallback(Handler.java:587)

W/InputManagerService( 489): at android.os.Handler.dispatchMessage(Handler.java:92)

W/InputManagerService( 489): at android.os.Looper.loop(Looper.java:123)

W/InputManagerService( 489): at com.android.server.ServerThread.run(SystemServer.java:812)

W/InputManagerService( 489): Session failed to close due to remote exception

W/InputManagerService( 489): android.os.DeadObjectException

W/InputManagerService( 489): at android.os.BinderProxy.transact(Native Method)

W/InputManagerService( 489): at com.android.internal.view.IInputMethodSession$Stub$Proxy.finishSession(IInputMethodSession.java:346)

W/InputManagerService( 489): at com.android.server.InputMethodManagerService.finishSession(InputMethodManagerService.java:901)

W/InputManagerService( 489): at com.android.server.InputMethodManagerService.clearCurMethodLocked(InputMethodManagerService.java:912)

W/InputManagerService( 489): at com.android.server.InputMethodManagerService.onServiceDisconnected(InputMethodManagerService.java:929)

W/InputManagerService( 489): at android.app.LoadedApk$ServiceDispatcher.doDeath(LoadedApk.java:1069)

W/InputManagerService( 489): at android.app.LoadedApk$ServiceDispatcher$RunConnection.run(LoadedApk.java:1083)

W/InputManagerService( 489): at android.os.Handler.handleCallback(Handler.java:587)

W/InputManagerService( 489): at android.os.Handler.dispatchMessage(Handler.java:92)

W/InputManagerService( 489): at android.os.Looper.loop(Looper.java:123)

W/InputManagerService( 489): at com.android.server.ServerThread.run(SystemServer.java:812)

W/InputManagerService( 489): Session failed to close due to remote exception

W/InputManagerService( 489): android.os.DeadObjectException

W/InputManagerService( 489): at android.os.BinderProxy.transact(Native Method)

W/InputManagerService( 489): at com.android.internal.view.IInputMethodSession$Stub$Proxy.finishSession(IInputMethodSession.java:346)

W/InputManagerService( 489): at com.android.server.InputMethodManagerService.finishSession(InputMethodManagerService.java:901)

W/InputManagerService( 489): at com.android.server.InputMethodManagerService.clearCurMethodLocked(InputMethodManagerService.java:916)

W/InputManagerService( 489): at com.android.server.InputMethodManagerService.onServiceDisconnected(InputMethodManagerService.java:929)

W/InputManagerService( 489): at android.app.LoadedApk$ServiceDispatcher.doDeath(LoadedApk.java:1069)

W/InputManagerService( 489): at android.app.LoadedApk$ServiceDispatcher$RunConnection.run(LoadedApk.java:1083)

W/InputManagerService( 489): at android.os.Handler.handleCallback(Handler.java:587)

W/InputManagerService( 489): at android.os.Handler.dispatchMessage(Handler.java:92)

W/InputManagerService( 489): at android.os.Looper.loop(Looper.java:123)

W/InputManagerService( 489): at com.android.server.ServerThread.run(SystemServer.java:812)`

Clam- commented 7 years ago

Sorry for the delay. I've had a look at the exception log, and it looks like you haven't put a CHARTABLE entry in here: https://github.com/iaros/TraditionalT9/blob/7e8ffd88b07366d0e8d255d2feae18d4932ba730/src/org/nyanya/android/traditionalt9/CharMap.java#L86

Even though you've added entries to the ruMap on line 77, you haven't actually added the ruMap in to a new slot for your uk language. The CHARTABLE is a mapping from character to "numpad digit" for reverse lookup when adding words to the database.

So you probably just need a: CHARTABLE.add(5, Collections.unmodifiableMap(ruMap));

iaros commented 7 years ago

Thank you for the support. I added the relevant string and now the dictionary loads. There were also two extraneous words in it, which I removed, and now it loaded in the database. I will make some field use of this stuff, to be sure no other errors pop somewhere.

iaros commented 7 years ago

Ok, should be fine now. Yet better to find a GPL wordlist, of course. Tested for some time - "worksforme", at least.

iaros commented 7 years ago

[OFF] Somebody wants Spanish here: https://forum.xda-developers.com/showpost.php?p=71210904&postcount=57.

iaros commented 7 years ago

Please disregard the changes after the Spanish request. I merged my branches in the wrong direction...

iaros commented 7 years ago

I will probably make a new clean pull request.