Attend XDA's Second Annual Developer Conference, XDA:DevCon 2014!
5,731,698 Members 49,159 Now Online
XDA Developers Android and Mobile Development Forum

[MOD] Add auto-correct to Samsung Keyboard and shorten long-press delay

Tip us?
 
eclipxe
Old
(Last edited by eclipxe; 11th January 2013 at 07:13 PM.)
#1  
Member - OP
Thanks Meter 84
Posts: 68
Join Date: Jan 2007
Lightbulb [MOD] Add auto-correct to Samsung Keyboard and shorten long-press delay

Hey all, this is my first mod, but it was driving me crazy that the stock samsung keyboard didn't support auto-correct - and the timeout delay was way too long.

I'm working on an auto-patcher in the next couple of days.

EDIT:
I attached the APK: /system/app/
Make sure to set the proper permissions, then reboot.

The code changed is below

Here's a first stab at fixing both, would love some feedback.

1. To change the long press delay
In PointerTracker:
Code:
        ###################################################
	# Change the long press delay to 200ms from 500ms #
	###################################################
    .line 498
    const/16 v0, 0xc8

    .line 499
    .local v0, delay:I
    packed-switch p1, :pswitch_data_0

    .line 504
    const/16 v0, 0xc8

    .line 507
    :goto_0
    int-to-long v1, v0

    return-wide v1

    .line 501
    :pswitch_0
    const/16 v0, 0xc8
2. To add auto-correct

In SwiftkeyQwertyLatinInputModule
Code:
    .line 312
    :cond_3
	
	##################################################
	# Add support for auto-correct on word separator # 
	##################################################
	#check if the user has entered text
    iget-object v7, p0, Lcom/diotek/ime/framework/input/AbstractInputModule;->mComposing:Ljava/lang/StringBuilder;
    invoke-virtual {v7}, Ljava/lang/StringBuilder;->length()I
    move-result v7
    if-lez v7, :cond_10
	
    iget-object v7, p0, Lcom/diotek/ime/framework/input/AbstractInputModule;->mEngineManager:Lcom/diotek/ime/framework/engine/InputEngineManager;
    iget-object v8, p0, Lcom/diotek/ime/framework/input/AbstractInputModule;->mComposing:Ljava/lang/StringBuilder;
    invoke-interface {v7, v8, v9}, Lcom/diotek/ime/framework/engine/InputEngineManager;->getCharSequence(Ljava/lang/StringBuilder;I)I
	invoke-virtual {p0}, Lcom/diotek/ime/framework/input/SwiftkeyQwertyLatinInputModule;->updateSuggestion()V
	invoke-virtual {p0}, Lcom/diotek/ime/framework/input/SwiftkeyQwertyLatinInputModule;->setComposingText()V
	##################################################
	# End support for auto-correct on word separator #
	##################################################

   #move clearCandidateList from beginning of processWordSeparator to after we do correct
   :cond_10
    invoke-virtual {p0}, Lcom/diotek/ime/framework/input/SwiftkeyQwertyLatinInputModule;->clearCandidateList()V
	
   #code below is not changed - just for reference	
    iget-object v7, p0, Lcom/diotek/ime/framework/input/AbstractInputModule;->mEngineManager:Lcom/diotek/ime/framework/engine/InputEngineManager;

    iget-object v8, p0, Lcom/diotek/ime/framework/input/AbstractInputModule;->mCandidates:Ljava/util/ArrayList;

    invoke-interface {v7, v8}, Lcom/diotek/ime/framework/engine/InputEngineManager;->getSuggestion(Ljava/util/ArrayList;)I

    .line 313
Attached Files
File Type: apk SamsungIME.apk - [Click for QR Code] (6.54 MB, 1826 views)
The Following 35 Users Say Thank You to eclipxe For This Useful Post: [ Click to Expand ]
 
brooon
Old
#2  
brooon's Avatar
Senior Member
Thanks Meter 138
Posts: 748
Join Date: May 2009
Looks very promising! As I donīt know where to add the code, Iīm patiently waiting for your patcher!
 
MohJee
Old
#3  
Senior Member
Thanks Meter 256
Posts: 644
Join Date: Nov 2012
Looking forward for patcher or flashable zip... Thank you for sharing
 
devynbf
Old
#5  
devynbf's Avatar
Senior Member
Thanks Meter 283
Posts: 897
Join Date: Oct 2012
Would love to see a flashable mod here, thanks

Sent from a potato.
 
ultra74
Old
(Last edited by ultra74; 11th January 2013 at 03:18 PM.)
#6  
Member
Thanks Meter 5
Posts: 36
Join Date: Feb 2010
This would be awesome as an "Xposed" framework apk. No need to bake into other roms.

Not sure if you have seen the below link.

http://forum.xda-developers.com/show....php?t=1574401

Here are some other examples of "patches". I'm using this on stock rooted.

Multiwindow apk:
http://forum.xda-developers.com/show....php?t=2048668

Per App DPI apk:
http://forum.xda-developers.com/show....php?t=2067303
EVO4G003
Note2
 
eclipxe
Old
#7  
Member - OP
Thanks Meter 84
Posts: 68
Join Date: Jan 2007
Yeah! I actually originally started by trying Xposed - in fact, I'll send you the Xposed module I built for changing the timeout delay - it didn't work though! I might have followed an outdated tutorial, but I kept banging my head against the wall trying to get Xposed to work, when it was just a simple smali change.

For the auto-correct, I'm not entirely sure how I would do it in exposed. I don't want to necessarily replace a method, I need to hook in at a precise execution point. How would I do that?

Quote:
Originally Posted by ultra74 View Post
This would be awesome as an "Xposed" framework apk. No need to bake into other roms.

Not sure if you have seen the below link.

http://forum.xda-developers.com/show....php?t=1574401

Here are some other examples of "patches". I'm using this on stock rooted.

Multiwindow apk:
http://forum.xda-developers.com/show....php?t=2048668

Per App DPI apk:
http://forum.xda-developers.com/show....php?t=2067303
 
samevo
Old
#8  
samevo's Avatar
Senior Member
Thanks Meter 72
Posts: 118
Join Date: Jun 2011
Location: Boise
I cant wait to try this out. Samsung innovated so much with this phone its a shame they couldnt add this in too.

Past phones: HTC Dash, HTC Evo 4g, HTC Evo 4g LTE, Samsung Galaxy s3
Current: Samsung Galaxy Note II
 
ultra74
Old
#9  
Member
Thanks Meter 5
Posts: 36
Join Date: Feb 2010
Quote:
Originally Posted by eclipxe View Post
Yeah! I actually originally started by trying Xposed - in fact, I'll send you the Xposed module I built for changing the timeout delay - it didn't work though! I might have followed an outdated tutorial, but I kept banging my head against the wall trying to get Xposed to work, when it was just a simple smali change.

For the auto-correct, I'm not entirely sure how I would do it in exposed. I don't want to necessarily replace a method, I need to hook in at a precise execution point. How would I do that?
That would be cool. I'm just a noob programmer, but I would like to take a look at what you have and see what I can do.

Thanks!
EVO4G003
Note2
 
eclipxe
Old
(Last edited by eclipxe; 11th January 2013 at 07:12 PM.)
#10  
Member - OP
Thanks Meter 84
Posts: 68
Join Date: Jan 2007
Quote:
Originally Posted by zkyevolved View Post
Or even an APK that can be installed as a keyboard itself for the people that aren't Rooted :$
I uploaded the APK - give it a try and let me know how it works for you guys. Open to suggestions. Also working on the patcher in case you wanted to customize it.

The Following User Says Thank You to eclipxe For This Useful Post: [ Click to Expand ]
Tags
keyboard, mod
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes