Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7c08ae50 authored by Danesh Mondegarian's avatar Danesh Mondegarian Committed by Gerrit Code Review
Browse files

Merge "Navbar : Rework logic for determining orientation" into jellybean

parents 3c6dbc3d c63ab11a
Loading
Loading
Loading
Loading
+17 −0
Original line number Diff line number Diff line
@@ -12,6 +12,7 @@ import android.content.res.Configuration;
import android.database.DataSetObserver;
import android.graphics.Color;
import android.provider.Settings;
import android.util.DisplayMetrics;
import android.view.HapticFeedbackConstants;
import android.view.KeyEvent;
import android.view.LayoutInflater;
@@ -56,6 +57,7 @@ public class NavbarEditor implements OnTouchListener {
            new LinkedHashMap<String,ButtonInfo>();

    protected static int visibleCount = 4;
    private static Boolean mIsDeviceHybrid = null;

    /**
     * Holds reference to the parent/root of the inflated view
@@ -165,6 +167,21 @@ public class NavbarEditor implements OnTouchListener {
        }
    };

    protected static boolean isDeviceHybrid(Context con) {
        if (mIsDeviceHybrid == null) {
            WindowManager wm = (WindowManager)con.getSystemService(Context.WINDOW_SERVICE);
            android.view.Display display = wm.getDefaultDisplay();
            int shortSize = Math.min(display.getRawHeight(), display.getRawWidth());
            int shortSizeDp = shortSize * DisplayMetrics.DENSITY_DEFAULT / DisplayMetrics.DENSITY_DEVICE;
            if (shortSizeDp < 720 && shortSizeDp >= 600) {
                mIsDeviceHybrid = true;
            } else {
                mIsDeviceHybrid = false;
            }
        }
        return mIsDeviceHybrid;
    }

    @Override
    public boolean onTouch(final View view, MotionEvent event) {
        if (!NavigationBarView.getEditMode() || (mDialog != null && mDialog.isShowing())) {
+1 −5
Original line number Diff line number Diff line
@@ -70,7 +70,6 @@ public class NavigationBarView extends LinearLayout {
    private OnClickListener mRecentsClickListener;
    private RecentsPanelView mRecentsPanel;
    private OnTouchListener mHomeSearchActionListener;
    private boolean mIs600dp;

    protected IStatusBarService mBarService;
    final Display mDisplay;
@@ -181,9 +180,6 @@ public class NavigationBarView extends LinearLayout {
        mBarSize = res.getDimensionPixelSize(R.dimen.navigation_bar_size);
        mVertical = false;
        mShowMenu = false;
        //Silly way to identify 600dp
        //TODO come up with a better way
        mIs600dp = res.getInteger(R.integer.notification_panel_layout_gravity) == 49;
        mDelegateHelper = new DelegateViewHelper(this);
        updateResources();

@@ -415,7 +411,7 @@ public class NavigationBarView extends LinearLayout {
        }
        mCurrentView = mRotatedViews[rot];
        mCurrentView.setVisibility(View.VISIBLE);
        if (!mIs600dp) {
        if (!NavbarEditor.isDeviceHybrid(mContext)) {
            mVertical = (rot == Surface.ROTATION_90 || rot == Surface.ROTATION_270);
        } else {
            mVertical = getWidth() > 0 && getHeight() > getWidth();