From d7e5a5fbe2e420737ab9136c1e6d03df98e469d9 Mon Sep 17 00:00:00 2001 From: anthony restaino Date: Wed, 3 May 2017 22:01:42 -0400 Subject: [PATCH] Removing unused class --- .../lightning/utils/KeyboardHelper.java | 67 ------------------- 1 file changed, 67 deletions(-) delete mode 100644 app/src/main/java/acr/browser/lightning/utils/KeyboardHelper.java diff --git a/app/src/main/java/acr/browser/lightning/utils/KeyboardHelper.java b/app/src/main/java/acr/browser/lightning/utils/KeyboardHelper.java deleted file mode 100644 index d6ed3ec..0000000 --- a/app/src/main/java/acr/browser/lightning/utils/KeyboardHelper.java +++ /dev/null @@ -1,67 +0,0 @@ -package acr.browser.lightning.utils; - -import android.graphics.Rect; -import android.support.annotation.NonNull; -import android.view.View; -import android.view.ViewTreeObserver; - -class KeyboardHelper { - - interface KeyboardListener { - /** - * Called when the visibility of the keyboard changes. - * Parameter tells whether the keyboard has been shown - * or hidden. - * - * @param visible true if the keyboard has been shown, - * false otherwise. - */ - void keyboardVisibilityChanged(boolean visible); - } - - @NonNull private final View mView; - private int mLastRight = -1; - private int mLastBottom = -1; - - /** - * Constructor - * - * @param view the view to listen on, should be - * the {@link android.R.id#content} view. - */ - public KeyboardHelper(@NonNull View view) { - mView = view; - } - - /** - * Registers a {@link KeyboardListener} to receive - * callbacks when the keyboard is shown for the specific - * view. The view used should be the content view as it - * will receive resize events from the system. - * - * @param listener the listener to register to receive events. - */ - public void registerKeyboardListener(@NonNull final KeyboardListener listener) { - mView.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() { - @Override - public void onGlobalLayout() { - Rect rect = new Rect(); - if (mLastBottom == -1) { - mLastBottom = rect.bottom; - } - if (mLastRight == -1) { - mLastRight = rect.right; - } - mView.getWindowVisibleDisplayFrame(rect); - if (mLastRight == rect.right && rect.bottom < mLastBottom) { - listener.keyboardVisibilityChanged(true); - } else if (mLastRight == rect.right && rect.bottom > mLastBottom) { - listener.keyboardVisibilityChanged(false); - } - mLastBottom = rect.bottom; - mLastRight = rect.right; - } - }); - } - -}