Android SoftKeyboardDetect: Ignore this event what does it mean? - android

I see this debug message frequently in LogCat. When doing swipe or rotating the device for example. The emulator doesn't react to the events then. What does it mean?
In need to test rotation on the emulator but on some versions, when I press CTRL F12 or CTRL F11 nothing happens (well, the device rotates as a whole but not the screen) and I see this message in log. I don't find anything with google either...
Ok, it's PhoneGap specific. I found something in the source code of PhoneGap:
/**
* We are providing this class to detect when the soft keyboard is shown
* and hidden in the web view.
*/
class LinearLayoutSoftKeyboardDetect extends LinearLayout {
private static final String TAG = "SoftKeyboardDetect";
But I'm not doing anything with soft keyboard, I'm just rotating the device. It's a bug maybe?

I can give you the background on this log. There is a bug in Android or maybe they'd call it a lack of feature but there is no event thrown when the keyboard is shown or goes away. This causes a problem for web applications as the keyboard shortens the the screen size. When the screen size becomes smaller then your UI suffers.
In order to be able to react to the keyboard show/hide in PhoneGap Android we implemented the LinearLayoutSoftKeyboardDetect which is basically a LinearLayout but it reacts to changes in the screen size. If you rotate the device the width becomes the height and we can ignore the change but if the height gets dramatically smaller while the width remains the same it is safe to assume there is a keyboard being shown and we throw a show keyboard event. When the height gets dramatically larger while width stays the same we throw a hide keyboard event. Make sense?

This implementation seems affect with the situation -> When native keyboard is pop up it shrink the webview in phonegap. Again demention changes. So it tends to ignore necessary events. I want to detect native keyboard done button press event.

Related

Prevent screen from locking but allow dimming

I'm trying to get my Android app to keep the screen unlocked as long as the app is running. I easily solved this problem with setting this flag - WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON - in each activity.
But now I'd also like to allow the screen to dim and stay dimmed until a touch event is registered. I tried to mess with window object's screenBrightness and dimAmount but none of these worked (no changes in the brightness were made). Any ideas if I can implement this feature?
As a last resort I'd think a black dialog with alpha .5 covering the whole screen would work, but I don't know if this solution will have the same effect as an actual dim, battery-saving wise

How to detect full screen gesture mode in Mi devices programmatically

I am writing an Android application that needs to calculate the height of screen to display content correctly. But the height I got in Mi devices (Mi 9 SE) wasn't correct when switching to full screen gesture mode.
How can I get the real height of the screen, or check if user turned on full screen gesture mode in Mi devices?
I have tried these suggestions.
How to detect full screen gesture mode in android Q
Android: detect navigation bar visibility
Check for navigation bar
After searching and experimenting, I have found the only solution: How to detect full screen gesture mode in android Q.
Instead of using ViewCompat.setOnApplyWindowInsetsListener() function, I just have to create a WindowInsets instance for the current context, then check the getSystemGestureInsets() for each edges. This is how I implemented to make a React Native's native module.
If you need a listener to detect every changes, the solution above has done well on Android app. If you want this listener for React Native, you might want to find another approach, since I haven't made it work.
A very simpler answer:
Don't use DisplayMetrics. Just make any view take full width and height of the screen (MATCH_PARENT) then get it's dimensions, it well give accurate numbers.

AIR - Get SoftKeyboard Screen Size

In my AIR mobile application I am trying to resize my application when the softkeyboard is activated so that the bottom of my application will not be covered by the keyboard. From what I have read this is suppose to be the default behavior but I have never been able to get it to work and I have tried everything I have found online, instead the keyboard overlays ontop of the application.
I then decided I would resize my application myself based on the height and y position of the softkeyboard only to find out that the built in AIR methods for determining the height and y position of the keyboard are not correct (YAY). I even tried using a 3rd party ANE for determining the screen height by FreshPlanet and their code does not always return correct values either. I feel like this shouldn't be that hard to figure out but I am stuck. Please help!
TLDR:
How can I resize my application to be the remaining screen space when the softkeyboard is activated?
What renderMode are you using? (in manifest.xml) I found that only cpu is working to get the correct keyboard height.
Also try to set softKeyboardBehavior to none: <softKeyboardBehavior>none</softKeyboardBehavior>

Flex on Android: App screen goes black when the soft keyboard pops up

I have an odd random problem in my Flex app for an android tablet (Samsung Note 10.1).
Sometimes (it is really random) when i click on a TextInput and the SoftKeyboard pops up, the whole screen goes black. Once it happened, it will go black every time I click on a TextInput. If i restart the application, everything is fine again.
My setup: Flex SDK 4.13.0 + AIR 14.0
The TextInput is not using any skins, just the default
RenderingMode: CPU (Can't use GPU)
Ok, i'm still not 100% sure if that problem have been solved but it didn't appeared for a long time after i've tried two things:
My app was using the Camera and I've read somewhere that the Camera have caused similar problems for some people. Indeed it turned out that the camera was not detached properly in my code. This did not helped in my case but maybe it will help someone else
I have found this hack in some third party component code (don't remember where) and apparently it did help. Basically, it is switching the app quality back and forth forcing Flex to redraw. So in your main MXML place this code after "addedToStage" event:
private function onAddedToStage():void
{
//Workaround for blank screen after screen unlock.
stage.addEventListener(Event.ACTIVATE, function(e:Event):void
{
stage.quality = StageQuality.MEDIUM;
});
stage.addEventListener(Event.DEACTIVATE, function(e:Event):void
{
stage.quality = StageQuality.LOW;
});
}

Android WebView Hardware Accelerated Keyboard Glitch

When WebView is hardware accelerated, clicking on input field causes keyboard to appear and html is redrawed shifted and duplicated for a moment:
1) When soft keyboard is appearing WebView pans its content to bottom-left, then againt to normal position. Causes short view-able duplication.
2) When changing keyboards (ex. abc->numbers) contents are panned down by keyboard height and then back to normal position. Causes short view-able duplication.
Tested on two Android 4.0 tablets, if hardware accelerations is turned off no such glitches appear.
I failed to found any information on this, has anyone experienced same problem?
So I finally found some solutions:
The entire WebView content moves by layout margin width, so setting it to 0px fixes this problem.
android:windowSoftInputMode="adjustPan" for WebView activity.

Categories

Resources