aboutsummaryrefslogtreecommitdiffstats
path: root/libs/emojicon/src/main/java/github
diff options
context:
space:
mode:
Diffstat (limited to 'libs/emojicon/src/main/java/github')
-rw-r--r--libs/emojicon/src/main/java/github/ankushsachdeva/emojicon/EmojiconsPopup.java21
1 files changed, 19 insertions, 2 deletions
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();