qt/qml android virtual keyboard z pozition - android

I met the trouble with which I cant deal. I need to place the qml component (for example the Rectangle) above the native android soft keyboard. Is it real to do so?

I think you can't change z of keyboard, because keyboard and your application are different apps, but you can disable it. Because lack of code in your question, I can guess that you have TextFiled, you can set it to readonly property.
Also you can check state of the keyboard and hide it, when it shows, but I'd not recommended this method

Related

UI Automator with custom keyboard. Find exact keyboard button and click it

I'm trying to write UI automation tests for the custom soft keyboard using UI Automator and\or Espresso. Tried different ways but I can't find a proper solution to "find the exact button on the opened keyboard and click it".
Problems:
UIAtomator's UiDevice.findObject(By.text("Q")).click() doesn't find Q button on keyboard.
Espresso's onView(withText("Q")).perform(click()) doesn't find the button either.
For now, it looks like the only way to click button is to measure XY coordinates based on screen height and keyboard height. But this solution is ugly and not persistent.
typeText("text")and uiObject.text = "text" don't work since it bypasses keyboard input.
Was anyone working with custom keyboards? Please help.
Since you're building a custom soft keyboard then I expect you're using a KeyboardView. KeyboardView draws the keys using a canvas therefore it is not possible to get the resource ids of the keys... so no chance to find them through the UiDevice's findObject method.
Considering the KeyboardView class is deprecated since API 29, a possible solution will be to reimplement your own KeyboardView (as suggested here) and use AccessibilityNodeInfo class to build virtual elements (one for each key) that will be included into the view hierarchy.
The best solution in my opinion would be to create your own TCP server to solve this issue. Please refer to this link to find out how: https://ops.tips/blog/a-tcp-server-in-c/

CSS styling for different devices & Android soft input

I'm using PhoneGap and JQueryMobile to create a mobile app that I want to deploy to both iOS and Android. The app is simple, and just consists of 3 bars: A header/search bar, a second bar (displays the results of the search), and the remaining screen is a that the user can write in.
Because I want to code my layout to look the same for the greatest # of devices, I've written my CSS for the layout of the app in %'s. Header is 6%, Second bar is 14%, ect. This appears to work decently for the devices I've tested for so far. I ran into an issue where the Android keyboard would squish the viewport height and therefore my layout. So I set the keyboard to resizePan and that solved the squishing issue. However now the bottom of the is not visible until the user closes the keyboard.
In the questions I've seen about that issue, the solution is to swap to "adjustResize" so that the user can scroll when the keyboard is active. I can't do this, because I want to avoid the layout-squish issue.
Is there a way to fix this without having to re-write the CSS? If I HAVE to re-write the CSS, how should I code the layout to look consistent on multiple devices? Do I have to use an extensive list of media queries for all possible devices?
Note: This isn't an issue for ios, because the soft-input keyobard overlays the textarea (like adjustPan) but still allows the user to scroll down and up to parts of the document outside of the view or covered by the keyboard.

How to kill the softkeyboard from flash player

I needed a way to invoke softkeyboard in android platforms, and i got to know how to do it form here Flash APIs for Android Platform. Now i need to kill the keyboard, basically there is a button which i want to use to toggle the keyboard. Flash has provided a way to invoke the keyboard but not to kill it.(never understood how they work). One more issue is that when i click the down button on softkeyboard which is located on bottom left of the screen, the Softkeyboard_Deactivate event is not fired. It seems its fired only when the focus shifts from one object to another.
So what should be done ?
OK so it seems if you just set the "stage.focus = null" it will lower the keyboard. It came out of the blue to me to try this and worked like a charm.
Im not sure if this will work and this is a bit of a hack but on the hide button click you could set focus to an off screen textfield which has its needsSoftKeyboard property set to false.
I dont have an android phone so im unable to test that this works from here.

"adjustResize" Android

I have an app that runs fullscreen by using:
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);
Because of this the layout, android:windowSoftInputMode="adjustResize" is not working properly, i.e. it dose not resize.
Is there any way to get over the problem?
FYI: This is an existing AOSP (Android Open Source Project) bug: http://code.google.com/p/android/issues/detail?id=5497
Ideally this bug would be fixed, but until then here are a couple thoughts of how it could be worked around. Since I have no idea what application scenario this pertains to, these may not be very applicable.
In agreement with my best interpretation of the previous answer, design your layout so that adjustPan works ok with it. The first thing I can think of here is not having any headers or footers that are intended to remain on screen when the keyboard is up.
Don't use FLAG_FULLSCREEN with a layout that can accept text input. Possibly it wouldn't be a big deal to show the status bar when accepting input. However, for something that views content with embedded input fields (like a web browser) that has a fullscreen mode, this doesn't make much sense at all.
Implement adjustResize-like behavior of your own. I'm not sure how well this would work, but possibly you could write a subclass of whichever class is causing the keyboard to be shown (ex: EditText) where you either track when the keyboard is shown or take over the calls to show and hide the keyboard (overriding at least onKeyUp and onTouchEvent). When shown, resize your content - possibly with a best guess of the softinput height, since users can install different soft input methods. I believe this would be technically difficult and not reasonable to attempt without extreme need.
Instead of android:windowSoftInputMode="adjustResize" you can try with android:windowSoftInputMode="adjustPan"

How does an Android app load a keyboard?

I need to bring up a few different keyboards: a 'standard' keyboard with Ctrl and Alt keys; maybe a cursor pad; and so on.
I have found the Keyboard class, which would let me define a keyboard in an XML resource. I have found that the KeyboardView class has a setKeyboard method ... and, so far, I have not found any other class that takes a Keyboard instance.
How am I supposed to use the KeyboardView? I tried adding one to my activity's XML; finding it at runtime with findViewById; and then calling setKeyboard ... but all this did was mess up my layout and not bring up the special keyboard.
This turns out to be very doable, and my initial problems probably had more to do with general Android newbiness (this is my first Android app) and not the KeyboardView. In particular, I'm used to visibility being a simple binary property.
Anyhow:
Declare the KeyboardView in your XML file with android:visibility="gone".
Before you make the view visible, call setKeyboard() to attach a keyboard. This is important, as the KeyboardView gets its size from the keyboard.
To get raw key events, call KeyboardView.setOnKeyboardActionListener(). After refactoring this functionality from a Dialog back to my main View, I put the OnKeyboardActionListener functionality in a stand-alone class, but this is not necessary.
I call keyboardView.setEnabled(true);. This does not seem to be necessary, but I am not sure (yet) under what circumstances it would matter; perhaps only if you call setEnabled(false).
I call keyboardView.setPreviewEnabled(true); - this is especially useful if the user won't be getting visual feedback from an input biox right above the keyboard.
Then, with the keyboard all set, call keyboardView.setVisibility(VISIBLE);.
To hide the keyboard when appropriate, just call keyboardView.setVisibility(GONE);. To change the keyboard (as on a shift key, or a cycle-through-the-symbol-keyboards key, just call setKeyboard again. I use a Map<<Integer, Keyboard> to implement a lazy-create pattern; a weak reference may be desirable, if the program will run for a long time and the keyboard will not be used much.
Keyboard and KeyboardView are for making alternative input method engines (IME). These are then able to be chosen by the user, just as they can install Swype, Graffiti, and other ones from the Android Market.
You, as a developer, can create such an IME, but you cannot force it upon the user.
using the inputType attribute in your editText view will help pick between the different system keyboards (phone, email, etc) Also the APIDemos application that comes with the SDK has an example of how to implement a forced custom keyboard for your app only.

Categories

Resources