Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,18 @@ Cordova plugin to dynamically change soft input mode on android devices
Currently the plugin supports setting the soft input to adjustPan (SOFT_INPUT_ADJUST_PAN) or adjustResize(SOFT_INPUT_ADJUST_RESIZE). Feel free to extend it and make a pull request

# Installation
cordova plugin add https://github.com/denkomanceski/windowSoftInputMode.git
~cordova plugin add https://github.com/denkomanceski/windowSoftInputMode.git~

This version no longer works with newer version of Cordova. In case my pull request does not get approved, you can install a working copy from my repo by running this:

`cordova plugin add https://github.com/PetersonRyan/windowSoftInputMode.git`

# Usage
To set the soft input mode to adjustPan: ```windowSoftManager.setMode("adjustPan");```
To set the soft input mode to adjustPan: ```windowSoftManager.setMode(windowSoftManager.MODES.SOFT_INPUT_ADJUST_PAN);```

To set the soft input mode to adjustResize: ```windowSoftManager.setMode(windowSoftManager.MODES.SOFT_INPUT_ADJUST_RESIZE);```

To set the soft input mode to adjustResize: ```windowSoftManager.setMode("adjustResize");```
To set the soft input mode to adjustNothing: ```windowSoftManager.setMode(windowSoftManager.MODES.SOFT_INPUT_ADJUST_NOTHING);```

Thats it. Simple and clear

Expand Down
33 changes: 33 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"name": "windowSoftManager",
"version": "1.0.0",
"description": "This plugin allows you to edit Android windowSoftInputMode dynamically from Cordova.",
"cordova": {
"id": "com.vertex.windowSoftInputMode",
"platforms": [
"android"
]
},
"repository": {
"type": "git",
"url": "git+https://github.com/denkomanceski/windowSoftInputMode"
},
"keywords": [
"Keyboard",
"windowSoftInputMode",
"ecosystem:cordova",
"cordova-android"
],
"engines": [
{
"name": "cordova",
"version": ">=3.0.0"
}
],
"author": "Denko Manceski (https://github.com/denkomanceski)",
"license": "MIT",
"bugs": {
"url": "https://github.com/denkomanceski/windowSoftInputMode/issues"
},
"homepage": "https://github.com/denkomanceski/windowSoftInputMode#readme"
}
2 changes: 2 additions & 0 deletions src/android/windowSoftManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ public void run() {
cordova.getActivity().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN);
else if(action.equals("adjustResize"))
cordova.getActivity().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
else if(action.equals("adjustNothing"))
cordova.getActivity().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_NOTHING);
}
});

Expand Down
8 changes: 7 additions & 1 deletion www/windowSoftManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,13 @@ windowSoftManager.prototype.setMode = function(aString){
function(result){
/*alert("Error" + reply);*/
},"windowSoftManager",aString,[]);
}
};

windowSoftManager.prototype.MODES = {
SOFT_INPUT_ADJUST_PAN: "adjustPan",
SOFT_INPUT_ADJUST_RESIZE: "adjustResize",
SOFT_INPUT_ADJUST_NOTHING: "adjustNothing"
};

var windowSoftManager = new windowSoftManager();
module.exports = windowSoftManager;