Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plugin installation is preventing the SoftKeyboard from pushing the content up #115

Open
nandukalidindi opened this issue Nov 2, 2017 · 36 comments

Comments

@nandukalidindi
Copy link

nandukalidindi commented Nov 2, 2017

First off, that you for this wonderful plugin!

I successfully am able to get it working with the expansion files and published 2 apps thanks to this.

However, recently I found out that after the installation of the plugin the SoftKeyboard that shows up while entering into textboxes is not pushing the content, rather the content just stays as is. This could be a problem for me because I would like the users to see what they are typing on the textbox.

BEFORE INSTALLATION:
screen shot 2017-11-01 at 11 17 07 pm

AFTER INSTALLATION
screen shot 2017-11-01 at 11 13 18 pm

The textbox is infact behind the SoftKeyboard. The red rectangle is just some text. The white form starts right below the rectangle and that contains the textbox to be typed into.

I tried debugging it before and after the plugin installation and I am positive that this happens only after the installation.

Is there a chance that the resizing is deliberately disabled through the extension?

Thanks.

@agamemnus
Copy link
Owner

agamemnus commented Nov 2, 2017

What if you remove the extension after installing it? Still like you didn't install it? (normal?)

@nandukalidindi
Copy link
Author

Yes, cordova plugin remove com.flyingsoftgames.xapkreader removing the plugin brought it back to normal, as in the SoftKeyboard is resizing/pushing the content as expected.

@agamemnus
Copy link
Owner

Ok, I found something in plugin.xml.

  <config-file target="AndroidManifest.xml" parent="application">
   <activity android:name="com.flyingsoftgames.xapkreader.XAPKDownloaderActivity" android:label="@string/app_name" android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale">
   </activity>

Maybe something in these config changes is doing this...

@agamemnus
Copy link
Owner

But then again, you want the keyboard to be hidden when the downloader bar shows so I am not sure.

@nandukalidindi
Copy link
Author

Earlier today I tried adding android:windowSoftInputMode="adjustResize" to the XAPKDownloaderActivity but that did not work. Now, after modifying the activity to this <activity android:label="@string/app_name" android:name="com.flyingsoftgames.xapkreader.XAPKDownloaderActivity" /> it still does not work.

@agamemnus
Copy link
Owner

Can you check to see if anything is changing in the meta headers in the generated html file maybe?

@agamemnus
Copy link
Owner

I guess try to see exactly what changes in the two different outputs.

@nandukalidindi
Copy link
Author

I don't see any HTML files being generated during the installation. Could you please tell which one is it that you meant.

@agamemnus
Copy link
Owner

Well, when you create a package, generated stuff goes into a separate directory, right...?

@nandukalidindi
Copy link
Author

screen shot 2017-11-01 at 11 42 26 pm

These are the changed/added files. Would you be able to guess which could possibly cause this?

@agamemnus
Copy link
Owner

Maybe in the manifest xml? Or possibly the config.xml.

@nandukalidindi
Copy link
Author

nandukalidindi commented Nov 2, 2017

You mean when I do cordova build android? I did not yet do that step yet, it's failing right here. Please excuse me if I am not providing you exact inputs, I am a total beginner with Cordova and Android.

config.xml
screen shot 2017-11-01 at 11 46 46 pm

AndroidManifest.xml
screen shot 2017-11-01 at 11 47 12 pm

android/res/xml/config.xml
screen shot 2017-11-01 at 11 46 15 pm

I don't feel any of these caused that.

@nandukalidindi
Copy link
Author

Have you ever faced this similar problem on one of your apps where you used your plugin?

@agamemnus
Copy link
Owner

I don't remember. I just set the meta tag so it does not resize.

@agamemnus
Copy link
Owner

Oh, I get it.... you need the opposite...

@agamemnus
Copy link
Owner

How about this? Try and see if you can get it to work... https://stackoverflow.com/questions/31407367/on-screen-keyboard-resizes-app-when-an-input-box-is-selected-apache-cordova-visu

But this is def. an issue that should be resolved somehow without it, probably.

@nandukalidindi
Copy link
Author

Yeah, I can install another plugin, not at all a problem. Let me check it and get back to you tomorrow? Keyboard.shrinkView(true); this addition hopefully resolves it temporarily.

@nandukalidindi
Copy link
Author

Thank you so much for the discussion though.

@agamemnus
Copy link
Owner

Sure. Let me know how it goes!

@nandukalidindi
Copy link
Author

So, I should add Keyboad.shrinkView after the onload in my JS file? Or is it somewhere in the Android app?

@agamemnus
Copy link
Owner

agamemnus commented Nov 2, 2017

Unsure. Try both ways (after the onload and before you show the form) I guess...

@nandukalidindi
Copy link
Author

Seems like the shrinkView method is only supported in iOS https://www.npmjs.com/package/cordova-plugin-keyboard#keyboardshrinkview

@agamemnus
Copy link
Owner

Unclear.... I dunno, there must be a way... maybe just meta tags.....

@nandukalidindi
Copy link
Author

nandukalidindi commented Nov 2, 2017

Could you please share the snippet where you add the <meta> tag if possible? I will spend more time anyway, so will let you know if anything pans out.

@agamemnus
Copy link
Owner

agamemnus commented Nov 2, 2017 via email

@nandukalidindi
Copy link
Author

@agamemnus

@Override public void onCreate (Bundle savedInstanceState) {
  
  if (cordovaActivity != null) {
   // <Workaround for Cordova/Crosswalk flickering status bar bug./>
   // cordovaActivity.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
   // cordovaActivity.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
   // <Workaround for Cordova/Crosswalk flickering status bar bug./>
  }
.
.
.
.
}

Commenting the workaround to be full screen in XAPKDownloaderActivity.java in your source code did the trick and now it is working as expected. The SoftKeyboard is pushing the content up while typing.

Once again, thank you for the discussion and the awesome plugin. Cheers!

@agamemnus
Copy link
Owner

Well, I need to fix this somehow.

Can you clarify something for me?

You said:
"However, recently I found out that after the installation of the plugin the SoftKeyboard that shows up while entering into textboxes is not resizing/pushing the content, rather the content just stays as is. This could be a problem for me because I would like the users to see what they are typing on the textbox."

So you are saying that you want the content to be resized and bigger, but your screenshots suggest you DON'T want the content to be resized. Was it a typo?

@agamemnus agamemnus reopened this Nov 4, 2017
@nandukalidindi
Copy link
Author

I want the user to be able to see what she/he is typing on the textbox. In my case the softkeyboard just blocks the textbox(AFTER INSTALLATION screenshot) without bringing the textbox to focus like in the BEFORE INSTALLATION screenshot. May be I should remove the resizing word to avoid confusion.

@agamemnus
Copy link
Owner

But after installation, the app does seem to resize and bring something else to focus, and not the textbox that the user was typing in?

???????

The red rectangle is causing a lot of confusion for me.

What if you change the code to as follows:

  if (cordovaActivity != null) {
   // <Workaround for Cordova/Crosswalk flickering status bar bug./>
   int original_FLAG_FULLSCREEN = WindowManager.LayoutParams.FLAG_FULLSCREEN
   cordovaActivity.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
   cordovaActivity.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, original_FLAG_FULLSCREEN);
   // <Workaround for Cordova/Crosswalk flickering status bar bug./>
  }

@nandukalidindi
Copy link
Author

nandukalidindi commented Nov 4, 2017

Red rectangle is just to hide some private content. But as you can see the login form starts right after the red rectangle which is supposed to be pushed up like in the first screenshot.

Before commenting out the code in XAPKDownloaderActivity.java the view stays as is without moving, so I was not able to see what I was typing in the textbox. Sorry if this is too confusing. I am currently working on another laptop, let me try that and let you know in about 4 hours?

@agamemnus
Copy link
Owner

Great, thanks.

@nandukalidindi
Copy link
Author

The snippet you provided 2 comments above did not work. I checked it a while back.

@agamemnus
Copy link
Owner

OK. I'll investigate further to see if I can solve this without commenting out that code. Thanks.

@MajorBreakfast
Copy link

MajorBreakfast commented Jan 9, 2018

This is related to #117.

The resize behavior is connected to the visibility of the status bar. I can reproduce this by calling StatusBar.hide() manually from the chrome dev tools remote device console. After the status bar is hidden, the app isn't resized anymore.

Edit: One can also see that @nandukalidindi 's screenshot after the installation of the plugin has no status bar.

@erobertson42
Copy link

I know this issue is old, but I ran into this same bug today, and I'm kicking myself for not checking here before spending the majority of the day tracking it down and fixing it.

So, @nandukalidindi was on the right track.

The setting android:windowSoftInputMode="adjustResize" in the AndroidManifest.xml file is what allows the keyboard to resize the view, so that it doesn't overlap the content. However, this setting is ignored if the app is in fullscreen mode.

The code that (s)he points out forces the app into fullscreen mode, but doesn't ever change it back if applicable, so it stays that way and thus breaks the soft keyboard setting. I was able to fix it by first checking/storing the current setting, and changing it back when the activity is finished, if it changed.

Here is the pull request: #139

My knowledge of Android development using Java is limited, so this should definitely be given some scrutiny. However, my own testing seems to show that it's working.

@agamemnus
Copy link
Owner

Okay. I also noticed you added another check. Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants