From 0bb004e648d80da99532a3e7ef43768038bf3ada Mon Sep 17 00:00:00 2001 From: "AP\\RavinduW" Date: Mon, 4 Jun 2018 11:02:32 +1000 Subject: [PATCH] updated gradle and android libs --- .idea/misc.xml | 5 +---- .idea/modules.xml | 3 +++ app/build.gradle | 10 +++++----- build.gradle | 5 +++-- gradle/wrapper/gradle-wrapper.properties | 2 +- keyboard-listener/build.gradle | 8 ++++---- .../java/com/rw/keyboardlistener/KeyboardUtils.java | 8 +++++--- 7 files changed, 22 insertions(+), 19 deletions(-) diff --git a/.idea/misc.xml b/.idea/misc.xml index b0a270f..3963879 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,8 +1,5 @@ - - - - + diff --git a/.idea/modules.xml b/.idea/modules.xml index ec68894..24edaaf 100644 --- a/.idea/modules.xml +++ b/.idea/modules.xml @@ -2,8 +2,11 @@ + + + diff --git a/app/build.gradle b/app/build.gradle index 215a2f6..1da6dd6 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -1,12 +1,12 @@ apply plugin: 'com.android.application' android { - compileSdkVersion 26 - buildToolsVersion "26.0.0" + compileSdkVersion 27 + buildToolsVersion "27.0.0" defaultConfig { applicationId "com.rw.keyboardutils" minSdkVersion 16 - targetSdkVersion 26 + targetSdkVersion 27 versionCode 1 versionName "1.0" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" @@ -25,8 +25,8 @@ dependencies { androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { exclude group: 'com.android.support', module: 'support-annotations' }) - compile 'com.android.support:appcompat-v7:26.0.0-alpha1' - compile 'com.android.support.constraint:constraint-layout:1.0.2' + compile 'com.android.support:appcompat-v7:27.1.1' + compile 'com.android.support.constraint:constraint-layout:1.1.0' testCompile 'junit:junit:4.12' compile project(':keyboard-listener') } diff --git a/build.gradle b/build.gradle index c2eea8e..2e0f3f9 100644 --- a/build.gradle +++ b/build.gradle @@ -3,9 +3,10 @@ buildscript { repositories { jcenter() + google() } dependencies { - classpath 'com.android.tools.build:gradle:2.3.3' + classpath 'com.android.tools.build:gradle:3.1.2' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files @@ -20,4 +21,4 @@ allprojects { task clean(type: Delete) { delete rootProject.buildDir -} +} \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 9e5cd56..17d2659 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip diff --git a/keyboard-listener/build.gradle b/keyboard-listener/build.gradle index 55b834e..59a8aea 100644 --- a/keyboard-listener/build.gradle +++ b/keyboard-listener/build.gradle @@ -1,12 +1,12 @@ apply plugin: 'com.android.library' android { - compileSdkVersion 26 - buildToolsVersion "26.0.0" + compileSdkVersion 27 + buildToolsVersion "27.0.0" defaultConfig { minSdkVersion 16 - targetSdkVersion 26 + targetSdkVersion 27 versionCode 1 versionName "1.0" @@ -26,6 +26,6 @@ dependencies { androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { exclude group: 'com.android.support', module: 'support-annotations' }) - compile 'com.android.support:appcompat-v7:26.0.0-alpha1' + //compile 'com.android.support:appcompat-v7:26.0.0-alpha1' testCompile 'junit:junit:4.12' } diff --git a/keyboard-listener/src/main/java/com/rw/keyboardlistener/KeyboardUtils.java b/keyboard-listener/src/main/java/com/rw/keyboardlistener/KeyboardUtils.java index a5e4d17..b0c2f87 100644 --- a/keyboard-listener/src/main/java/com/rw/keyboardlistener/KeyboardUtils.java +++ b/keyboard-listener/src/main/java/com/rw/keyboardlistener/KeyboardUtils.java @@ -22,7 +22,7 @@ public class KeyboardUtils implements ViewTreeObserver.OnGlobalLayoutListener private SoftKeyboardToggleListener mCallback; private View mRootView; private Boolean prevValue = null; - private float mScreenDensity = 1; + private float mScreenDensity; private static HashMap sListenerMap = new HashMap<>(); public interface SoftKeyboardToggleListener @@ -92,7 +92,8 @@ public static void removeAllKeyboardToggleListeners() public static void toggleKeyboardVisibility(Context context) { InputMethodManager inputMethodManager = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE); - inputMethodManager.toggleSoftInput(InputMethodManager.SHOW_FORCED, 0); + if(inputMethodManager != null) + inputMethodManager.toggleSoftInput(InputMethodManager.SHOW_FORCED, 0); } /** @@ -102,7 +103,8 @@ public static void toggleKeyboardVisibility(Context context) public static void forceCloseKeyboard(View activeView) { InputMethodManager inputMethodManager = (InputMethodManager) activeView.getContext().getSystemService(Context.INPUT_METHOD_SERVICE); - inputMethodManager.hideSoftInputFromWindow(activeView.getWindowToken(), 0); + if(inputMethodManager != null) + inputMethodManager.hideSoftInputFromWindow(activeView.getWindowToken(), 0); } private void removeListener()