diff options
Diffstat (limited to 'Android/src')
-rw-r--r-- | Android/src/org/apache/cordova/plugins/SoftKeyBoard.java | 46 | ||||
-rw-r--r-- | Android/src/org/mysociety/FixMyStreet/FixMyStreet.java | 28 |
2 files changed, 0 insertions, 74 deletions
diff --git a/Android/src/org/apache/cordova/plugins/SoftKeyBoard.java b/Android/src/org/apache/cordova/plugins/SoftKeyBoard.java deleted file mode 100644 index 18940e1..0000000 --- a/Android/src/org/apache/cordova/plugins/SoftKeyBoard.java +++ /dev/null @@ -1,46 +0,0 @@ -package org.apache.cordova.plugins; - -import org.json.JSONArray; -import android.content.Context; -import android.view.inputmethod.InputMethodManager; -import org.apache.cordova.api.CordovaPlugin; -import org.apache.cordova.api.CallbackContext; - -public class SoftKeyBoard extends CordovaPlugin { -public SoftKeyBoard () { } - -public void showKeyBoard () { - InputMethodManager mgr = (InputMethodManager) cordova.getActivity().getSystemService(Context.INPUT_METHOD_SERVICE); - mgr.showSoftInput(webView, InputMethodManager.SHOW_IMPLICIT); - ((InputMethodManager) cordova.getActivity().getSystemService(Context.INPUT_METHOD_SERVICE)).showSoftInput(webView, 0); -} - -public void hideKeyBoard() { - InputMethodManager mgr = (InputMethodManager) cordova.getActivity().getSystemService(Context.INPUT_METHOD_SERVICE); - mgr.hideSoftInputFromWindow(webView.getWindowToken(), 0); -} - -public boolean isKeyBoardShowing() { - // if more than 100 pixels, its probably a keyboard... - int heightDiff = webView.getRootView().getHeight() - webView.getHeight(); - return (100 < heightDiff); -} - -@Override -public boolean execute(String action, JSONArray args, CallbackContext callbackContext) { - if (action.equals("show")) { - this.showKeyBoard(); - callbackContext.success("done"); - return true; - } else if (action.equals("hide")) { - this.hideKeyBoard(); - callbackContext.success(); - return true; - } else if (action.equals("isShowing")) { - callbackContext.success(Boolean.toString(this.isKeyBoardShowing())); - return true; - } else { - return false; - } -} -} diff --git a/Android/src/org/mysociety/FixMyStreet/FixMyStreet.java b/Android/src/org/mysociety/FixMyStreet/FixMyStreet.java deleted file mode 100644 index a88ae25..0000000 --- a/Android/src/org/mysociety/FixMyStreet/FixMyStreet.java +++ /dev/null @@ -1,28 +0,0 @@ -package org.mysociety.FixMyStreet; - -import android.os.Bundle; -import android.view.WindowManager; - -import org.apache.cordova.*; - -public class FixMyStreet extends DroidGap { - /** Called when the activity is first created. */ - @Override - public void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - /* yes, we are using a magic number here but the version constants aren't defined - until the relevant release so if you want to check against a version that's - after your minimum target version you have to use the number :( - in this case 11 is Honeycomb / 3.0 */ - if (android.os.Build.VERSION.SDK_INT <= 11) { - /* If we leave the default on for android 2 then on the details screen it scrolls - the details screen in such a way that you can't see where you are typing so - we switch back to adjustPan. We don't want to use that all the time as adjustPan - stops you scrolling the screen when the softKeyboard is displayed which is what - we'd like to be able to do so people can scroll to see if there are other - fields. */ - getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN); - } - super.loadUrl("file:///android_asset/www/src/index.html", 30000); - } -}
\ No newline at end of file |