Software Archive
Read-only legacy content
17061 Discussions

Android windowSoftInputMode setting

Antonio_Za
Beginner
3,129 Views

Hello,

I solved my issue weeks ago and now I got the same issue as before, I suppose this could be related to my upgrade from CLI4 to CLI5. Anyway, I'd like to set the windowSoftInputMode parameter in the manifest.xml as "adjustPan" instead of the default "adjustResize".

I set these two preferences in the intelxdk.config.additions.xml:

<preference name="Fullscreen" value="false"/> 

<preference name="android-windowSoftInputMode" value="stateVisible|adjustPan" />

When reading the manifest.xml built using the build XDK feature I got:

<activity android:configChanges="locale|keyboard|keyboardHidden|orientation|screenSize" android:label="@string/activity_name" android:launchMode="singleTop" android:name="com.arsdigitalia.neolatte.MainActivity" android:screenOrientation="portrait" android:theme="@android:style/Theme.Black.NoTitleBar" android:windowSoftInputMode="adjustResize">

and at the bottom:

<activity android:name="com.arsdigitalia.neolatte.NeoLatte" android:screenOrientation="portrait" windowSoftInputMode="stateVisible|adjustPan"/>

So, it seems something is in the manifest as adjustPan, but the action is still as adjustResize. However, seems strange to me to read both the options on two different lines, instead of just one.

Any clue?

 

0 Kudos
12 Replies
PaulF_IntelCorp
Employee
3,129 Views

The preference parameters you can put into the additions file are those that you can put in the standard Cordova config.xml file. See this doc page for a list of valid Android Cordova config parameters > http://cordova.apache.org/docs/en/latest/guide/platforms/android/config.html -- note that "android-windowSoftInputMode" is not one of them.

In order to modify the Android manifest file you need to create a simple cordova plugin. See this FAQ for some help > https://software.intel.com/en-us/xdk/faqs/general#android-manifest

0 Kudos
Antonio_Za
Beginner
3,129 Views

Thank you Paul, I'd like to follow your suggestion. I created a folder in my plugin folder, called mycustom-android-plugin.

In this folder I created a plugin.xml with a similar structure as shown in the link you posted as example. Anyway, when importing using "import local plugin" in the project section, I got "Cannot read property 'getVisibleName' of undefined". Could you please help me?

The plugin I suppose will do the job is the following:

 

<?xml version="1.0" encoding="UTF-8"?>  
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0" id="mycustomandroidplugin" version="1.0.0"> 

    <name>My Custom Android Plugin</name> 
    <description>Add Intents to the AndroidManifest.xml</description> 
    <license>Ars Digitalia</license> 

    <engines> 
        <engine name="cordova" version=">=3.0.0" /> 
    </engines>  

    <!-- android --> 
    <platform name="android"> 
        <config-file target="AndroidManifest.xml" parent="/manifest/application"> 
            <activity android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale" android:label="@string/app_name" android:launchMode="singleTop" android:name="com.arsdigitalia.neolatte.MainActivity" android:screenOrientation="portrait" android:theme="@android:style/Theme.Black.NoTitleBar" android:windowSoftInputMode="adjustPan"> 
                <intent-filter> 
                    <action android:name="android.intent.action.SEND" /> 
                    <category android:name="android.intent.category.DEFAULT" /> 
                    <data android:mimeType="*/*" /> 
                </intent-filter> 
            </activity> 
        </config-file> 
    </platform>  
</plugin>

 

 

0 Kudos
PaulF_IntelCorp
Employee
3,129 Views

Don't place that plugin.xml file in the <project-name>/plugins directory, put it somewhere else (for example <project-name>/my-custom-android-plugin) and then use the add third-party plugins panel in the plugin manager to locate a "local" plugin and add it that way. The plugin manager will make a copy and add it to the <project-name>/plugins directory. Any changes you make should be to your "source" not to the one in the /plugins directory. Also, to be consistent with conventions, I recommend that you add dashes to the id name (like I did in the <project-name>/... above).

0 Kudos
Antonio_Za
Beginner
3,129 Views

Dear Paul, I successfully installed the plugin, this is the code I use (from the official example you linked above):

  <!-- android -->
  <platform name="android">
    <config-file target="AndroidManifest.xml" parent="/manifest/application">
      <activity android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale" android:label="@string/app_name" android:launchMode="singleTop" android:name="testa" android:theme="@android:style/Theme.Black.NoTitleBar" android:windowSoftInputMode="adjustPan">
        <intent-filter>
          <action android:name="android.intent.action.SEND" />
          <category android:name="android.intent.category.DEFAULT" />
          <data android:mimeType="*/*" />
        </intent-filter>
      </activity>
    </config-file>
  </platform>

 

Anyway, the adjustpan parameter still doesn't work. I suppose this is related to these lines in the final manifest:

<activity android:configChanges="locale|keyboard|keyboardHidden|orientation|screenSize" android:label="@string/activity_name" android:launchMode="singleTop" android:name="com.arsdigitalia.neolatte.MainActivity" android:screenOrientation="portrait" android:theme="@android:style/Theme.Black.NoTitleBar" android:windowSoftInputMode="adjustResize">
            <intent-filter android:label="@string/launcher_name">
                <action android:name="android.intent.action.MAIN"/>
                <category android:name="android.intent.category.LAUNCHER"/>
            </intent-filter>
        </activity>

......



<activity android:configChanges="locale|keyboard|keyboardHidden|orientation|screenSize" android:label="@string/app_name" android:launchMode="singleTop" android:name="com.arsdigitalia.neolatte.testa" android:theme="@android:style/Theme.Black.NoTitleBar" android:windowSoftInputMode="adjustPan">
            <intent-filter>
                <action android:name="android.intent.action.SEND"/>
                <category android:name="android.intent.category.DEFAULT"/>
                <data android:mimeType="*/*"/>
            </intent-filter>
        </activity>

 

As you can see, I have twice the android:windowSoftInputMode parameter set, but I think it would be just once. Moreover, I don't know if the android:name="testa" used in my plugin.xml is the right one, but I tried using android:name="com.arsdigitalia.neolatte.MainActivity" in my plugin.xml without success, since I always got an error like this:

 

:processArmv7ReleaseManifest.../NeoLatte/platforms/android/AndroidManifest.xml:47:9 Error:
	Element activity#com.arsdigitalia.neolatte.MainActivity at AndroidManifest.xml:47:9 duplicated with element declared at AndroidManifest.xml:8:9
.../NeoLatte/platforms/android/AndroidManifest.xml:0:0 Error:
	Validation failed, exiting
 FAILED

 

Could you please help me? I need it to publish my app in next days, it's ready for the Android store, I just need this latest feature.

 

 

0 Kudos
Antonio_Za
Beginner
3,129 Views

Dear Paul, any news on this subject?

0 Kudos
PaulF_IntelCorp
Employee
3,129 Views

Aaaa -- I found several StackOverflow posts regarding this and they were all related to issues with the keyboard. Is this what you are trying to change? How the keyboard behaves? If so, the Ionic keyboard plugin may be a simpler solution. Also, this post may be relevant:

http://stackoverflow.com/a/23825387/2914328

Specifically the part about setting fullscreen to false...

 

0 Kudos
Markus_G_1
Beginner
3,129 Views

Could you please fix the '<preference name="android-windowSoftInputMode" ...>' since it is needed to make iOS and Android to get same look and feel?

0 Kudos
PaulF_IntelCorp
Employee
3,129 Views

Markus -- that appears to be either an undocumented Cordova preference, you will not find it in any of the Cordova docs, or it is a PhoneGap Build preference. See this SO post > http://stackoverflow.com/a/37206382/2914328 < we use standard Cordova to build, we do not use PhoneGap, which is a version of Cordova that is unique to Adobe.

0 Kudos
PaulF_IntelCorp
Employee
3,129 Views

Also, see this Cordova bug that was tracking that feature > https://issues.apache.org/jira/browse/CB-4404 < it appears that, if it does work, it only works as described in the bug report. That Jira was implemented in some quite old versions of Cordova. If it is no longer working in Cordova, as described in that Jira, then a new Cordova Jira needs to be opened, because that is where it needs to be fixed.

0 Kudos
PaulF_IntelCorp
Employee
3,129 Views

It may also be a Crosswalk bug, see > https://crosswalk-project.org/jira/browse/XWALK-6513 < please give it a try with and without Crosswalk selected to see if that makes a difference. If we can pinpoint the problem to Crosswalk we can get them to fix the issue (we do not own the Crosswalk project but do have some good connections into that project).

0 Kudos
Markus_G_1
Beginner
3,129 Views

Then I suggest you remove it from: https://software.intel.com/en-us/xdk/docs/cordova-for-android-build-options

However being able to set this option to like 'adjustNothing' would be a really good feature.

0 Kudos
PaulF_IntelCorp
Employee
3,129 Views

Markus -- so glad you pointed that out! That feature was added as an option to our original build system, but did not get added back to the new build system. I will file a bug and see if we can get it included as part of the new build system.

0 Kudos
Reply