I developed a hexeditor to change the contents of hex-files. During the work I found that editing a hex-file by using the standard-softkeyboard is horrible. So I decided to write a library for an own softkeyboard. This library needs at least API-level-15
Good for understanding how it works is a posting of Maarten Fampennings which you can find here.
Also useful is a guide on the xda-developers-page. You'll find it here.
After a lot of pitfalls I got it working and can share it now. Because I don't have much sparetime I can't give much support.
With this CustomKeyboard-library you can replace the standard-softkeyboard with your self-designed-CustomKeyboard. You can use different keyboards and also different styles (see example 3). You also can have popup-minikeyboards for keys with more than one value. Have a good look in the 3 included examples and into the xml-files of the example-projects. Each method have an online-explanation of it's use included. You can add the EditTextView which you want to use with the CustomKeyboard by designer or with xml-file. The only difference between the two methods is that if you use the xml-method you can implement your owen full styling (textSelectHandle for example). If you use the designer-method you always get the standard styling from B4A. You can register as much EditTextViews as you like for each CustomKeyboard.
Declare just one CustomKeyboard-instance in your activity and use the RegisterEditText, ChangeKeyboardLayout/ChangeKeyboardStyle-methods to switch between different keyboards and styles (see example 3).
HOW TO USE:
a)
b)
SUPPORTED EVENTS:
Keyboard related:
This events are all self-explanatory. You can catch the EditTextView which fired the event via the ViewTag (see example2)
EditText related:
AVAILABLE METHODS:
Good for understanding how it works is a posting of Maarten Fampennings which you can find here.
Also useful is a guide on the xda-developers-page. You'll find it here.
After a lot of pitfalls I got it working and can share it now. Because I don't have much sparetime I can't give much support.
With this CustomKeyboard-library you can replace the standard-softkeyboard with your self-designed-CustomKeyboard. You can use different keyboards and also different styles (see example 3). You also can have popup-minikeyboards for keys with more than one value. Have a good look in the 3 included examples and into the xml-files of the example-projects. Each method have an online-explanation of it's use included. You can add the EditTextView which you want to use with the CustomKeyboard by designer or with xml-file. The only difference between the two methods is that if you use the xml-method you can implement your owen full styling (textSelectHandle for example). If you use the designer-method you always get the standard styling from B4A. You can register as much EditTextViews as you like for each CustomKeyboard.
Declare just one CustomKeyboard-instance in your activity and use the RegisterEditText, ChangeKeyboardLayout/ChangeKeyboardStyle-methods to switch between different keyboards and styles (see example 3).
HOW TO USE:
- put the CustomKeyboard.jar-file and the CustomKeyboard.xml-file into your AdditionalLibraries-folder
- put the xml-file for the KeyboardView into the layout-folder of your project and mark it as writeprotected
- put the xml-file(s) for the KeyboardLayout(s) into the xml-folder of your project and mark them as writeprotected
- put all the drawables you used in the KeyboardLayout into the drawable-folder(s) of your project and mark them as writeprotected
- put all your styling xml-files (if any) into the values-folder of your project and mark them as writeprotected
- from now chose version a) (add EditTextView by designer) or version b) (add EditTextView by xml)
a)
- place an EditTextView in the designer
- in Activity_Create-sub load the designer-created layout-file into your Activity
- initialize your CustomKeyboard with the Initialize-method of CustomKeyboard
- register your EditTextView with the RegisterEditText-method of CustomKeyboard
b)
- create an xml-file with an EditTextView, load it into the layout-folder of your project and mark it as writeprotected
- in Activity_Create-sub load the designer-created layout-file into your Activity (if any)
- with XmlLayoutBuilder load the EditTextView-xml-file into your Activity or any Panel
- get the EditTextView with the GetAllViewsRecursive-method of XmlLayoutBuilder, remove it from parent and add again with layoutvalues
- initialize your CustomKeyboard with the Initialize-method of CustomKeyboard
- register your EditTextView with the RegisterEditText-method of CustomKeyboard
SUPPORTED EVENTS:
Keyboard related:
- KeyboardEventName_KeyboardHeightChanged(NewHeight As Int, OldHeight As Int)
- KeyboardEventName_onKeyUp(ViewTag As Object, PrimaryKeyCode As Int)
- KeyboardEventName_KeyPressed (ViewTag As Object, PrimaryKeyCode As Int, AddKeyCodes() As Int) As Boolean
- KeyboardEventName_onKeyDown(ViewTag As Object, PrimaryKeyCode As Int)
This events are all self-explanatory. You can catch the EditTextView which fired the event via the ViewTag (see example2)
EditText related:
- eventName_Touch (Action As Int, X As Float, Y As Float, MotionEvent As Object) As Boolean, fires if the registered EditText is touched by the user
- eventName_FocusChanged (HasFocus As Boolean), fires if the registered EditText gets or looses focus
- eventName_Click(), fires if the registered EditText is clicked by the user
- eventName_TextChanged (Old As String, New As String), fires if the text of the registered EditText has changed
- eventName_HandleAction() As Boolean, fires if the CustomKeyboard of the registered EditText contains an Enter-key and this is pressed
AVAILABLE METHODS:
- IsOScompatible () As Boolean
- Initialize (KeyboardEventName As String, KeyboardViewFileName As String)
- IsIntialized () As Boolean
- RegisterEditText (editTextView As EditText, eventName As String, KeyboardLayoutFileName As String, showCursor As Boolean) As Boolean
- UnregisterEditText (et As EditText) As Boolean
- GetRegisteredStatus (et As EditText) As String
- SetCustomFilter (et As EditText, DefaultInputType As Integer, AcceptedCharacters As String)
- SetLengthFilter (et As EditText, MaxLength As Integer)
- ShowKeyboard (et As EditText)
- HideKeyboard ()
- IsSoftKeyboardVisible () As Boolean
- GetCurKeyboardStyle () As String
- GetCurLayoutFile () As String
- ChangeKeyboardLayout (et As EditText, KeyboardLayoutFileName As String) As Boolean
- ChangeKeyboardStyle (KeyboardViewFileName As String) As Boolean
- ChangeKeyValues (OldLabel As String, OldIsIcon As Boolean, NewLabel As String, NewIsIcon As Boolean, NewCodes() As Integer) As Boolean
- ShowPreviewPopup (show As Boolean)
- IsPreviewEnabled () As Boolean
- SetHapticFeedbackEnabled (boolean goEnabled)
- IsHapticFeedbackEnabled () As Boolean
- SetShifted (goShifted As Boolean)
- IsShifted () As Boolean
- HandleBack () As Boolean
- GetSelectionStart (et As EditText) As Integer
- GetSelectionEnd (et As EditText) As Integer
- SetSelection (et As EditText, start As Integer, stop As Integer)
- DeleteSelection (et As EditText)
- ExtendSelection (et As EditText, toIndex As Integer)
- InsertText (et As EditText, text As String, startIndex As Integer) As Boolean
Attachments
Last edited: