The keyboard height issue (revisited)

Thank you so much! This works for ios. This does not work for Android :frowning: For iOS, the height indicates when the keyboard is already hidden.It would be nice if the height was shown only when the keyboard is shown or to make the function of determining the keyboard state. If the height is greater than 0, then the keyboard is shown, if it is 0, then The keyboard is hidden.

For Android and iOS

CoronaWindowMovesWhenKeyboardAppears = true

Another request - can I make a setting to turn off the Bluetooth permission request for iOS

This should be fixed, please wait an hour. Added the abilty to turn off bluetooh checking

moreInfo.init(disableBluetoothChecking)

 

disableBluetoothChecking(boolean) (iOS only)

Thank you so much! I will wait for the fix.

It has been three hours, changes should be implemented

Now the Android works, but iOS does not work :frowning:

Permission for a bluetooth is no asked. Thanks for this!)

The android shows the wrong height of the keyboard when the keyboard is hidden. At me for example 615px when the keyboard is hidden and 393px when the keyboard is shown.

Yeah the keyboard height and width only works when keyboard is shown. There is a problem with end events on iOS and android. I patched iOS bug.

Edit: so that’s why I cannot set values 0, native textboxes and test fields have event listeners so I recommend that. I don’t know exactly why the keyboard hide phase is not working in native code.

Thank you so much! Now works for Android and IOS. All perfectly!

And can I not ask for permission when installing on Android with disableBluetoothChecking = false? I’m sorry that I did not write about it at once.

Bluetooth permission removed.  

Thank you!  :slight_smile:

You can put all display objects in a scroll view & scroll up/down at keypad active event.
 

I am a little bit shady on what you mean. Add a user input event to the TextBox and as soon as the TextBox gets in focus I scroll the ScrollView to a vertical center position? I can not see how this could make it possible to implement the UI design I attached to my initial message. I may completely misunderstand what you mean though. :slight_smile:

Another way could be to redesign the UI to use a ScrollView for the complete scene and put the TextBox as its bottom part (under any attached images and action buttons). The bottom part of the TextBox would be hidden by the keyboard whenever the keyboard appears. The top part of the TextBox would be visible though. The user starts to write into the TextBox and when the text eventually goes behind/below the keyboard it’s up to the user to scroll. This would not require any user input event handlers but the UX would (may) be a bit strange. The UI design used for this would not look as my UI mate planned for but rather as seen in this link:

https://drive.google.com/open?id=0BwgAXmsq27k2aGJMekplWWpWMEk

Hmm

Any thoughts about that?

Hi,

I solved this with a native Java plugin for Android which calculates the available vertical space above the keyboard. I will do something similar for iOS later (my immediate need is to conclude an Android prototype).

With this plugin I can achieve the exact layout I want above the keyboard.

A main.lua example:

display.setStatusBar(display.HiddenStatusBar) local \_W = display.contentWidth local dummyTextField = native.newTextField(-20, -20, 10, 10) native.setKeyboardFocus(dummyTextField) local function render()   dummyTextField:removeSelf()   local spaceAboveKeyboard = SpaceAboveKeyboard.calculate()   local textBox =     native.newTextBox(\_W / 2, spaceAboveKeyboard / 2, \_W, spaceAboveKeyboard)   textBox.isEditable = true   native.setKeyboardFocus(textBox) end timer.performWithDelay(1000, render)

I updated android/app/src/main/AndroidManifest.xml like this:

$ svn diff android/app/src/main/AndroidManifest.xml Index: android/app/src/main/AndroidManifest.xml =================================================================== --- android/app/src/main/AndroidManifest.xml&nbsp;&nbsp; &nbsp;(revision 598) +++ android/app/src/main/AndroidManifest.xml&nbsp;&nbsp; &nbsp;(working copy) @@ -41,6 +41,7 @@ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \<action android:name="android.intent.action.MAIN" /\> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \<category android:name="android.intent.category.LAUNCHER" /\> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \</intent-filter\> +&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \<meta-data android:name="coronaWindowMovesWhenKeyboardAppears" android:value="true"/\> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \</activity\>

I updated android/app/src/main/java/com/mycompany/app/CoronaApplication.java like this:

$ svn diff android/app/src/main/java/com/mycompany/app/CoronaApplication.java Index: android/app/src/main/java/com/mycompany/app/CoronaApplication.java =================================================================== --- android/app/src/main/java/com/mycompany/app/CoronaApplication.java&nbsp;&nbsp; &nbsp;(revision 598) +++ android/app/src/main/java/com/mycompany/app/CoronaApplication.java&nbsp;&nbsp; &nbsp;(working copy) @@ -29,14 +29,20 @@ &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;@Override &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;public void onLoaded(com.ansca.corona.CoronaRuntime runtime) { +&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; com.naef.jnlua.NamedJavaFunction[] luaFunctions; +&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; com.naef.jnlua.LuaState luaState = runtime.getLuaState(); +&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; luaFunctions = new com.naef.jnlua.NamedJavaFunction[] { +&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; new SpaceAboveKeyboard() +&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }; +&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; luaState.register("SpaceAboveKeyboard", luaFunctions); +&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; luaState.pop(1); &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; } &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;/\*\*

SpaceAboveKeyboard.java looks like this:

package com.mycompany.app; import android.app.Activity; import android.graphics.Rect; import android.view.View; public class SpaceAboveKeyboard implements com.naef.jnlua.NamedJavaFunction { &nbsp;&nbsp;&nbsp; public String getName() { &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return "calculate"; &nbsp;&nbsp;&nbsp; } &nbsp;&nbsp;&nbsp; public int invoke(com.naef.jnlua.LuaState luaState) { &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; com.ansca.corona.CoronaActivity activity = &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; com.ansca.corona.CoronaEnvironment.getCoronaActivity(); &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (activity == null) &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return 1; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Rect r = new Rect(); &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; View rootview = activity.getWindow().getDecorView(); &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; rootview.getWindowVisibleDisplayFrame(r); &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; luaState.pushInteger(r.height()); &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return 1; &nbsp;&nbsp;&nbsp; } }

Cheers

/Joakim

Hi @joagre,

Would you be able/willing to release and expose this plugin to the Corona Marketplace for other developers to take advantage of?

Best regards,

Brent

That would be great.

I will give it a shot.

That would be cool. A plugin is very needed

Working on it for more info

Thank you!

added to moreinfo plugin

https://scotth.tech/plugin-moreInfo