am 6533c544: Merge "Tune spacing in navigation bar for small and big devices" into lmp-mr1-dev
* commit '6533c544cfc3896793e038ae303ce5b9eafebdab': Tune spacing in navigation bar for small and big devices
This commit is contained in:
@@ -43,7 +43,7 @@
|
|||||||
|
|
||||||
<!-- navigation controls -->
|
<!-- navigation controls -->
|
||||||
<View
|
<View
|
||||||
android:layout_width="40dp"
|
android:layout_width="@dimen/navigation_side_padding"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_weight="0"
|
android:layout_weight="0"
|
||||||
android:visibility="invisible"
|
android:visibility="invisible"
|
||||||
@@ -58,7 +58,7 @@
|
|||||||
android:contentDescription="@string/accessibility_back"
|
android:contentDescription="@string/accessibility_back"
|
||||||
/>
|
/>
|
||||||
<View
|
<View
|
||||||
android:layout_width="match_parent"
|
android:layout_width="0dp"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:visibility="invisible"
|
android:visibility="invisible"
|
||||||
@@ -70,10 +70,11 @@
|
|||||||
systemui:keyCode="3"
|
systemui:keyCode="3"
|
||||||
systemui:keyRepeat="false"
|
systemui:keyRepeat="false"
|
||||||
android:layout_weight="0"
|
android:layout_weight="0"
|
||||||
|
android:scaleType="center"
|
||||||
android:contentDescription="@string/accessibility_home"
|
android:contentDescription="@string/accessibility_home"
|
||||||
/>
|
/>
|
||||||
<View
|
<View
|
||||||
android:layout_width="match_parent"
|
android:layout_width="0dp"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:visibility="invisible"
|
android:visibility="invisible"
|
||||||
@@ -83,10 +84,11 @@
|
|||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:src="@drawable/ic_sysbar_recent"
|
android:src="@drawable/ic_sysbar_recent"
|
||||||
android:layout_weight="0"
|
android:layout_weight="0"
|
||||||
|
android:scaleType="center"
|
||||||
android:contentDescription="@string/accessibility_recent"
|
android:contentDescription="@string/accessibility_recent"
|
||||||
/>
|
/>
|
||||||
<FrameLayout
|
<FrameLayout
|
||||||
android:layout_width="@dimen/navigation_extra_key_width"
|
android:layout_width="@dimen/navigation_side_padding"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_weight="0" >
|
android:layout_weight="0" >
|
||||||
<com.android.systemui.statusbar.policy.KeyButtonView
|
<com.android.systemui.statusbar.policy.KeyButtonView
|
||||||
@@ -96,6 +98,7 @@
|
|||||||
android:contentDescription="@string/accessibility_menu"
|
android:contentDescription="@string/accessibility_menu"
|
||||||
android:src="@drawable/ic_sysbar_menu"
|
android:src="@drawable/ic_sysbar_menu"
|
||||||
android:visibility="invisible"
|
android:visibility="invisible"
|
||||||
|
android:layout_gravity="end"
|
||||||
systemui:keyCode="82" />
|
systemui:keyCode="82" />
|
||||||
|
|
||||||
<com.android.systemui.statusbar.policy.KeyButtonView
|
<com.android.systemui.statusbar.policy.KeyButtonView
|
||||||
@@ -105,7 +108,8 @@
|
|||||||
android:contentDescription="@string/accessibility_ime_switch_button"
|
android:contentDescription="@string/accessibility_ime_switch_button"
|
||||||
android:scaleType="centerInside"
|
android:scaleType="centerInside"
|
||||||
android:src="@drawable/ic_ime_switcher_default"
|
android:src="@drawable/ic_ime_switcher_default"
|
||||||
android:visibility="invisible" />
|
android:visibility="invisible"
|
||||||
|
android:layout_gravity="end" />
|
||||||
</FrameLayout>
|
</FrameLayout>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
@@ -119,9 +123,9 @@
|
|||||||
android:visibility="gone"
|
android:visibility="gone"
|
||||||
>
|
>
|
||||||
<ImageView
|
<ImageView
|
||||||
android:layout_width="80dp"
|
android:layout_width="@dimen/navigation_key_width"
|
||||||
android:layout_height="match_parent"
|
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:src="@drawable/ic_sysbar_lights_out_dot_small"
|
||||||
android:scaleType="center"
|
android:scaleType="center"
|
||||||
android:layout_weight="0"
|
android:layout_weight="0"
|
||||||
@@ -133,7 +137,7 @@
|
|||||||
android:visibility="invisible"
|
android:visibility="invisible"
|
||||||
/>
|
/>
|
||||||
<ImageView
|
<ImageView
|
||||||
android:layout_width="80dp"
|
android:layout_width="@dimen/navigation_key_width"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:src="@drawable/ic_sysbar_lights_out_dot_large"
|
android:src="@drawable/ic_sysbar_lights_out_dot_large"
|
||||||
android:scaleType="center"
|
android:scaleType="center"
|
||||||
@@ -146,8 +150,8 @@
|
|||||||
android:visibility="invisible"
|
android:visibility="invisible"
|
||||||
/>
|
/>
|
||||||
<ImageView
|
<ImageView
|
||||||
android:layout_width="80dp"
|
android:layout_width="@dimen/navigation_key_width"
|
||||||
android:layout_marginEnd="40dp"
|
android:layout_marginEnd="@dimen/navigation_side_padding"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:src="@drawable/ic_sysbar_lights_out_dot_small"
|
android:src="@drawable/ic_sysbar_lights_out_dot_small"
|
||||||
android:scaleType="center"
|
android:scaleType="center"
|
||||||
@@ -189,14 +193,15 @@
|
|||||||
<FrameLayout
|
<FrameLayout
|
||||||
android:layout_weight="0"
|
android:layout_weight="0"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="40dp" >
|
android:layout_height="@dimen/navigation_side_padding" >
|
||||||
<com.android.systemui.statusbar.policy.KeyButtonView
|
<com.android.systemui.statusbar.policy.KeyButtonView
|
||||||
android:id="@+id/ime_switcher"
|
android:id="@+id/ime_switcher"
|
||||||
android:layout_width="match_parent"
|
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:contentDescription="@string/accessibility_ime_switch_button"
|
||||||
android:scaleType="centerInside"
|
android:scaleType="centerInside"
|
||||||
android:src="@drawable/ic_ime_switcher_default"
|
android:src="@drawable/ic_ime_switcher_default"
|
||||||
|
android:layout_gravity="top"
|
||||||
android:visibility="invisible" />
|
android:visibility="invisible" />
|
||||||
|
|
||||||
<com.android.systemui.statusbar.policy.KeyButtonView
|
<com.android.systemui.statusbar.policy.KeyButtonView
|
||||||
@@ -205,14 +210,16 @@
|
|||||||
android:layout_height="40dp"
|
android:layout_height="40dp"
|
||||||
android:contentDescription="@string/accessibility_menu"
|
android:contentDescription="@string/accessibility_menu"
|
||||||
android:src="@drawable/ic_sysbar_menu_land"
|
android:src="@drawable/ic_sysbar_menu_land"
|
||||||
|
android:layout_gravity="top"
|
||||||
android:visibility="invisible"
|
android:visibility="invisible"
|
||||||
systemui:keyCode="82" />
|
systemui:keyCode="82" />
|
||||||
</FrameLayout>
|
</FrameLayout>
|
||||||
|
|
||||||
<com.android.systemui.statusbar.policy.KeyButtonView android:id="@+id/recent_apps"
|
<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:layout_width="match_parent"
|
||||||
android:src="@drawable/ic_sysbar_recent_land"
|
android:src="@drawable/ic_sysbar_recent_land"
|
||||||
|
android:scaleType="center"
|
||||||
android:layout_weight="0"
|
android:layout_weight="0"
|
||||||
android:contentDescription="@string/accessibility_recent"
|
android:contentDescription="@string/accessibility_recent"
|
||||||
/>
|
/>
|
||||||
@@ -223,9 +230,10 @@
|
|||||||
android:visibility="invisible"
|
android:visibility="invisible"
|
||||||
/>
|
/>
|
||||||
<com.android.systemui.statusbar.policy.KeyButtonView android:id="@+id/home"
|
<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:layout_width="match_parent"
|
||||||
android:src="@drawable/ic_sysbar_home_land"
|
android:src="@drawable/ic_sysbar_home_land"
|
||||||
|
android:scaleType="center"
|
||||||
systemui:keyCode="3"
|
systemui:keyCode="3"
|
||||||
systemui:keyRepeat="false"
|
systemui:keyRepeat="false"
|
||||||
android:layout_weight="0"
|
android:layout_weight="0"
|
||||||
@@ -238,7 +246,7 @@
|
|||||||
android:visibility="invisible"
|
android:visibility="invisible"
|
||||||
/>
|
/>
|
||||||
<com.android.systemui.statusbar.policy.KeyButtonView android:id="@+id/back"
|
<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:layout_width="match_parent"
|
||||||
android:src="@drawable/ic_sysbar_back_land"
|
android:src="@drawable/ic_sysbar_back_land"
|
||||||
android:scaleType="center"
|
android:scaleType="center"
|
||||||
@@ -247,7 +255,7 @@
|
|||||||
android:contentDescription="@string/accessibility_back"
|
android:contentDescription="@string/accessibility_back"
|
||||||
/>
|
/>
|
||||||
<View
|
<View
|
||||||
android:layout_height="40dp"
|
android:layout_height="@dimen/navigation_side_padding"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_weight="0"
|
android:layout_weight="0"
|
||||||
android:visibility="invisible"
|
android:visibility="invisible"
|
||||||
@@ -263,8 +271,8 @@
|
|||||||
android:visibility="gone"
|
android:visibility="gone"
|
||||||
>
|
>
|
||||||
<ImageView
|
<ImageView
|
||||||
android:layout_height="80dp"
|
android:layout_height="@dimen/navigation_key_width"
|
||||||
android:layout_marginTop="40dp"
|
android:layout_marginTop="@dimen/navigation_side_padding"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:src="@drawable/ic_sysbar_lights_out_dot_small"
|
android:src="@drawable/ic_sysbar_lights_out_dot_small"
|
||||||
android:scaleType="center"
|
android:scaleType="center"
|
||||||
@@ -277,7 +285,7 @@
|
|||||||
android:visibility="invisible"
|
android:visibility="invisible"
|
||||||
/>
|
/>
|
||||||
<ImageView
|
<ImageView
|
||||||
android:layout_height="80dp"
|
android:layout_height="@dimen/navigation_key_width"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:src="@drawable/ic_sysbar_lights_out_dot_large"
|
android:src="@drawable/ic_sysbar_lights_out_dot_large"
|
||||||
android:scaleType="center"
|
android:scaleType="center"
|
||||||
@@ -290,8 +298,8 @@
|
|||||||
android:visibility="invisible"
|
android:visibility="invisible"
|
||||||
/>
|
/>
|
||||||
<ImageView
|
<ImageView
|
||||||
android:layout_height="80dp"
|
android:layout_height="@dimen/navigation_key_width"
|
||||||
android:layout_marginBottom="40dp"
|
android:layout_marginBottom="@dimen/navigation_side_padding"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:src="@drawable/ic_sysbar_lights_out_dot_small"
|
android:src="@drawable/ic_sysbar_lights_out_dot_small"
|
||||||
android:scaleType="center"
|
android:scaleType="center"
|
||||||
|
|||||||
30
packages/SystemUI/res/values-sw360dp/dimens.xml
Normal file
30
packages/SystemUI/res/values-sw360dp/dimens.xml
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
<?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
packages/SystemUI/res/values-sw400dp/dimens.xml
Normal file
27
packages/SystemUI/res/values-sw400dp/dimens.xml
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
<?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>
|
||||||
|
|
||||||
@@ -103,11 +103,15 @@
|
|||||||
<!-- The padding on the global screenshot background image -->
|
<!-- The padding on the global screenshot background image -->
|
||||||
<dimen name="global_screenshot_bg_padding">20dp</dimen>
|
<dimen name="global_screenshot_bg_padding">20dp</dimen>
|
||||||
|
|
||||||
<!-- The width of the view containing non-menu status bar icons -->
|
<!-- The width of the view containing navigation buttons -->
|
||||||
<dimen name="navigation_key_width">80dip</dimen>
|
<dimen name="navigation_key_width">70dp</dimen>
|
||||||
|
|
||||||
<!-- The width of the view containing the menu/ime navigation bar icons -->
|
<!-- 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 -->
|
<!-- Default distance beyond which snaps to the matching target -->
|
||||||
<dimen name="navbar_search_snap_margin">40dip</dimen>
|
<dimen name="navbar_search_snap_margin">40dip</dimen>
|
||||||
|
|||||||
@@ -33,12 +33,14 @@ import android.os.Message;
|
|||||||
import android.util.AttributeSet;
|
import android.util.AttributeSet;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.Display;
|
import android.view.Display;
|
||||||
|
import android.view.Gravity;
|
||||||
import android.view.MotionEvent;
|
import android.view.MotionEvent;
|
||||||
import android.view.Surface;
|
import android.view.Surface;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.view.WindowManager;
|
import android.view.WindowManager;
|
||||||
import android.view.inputmethod.InputMethodManager;
|
import android.view.inputmethod.InputMethodManager;
|
||||||
|
import android.widget.FrameLayout;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
import com.android.systemui.R;
|
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
|
// We swap all children of the 90 and 270 degree layouts, since they are vertical
|
||||||
View rotation90 = mRotatedViews[Surface.ROTATION_90];
|
View rotation90 = mRotatedViews[Surface.ROTATION_90];
|
||||||
swapChildrenOrderIfVertical(rotation90.findViewById(R.id.nav_buttons));
|
swapChildrenOrderIfVertical(rotation90.findViewById(R.id.nav_buttons));
|
||||||
|
adjustExtraKeyGravity(rotation90, isLayoutRtl);
|
||||||
|
|
||||||
View rotation270 = mRotatedViews[Surface.ROTATION_270];
|
View rotation270 = mRotatedViews[Surface.ROTATION_270];
|
||||||
if (rotation90 != rotation270) {
|
if (rotation90 != rotation270) {
|
||||||
swapChildrenOrderIfVertical(rotation270.findViewById(R.id.nav_buttons));
|
swapChildrenOrderIfVertical(rotation270.findViewById(R.id.nav_buttons));
|
||||||
|
adjustExtraKeyGravity(rotation270, isLayoutRtl);
|
||||||
}
|
}
|
||||||
mIsLayoutRtl = 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
|
* Swaps the children order of a LinearLayout if it's orientation is Vertical
|
||||||
|
|||||||
Reference in New Issue
Block a user