From c25177f7585d57118a67158a875a8a3fbe8a8fc7 Mon Sep 17 00:00:00 2001 From: Morgan McMillian Date: Sun, 2 Sep 2018 16:55:16 -0700 Subject: [PATCH] remove cordova-plugin-console and ionic-plugin-keyboard plugins issue #72 --- config.xml | 2 - package-lock.json | 10 -- package.json | 4 - platforms/android/android.json | 21 --- .../java/io/ionic/keyboard/IonicKeyboard.java | 130 ------------------ .../android/app/src/main/res/xml/config.xml | 4 - 6 files changed, 171 deletions(-) delete mode 100644 platforms/android/app/src/main/java/io/ionic/keyboard/IonicKeyboard.java diff --git a/config.xml b/config.xml index 51bd9b1..6ba6c9c 100644 --- a/config.xml +++ b/config.xml @@ -87,7 +87,6 @@ - @@ -96,7 +95,6 @@ - diff --git a/package-lock.json b/package-lock.json index b2e1249..a957402 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2363,11 +2363,6 @@ "xml2js": "0.4.19" } }, - "cordova-plugin-console": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/cordova-plugin-console/-/cordova-plugin-console-1.1.0.tgz", - "integrity": "sha1-4vusECkBeeRMtyxf28QQpTHBzW0=" - }, "cordova-plugin-device": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/cordova-plugin-device/-/cordova-plugin-device-2.0.2.tgz", @@ -4659,11 +4654,6 @@ "resolved": "https://registry.npmjs.org/ionic-angular/-/ionic-angular-3.9.2.tgz", "integrity": "sha512-BEZ6magY1i5GwM9ki/MOpszUz62+g518HsGICtw9TE1D4v9Eb6n/o7e+X0vtvpK4TdouFjQ8r5XA9VPAKW9/+Q==" }, - "ionic-plugin-keyboard": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/ionic-plugin-keyboard/-/ionic-plugin-keyboard-2.2.1.tgz", - "integrity": "sha1-8qnhabvptVIkADR8n9bTRn7j+hI=" - }, "ionicons": { "version": "4.2.4", "resolved": "https://registry.npmjs.org/ionicons/-/ionicons-4.2.4.tgz", diff --git a/package.json b/package.json index 6ea0a2f..c6fd26f 100644 --- a/package.json +++ b/package.json @@ -32,7 +32,6 @@ "com-darryncampbell-cordova-plugin-intent": "^1.1.0", "cordova-android": "7.1.0", "cordova-android-support-gradle-release": "^1.4.4", - "cordova-plugin-console": "^1.1.0", "cordova-plugin-device": "^2.0.2", "cordova-plugin-file": "^6.0.1", "cordova-plugin-file-transfer": "^1.7.1", @@ -45,7 +44,6 @@ "cordova-plugin-telerik-imagepicker": "^2.1.8", "cordova-plugin-whitelist": "^1.3.3", "ionic-angular": "3.9.2", - "ionic-plugin-keyboard": "^2.2.1", "ionicons": "4.2.4", "moment": "^2.18.1", "ng2-cordova-oauth": "0.0.8", @@ -63,7 +61,6 @@ "description": "An Ionic project", "cordova": { "plugins": { - "ionic-plugin-keyboard": {}, "cordova-plugin-share-content": {}, "cordova-plugin-filechooser": {}, "cordova-plugin-file": {}, @@ -74,7 +71,6 @@ "cordova-plugin-statusbar": {}, "cordova-plugin-splashscreen": {}, "cordova-plugin-device": {}, - "cordova-plugin-console": {}, "cordova-android-support-gradle-release": { "ANDROID_SUPPORT_VERSION": "27.+" }, diff --git a/platforms/android/android.json b/platforms/android/android.json index 949d248..9188143 100644 --- a/platforms/android/android.json +++ b/platforms/android/android.json @@ -14,10 +14,6 @@ } ], "/*": [ - { - "xml": "", - "count": 1 - }, { "xml": "", "count": 1 @@ -116,9 +112,6 @@ "cordova-plugin-share-content": { "PACKAGE_NAME": "com.monkeystew.goober_m" }, - "ionic-plugin-keyboard": { - "PACKAGE_NAME": "com.monkeystew.goober_m" - }, "cordova-plugin-file": { "PACKAGE_NAME": "com.monkeystew.goober_m" }, @@ -143,9 +136,6 @@ "cordova-plugin-device": { "PACKAGE_NAME": "com.monkeystew.goober_m" }, - "cordova-plugin-console": { - "PACKAGE_NAME": "com.monkeystew.goober_m" - }, "cordova-android-support-gradle-release": { "ANDROID_SUPPORT_VERSION": "27.+", "PACKAGE_NAME": "com.monkeystew.goober_m" @@ -172,15 +162,6 @@ "shareContentPlugin" ] }, - { - "id": "ionic-plugin-keyboard.keyboard", - "file": "plugins/ionic-plugin-keyboard/www/android/keyboard.js", - "pluginId": "ionic-plugin-keyboard", - "clobbers": [ - "cordova.plugins.Keyboard" - ], - "runs": true - }, { "id": "cordova-plugin-file.DirectoryEntry", "file": "plugins/cordova-plugin-file/www/DirectoryEntry.js", @@ -423,7 +404,6 @@ "plugin_metadata": { "cordova-plugin-filechooser": "1.0.1", "cordova-plugin-share-content": "1.0.0", - "ionic-plugin-keyboard": "2.2.1", "cordova-plugin-file": "6.0.1", "cordova-plugin-file-transfer": "1.7.1", "com-darryncampbell-cordova-plugin-intent": "1.1.0", @@ -432,7 +412,6 @@ "cordova-plugin-statusbar": "2.4.2", "cordova-plugin-splashscreen": "5.0.2", "cordova-plugin-device": "2.0.2", - "cordova-plugin-console": "1.1.0", "cordova-android-support-gradle-release": "1.4.4", "cordova-plugin-filepath": "1.4.2" } diff --git a/platforms/android/app/src/main/java/io/ionic/keyboard/IonicKeyboard.java b/platforms/android/app/src/main/java/io/ionic/keyboard/IonicKeyboard.java deleted file mode 100644 index 128063b..0000000 --- a/platforms/android/app/src/main/java/io/ionic/keyboard/IonicKeyboard.java +++ /dev/null @@ -1,130 +0,0 @@ -package io.ionic.keyboard; - -import org.apache.cordova.CallbackContext; -import org.apache.cordova.CordovaInterface; -import org.apache.cordova.CordovaPlugin; -import org.apache.cordova.CordovaWebView; -import org.apache.cordova.PluginResult; -import org.apache.cordova.PluginResult.Status; -import org.json.JSONArray; -import org.json.JSONException; - -import android.content.Context; -import android.graphics.Rect; -import android.util.DisplayMetrics; -import android.view.View; -import android.view.ViewTreeObserver.OnGlobalLayoutListener; -import android.view.inputmethod.InputMethodManager; - -// import additionally required classes for calculating screen height -import android.view.Display; -import android.graphics.Point; -import android.os.Build; - -public class IonicKeyboard extends CordovaPlugin { - - public void initialize(CordovaInterface cordova, CordovaWebView webView) { - super.initialize(cordova, webView); - } - - public boolean execute(String action, JSONArray args, final CallbackContext callbackContext) throws JSONException { - if ("close".equals(action)) { - cordova.getThreadPool().execute(new Runnable() { - public void run() { - //http://stackoverflow.com/a/7696791/1091751 - InputMethodManager inputManager = (InputMethodManager) cordova.getActivity().getSystemService(Context.INPUT_METHOD_SERVICE); - View v = cordova.getActivity().getCurrentFocus(); - - if (v == null) { - callbackContext.error("No current focus"); - } else { - inputManager.hideSoftInputFromWindow(v.getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS); - callbackContext.success(); // Thread-safe. - } - } - }); - return true; - } - if ("show".equals(action)) { - cordova.getThreadPool().execute(new Runnable() { - public void run() { - ((InputMethodManager) cordova.getActivity().getSystemService(Context.INPUT_METHOD_SERVICE)).toggleSoftInput(0, InputMethodManager.HIDE_IMPLICIT_ONLY); - callbackContext.success(); // Thread-safe. - } - }); - return true; - } - if ("init".equals(action)) { - cordova.getThreadPool().execute(new Runnable() { - public void run() { - //calculate density-independent pixels (dp) - //http://developer.android.com/guide/practices/screens_support.html - DisplayMetrics dm = new DisplayMetrics(); - cordova.getActivity().getWindowManager().getDefaultDisplay().getMetrics(dm); - final float density = dm.density; - - //http://stackoverflow.com/a/4737265/1091751 detect if keyboard is showing - final View rootView = cordova.getActivity().getWindow().getDecorView().findViewById(android.R.id.content).getRootView(); - OnGlobalLayoutListener list = new OnGlobalLayoutListener() { - int previousHeightDiff = 0; - @Override - public void onGlobalLayout() { - Rect r = new Rect(); - //r will be populated with the coordinates of your view that area still visible. - rootView.getWindowVisibleDisplayFrame(r); - - PluginResult result; - - // cache properties for later use - int rootViewHeight = rootView.getRootView().getHeight(); - int resultBottom = r.bottom; - - // calculate screen height differently for android versions >= 21: Lollipop 5.x, Marshmallow 6.x - //http://stackoverflow.com/a/29257533/3642890 beware of nexus 5 - int screenHeight; - - if (Build.VERSION.SDK_INT >= 21) { - Display display = cordova.getActivity().getWindowManager().getDefaultDisplay(); - Point size = new Point(); - display.getSize(size); - screenHeight = size.y; - } else { - screenHeight = rootViewHeight; - } - - int heightDiff = screenHeight - resultBottom; - - int pixelHeightDiff = (int)(heightDiff / density); - if (pixelHeightDiff > 100 && pixelHeightDiff != previousHeightDiff) { // if more than 100 pixels, its probably a keyboard... - String msg = "S" + Integer.toString(pixelHeightDiff); - result = new PluginResult(PluginResult.Status.OK, msg); - result.setKeepCallback(true); - callbackContext.sendPluginResult(result); - } - else if ( pixelHeightDiff != previousHeightDiff && ( previousHeightDiff - pixelHeightDiff ) > 100 ){ - String msg = "H"; - result = new PluginResult(PluginResult.Status.OK, msg); - result.setKeepCallback(true); - callbackContext.sendPluginResult(result); - } - previousHeightDiff = pixelHeightDiff; - } - }; - - rootView.getViewTreeObserver().addOnGlobalLayoutListener(list); - - - PluginResult dataResult = new PluginResult(PluginResult.Status.OK); - dataResult.setKeepCallback(true); - callbackContext.sendPluginResult(dataResult); - } - }); - return true; - } - return false; // Returning false results in a "MethodNotFound" error. - } - - -} - - diff --git a/platforms/android/app/src/main/res/xml/config.xml b/platforms/android/app/src/main/res/xml/config.xml index c6801ce..216e129 100644 --- a/platforms/android/app/src/main/res/xml/config.xml +++ b/platforms/android/app/src/main/res/xml/config.xml @@ -3,10 +3,6 @@ - - - -