diff --git a/README.md b/README.md index 92c4be5..089ecc5 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/package.json b/package.json new file mode 100644 index 0000000..4425703 --- /dev/null +++ b/package.json @@ -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" +} \ No newline at end of file diff --git a/src/android/windowSoftManager.java b/src/android/windowSoftManager.java index ec92b87..d604146 100644 --- a/src/android/windowSoftManager.java +++ b/src/android/windowSoftManager.java @@ -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); } }); diff --git a/www/windowSoftManager.js b/www/windowSoftManager.js index 6d08767..5b1af60 100644 --- a/www/windowSoftManager.js +++ b/www/windowSoftManager.js @@ -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;