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

Commit 187135e4 authored by Daniel Sandler's avatar Daniel Sandler Committed by Android (Google) Code Review
Browse files

Merge "Add 2mm dead zone (12dp) at the top of the navigation bar."

parents de148888 41006aaf
Loading
Loading
Loading
Loading
+42 −25
Original line number Diff line number Diff line
@@ -25,14 +25,13 @@
    android:layout_width="match_parent"
    >

    <FrameLayout
        android:id="@+id/background"
    <FrameLayout android:id="@+id/rot0"
        android:layout_height="match_parent"
        android:layout_width="match_parent"
        android:background="#FF000000"
        >

        <LinearLayout android:id="@+id/rot0"
        <LinearLayout
            android:layout_height="match_parent"
            android:layout_width="match_parent"
            android:orientation="horizontal"
@@ -40,12 +39,12 @@

            <!-- navigation controls -->
            <View
                android:layout_width="32dp"
                android:layout_width="40dp"
                android:layout_height="match_parent"
                android:layout_weight="0"
                />
            <com.android.systemui.statusbar.policy.KeyButtonView android:id="@+id/back"
                android:layout_width="54dp"
                android:layout_width="80dp"
                android:layout_height="match_parent"
                android:src="@drawable/ic_sysbar_back_default"
                systemui:keyCode="4"
@@ -57,7 +56,7 @@
                android:layout_weight="1"
                />
            <com.android.systemui.statusbar.policy.KeyButtonView android:id="@+id/home"
                android:layout_width="54dp"
                android:layout_width="80dp"
                android:layout_height="match_parent"
                android:src="@drawable/ic_sysbar_home_default"
                systemui:keyCode="3"
@@ -69,13 +68,13 @@
                android:layout_weight="1"
                />
            <ImageView android:id="@+id/recent_apps"
                android:layout_width="54dp"
                android:layout_width="80dp"
                android:layout_height="match_parent"
                android:src="@drawable/ic_sysbar_recent_default"
                android:layout_weight="0"
                />
            <com.android.systemui.statusbar.policy.KeyButtonView android:id="@+id/menu"
                android:layout_width="32dp"
                android:layout_width="40dp"
                android:layout_height="match_parent"
                android:src="@drawable/ic_sysbar_menu_default"
                systemui:keyCode="82"
@@ -84,17 +83,31 @@
                />
        </LinearLayout>

        <LinearLayout android:id="@+id/rot90"
        <View android:id="@+id/deadzone"
            android:layout_height="@dimen/navigation_bar_deadzone_size"
            android:layout_width="match_parent"
            android:layout_gravity="top"
            android:clickable="true"
            />
    </FrameLayout>

    <FrameLayout android:id="@+id/rot90"
        android:layout_height="match_parent"
        android:layout_width="match_parent"
            android:orientation="vertical"
        android:background="#FF000000"
        android:visibility="gone"
        android:paddingTop="24dp"
        >

        <LinearLayout 
            android:layout_height="match_parent"
            android:layout_width="match_parent"
            android:orientation="vertical"
            >
            
            <!-- navigation controls -->
            <com.android.systemui.statusbar.policy.KeyButtonView android:id="@+id/menu"
                android:layout_height="32dp"
                android:layout_height="40dp"
                android:layout_width="match_parent"
                android:src="@drawable/ic_sysbar_menu_default_land"
                systemui:keyCode="82"
@@ -102,7 +115,7 @@
                android:visibility="invisible"
                />
            <ImageView android:id="@+id/recent_apps"
                android:layout_height="54dp"
                android:layout_height="80dp"
                android:layout_width="match_parent"
                android:src="@drawable/ic_sysbar_recent_default_land"
                android:layout_weight="0"
@@ -113,7 +126,7 @@
                android:layout_weight="1"
                />
            <com.android.systemui.statusbar.policy.KeyButtonView android:id="@+id/home"
                android:layout_height="54dp"
                android:layout_height="80dp"
                android:layout_width="match_parent"
                android:src="@drawable/ic_sysbar_home_default_land"
                systemui:keyCode="3"
@@ -125,28 +138,32 @@
                android:layout_weight="1"
                />
            <com.android.systemui.statusbar.policy.KeyButtonView android:id="@+id/back"
                android:layout_height="54dp"
                android:layout_height="80dp"
                android:layout_width="match_parent"
                android:src="@drawable/ic_sysbar_back_default_land"
                systemui:keyCode="4"
                android:layout_weight="0"
                />
            <View
                android:layout_height="32dp"
                android:layout_height="40dp"
                android:layout_width="match_parent"
                android:layout_weight="0"
                />
        </LinearLayout>

        <LinearLayout android:id="@+id/rot270"
        <View android:id="@+id/deadzone"
            android:layout_width="@dimen/navigation_bar_deadzone_size"
            android:layout_height="match_parent"
            android:layout_width="match_parent"
            android:orientation="vertical"
            android:visibility="gone"
            >
            android:layout_gravity="left"
            android:clickable="true"
            />
    </FrameLayout>

    <!-- not used -->
        </LinearLayout>
    <View android:id="@+id/rot270"
        android:layout_height="match_parent"
        android:layout_width="match_parent"
        android:visibility="gone"
        />

    </FrameLayout>
</com.android.systemui.statusbar.phone.NavigationBarView>
+5 −1
Original line number Diff line number Diff line
@@ -40,7 +40,11 @@
    <dimen name="peek_window_y_offset">-12dp</dimen>

    <!-- thickness (height) of the navigation bar on phones that require it -->
    <dimen name="navigation_bar_size">32dp</dimen>
    <dimen name="navigation_bar_size">48dp</dimen>

    <!-- thickness (height) of the dead zone at the top of the navigation bar,
         reducing false presses on navbar buttons; approx 2mm -->
    <dimen name="navigation_bar_deadzone_size">12dp</dimen>

    <!-- thickness (height) of each notification row, including any separators or padding -->
    <dimen name="notification_height">65dp</dimen>
+8 −5
Original line number Diff line number Diff line
@@ -36,13 +36,14 @@ import com.android.internal.statusbar.IStatusBarService;
import com.android.systemui.R;

public class NavigationBarView extends LinearLayout {
    final static boolean DEBUG_DEADZONE = false;

    final static boolean NAVBAR_ALWAYS_AT_RIGHT = true;

    protected IStatusBarService mBarService;
    final Display mDisplay;
    View mCurrentView = null;
    View[] mRotatedViews = new View[4];
    View mBackground;
    Animator mLastAnimator = null;

    public View getRecentsButton() {
@@ -74,13 +75,13 @@ public class NavigationBarView extends LinearLayout {
    }

    private void setLights(final boolean on) {
        float oldAlpha = mBackground.getAlpha();
        float oldAlpha = mCurrentView.getAlpha();
        android.util.Log.d("NavigationBarView", "animating alpha: " + oldAlpha + " -> "
            + (on ? 1f : 0f));

        if (mLastAnimator != null && mLastAnimator.isRunning()) mLastAnimator.cancel();

        mLastAnimator = ObjectAnimator.ofFloat(mBackground, "alpha", oldAlpha, on ? 1f : 0f)
        mLastAnimator = ObjectAnimator.ofFloat(mCurrentView, "alpha", oldAlpha, on ? 1f : 0f)
            .setDuration(on ? 250 : 1500);
        mLastAnimator.addListener(new AnimatorListenerAdapter() {
            @Override
@@ -92,8 +93,6 @@ public class NavigationBarView extends LinearLayout {
    }

    public void onFinishInflate() {
        mBackground = findViewById(R.id.background);

        mRotatedViews[Surface.ROTATION_0] = 
        mRotatedViews[Surface.ROTATION_180] = findViewById(R.id.rot0);

@@ -121,6 +120,10 @@ public class NavigationBarView extends LinearLayout {
        mCurrentView = mRotatedViews[rot];
        mCurrentView.setVisibility(View.VISIBLE);

        if (DEBUG_DEADZONE) {
            mCurrentView.findViewById(R.id.deadzone).setBackgroundColor(0x808080FF);
        }

        android.util.Log.d("NavigationBarView", "reorient(): rot=" + mDisplay.getRotation());
    }
}