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

Commit 6533c544 authored by Jorim Jaggi's avatar Jorim Jaggi Committed by Android (Google) Code Review
Browse files

Merge "Tune spacing in navigation bar for small and big devices" into lmp-mr1-dev

parents b9e290c7 ca8c626f
Loading
Loading
Loading
Loading
+29 −21
Original line number Diff line number Diff line
@@ -43,7 +43,7 @@

            <!-- navigation controls -->
            <View
                android:layout_width="40dp"
                android:layout_width="@dimen/navigation_side_padding"
                android:layout_height="match_parent"
                android:layout_weight="0"
                android:visibility="invisible"
@@ -58,7 +58,7 @@
                android:contentDescription="@string/accessibility_back"
                />
            <View 
                android:layout_width="match_parent"
                android:layout_width="0dp"
                android:layout_height="match_parent"
                android:layout_weight="1"
                android:visibility="invisible"
@@ -70,10 +70,11 @@
                systemui:keyCode="3"
                systemui:keyRepeat="false"
                android:layout_weight="0"
                android:scaleType="center"
                android:contentDescription="@string/accessibility_home"
                />
            <View 
                android:layout_width="match_parent"
                android:layout_width="0dp"
                android:layout_height="match_parent"
                android:layout_weight="1"
                android:visibility="invisible"
@@ -83,10 +84,11 @@
                android:layout_height="match_parent"
                android:src="@drawable/ic_sysbar_recent"
                android:layout_weight="0"
                android:scaleType="center"
                android:contentDescription="@string/accessibility_recent"
                />
            <FrameLayout
                android:layout_width="@dimen/navigation_extra_key_width"
                android:layout_width="@dimen/navigation_side_padding"
                android:layout_height="match_parent"
                android:layout_weight="0" >
                <com.android.systemui.statusbar.policy.KeyButtonView
@@ -96,6 +98,7 @@
                    android:contentDescription="@string/accessibility_menu"
                    android:src="@drawable/ic_sysbar_menu"
                    android:visibility="invisible"
                    android:layout_gravity="end"
                    systemui:keyCode="82" />

                <com.android.systemui.statusbar.policy.KeyButtonView
@@ -105,7 +108,8 @@
                    android:contentDescription="@string/accessibility_ime_switch_button"
                    android:scaleType="centerInside"
                    android:src="@drawable/ic_ime_switcher_default"
                    android:visibility="invisible" />
                    android:visibility="invisible"
                    android:layout_gravity="end" />
            </FrameLayout>

        </LinearLayout>
@@ -119,9 +123,9 @@
            android:visibility="gone"
            >
            <ImageView
                android:layout_width="80dp"
                android:layout_width="@dimen/navigation_key_width"
                android:layout_height="match_parent"
                android:layout_marginStart="40dp"
                android:layout_marginStart="@dimen/navigation_side_padding"
                android:src="@drawable/ic_sysbar_lights_out_dot_small"
                android:scaleType="center"
                android:layout_weight="0"
@@ -133,7 +137,7 @@
                android:visibility="invisible"
                />
            <ImageView
                android:layout_width="80dp"
                android:layout_width="@dimen/navigation_key_width"
                android:layout_height="match_parent"
                android:src="@drawable/ic_sysbar_lights_out_dot_large"
                android:scaleType="center"
@@ -146,8 +150,8 @@
                android:visibility="invisible"
                />
            <ImageView
                android:layout_width="80dp"
                android:layout_marginEnd="40dp"
                android:layout_width="@dimen/navigation_key_width"
                android:layout_marginEnd="@dimen/navigation_side_padding"
                android:layout_height="match_parent"
                android:src="@drawable/ic_sysbar_lights_out_dot_small"
                android:scaleType="center"
@@ -189,14 +193,15 @@
            <FrameLayout
                android:layout_weight="0"
                android:layout_width="match_parent"
                android:layout_height="40dp" >
                android:layout_height="@dimen/navigation_side_padding" >
                <com.android.systemui.statusbar.policy.KeyButtonView
                    android:id="@+id/ime_switcher"
                    android:layout_width="match_parent"
                    android:layout_height="40dp"
                    android:layout_height="@dimen/navigation_extra_key_width"
                    android:contentDescription="@string/accessibility_ime_switch_button"
                    android:scaleType="centerInside"
                    android:src="@drawable/ic_ime_switcher_default"
                    android:layout_gravity="top"
                    android:visibility="invisible" />

                <com.android.systemui.statusbar.policy.KeyButtonView
@@ -205,14 +210,16 @@
                    android:layout_height="40dp"
                    android:contentDescription="@string/accessibility_menu"
                    android:src="@drawable/ic_sysbar_menu_land"
                    android:layout_gravity="top"
                    android:visibility="invisible"
                    systemui:keyCode="82" />
            </FrameLayout>

            <com.android.systemui.statusbar.policy.KeyButtonView android:id="@+id/recent_apps"
                android:layout_height="80dp"
                android:layout_height="@dimen/navigation_key_width"
                android:layout_width="match_parent"
                android:src="@drawable/ic_sysbar_recent_land"
                android:scaleType="center"
                android:layout_weight="0"
                android:contentDescription="@string/accessibility_recent"
                />
@@ -223,9 +230,10 @@
                android:visibility="invisible"
                />
            <com.android.systemui.statusbar.policy.KeyButtonView android:id="@+id/home"
                android:layout_height="80dp"
                android:layout_height="@dimen/navigation_key_width"
                android:layout_width="match_parent"
                android:src="@drawable/ic_sysbar_home_land"
                android:scaleType="center"
                systemui:keyCode="3"
                systemui:keyRepeat="false"
                android:layout_weight="0"
@@ -238,7 +246,7 @@
                android:visibility="invisible"
                />
            <com.android.systemui.statusbar.policy.KeyButtonView android:id="@+id/back"
                android:layout_height="80dp"
                android:layout_height="@dimen/navigation_key_width"
                android:layout_width="match_parent"
                android:src="@drawable/ic_sysbar_back_land"
                android:scaleType="center"
@@ -247,7 +255,7 @@
                android:contentDescription="@string/accessibility_back"
                />
            <View
                android:layout_height="40dp"
                android:layout_height="@dimen/navigation_side_padding"
                android:layout_width="match_parent"
                android:layout_weight="0"
                android:visibility="invisible"
@@ -263,8 +271,8 @@
            android:visibility="gone"
            >
            <ImageView
                android:layout_height="80dp"
                android:layout_marginTop="40dp"
                android:layout_height="@dimen/navigation_key_width"
                android:layout_marginTop="@dimen/navigation_side_padding"
                android:layout_width="match_parent"
                android:src="@drawable/ic_sysbar_lights_out_dot_small"
                android:scaleType="center"
@@ -277,7 +285,7 @@
                android:visibility="invisible"
                />
            <ImageView
                android:layout_height="80dp"
                android:layout_height="@dimen/navigation_key_width"
                android:layout_width="match_parent"
                android:src="@drawable/ic_sysbar_lights_out_dot_large"
                android:scaleType="center"
@@ -290,8 +298,8 @@
                android:visibility="invisible"
                />
            <ImageView
                android:layout_height="80dp"
                android:layout_marginBottom="40dp"
                android:layout_height="@dimen/navigation_key_width"
                android:layout_marginBottom="@dimen/navigation_side_padding"
                android:layout_width="match_parent"
                android:src="@drawable/ic_sysbar_lights_out_dot_small"
                android:scaleType="center"
+30 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
  ~ Copyright (C) 2014 The Android Open Source Project
  ~
  ~ Licensed under the Apache License, Version 2.0 (the "License");
  ~ you may not use this file except in compliance with the License.
  ~ You may obtain a copy of the License at
  ~
  ~      http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing, software
  ~ distributed under the License is distributed on an "AS IS" BASIS,
  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  ~ See the License for the specific language governing permissions and
  ~ limitations under the License
  -->
<resources>

    <!-- The width of the view containing navigation buttons -->
    <dimen name="navigation_key_width">80dip</dimen>

    <!-- The width of the view containing the menu/ime navigation bar icons -->
    <dimen name="navigation_extra_key_width">40dip</dimen>

    <!-- The padding on the side of the navigation bar. Must be greater than or equal to
         navigation_extra_key_width -->
    <dimen name="navigation_side_padding">40dip</dimen>

</resources>
+27 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
  ~ Copyright (C) 2014 The Android Open Source Project
  ~
  ~ Licensed under the Apache License, Version 2.0 (the "License");
  ~ you may not use this file except in compliance with the License.
  ~ You may obtain a copy of the License at
  ~
  ~      http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing, software
  ~ distributed under the License is distributed on an "AS IS" BASIS,
  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  ~ See the License for the specific language governing permissions and
  ~ limitations under the License
  -->
<resources>

    <!-- The width of the view containing navigation buttons -->
    <dimen name="navigation_key_width">80dip</dimen>

    <!-- The padding on the side of the navigation bar. Must be greater than or equal to
         navigation_extra_key_width -->
    <dimen name="navigation_side_padding">50dp</dimen>

</resources>
+7 −3
Original line number Diff line number Diff line
@@ -103,11 +103,15 @@
    <!-- The padding on the global screenshot background image -->
    <dimen name="global_screenshot_bg_padding">20dp</dimen>

    <!-- The width of the view containing non-menu status bar icons -->
    <dimen name="navigation_key_width">80dip</dimen>
    <!-- The width of the view containing navigation buttons -->
    <dimen name="navigation_key_width">70dp</dimen>

    <!-- The width of the view containing the menu/ime navigation bar icons -->
    <dimen name="navigation_extra_key_width">40dip</dimen>
    <dimen name="navigation_extra_key_width">36dp</dimen>

    <!-- The padding on the side of the navigation bar. Must be greater than or equal to
         navigation_extra_key_width -->
    <dimen name="navigation_side_padding">36dp</dimen>

    <!-- Default distance beyond which snaps to the matching target -->
    <dimen name="navbar_search_snap_margin">40dip</dimen>
+18 −0
Original line number Diff line number Diff line
@@ -33,12 +33,14 @@ import android.os.Message;
import android.util.AttributeSet;
import android.util.Log;
import android.view.Display;
import android.view.Gravity;
import android.view.MotionEvent;
import android.view.Surface;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.view.inputmethod.InputMethodManager;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import com.android.systemui.R;
@@ -503,15 +505,31 @@ public class NavigationBarView extends LinearLayout {
            // We swap all children of the 90 and 270 degree layouts, since they are vertical
            View rotation90 = mRotatedViews[Surface.ROTATION_90];
            swapChildrenOrderIfVertical(rotation90.findViewById(R.id.nav_buttons));
            adjustExtraKeyGravity(rotation90, isLayoutRtl);

            View rotation270 = mRotatedViews[Surface.ROTATION_270];
            if (rotation90 != rotation270) {
                swapChildrenOrderIfVertical(rotation270.findViewById(R.id.nav_buttons));
                adjustExtraKeyGravity(rotation270, isLayoutRtl);
            }
            mIsLayoutRtl = isLayoutRtl;
        }
    }

    private void adjustExtraKeyGravity(View navBar, boolean isLayoutRtl) {
        View menu = navBar.findViewById(R.id.menu);
        View imeSwitcher = navBar.findViewById(R.id.ime_switcher);
        if (menu != null) {
            FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams) menu.getLayoutParams();
            lp.gravity = isLayoutRtl ? Gravity.BOTTOM : Gravity.TOP;
            menu.setLayoutParams(lp);
        }
        if (imeSwitcher != null) {
            FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams) imeSwitcher.getLayoutParams();
            lp.gravity = isLayoutRtl ? Gravity.BOTTOM : Gravity.TOP;
            imeSwitcher.setLayoutParams(lp);
        }
    }

    /**
     * Swaps the children order of a LinearLayout if it's orientation is Vertical