aboutsummaryrefslogtreecommitdiffstats
path: root/libs/emojicon
diff options
context:
space:
mode:
authorlookshe <github@lookshe.org>2016-03-06 17:28:50 +0100
committerlookshe <github@lookshe.org>2016-03-06 17:28:50 +0100
commitf28d77dc42f6bac5a026e0b1c78562dee8de45ac (patch)
tree852e3fb71b1232faa7ff3cdd978174648052eb21 /libs/emojicon
parent83cbc2b33b607ee97a770e1cdc2cfc06e3bd15d2 (diff)
Fixes: FS#94 - wrong size on emojicon keyboard
Diffstat (limited to 'libs/emojicon')
-rw-r--r--libs/emojicon/build.gradle2
-rw-r--r--libs/emojicon/src/main/java/github/ankushsachdeva/emojicon/EmojiconsPopup.java21
2 files changed, 20 insertions, 3 deletions
diff --git a/libs/emojicon/build.gradle b/libs/emojicon/build.gradle
index 8673b750..659dafb0 100644
--- a/libs/emojicon/build.gradle
+++ b/libs/emojicon/build.gradle
@@ -1,7 +1,7 @@
apply plugin: 'com.android.library'
android {
- compileSdkVersion 19
+ compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
diff --git a/libs/emojicon/src/main/java/github/ankushsachdeva/emojicon/EmojiconsPopup.java b/libs/emojicon/src/main/java/github/ankushsachdeva/emojicon/EmojiconsPopup.java
index b5d26047..43beee0a 100644
--- a/libs/emojicon/src/main/java/github/ankushsachdeva/emojicon/EmojiconsPopup.java
+++ b/libs/emojicon/src/main/java/github/ankushsachdeva/emojicon/EmojiconsPopup.java
@@ -27,15 +27,18 @@ import github.ankushsachdeva.emojicon.emoji.Symbols;
import java.util.Arrays;
import java.util.List;
+import android.annotation.TargetApi;
import android.app.Activity;
import android.content.Context;
import android.content.res.Resources;
+import android.graphics.Point;
import android.graphics.Rect;
import android.os.Build;
import android.os.Handler;
import android.os.SystemClock;
import android.support.v4.view.PagerAdapter;
import android.support.v4.view.ViewPager;
+import android.view.Display;
import android.view.Gravity;
import android.view.KeyCharacterMap;
import android.view.KeyEvent;
@@ -46,6 +49,7 @@ import android.view.View.OnClickListener;
import android.view.ViewConfiguration;
import android.view.ViewGroup;
import android.view.ViewTreeObserver.OnGlobalLayoutListener;
+import android.view.WindowManager;
import android.view.WindowManager.LayoutParams;
import android.widget.PopupWindow;
@@ -146,6 +150,15 @@ public class EmojiconsPopup extends PopupWindow implements ViewPager.OnPageChang
.getInstance(mContext).saveRecents();
}
+ @TargetApi(Build.VERSION_CODES.HONEYCOMB_MR2)
+ public int calculateScreenHeightForLollipop() {
+ WindowManager wm = (WindowManager) mContext.getSystemService(Context.WINDOW_SERVICE);
+ Display display = wm.getDefaultDisplay();
+ Point size = new Point();
+ display.getSize(size);
+ return size.y;
+ }
+
/**
* Call this function to resize the emoji popup according to your soft keyboard size
*/
@@ -156,8 +169,12 @@ public class EmojiconsPopup extends PopupWindow implements ViewPager.OnPageChang
Rect r = new Rect();
rootView.getWindowVisibleDisplayFrame(r);
- int screenHeight = rootView.getRootView()
- .getHeight();
+ int screenHeight = 0;
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
+ screenHeight = calculateScreenHeightForLollipop();
+ } else {
+ screenHeight = rootView.getRootView().getHeight();
+ }
int heightDifference = screenHeight
- (r.bottom - r.top);
Resources resources = mContext.getResources();