summaryrefslogtreecommitdiffstats
path: root/packages/SystemUI
diff options
context:
space:
mode:
Diffstat (limited to 'packages/SystemUI')
-rw-r--r--packages/SystemUI/res/drawable-hdpi/ic_sysbar_add.pngbin0 -> 536 bytes
-rw-r--r--packages/SystemUI/res/drawable-hdpi/ic_sysbar_add_land.pngbin0 -> 532 bytes
-rw-r--r--packages/SystemUI/res/drawable-hdpi/ic_sysbar_add_side.pngbin0 -> 992 bytes
-rw-r--r--packages/SystemUI/res/drawable-hdpi/ic_sysbar_back_side.pngbin0 -> 1300 bytes
-rw-r--r--packages/SystemUI/res/drawable-hdpi/ic_sysbar_menu_big.pngbin0 -> 744 bytes
-rw-r--r--packages/SystemUI/res/drawable-hdpi/ic_sysbar_menu_big_land.pngbin0 -> 744 bytes
-rw-r--r--packages/SystemUI/res/drawable-hdpi/ic_sysbar_recent_side.pngbin0 -> 1226 bytes
-rw-r--r--packages/SystemUI/res/drawable-hdpi/ic_sysbar_search.pngbin0 -> 1042 bytes
-rw-r--r--packages/SystemUI/res/drawable-hdpi/ic_sysbar_search_land.pngbin0 -> 1016 bytes
-rw-r--r--packages/SystemUI/res/drawable-hdpi/ic_sysbar_search_side.pngbin0 -> 1440 bytes
-rw-r--r--packages/SystemUI/res/drawable-mdpi/ic_sysbar_add.pngbin0 -> 321 bytes
-rw-r--r--packages/SystemUI/res/drawable-mdpi/ic_sysbar_add_land.pngbin0 -> 320 bytes
-rw-r--r--packages/SystemUI/res/drawable-mdpi/ic_sysbar_add_side.pngbin0 -> 1083 bytes
-rw-r--r--packages/SystemUI/res/drawable-mdpi/ic_sysbar_back_side.pngbin0 -> 1177 bytes
-rw-r--r--packages/SystemUI/res/drawable-mdpi/ic_sysbar_menu_big.pngbin0 -> 487 bytes
-rw-r--r--packages/SystemUI/res/drawable-mdpi/ic_sysbar_menu_big_land.pngbin0 -> 479 bytes
-rw-r--r--packages/SystemUI/res/drawable-mdpi/ic_sysbar_recent_side.pngbin0 -> 1151 bytes
-rw-r--r--packages/SystemUI/res/drawable-mdpi/ic_sysbar_search.pngbin0 -> 650 bytes
-rw-r--r--packages/SystemUI/res/drawable-mdpi/ic_sysbar_search_land.pngbin0 -> 641 bytes
-rw-r--r--packages/SystemUI/res/drawable-mdpi/ic_sysbar_search_side.pngbin0 -> 1266 bytes
-rw-r--r--packages/SystemUI/res/drawable-xhdpi/ic_sysbar_add.pngbin0 -> 552 bytes
-rw-r--r--packages/SystemUI/res/drawable-xhdpi/ic_sysbar_add_land.pngbin0 -> 543 bytes
-rw-r--r--packages/SystemUI/res/drawable-xhdpi/ic_sysbar_add_side.pngbin0 -> 517 bytes
-rw-r--r--packages/SystemUI/res/drawable-xhdpi/ic_sysbar_back_side.pngbin0 -> 3434 bytes
-rw-r--r--packages/SystemUI/res/drawable-xhdpi/ic_sysbar_menu_big.pngbin0 -> 898 bytes
-rw-r--r--packages/SystemUI/res/drawable-xhdpi/ic_sysbar_menu_big_land.pngbin0 -> 880 bytes
-rw-r--r--packages/SystemUI/res/drawable-xhdpi/ic_sysbar_recent_side.pngbin0 -> 3209 bytes
-rw-r--r--packages/SystemUI/res/drawable-xhdpi/ic_sysbar_search.pngbin0 -> 1457 bytes
-rw-r--r--packages/SystemUI/res/drawable-xhdpi/ic_sysbar_search_land.pngbin0 -> 1409 bytes
-rw-r--r--packages/SystemUI/res/drawable-xhdpi/ic_sysbar_search_side.pngbin0 -> 3766 bytes
-rw-r--r--packages/SystemUI/res/drawable-xxhdpi/ic_sysbar_add.pngbin0 -> 889 bytes
-rw-r--r--packages/SystemUI/res/drawable-xxhdpi/ic_sysbar_add_land.pngbin0 -> 891 bytes
-rw-r--r--packages/SystemUI/res/drawable-xxhdpi/ic_sysbar_menu_big.pngbin0 -> 1444 bytes
-rw-r--r--packages/SystemUI/res/drawable-xxhdpi/ic_sysbar_menu_big_land.pngbin0 -> 1479 bytes
-rw-r--r--packages/SystemUI/res/drawable-xxhdpi/ic_sysbar_search.pngbin0 -> 2566 bytes
-rw-r--r--packages/SystemUI/res/drawable-xxhdpi/ic_sysbar_search_land.pngbin0 -> 2769 bytes
-rw-r--r--packages/SystemUI/res/layout-sw600dp/mid_navigation_bar_land.xml98
-rw-r--r--packages/SystemUI/res/layout-sw600dp/mid_navigation_bar_port.xml99
-rw-r--r--packages/SystemUI/res/layout-sw600dp/navigation_bar.xml324
-rw-r--r--packages/SystemUI/res/layout/mid_navigation_bar_land.xml103
-rw-r--r--packages/SystemUI/res/layout/mid_navigation_bar_port.xml102
-rw-r--r--packages/SystemUI/res/layout/navigation_bar.xml218
-rw-r--r--packages/SystemUI/res/layout/navigation_bar_edit_menu_item.xml44
-rw-r--r--packages/SystemUI/res/values/cm_strings.xml11
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/NavbarEditor.java547
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java218
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java24
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyButtonView.java72
48 files changed, 1378 insertions, 482 deletions
diff --git a/packages/SystemUI/res/drawable-hdpi/ic_sysbar_add.png b/packages/SystemUI/res/drawable-hdpi/ic_sysbar_add.png
new file mode 100644
index 0000000..66e0c12
--- /dev/null
+++ b/packages/SystemUI/res/drawable-hdpi/ic_sysbar_add.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-hdpi/ic_sysbar_add_land.png b/packages/SystemUI/res/drawable-hdpi/ic_sysbar_add_land.png
new file mode 100644
index 0000000..63da6d2
--- /dev/null
+++ b/packages/SystemUI/res/drawable-hdpi/ic_sysbar_add_land.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-hdpi/ic_sysbar_add_side.png b/packages/SystemUI/res/drawable-hdpi/ic_sysbar_add_side.png
new file mode 100644
index 0000000..956ebe4
--- /dev/null
+++ b/packages/SystemUI/res/drawable-hdpi/ic_sysbar_add_side.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-hdpi/ic_sysbar_back_side.png b/packages/SystemUI/res/drawable-hdpi/ic_sysbar_back_side.png
new file mode 100644
index 0000000..0d12637
--- /dev/null
+++ b/packages/SystemUI/res/drawable-hdpi/ic_sysbar_back_side.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-hdpi/ic_sysbar_menu_big.png b/packages/SystemUI/res/drawable-hdpi/ic_sysbar_menu_big.png
new file mode 100644
index 0000000..5b30293
--- /dev/null
+++ b/packages/SystemUI/res/drawable-hdpi/ic_sysbar_menu_big.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-hdpi/ic_sysbar_menu_big_land.png b/packages/SystemUI/res/drawable-hdpi/ic_sysbar_menu_big_land.png
new file mode 100644
index 0000000..99413a8
--- /dev/null
+++ b/packages/SystemUI/res/drawable-hdpi/ic_sysbar_menu_big_land.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-hdpi/ic_sysbar_recent_side.png b/packages/SystemUI/res/drawable-hdpi/ic_sysbar_recent_side.png
new file mode 100644
index 0000000..24ad426
--- /dev/null
+++ b/packages/SystemUI/res/drawable-hdpi/ic_sysbar_recent_side.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-hdpi/ic_sysbar_search.png b/packages/SystemUI/res/drawable-hdpi/ic_sysbar_search.png
new file mode 100644
index 0000000..b31c2c7
--- /dev/null
+++ b/packages/SystemUI/res/drawable-hdpi/ic_sysbar_search.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-hdpi/ic_sysbar_search_land.png b/packages/SystemUI/res/drawable-hdpi/ic_sysbar_search_land.png
new file mode 100644
index 0000000..5ad767c
--- /dev/null
+++ b/packages/SystemUI/res/drawable-hdpi/ic_sysbar_search_land.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-hdpi/ic_sysbar_search_side.png b/packages/SystemUI/res/drawable-hdpi/ic_sysbar_search_side.png
new file mode 100644
index 0000000..f8e9b08
--- /dev/null
+++ b/packages/SystemUI/res/drawable-hdpi/ic_sysbar_search_side.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-mdpi/ic_sysbar_add.png b/packages/SystemUI/res/drawable-mdpi/ic_sysbar_add.png
new file mode 100644
index 0000000..cf9fda6
--- /dev/null
+++ b/packages/SystemUI/res/drawable-mdpi/ic_sysbar_add.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-mdpi/ic_sysbar_add_land.png b/packages/SystemUI/res/drawable-mdpi/ic_sysbar_add_land.png
new file mode 100644
index 0000000..ec8dfa4
--- /dev/null
+++ b/packages/SystemUI/res/drawable-mdpi/ic_sysbar_add_land.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-mdpi/ic_sysbar_add_side.png b/packages/SystemUI/res/drawable-mdpi/ic_sysbar_add_side.png
new file mode 100644
index 0000000..6231b21
--- /dev/null
+++ b/packages/SystemUI/res/drawable-mdpi/ic_sysbar_add_side.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-mdpi/ic_sysbar_back_side.png b/packages/SystemUI/res/drawable-mdpi/ic_sysbar_back_side.png
new file mode 100644
index 0000000..5854b38
--- /dev/null
+++ b/packages/SystemUI/res/drawable-mdpi/ic_sysbar_back_side.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-mdpi/ic_sysbar_menu_big.png b/packages/SystemUI/res/drawable-mdpi/ic_sysbar_menu_big.png
new file mode 100644
index 0000000..c2dd22b
--- /dev/null
+++ b/packages/SystemUI/res/drawable-mdpi/ic_sysbar_menu_big.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-mdpi/ic_sysbar_menu_big_land.png b/packages/SystemUI/res/drawable-mdpi/ic_sysbar_menu_big_land.png
new file mode 100644
index 0000000..4345844
--- /dev/null
+++ b/packages/SystemUI/res/drawable-mdpi/ic_sysbar_menu_big_land.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-mdpi/ic_sysbar_recent_side.png b/packages/SystemUI/res/drawable-mdpi/ic_sysbar_recent_side.png
new file mode 100644
index 0000000..286bd00
--- /dev/null
+++ b/packages/SystemUI/res/drawable-mdpi/ic_sysbar_recent_side.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-mdpi/ic_sysbar_search.png b/packages/SystemUI/res/drawable-mdpi/ic_sysbar_search.png
new file mode 100644
index 0000000..885c130
--- /dev/null
+++ b/packages/SystemUI/res/drawable-mdpi/ic_sysbar_search.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-mdpi/ic_sysbar_search_land.png b/packages/SystemUI/res/drawable-mdpi/ic_sysbar_search_land.png
new file mode 100644
index 0000000..2487dfb
--- /dev/null
+++ b/packages/SystemUI/res/drawable-mdpi/ic_sysbar_search_land.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-mdpi/ic_sysbar_search_side.png b/packages/SystemUI/res/drawable-mdpi/ic_sysbar_search_side.png
new file mode 100644
index 0000000..0ff41f5
--- /dev/null
+++ b/packages/SystemUI/res/drawable-mdpi/ic_sysbar_search_side.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xhdpi/ic_sysbar_add.png b/packages/SystemUI/res/drawable-xhdpi/ic_sysbar_add.png
new file mode 100644
index 0000000..75ba404
--- /dev/null
+++ b/packages/SystemUI/res/drawable-xhdpi/ic_sysbar_add.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xhdpi/ic_sysbar_add_land.png b/packages/SystemUI/res/drawable-xhdpi/ic_sysbar_add_land.png
new file mode 100644
index 0000000..30f4415
--- /dev/null
+++ b/packages/SystemUI/res/drawable-xhdpi/ic_sysbar_add_land.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xhdpi/ic_sysbar_add_side.png b/packages/SystemUI/res/drawable-xhdpi/ic_sysbar_add_side.png
new file mode 100644
index 0000000..916fe9a
--- /dev/null
+++ b/packages/SystemUI/res/drawable-xhdpi/ic_sysbar_add_side.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xhdpi/ic_sysbar_back_side.png b/packages/SystemUI/res/drawable-xhdpi/ic_sysbar_back_side.png
new file mode 100644
index 0000000..7504d32
--- /dev/null
+++ b/packages/SystemUI/res/drawable-xhdpi/ic_sysbar_back_side.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xhdpi/ic_sysbar_menu_big.png b/packages/SystemUI/res/drawable-xhdpi/ic_sysbar_menu_big.png
new file mode 100644
index 0000000..83f8d78
--- /dev/null
+++ b/packages/SystemUI/res/drawable-xhdpi/ic_sysbar_menu_big.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xhdpi/ic_sysbar_menu_big_land.png b/packages/SystemUI/res/drawable-xhdpi/ic_sysbar_menu_big_land.png
new file mode 100644
index 0000000..fe74ae9
--- /dev/null
+++ b/packages/SystemUI/res/drawable-xhdpi/ic_sysbar_menu_big_land.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xhdpi/ic_sysbar_recent_side.png b/packages/SystemUI/res/drawable-xhdpi/ic_sysbar_recent_side.png
new file mode 100644
index 0000000..db596cc
--- /dev/null
+++ b/packages/SystemUI/res/drawable-xhdpi/ic_sysbar_recent_side.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xhdpi/ic_sysbar_search.png b/packages/SystemUI/res/drawable-xhdpi/ic_sysbar_search.png
new file mode 100644
index 0000000..007faa3
--- /dev/null
+++ b/packages/SystemUI/res/drawable-xhdpi/ic_sysbar_search.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xhdpi/ic_sysbar_search_land.png b/packages/SystemUI/res/drawable-xhdpi/ic_sysbar_search_land.png
new file mode 100644
index 0000000..e997c37
--- /dev/null
+++ b/packages/SystemUI/res/drawable-xhdpi/ic_sysbar_search_land.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xhdpi/ic_sysbar_search_side.png b/packages/SystemUI/res/drawable-xhdpi/ic_sysbar_search_side.png
new file mode 100644
index 0000000..69f1a0b
--- /dev/null
+++ b/packages/SystemUI/res/drawable-xhdpi/ic_sysbar_search_side.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xxhdpi/ic_sysbar_add.png b/packages/SystemUI/res/drawable-xxhdpi/ic_sysbar_add.png
new file mode 100644
index 0000000..af182a6
--- /dev/null
+++ b/packages/SystemUI/res/drawable-xxhdpi/ic_sysbar_add.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xxhdpi/ic_sysbar_add_land.png b/packages/SystemUI/res/drawable-xxhdpi/ic_sysbar_add_land.png
new file mode 100644
index 0000000..cb601f3
--- /dev/null
+++ b/packages/SystemUI/res/drawable-xxhdpi/ic_sysbar_add_land.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xxhdpi/ic_sysbar_menu_big.png b/packages/SystemUI/res/drawable-xxhdpi/ic_sysbar_menu_big.png
new file mode 100644
index 0000000..9664962
--- /dev/null
+++ b/packages/SystemUI/res/drawable-xxhdpi/ic_sysbar_menu_big.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xxhdpi/ic_sysbar_menu_big_land.png b/packages/SystemUI/res/drawable-xxhdpi/ic_sysbar_menu_big_land.png
new file mode 100644
index 0000000..bb677dc
--- /dev/null
+++ b/packages/SystemUI/res/drawable-xxhdpi/ic_sysbar_menu_big_land.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xxhdpi/ic_sysbar_search.png b/packages/SystemUI/res/drawable-xxhdpi/ic_sysbar_search.png
new file mode 100644
index 0000000..9fcc72d
--- /dev/null
+++ b/packages/SystemUI/res/drawable-xxhdpi/ic_sysbar_search.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xxhdpi/ic_sysbar_search_land.png b/packages/SystemUI/res/drawable-xxhdpi/ic_sysbar_search_land.png
new file mode 100644
index 0000000..b2ae541
--- /dev/null
+++ b/packages/SystemUI/res/drawable-xxhdpi/ic_sysbar_search_land.png
Binary files differ
diff --git a/packages/SystemUI/res/layout-sw600dp/mid_navigation_bar_land.xml b/packages/SystemUI/res/layout-sw600dp/mid_navigation_bar_land.xml
new file mode 100644
index 0000000..3e146ea
--- /dev/null
+++ b/packages/SystemUI/res/layout-sw600dp/mid_navigation_bar_land.xml
@@ -0,0 +1,98 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+** Copyright 2015 The CyanogenMod 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.
+*/
+-->
+
+<LinearLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:systemui="http://schemas.android.com/apk/res-auto"
+ android:layout_height="match_parent"
+ android:layout_width="match_parent"
+ android:orientation="horizontal"
+ android:clipChildren="false"
+ android:clipToPadding="false"
+ android:id="@+id/nav_buttons">
+
+ <FrameLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content" >
+ <com.android.systemui.statusbar.policy.KeyButtonView
+ android:id="@+id/one"
+ android:layout_width="48dp"
+ android:layout_height="match_parent"
+ android:layout_weight="0"
+ android:scaleType="centerInside" />
+ <com.android.systemui.statusbar.policy.KeyButtonView
+ android:id="@+id/ime_switcher"
+ android:layout_width="match_parent"
+ android:layout_height="@dimen/navigation_extra_key_width"
+ android:src="@drawable/ic_ime_switcher_default"
+ android:visibility="invisible"
+ android:contentDescription="@string/accessibility_ime_switch_button"
+ android:scaleType="centerInside" />
+ </FrameLayout>
+ <View
+ android:layout_width="0dp"
+ android:layout_height="match_parent"
+ android:layout_weight="1" />
+ <LinearLayout
+ android:layout_height="match_parent"
+ android:layout_width="wrap_content"
+ android:layout_weight="1"
+ android:clipChildren="false"
+ android:clipToPadding="false"
+ android:id="@+id/mid_nav_buttons"
+ android:gravity="center_horizontal"
+ android:layout_gravity="center_horizontal"
+ android:animateLayoutChanges="true">
+ <com.android.systemui.statusbar.policy.KeyButtonView
+ android:id="@+id/two"
+ android:layout_width="162dp" android:paddingLeft="42dp" android:paddingRight="42dp"
+ android:layout_height="match_parent"
+ systemui:keyRepeat="true"
+ android:layout_weight="0" />
+ <com.android.systemui.statusbar.policy.KeyButtonView
+ android:id="@+id/three"
+ android:layout_width="162dp" android:paddingLeft="42dp" android:paddingRight="42dp"
+ android:layout_height="match_parent"
+ systemui:keyRepeat="true"
+ android:layout_weight="0" />
+ <com.android.systemui.statusbar.policy.KeyButtonView
+ android:id="@+id/four"
+ android:layout_width="162dp" android:paddingLeft="42dp" android:paddingRight="42dp"
+ android:layout_height="match_parent"
+ android:layout_weight="0"
+ systemui:keyRepeat="true" />
+ <com.android.systemui.statusbar.policy.KeyButtonView
+ android:id="@+id/five"
+ android:layout_width="162dp" android:paddingLeft="42dp" android:paddingRight="42dp"
+ android:layout_height="match_parent"
+ android:layout_weight="0"
+ systemui:keyRepeat="true" />
+ </LinearLayout>
+ <View
+ android:layout_width="0dp"
+ android:layout_height="match_parent"
+ android:layout_weight="1" />
+ <com.android.systemui.statusbar.policy.KeyButtonView
+ android:id="@+id/six"
+ android:layout_width="48dp"
+ android:layout_height="match_parent"
+ android:layout_weight="0"
+ android:scaleType="fitCenter" />
+
+</LinearLayout>
diff --git a/packages/SystemUI/res/layout-sw600dp/mid_navigation_bar_port.xml b/packages/SystemUI/res/layout-sw600dp/mid_navigation_bar_port.xml
new file mode 100644
index 0000000..3034280
--- /dev/null
+++ b/packages/SystemUI/res/layout-sw600dp/mid_navigation_bar_port.xml
@@ -0,0 +1,99 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+** Copyright 2015 The CyanogenMod 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.
+*/
+-->
+
+<LinearLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:systemui="http://schemas.android.com/apk/res-auto"
+ android:layout_height="match_parent"
+ android:layout_width="match_parent"
+ android:orientation="horizontal"
+ android:clipChildren="false"
+ android:clipToPadding="false"
+ android:id="@+id/nav_buttons">
+ <com.android.systemui.statusbar.policy.KeyButtonView
+ android:id="@+id/one"
+ android:layout_width="@dimen/navigation_extra_key_width"
+ android:layout_height="match_parent"
+ android:layout_weight="0"
+ android:scaleType="fitCenter" />
+ <View
+ android:layout_width="0dp"
+ android:layout_height="match_parent"
+ android:layout_weight="1" />
+ <LinearLayout
+ android:layout_height="match_parent"
+ android:layout_width="wrap_content"
+ android:layout_weight="1"
+ android:clipChildren="false"
+ android:clipToPadding="false"
+ android:id="@+id/mid_nav_buttons"
+ android:gravity="center_horizontal"
+ android:layout_gravity="center_horizontal"
+ android:animateLayoutChanges="true">
+ <com.android.systemui.statusbar.policy.KeyButtonView
+ android:id="@+id/two"
+ android:layout_width="128dp" android:paddingLeft="25dp" android:paddingRight="25dp"
+ android:layout_height="match_parent"
+ systemui:keyRepeat="true"
+ android:layout_weight="0" />
+ <com.android.systemui.statusbar.policy.KeyButtonView
+ android:id="@+id/three"
+ android:layout_width="128dp" android:paddingLeft="25dp" android:paddingRight="25dp"
+ android:layout_height="match_parent"
+ systemui:keyRepeat="true"
+ android:layout_weight="0" />
+ <com.android.systemui.statusbar.policy.KeyButtonView
+ android:id="@+id/four"
+ android:layout_width="128dp" android:paddingLeft="25dp" android:paddingRight="25dp"
+ android:layout_height="match_parent"
+ android:layout_weight="0"
+ systemui:keyRepeat="true" />
+ <com.android.systemui.statusbar.policy.KeyButtonView
+ android:id="@+id/five"
+ android:layout_width="128dp" android:paddingLeft="25dp" android:paddingRight="25dp"
+ android:layout_height="match_parent"
+ android:layout_weight="0"
+ systemui:keyRepeat="true" />
+ </LinearLayout>
+ <View
+ android:layout_width="0dp"
+ android:layout_height="match_parent"
+ android:layout_weight="1" />
+ <FrameLayout
+ android:layout_width="@dimen/navigation_extra_key_width"
+ android:layout_height="match_parent"
+ android:layout_weight="0"
+ android:layout_marginEnd="2dp" >
+ <com.android.systemui.statusbar.policy.KeyButtonView
+ android:id="@+id/ime_switcher"
+ android:layout_width="@dimen/navigation_extra_key_width"
+ android:layout_height="match_parent"
+ android:scaleType="centerInside"
+ android:src="@drawable/ic_ime_switcher_default"
+ android:visibility="invisible"
+ android:contentDescription="@string/accessibility_ime_switch_button" />
+ <com.android.systemui.statusbar.policy.KeyButtonView
+ android:id="@+id/six"
+ android:layout_width="@dimen/navigation_extra_key_width"
+ android:layout_height="match_parent"
+ android:layout_weight="0"
+ android:scaleType="fitCenter" />
+ </FrameLayout>
+
+</LinearLayout>
diff --git a/packages/SystemUI/res/layout-sw600dp/navigation_bar.xml b/packages/SystemUI/res/layout-sw600dp/navigation_bar.xml
index 9912343..68883ce 100644
--- a/packages/SystemUI/res/layout-sw600dp/navigation_bar.xml
+++ b/packages/SystemUI/res/layout-sw600dp/navigation_bar.xml
@@ -3,16 +3,16 @@
**
** Copyright 2012, 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
+** 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
+** 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
+** 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.
-->
@@ -36,126 +36,65 @@
android:orientation="horizontal"
android:clipChildren="false"
android:clipToPadding="false"
- android:id="@+id/nav_buttons"
- android:animateLayoutChanges="true"
+ android:id="@+id/container"
>
- <!-- navigation controls -->
- <View
- android:layout_width="@dimen/navigation_extra_key_width"
- android:layout_height="match_parent"
- android:layout_weight="0"
- android:layout_marginStart="2dp"
- android:visibility="invisible"
- />
- <Space
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:layout_weight="1"
- />
- <com.android.systemui.statusbar.policy.KeyButtonView android:id="@+id/back"
- android:layout_width="128dp" android:paddingStart="25dp" android:paddingEnd="25dp"
- android:layout_height="match_parent"
- android:src="@drawable/ic_sysbar_back"
- android:scaleType="centerInside"
- systemui:keyCode="4"
- android:layout_weight="0"
- android:contentDescription="@string/accessibility_back"
- />
- <com.android.systemui.statusbar.policy.KeyButtonView android:id="@+id/home"
- android:layout_width="128dp" android:paddingStart="25dp" android:paddingEnd="25dp"
- android:layout_height="match_parent"
- android:src="@drawable/ic_sysbar_home"
- android:scaleType="centerInside"
- systemui:keyCode="3"
- systemui:keyRepeat="true"
- android:layout_weight="0"
- android:contentDescription="@string/accessibility_home"
- />
- <com.android.systemui.statusbar.policy.KeyButtonView android:id="@+id/recent_apps"
- android:layout_width="128dp" android:paddingStart="25dp" android:paddingEnd="25dp"
- android:layout_height="match_parent"
- android:src="@drawable/ic_sysbar_recent"
- android:scaleType="centerInside"
- android:layout_weight="0"
- android:contentDescription="@string/accessibility_recent"
- />
- <Space
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:layout_weight="1"
- />
- <FrameLayout
- android:layout_width="@dimen/navigation_extra_key_width"
- android:layout_height="match_parent"
- android:layout_weight="0"
- android:layout_marginEnd="2dp" >
- <com.android.systemui.statusbar.policy.KeyButtonView android:id="@+id/menu"
- android:layout_width="@dimen/navigation_extra_key_width"
- android:layout_height="match_parent"
- android:src="@drawable/ic_sysbar_menu"
- android:scaleType="centerInside"
- android:layout_marginEnd="2dp"
- systemui:keyCode="82"
- android:visibility="invisible"
- android:contentDescription="@string/accessibility_menu"
- />
- <com.android.systemui.statusbar.policy.KeyButtonView
- android:id="@+id/ime_switcher"
- android:layout_width="@dimen/navigation_extra_key_width"
- android:layout_height="match_parent"
- android:layout_marginEnd="2dp"
- android:scaleType="centerInside"
- android:src="@drawable/ic_ime_switcher_default"
- android:visibility="invisible"
- android:contentDescription="@string/accessibility_ime_switch_button" />
- </FrameLayout>
+ <include layout="@layout/mid_navigation_bar_port"/>
+
</LinearLayout>
- <!-- lights out layout to match exactly -->
- <LinearLayout
+ <LinearLayout
android:layout_height="match_parent"
android:layout_width="match_parent"
android:orientation="horizontal"
- android:id="@+id/lights_out"
- android:visibility="gone"
+ android:gravity="center_horizontal"
+ android:layout_gravity="center_horizontal"
>
- <Space
- android:layout_width="match_parent"
+ <View
+ android:layout_width="0dp"
android:layout_height="match_parent"
- android:layout_weight="1"
- />
- <ImageView
- android:layout_width="128dp" android:paddingStart="25dp" android:paddingEnd="25dp"
+ android:layout_weight="1" />
+ <!-- lights out layout to match exactly -->
+ <LinearLayout
android:layout_height="match_parent"
+ android:layout_width="wrap_content"
+ android:layout_weight="1"
+ android:orientation="horizontal"
+ android:gravity="center_horizontal"
android:layout_marginStart="40dp"
- android:src="@drawable/ic_sysbar_lights_out_dot_small"
- android:scaleType="center"
- android:layout_weight="0"
- android:contentDescription="@string/accessibility_back"
- />
- <ImageView
- android:layout_width="128dp" android:paddingStart="25dp" android:paddingEnd="25dp"
- android:layout_height="match_parent"
- android:src="@drawable/ic_sysbar_lights_out_dot_large"
- android:scaleType="center"
- android:layout_weight="0"
- android:contentDescription="@string/accessibility_home"
- />
- <ImageView
- android:layout_width="128dp" android:paddingStart="25dp" android:paddingEnd="25dp"
android:layout_marginEnd="40dp"
+ android:layout_gravity="center_horizontal"
+ android:id="@+id/lights_out"
+ android:visibility="gone">
+ <ImageView
+ android:layout_width="128dp" android:paddingStart="25dp" android:paddingEnd="25dp"
+ android:layout_height="match_parent"
+ android:src="@drawable/ic_sysbar_lights_out_dot_large"
+ android:scaleType="center"
+ />
+ <ImageView
+ android:layout_width="128dp" android:paddingStart="25dp" android:paddingEnd="25dp"
+ android:layout_height="match_parent"
+ android:src="@drawable/ic_sysbar_lights_out_dot_large"
+ android:scaleType="center"
+ />
+ <ImageView
+ android:layout_width="128dp" android:paddingStart="25dp" android:paddingEnd="25dp"
+ android:layout_height="match_parent"
+ android:src="@drawable/ic_sysbar_lights_out_dot_large"
+ android:scaleType="center"
+ />
+ <ImageView
+ android:layout_width="128dp" android:paddingStart="25dp" android:paddingEnd="25dp"
+ android:layout_height="match_parent"
+ android:src="@drawable/ic_sysbar_lights_out_dot_large"
+ android:scaleType="center"
+ />
+ </LinearLayout>
+ <View
+ android:layout_width="0dp"
android:layout_height="match_parent"
- android:src="@drawable/ic_sysbar_lights_out_dot_small"
- android:scaleType="center"
- android:layout_weight="0"
- android:contentDescription="@string/accessibility_recent"
- />
- <Space
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:layout_weight="1"
- />
+ android:layout_weight="1" />
</LinearLayout>
<com.android.systemui.statusbar.policy.DeadZone
@@ -182,127 +121,72 @@
android:layout_height="match_parent"
android:layout_width="match_parent"
android:orientation="horizontal"
+ android:gravity="center_horizontal"
+ android:layout_gravity="center_horizontal"
android:clipChildren="false"
android:clipToPadding="false"
- android:id="@+id/nav_buttons"
- android:animateLayoutChanges="true"
+ android:id="@+id/container"
>
- <!-- navigation controls -->
- <View
- android:layout_width="@dimen/navigation_extra_key_width"
- android:layout_height="match_parent"
- android:layout_weight="0"
- android:layout_marginStart="2dp"
- android:visibility="invisible"
- />
- <Space
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:layout_weight="1"
- />
- <com.android.systemui.statusbar.policy.KeyButtonView android:id="@+id/back"
- android:layout_width="162dp" android:paddingStart="42dp" android:paddingEnd="42dp"
- android:layout_height="match_parent"
- android:src="@drawable/ic_sysbar_back"
- android:scaleType="centerInside"
- systemui:keyCode="4"
- android:layout_weight="0"
- android:contentDescription="@string/accessibility_back"
- />
- <com.android.systemui.statusbar.policy.KeyButtonView android:id="@+id/home"
- android:layout_width="162dp" android:paddingStart="42dp" android:paddingEnd="42dp"
- android:layout_height="match_parent"
- android:src="@drawable/ic_sysbar_home"
- android:scaleType="centerInside"
- systemui:keyCode="3"
- systemui:keyRepeat="true"
- android:layout_weight="0"
- android:contentDescription="@string/accessibility_home"
- />
- <com.android.systemui.statusbar.policy.KeyButtonView android:id="@+id/recent_apps"
- android:layout_width="162dp" android:paddingStart="42dp" android:paddingEnd="42dp"
- android:layout_height="match_parent"
- android:src="@drawable/ic_sysbar_recent"
- android:scaleType="centerInside"
- android:layout_weight="0"
- android:contentDescription="@string/accessibility_recent"
- />
- <Space
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:layout_weight="1"
- />
- <FrameLayout
- android:layout_width="@dimen/navigation_extra_key_width"
- android:layout_height="match_parent"
- android:layout_marginEnd="2dp"
- android:layout_weight="0" >
- <com.android.systemui.statusbar.policy.KeyButtonView android:id="@+id/menu"
- android:layout_width="@dimen/navigation_extra_key_width"
- android:layout_height="match_parent"
- android:layout_marginEnd="2dp"
- android:src="@drawable/ic_sysbar_menu"
- android:scaleType="centerInside"
- systemui:keyCode="82"
- android:visibility="invisible"
- android:contentDescription="@string/accessibility_menu" />
- <com.android.systemui.statusbar.policy.KeyButtonView
- android:id="@+id/ime_switcher"
- android:layout_width="@dimen/navigation_extra_key_width"
- android:layout_height="match_parent"
- android:layout_marginEnd="2dp"
- android:src="@drawable/ic_ime_switcher_default"
- android:visibility="invisible"
- android:contentDescription="@string/accessibility_ime_switch_button"
- android:scaleType="centerInside" />
- </FrameLayout>
+ <include layout="@layout/mid_navigation_bar_land"/>
+
</LinearLayout>
- <!-- lights out layout to match exactly -->
+ <!-- lights out layout to match exactly -->
<LinearLayout
android:layout_height="match_parent"
android:layout_width="match_parent"
android:orientation="horizontal"
- android:id="@+id/lights_out"
- android:visibility="gone"
+ android:gravity="center_horizontal"
+ android:layout_gravity="center_horizontal"
+ android:visibility="visible"
>
- <Space
- android:layout_width="match_parent"
+ <View
+ android:layout_width="0dp"
android:layout_height="match_parent"
- android:layout_weight="1"
- />
- <ImageView
- android:layout_width="162dp" android:paddingStart="42dp" android:paddingEnd="42dp"
+ android:layout_weight="1" />
+ <!-- lights out layout to match exactly -->
+ <LinearLayout
android:layout_height="match_parent"
+ android:layout_width="wrap_content"
+ android:layout_weight="1"
+ android:orientation="horizontal"
+ android:gravity="center_horizontal"
+ android:layout_gravity="center_horizontal"
android:layout_marginStart="40dp"
- android:src="@drawable/ic_sysbar_lights_out_dot_small"
- android:scaleType="center"
- android:layout_weight="0"
- android:contentDescription="@string/accessibility_back"
- />
- <ImageView
- android:layout_width="162dp" android:paddingStart="42dp" android:paddingEnd="42dp"
- android:layout_height="match_parent"
- android:src="@drawable/ic_sysbar_lights_out_dot_large"
- android:scaleType="center"
- android:layout_weight="0"
- android:contentDescription="@string/accessibility_home"
- />
- <ImageView
- android:layout_width="162dp" android:paddingStart="42dp" android:paddingEnd="42dp"
android:layout_marginEnd="40dp"
+ android:id="@+id/lights_out"
+ android:visibility="gone"
+ >
+ <ImageView
+ android:layout_width="162dp" android:paddingStart="42dp" android:paddingEnd="42dp"
+ android:layout_height="match_parent"
+ android:src="@drawable/ic_sysbar_lights_out_dot_large"
+ android:scaleType="center"
+ />
+ <ImageView
+ android:layout_width="162dp" android:paddingStart="42dp" android:paddingEnd="42dp"
+ android:layout_height="match_parent"
+ android:src="@drawable/ic_sysbar_lights_out_dot_large"
+ android:scaleType="center"
+ />
+ <ImageView
+ android:layout_width="162dp" android:paddingStart="42dp" android:paddingEnd="42dp"
+ android:layout_height="match_parent"
+ android:src="@drawable/ic_sysbar_lights_out_dot_large"
+ android:scaleType="center"
+ />
+ <ImageView
+ android:layout_width="162dp" android:paddingStart="42dp" android:paddingEnd="42dp"
+ android:layout_height="match_parent"
+ android:src="@drawable/ic_sysbar_lights_out_dot_large"
+ android:scaleType="center"
+ />
+ </LinearLayout>
+ <View
+ android:layout_width="0dp"
android:layout_height="match_parent"
- android:src="@drawable/ic_sysbar_lights_out_dot_small"
- android:scaleType="center"
- android:layout_weight="0"
- android:contentDescription="@string/accessibility_recent"
- />
- <Space
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:layout_weight="1"
- />
+ android:layout_weight="1" />
</LinearLayout>
<com.android.systemui.statusbar.policy.DeadZone
diff --git a/packages/SystemUI/res/layout/mid_navigation_bar_land.xml b/packages/SystemUI/res/layout/mid_navigation_bar_land.xml
new file mode 100644
index 0000000..95e63bd
--- /dev/null
+++ b/packages/SystemUI/res/layout/mid_navigation_bar_land.xml
@@ -0,0 +1,103 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+** Copyright 2015 The CyanogenMod 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.
+*/
+-->
+<LinearLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:systemui="http://schemas.android.com/apk/res-auto"
+ android:layout_height="match_parent"
+ android:layout_width="match_parent"
+ android:orientation="vertical"
+ android:clipChildren="false"
+ android:clipToPadding="false"
+ android:id="@+id/nav_buttons">
+ <FrameLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content" >
+ <com.android.systemui.statusbar.policy.KeyButtonView
+ android:id="@+id/ime_switcher"
+ android:layout_width="match_parent"
+ android:layout_height="40dp"
+ android:contentDescription="@string/accessibility_ime_switch_button"
+ android:scaleType="centerInside"
+ android:src="@drawable/ic_ime_switcher_default"
+ android:visibility="invisible" />
+
+ <com.android.systemui.statusbar.policy.KeyButtonView
+ android:id="@+id/one"
+ android:layout_height="40dp"
+ android:layout_width="match_parent"
+ android:layout_weight="0" />
+ </FrameLayout>
+ <LinearLayout
+ android:layout_height="wrap_content"
+ android:layout_width="match_parent"
+ android:layout_weight="1"
+ android:orientation="vertical"
+ android:clipChildren="false"
+ android:gravity="center_vertical"
+ android:id="@+id/mid_nav_buttons"
+ android:layout_gravity="center_vertical"
+ android:clipToPadding="false"
+ android:animateLayoutChanges="true">
+ <com.android.systemui.statusbar.policy.KeyButtonView
+ android:id="@+id/two"
+ android:layout_height="80dp"
+ android:layout_width="match_parent"
+ android:layout_weight="0"
+ systemui:keyRepeat="true" />
+ <View
+ android:layout_height="0dp"
+ android:layout_width="match_parent"
+ android:layout_weight="1"
+ android:visibility="invisible" />
+ <com.android.systemui.statusbar.policy.KeyButtonView
+ android:id="@+id/three"
+ android:layout_height="80dp"
+ android:layout_width="match_parent"
+ systemui:keyRepeat="true"
+ android:layout_weight="0" />
+ <View
+ android:layout_height="0dp"
+ android:layout_width="match_parent"
+ android:layout_weight="1"
+ android:visibility="invisible" />
+ <com.android.systemui.statusbar.policy.KeyButtonView
+ android:id="@+id/four"
+ android:layout_height="80dp"
+ android:layout_width="match_parent"
+ android:layout_weight="0"
+ systemui:keyRepeat="true" />
+ <View
+ android:layout_height="0dp"
+ android:layout_width="match_parent"
+ android:layout_weight="1"
+ android:visibility="invisible" />
+ <com.android.systemui.statusbar.policy.KeyButtonView
+ android:id="@+id/five"
+ android:layout_height="80dp"
+ android:layout_width="match_parent"
+ android:layout_weight="0"
+ systemui:keyRepeat="true" />
+ </LinearLayout>
+ <com.android.systemui.statusbar.policy.KeyButtonView
+ android:id="@+id/six"
+ android:layout_height="40dp"
+ android:layout_width="match_parent"
+ android:layout_weight="0"
+ systemui:keyRepeat="true" />
+</LinearLayout>
diff --git a/packages/SystemUI/res/layout/mid_navigation_bar_port.xml b/packages/SystemUI/res/layout/mid_navigation_bar_port.xml
new file mode 100644
index 0000000..efcda39
--- /dev/null
+++ b/packages/SystemUI/res/layout/mid_navigation_bar_port.xml
@@ -0,0 +1,102 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+** Copyright 2015 The CyanogenMod 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.
+*/
+-->
+
+<LinearLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:systemui="http://schemas.android.com/apk/res-auto"
+ android:layout_height="match_parent"
+ android:layout_width="match_parent"
+ android:orientation="horizontal"
+ android:clipChildren="false"
+ android:clipToPadding="false"
+ android:id="@+id/nav_buttons">
+ <com.android.systemui.statusbar.policy.KeyButtonView
+ android:id="@+id/one"
+ android:layout_width="@dimen/navigation_extra_key_width"
+ android:layout_height="match_parent"
+ android:layout_weight="0"
+ android:scaleType="fitCenter" />
+ <LinearLayout
+ android:layout_height="match_parent"
+ android:layout_width="0dp"
+ android:layout_weight="1"
+ android:clipChildren="false"
+ android:clipToPadding="false"
+ android:id="@+id/mid_nav_buttons"
+ android:gravity="center_horizontal"
+ android:layout_gravity="center_horizontal"
+ android:animateLayoutChanges="true">
+ <com.android.systemui.statusbar.policy.KeyButtonView
+ android:id="@+id/two"
+ android:layout_width="@dimen/navigation_key_width"
+ android:layout_height="match_parent"
+ systemui:keyRepeat="true"
+ android:layout_weight="0" />
+ <View
+ android:layout_width="0dp"
+ android:layout_height="match_parent"
+ android:layout_weight="1" />
+ <com.android.systemui.statusbar.policy.KeyButtonView
+ android:id="@+id/three"
+ android:layout_width="@dimen/navigation_key_width"
+ android:layout_height="match_parent"
+ systemui:keyRepeat="true"
+ android:layout_weight="0" />
+ <View
+ android:layout_width="0dp"
+ android:layout_height="match_parent"
+ android:layout_weight="1" />
+ <com.android.systemui.statusbar.policy.KeyButtonView
+ android:id="@+id/four"
+ android:layout_width="@dimen/navigation_key_width"
+ android:layout_height="match_parent"
+ android:layout_weight="0"
+ systemui:keyRepeat="true" />
+ <View
+ android:layout_width="0dp"
+ android:layout_height="match_parent"
+ android:layout_weight="1" />
+ <com.android.systemui.statusbar.policy.KeyButtonView
+ android:id="@+id/five"
+ android:layout_width="@dimen/navigation_key_width"
+ android:layout_height="match_parent"
+ android:layout_weight="0"
+ systemui:keyRepeat="true" />
+ </LinearLayout>
+ <FrameLayout
+ android:layout_width="wrap_content"
+ android:layout_height="match_parent" >
+ <com.android.systemui.statusbar.policy.KeyButtonView
+ android:background="#FFAA0000"
+ android:id="@+id/ime_switcher"
+ android:layout_width="@dimen/navigation_extra_key_width"
+ android:layout_weight="0"
+ android:layout_height="match_parent"
+ android:contentDescription="@string/accessibility_ime_switch_button"
+ android:scaleType="centerInside"
+ android:src="@drawable/ic_ime_switcher_default"
+ android:visibility="invisible" />
+ <com.android.systemui.statusbar.policy.KeyButtonView
+ android:id="@+id/six"
+ android:layout_width="@dimen/navigation_extra_key_width"
+ android:layout_height="match_parent"
+ android:layout_weight="0"
+ android:scaleType="fitCenter" />
+ </FrameLayout>
+</LinearLayout>
diff --git a/packages/SystemUI/res/layout/navigation_bar.xml b/packages/SystemUI/res/layout/navigation_bar.xml
index d58664f..6a28ef6 100644
--- a/packages/SystemUI/res/layout/navigation_bar.xml
+++ b/packages/SystemUI/res/layout/navigation_bar.xml
@@ -4,7 +4,7 @@
**
** Copyright 2011, The Android Open Source Project
**
-** Licensed under the Apache License, Version 2.0 (the "License");
+** 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
**
@@ -37,81 +37,10 @@
android:orientation="horizontal"
android:clipChildren="false"
android:clipToPadding="false"
- android:id="@+id/nav_buttons"
- android:animateLayoutChanges="true"
+ android:id="@+id/container"
>
- <!-- navigation controls -->
- <View
- android:layout_width="@dimen/navigation_side_padding"
- android:layout_height="match_parent"
- android:layout_weight="0"
- android:visibility="invisible"
- />
- <com.android.systemui.statusbar.policy.KeyButtonView android:id="@+id/back"
- android:layout_width="@dimen/navigation_key_width"
- android:layout_height="match_parent"
- android:src="@drawable/ic_sysbar_back"
- systemui:keyCode="4"
- android:layout_weight="0"
- android:scaleType="center"
- android:contentDescription="@string/accessibility_back"
- />
- <View
- android:layout_width="0dp"
- android:layout_height="match_parent"
- android:layout_weight="1"
- android:visibility="invisible"
- />
- <com.android.systemui.statusbar.policy.KeyButtonView android:id="@+id/home"
- android:layout_width="@dimen/navigation_key_width"
- android:layout_height="match_parent"
- android:src="@drawable/ic_sysbar_home"
- systemui:keyCode="3"
- systemui:keyRepeat="false"
- android:layout_weight="0"
- android:scaleType="center"
- android:contentDescription="@string/accessibility_home"
- />
- <View
- android:layout_width="0dp"
- android:layout_height="match_parent"
- android:layout_weight="1"
- android:visibility="invisible"
- />
- <com.android.systemui.statusbar.policy.KeyButtonView android:id="@+id/recent_apps"
- android:layout_width="@dimen/navigation_key_width"
- 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_side_padding"
- android:layout_height="match_parent"
- android:layout_weight="0" >
- <com.android.systemui.statusbar.policy.KeyButtonView
- android:id="@+id/menu"
- android:layout_width="@dimen/navigation_extra_key_width"
- android:layout_height="match_parent"
- android:contentDescription="@string/accessibility_menu"
- android:src="@drawable/ic_sysbar_menu"
- android:visibility="invisible"
- android:scaleType="centerInside"
- android:layout_gravity="end"
- systemui:keyCode="82" />
-
- <com.android.systemui.statusbar.policy.KeyButtonView
- android:id="@+id/ime_switcher"
- android:layout_width="@dimen/navigation_extra_key_width"
- android:layout_height="match_parent"
- android:contentDescription="@string/accessibility_ime_switch_button"
- android:scaleType="centerInside"
- android:src="@drawable/ic_ime_switcher_default"
- android:visibility="invisible"
- android:layout_gravity="end" />
- </FrameLayout>
+ <include layout="@layout/mid_navigation_bar_port"/>
</LinearLayout>
@@ -120,6 +49,10 @@
android:layout_height="match_parent"
android:layout_width="match_parent"
android:orientation="horizontal"
+ android:gravity="center_horizontal"
+ android:layout_marginStart="40dp"
+ android:layout_marginEnd="40dp"
+ android:layout_gravity="center_horizontal"
android:id="@+id/lights_out"
android:visibility="gone"
>
@@ -127,13 +60,11 @@
android:layout_width="@dimen/navigation_key_width"
android:layout_height="match_parent"
android:layout_marginStart="@dimen/navigation_side_padding"
- android:src="@drawable/ic_sysbar_lights_out_dot_small"
+ android:src="@drawable/ic_sysbar_lights_out_dot_large"
android:scaleType="center"
- android:layout_weight="0"
- 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"
@@ -143,11 +74,9 @@
android:layout_height="match_parent"
android:src="@drawable/ic_sysbar_lights_out_dot_large"
android:scaleType="center"
- android:layout_weight="0"
- 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"
@@ -156,10 +85,20 @@
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:src="@drawable/ic_sysbar_lights_out_dot_large"
+ android:scaleType="center"
+ />
+ <View
+ android:layout_width="0dp"
+ android:layout_height="match_parent"
+ android:visibility="invisible"
+ android:layout_weight="1"
+ />
+ <ImageView
+ android:layout_width="80dp"
+ android:layout_height="match_parent"
+ android:src="@drawable/ic_sysbar_lights_out_dot_large"
android:scaleType="center"
- android:layout_weight="0"
- android:contentDescription="@string/accessibility_recent"
/>
</LinearLayout>
@@ -183,95 +122,30 @@
android:paddingTop="0dp"
>
- <LinearLayout
+ <LinearLayout
android:layout_height="match_parent"
android:layout_width="match_parent"
android:orientation="vertical"
+ android:gravity="center_vertical"
+ android:layout_gravity="center_vertical"
android:clipChildren="false"
android:clipToPadding="false"
- android:id="@+id/nav_buttons"
- android:animateLayoutChanges="true"
+ android:id="@+id/container"
>
- <!-- navigation controls -->
- <FrameLayout
- android:layout_weight="0"
- android:layout_width="match_parent"
- 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="@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
- android:id="@+id/menu"
- android:layout_width="match_parent"
- android:layout_height="40dp"
- android:contentDescription="@string/accessibility_menu"
- android:src="@drawable/ic_sysbar_menu"
- android:scaleType="centerInside"
- android:layout_gravity="top"
- android:visibility="invisible"
- systemui:keyCode="82" />
- </FrameLayout>
+ <include layout="@layout/mid_navigation_bar_land"/>
- <com.android.systemui.statusbar.policy.KeyButtonView android:id="@+id/recent_apps"
- android:layout_height="@dimen/navigation_key_width"
- android:layout_width="match_parent"
- android:src="@drawable/ic_sysbar_recent"
- android:scaleType="center"
- android:layout_weight="0"
- android:contentDescription="@string/accessibility_recent"
- />
- <View
- android:layout_height="match_parent"
- android:layout_width="match_parent"
- android:layout_weight="1"
- android:visibility="invisible"
- />
- <com.android.systemui.statusbar.policy.KeyButtonView android:id="@+id/home"
- android:layout_height="@dimen/navigation_key_width"
- android:layout_width="match_parent"
- android:src="@drawable/ic_sysbar_home"
- android:scaleType="center"
- systemui:keyCode="3"
- systemui:keyRepeat="false"
- android:layout_weight="0"
- android:contentDescription="@string/accessibility_home"
- />
- <View
- android:layout_height="match_parent"
- android:layout_width="match_parent"
- android:layout_weight="1"
- android:visibility="invisible"
- />
- <com.android.systemui.statusbar.policy.KeyButtonView android:id="@+id/back"
- android:layout_height="@dimen/navigation_key_width"
- android:layout_width="match_parent"
- android:src="@drawable/ic_sysbar_back"
- android:scaleType="center"
- systemui:keyCode="4"
- android:layout_weight="0"
- android:contentDescription="@string/accessibility_back"
- />
- <View
- android:layout_height="@dimen/navigation_side_padding"
- android:layout_width="match_parent"
- android:layout_weight="0"
- android:visibility="invisible"
- />
</LinearLayout>
<!-- lights out layout to match exactly -->
- <LinearLayout
+ <LinearLayout
android:layout_height="match_parent"
android:layout_width="match_parent"
android:orientation="vertical"
+ android:gravity="center_vertical"
+ android:layout_gravity="center_vertical"
+ android:layout_marginTop="40dp"
+ android:layout_marginBottom="40dp"
android:id="@+id/lights_out"
android:visibility="gone"
>
@@ -279,13 +153,11 @@
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:src="@drawable/ic_sysbar_lights_out_dot_large"
android:scaleType="center"
- android:layout_weight="0"
- android:contentDescription="@string/accessibility_recent"
/>
<View
- android:layout_height="match_parent"
+ android:layout_height="0dp"
android:layout_width="match_parent"
android:layout_weight="1"
android:visibility="invisible"
@@ -295,11 +167,9 @@
android:layout_width="match_parent"
android:src="@drawable/ic_sysbar_lights_out_dot_large"
android:scaleType="center"
- android:layout_weight="0"
- android:contentDescription="@string/accessibility_home"
/>
<View
- android:layout_height="match_parent"
+ android:layout_height="0dp"
android:layout_width="match_parent"
android:layout_weight="1"
android:visibility="invisible"
@@ -308,10 +178,20 @@
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:src="@drawable/ic_sysbar_lights_out_dot_large"
+ android:scaleType="center"
+ />
+ <View
+ android:layout_width="match_parent"
+ android:layout_height="0dp"
+ android:visibility="invisible"
+ android:layout_weight="1"
+ />
+ <ImageView
+ android:layout_height="80dp"
+ android:layout_width="match_parent"
+ android:src="@drawable/ic_sysbar_lights_out_dot_large"
android:scaleType="center"
- android:layout_weight="0"
- android:contentDescription="@string/accessibility_back"
/>
</LinearLayout>
diff --git a/packages/SystemUI/res/layout/navigation_bar_edit_menu_item.xml b/packages/SystemUI/res/layout/navigation_bar_edit_menu_item.xml
new file mode 100644
index 0000000..d951f5b
--- /dev/null
+++ b/packages/SystemUI/res/layout/navigation_bar_edit_menu_item.xml
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+** Copyright 2015 The CyanogenMod 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.
+*/
+-->
+
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal">
+
+ <ImageView
+ android:id="@+id/key_icon"
+ android:layout_width="80dip"
+ android:layout_height="match_parent"
+ android:padding="4dip"
+ android:scaleType="centerInside"/>
+
+ <TextView
+ android:id="@+id/key_text"
+ android:layout_width="0dip"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:minHeight="?android:attr/listPreferredItemHeightSmall"
+ android:textAppearance="?android:attr/textAppearanceListItemSmall"
+ android:textColor="?android:attr/textColorAlertDialogListItem"
+ android:gravity="center_vertical"
+ android:paddingEnd="16dip"
+ android:ellipsize="marquee"/>
+
+</LinearLayout>
diff --git a/packages/SystemUI/res/values/cm_strings.xml b/packages/SystemUI/res/values/cm_strings.xml
index 3024ec9..cfe9c9f 100644
--- a/packages/SystemUI/res/values/cm_strings.xml
+++ b/packages/SystemUI/res/values/cm_strings.xml
@@ -40,4 +40,15 @@
<string name="select_application">Select application</string>
<string name="lockscreen_choose_action_title">Choose action</string>
<string name="lockscreen_none_target">None</string>
+
+ <!-- Dialog title for navigation bar button selection -->
+ <string name="navbar_dialog_title">Choose action to assign</string>
+ <string name="navbar_home_button">Home button</string>
+ <string name="navbar_recent_button">Recent button</string>
+ <string name="navbar_search_button">Search button</string>
+ <string name="navbar_back_button">Back button</string>
+ <string name="navbar_empty_button">Empty button</string>
+ <string name="navbar_menu_conditional_button">Menu (autoHide) button</string>
+ <string name="navbar_menu_always_button">Menu (alwaysShow) button</string>
+ <string name="navbar_menu_big_button">Menu button</string>
</resources>
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavbarEditor.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavbarEditor.java
new file mode 100644
index 0000000..de141db
--- /dev/null
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavbarEditor.java
@@ -0,0 +1,547 @@
+/*
+ * Copyright (C) 2015 The CyanogenMod 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.
+ */
+
+package com.android.systemui.statusbar.phone;
+
+import android.app.AlertDialog;
+import android.content.Context;
+import android.content.DialogInterface;
+import android.graphics.PorterDuff;
+import android.graphics.PorterDuffColorFilter;
+import android.os.UserHandle;
+import android.provider.Settings;
+import android.util.DisplayMetrics;
+import android.view.DisplayInfo;
+import android.view.HapticFeedbackConstants;
+import android.view.KeyEvent;
+import android.view.LayoutInflater;
+import android.view.MotionEvent;
+import android.view.View;
+import android.view.ViewConfiguration;
+import android.view.ViewGroup;
+import android.view.WindowManager;
+import android.widget.ArrayAdapter;
+import android.widget.ImageView;
+import android.widget.TextView;
+
+import com.android.internal.util.ArrayUtils;
+import com.android.systemui.R;
+import com.android.systemui.statusbar.policy.KeyButtonView;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+
+import cyanogenmod.providers.CMSettings;
+
+/**
+ * Handles the editing of the navigation bar
+ * @author Danesh M
+ * @hide
+ */
+public class NavbarEditor implements View.OnTouchListener {
+ /**
+ * Holds reference to all assignable button ids
+ */
+ private static final int[] BUTTON_IDS =
+ { R.id.one, R.id.two, R.id.three, R.id.four, R.id.five, R.id.six };
+
+ /**
+ * Subset of BUTTON_IDS, to differentiate small/side buttons
+ * since they can be assigned additional functionality.
+ */
+ private static final int[] SMALL_BUTTON_IDS = { R.id.one, R.id.six };
+
+ // holds the button views in the order they currently appear on screen
+ private final ArrayList<KeyButtonView> mButtonViews;
+ private final boolean mRtl;
+
+ private Context mContext;
+ private static Boolean sIsDevicePhone = null;
+ private boolean mInEditMode = false;
+
+ // Holds reference to the parent/root of the inflated view
+ private View mParent;
+
+ // Button chooser dialog
+ private AlertDialog mDialog;
+
+ // true == we're in landscape mode
+ private boolean mVertical;
+ // true == we're currently checking for long press
+ private boolean mLongPressed;
+ // start point of the current drag operation
+ private float mDragOrigin;
+
+ // just to avoid reallocations
+ private static final int[] sLocation = new int[2];
+
+ /**
+ * Longpress runnable to assign buttons in edit mode
+ */
+ private Runnable mCheckLongPress = new Runnable() {
+ public void run() {
+ if (mInEditMode) {
+ mLongPressed = true;
+ mParent.performHapticFeedback(HapticFeedbackConstants.VIRTUAL_KEY);
+ }
+ }
+ };
+
+ //Available buttons
+ public static final ButtonInfo NAVBAR_EMPTY = new ButtonInfo("empty",
+ R.string.navbar_empty_button, R.string.accessibility_clear_all,
+ 0, R.drawable.ic_sysbar_add,
+ R.drawable.ic_sysbar_add_land, R.drawable.ic_sysbar_add_side);
+ public static final ButtonInfo NAVBAR_HOME = new ButtonInfo("home",
+ R.string.navbar_home_button, R.string.accessibility_home,
+ KeyEvent.KEYCODE_HOME, R.drawable.ic_sysbar_home,
+ R.drawable.ic_sysbar_home, R.drawable.ic_sysbar_home);
+ public static final ButtonInfo NAVBAR_BACK = new ButtonInfo("back",
+ R.string.navbar_back_button, R.string.accessibility_back,
+ KeyEvent.KEYCODE_BACK, R.drawable.ic_sysbar_back,
+ R.drawable.ic_sysbar_back, R.drawable.ic_sysbar_back_side);
+ public static final ButtonInfo NAVBAR_SEARCH = new ButtonInfo("search",
+ R.string.navbar_search_button, R.string.accessibility_back,
+ KeyEvent.KEYCODE_SEARCH, R.drawable.ic_sysbar_search,
+ R.drawable.ic_sysbar_search_land, R.drawable.ic_sysbar_search_side);
+ public static final ButtonInfo NAVBAR_RECENT = new ButtonInfo("recent",
+ R.string.navbar_recent_button, R.string.accessibility_recent,
+ 0, R.drawable.ic_sysbar_recent,
+ R.drawable.ic_sysbar_recent, R.drawable.ic_sysbar_recent_side);
+ public static final ButtonInfo NAVBAR_CONDITIONAL_MENU = new ButtonInfo("menu0",
+ R.string.navbar_menu_conditional_button, R.string.accessibility_menu,
+ KeyEvent.KEYCODE_MENU, R.drawable.ic_sysbar_menu,
+ R.drawable.ic_sysbar_menu, R.drawable.ic_sysbar_menu);
+ public static final ButtonInfo NAVBAR_ALWAYS_MENU = new ButtonInfo("menu1",
+ R.string.navbar_menu_always_button, R.string.accessibility_menu,
+ KeyEvent.KEYCODE_MENU, R.drawable.ic_sysbar_menu,
+ R.drawable.ic_sysbar_menu, R.drawable.ic_sysbar_menu);
+ public static final ButtonInfo NAVBAR_MENU_BIG = new ButtonInfo("menu2",
+ R.string.navbar_menu_big_button, R.string.accessibility_menu,
+ KeyEvent.KEYCODE_MENU, R.drawable.ic_sysbar_menu_big,
+ R.drawable.ic_sysbar_menu_big_land, 0);
+
+ private static final ButtonInfo[] ALL_BUTTONS = new ButtonInfo[] {
+ NAVBAR_EMPTY, NAVBAR_HOME, NAVBAR_BACK, NAVBAR_SEARCH,
+ NAVBAR_RECENT, NAVBAR_CONDITIONAL_MENU, NAVBAR_ALWAYS_MENU, NAVBAR_MENU_BIG
+ };
+
+ private static final String DEFAULT_SETTING_STRING = "empty|back|home|recent|empty|menu0";
+
+ public NavbarEditor (View parent, boolean orientation, boolean isRtl) {
+ mContext = parent.getContext();
+ mParent = parent;
+ mVertical = orientation;
+ mRtl = isRtl;
+
+ mButtonViews = new ArrayList<KeyButtonView>();
+ for (int id : BUTTON_IDS) {
+ mButtonViews.add((KeyButtonView) mParent.findViewById(id));
+ }
+ }
+
+ public void setEditMode(boolean editMode) {
+ mInEditMode = editMode;
+ for (Integer id : BUTTON_IDS) {
+ KeyButtonView button = (KeyButtonView) mParent.findViewById(id);
+ if (button != null) {
+ button.setEditMode(editMode);
+ button.setOnTouchListener(editMode ? this : null);
+ }
+ }
+ if (!editMode && mDialog != null && mDialog.isShowing()) {
+ mDialog.dismiss();
+ }
+ }
+
+ public static boolean isDevicePhone(Context context) {
+ if (sIsDevicePhone == null) {
+ WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
+ DisplayInfo outDisplayInfo = new DisplayInfo();
+
+ wm.getDefaultDisplay().getDisplayInfo(outDisplayInfo);
+
+ int shortSize = Math.min(outDisplayInfo.logicalHeight, outDisplayInfo.logicalWidth);
+ int shortSizeDp = shortSize * DisplayMetrics.DENSITY_DEFAULT / outDisplayInfo.logicalDensityDpi;
+
+ // 0-599dp: "phone" UI with a separate status & navigation bar
+ sIsDevicePhone = shortSizeDp < 600;
+ }
+
+ return sIsDevicePhone;
+ }
+
+ /**
+ * Find intersecting view in mButtonViews
+ * @param pos - pointer location
+ * @param v - view being dragged
+ * @return intersecting view or null
+ */
+ private View findInterceptingView(float pos, View v) {
+ for (KeyButtonView otherView : mButtonViews) {
+ if (otherView == v) {
+ continue;
+ }
+
+ if (ArrayUtils.contains(SMALL_BUTTON_IDS, otherView.getId())) {
+ continue;
+ }
+
+ otherView.getLocationOnScreen(sLocation);
+ float otherPos = sLocation[mVertical ? 1 : 0];
+ float otherDimension = mVertical ? v.getHeight() : v.getWidth();
+
+ if (pos > (otherPos + otherDimension / 4) && pos < (otherPos + otherDimension)) {
+ return otherView;
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public boolean onTouch(final View view, MotionEvent event) {
+ if (!mInEditMode || (mDialog != null && mDialog.isShowing())) {
+ return false;
+ }
+
+ if (event.getAction() == MotionEvent.ACTION_DOWN) {
+ view.setPressed(true);
+ view.getLocationOnScreen(sLocation);
+ mDragOrigin = sLocation[mVertical ? 1 : 0];
+ view.postDelayed(mCheckLongPress, ViewConfiguration.getLongPressTimeout());
+ } else if (event.getAction() == MotionEvent.ACTION_MOVE) {
+ view.setPressed(false);
+
+ if (!mLongPressed || ArrayUtils.contains(SMALL_BUTTON_IDS, view.getId())) {
+ return false;
+ }
+
+ ViewGroup viewParent = (ViewGroup) view.getParent();
+ float pos = mVertical ? event.getRawY() : event.getRawX();
+ float buttonSize = mVertical ? view.getHeight() : view.getWidth();
+ float min = mVertical ? viewParent.getTop() : (viewParent.getLeft() - buttonSize / 2);
+ float max = mVertical ? (viewParent.getTop() + viewParent.getHeight())
+ : (viewParent.getLeft() + viewParent.getWidth());
+
+ // Prevents user from dragging view outside of bounds
+ if (pos < min || pos > max) {
+ return false;
+ }
+ if (!mVertical) {
+ view.setX(pos - viewParent.getLeft() - buttonSize / 2);
+ } else {
+ view.setY(pos - viewParent.getTop() - buttonSize / 2);
+ }
+ View affectedView = findInterceptingView(pos, view);
+ if (affectedView == null) {
+ return false;
+ }
+ switchId(affectedView, view);
+ } else if (event.getAction() == MotionEvent.ACTION_UP
+ || event.getAction() == MotionEvent.ACTION_CANCEL) {
+ view.setPressed(false);
+ view.removeCallbacks(mCheckLongPress);
+
+ if (!mLongPressed && !view.getTag().equals(NAVBAR_HOME)) {
+ final boolean isSmallButton = ArrayUtils.contains(SMALL_BUTTON_IDS, view.getId());
+ final ButtonAdapter list = new ButtonAdapter(mContext, mButtonViews, isSmallButton);
+
+ AlertDialog.Builder builder = new AlertDialog.Builder(mContext)
+ .setTitle(mContext.getString(R.string.navbar_dialog_title))
+ .setAdapter(list, new DialogInterface.OnClickListener() {
+ @Override
+ public void onClick(DialogInterface dialog, int which) {
+ KeyButtonView button = (KeyButtonView) view;
+ ButtonInfo info = list.getItem(which);
+
+ button.setInfo(info, mVertical, isSmallButton);
+ }
+ })
+ .setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() {
+ @Override
+ public void onClick(DialogInterface dialog, int id) {
+ dialog.cancel();
+ }
+ });
+
+ mDialog = builder.create();
+ mDialog.getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_DIALOG);
+ mDialog.setCanceledOnTouchOutside(false);
+ mDialog.show();
+ } else {
+ // Reset the dragged view to its original location
+ ViewGroup parent = (ViewGroup) view.getParent();
+
+ if (!mVertical) {
+ view.setX(mDragOrigin - parent.getLeft());
+ } else {
+ view.setY(mDragOrigin - parent.getTop());
+ }
+ }
+ mLongPressed = false;
+ }
+ return true;
+ }
+
+ /**
+ * Switches positions of two views and
+ * updates their mButtonViews entry
+ * @param targetView - view to be replaced
+ * @param view - view being dragged
+ */
+ private void switchId(View targetView, View view) {
+ ViewGroup parent = (ViewGroup) view.getParent();
+
+ targetView.getLocationOnScreen(sLocation);
+ if (!mVertical) {
+ targetView.setX(mDragOrigin - parent.getLeft());
+ mDragOrigin = sLocation[0];
+ } else {
+ targetView.setY(mDragOrigin - parent.getTop());
+ mDragOrigin = sLocation[1];
+ }
+
+ int targetIndex = mButtonViews.indexOf(targetView);
+ int draggedIndex = mButtonViews.indexOf(view);
+ Collections.swap(mButtonViews, draggedIndex, targetIndex);
+ }
+
+ /**
+ * Saves the current key arrangement
+ * to the settings provider
+ */
+ protected void saveKeys() {
+ StringBuilder sb = new StringBuilder();
+ for (int i = 0; i < BUTTON_IDS.length; i++) {
+ int idIndex = mVertical && !mRtl ? BUTTON_IDS.length - (i + 1) : i;
+ ButtonInfo info = (ButtonInfo) mButtonViews.get(idIndex).getTag();
+ if (i != 0) sb.append("|");
+ sb.append(info.key);
+ }
+ CMSettings.System.putStringForUser(mContext.getContentResolver(),
+ CMSettings.System.NAV_BUTTONS, sb.toString(), UserHandle.USER_CURRENT);
+ }
+
+ /**
+ * Updates the buttons according to the
+ * key arrangement stored in settings provider
+ */
+ protected void updateKeys() {
+ String saved = CMSettings.System.getStringForUser(mContext.getContentResolver(),
+ CMSettings.System.NAV_BUTTONS, UserHandle.USER_CURRENT);
+ if (saved == null) {
+ saved = DEFAULT_SETTING_STRING;
+ }
+
+ String[] buttons = saved.split("\\|");
+ if (buttons.length < BUTTON_IDS.length) {
+ buttons = DEFAULT_SETTING_STRING.split("\\|");
+ }
+
+ int visibleCount = 0;
+
+ for (int i = 0; i < BUTTON_IDS.length; i++) {
+ int id = BUTTON_IDS[i];
+ int index = mVertical && !mRtl ? BUTTON_IDS.length - i - 1 : i;
+ String key = index < buttons.length ? buttons[index] : null;
+ KeyButtonView buttonView = (KeyButtonView) mParent.findViewById(id);
+ boolean isSmallButton = ArrayUtils.contains(SMALL_BUTTON_IDS, id);
+ ButtonInfo button = NAVBAR_EMPTY;
+
+ for (ButtonInfo info : ALL_BUTTONS) {
+ if (info.key.equals(key)) {
+ button = info;
+ break;
+ }
+ }
+
+ buttonView.setInfo(button, mVertical, isSmallButton);
+ if (button != NAVBAR_EMPTY && !isSmallButton) {
+ visibleCount++;
+ }
+
+ buttonView.setTranslationX(0);
+ mButtonViews.set(i, buttonView);
+ }
+
+ if (isDevicePhone(mContext)) {
+ adjustPadding(visibleCount);
+ }
+ updateLowLights(visibleCount);
+ }
+
+ /**
+ * Accommodates the padding between keys based on
+ * number of keys in use.
+ */
+ private void adjustPadding(int visibleCount) {
+ ViewGroup viewParent = (ViewGroup) mParent.findViewById(R.id.mid_nav_buttons);
+ int totalViews = viewParent.getChildCount();
+
+ for (int v = 0; v < totalViews; v++) {
+ View currentKey = viewParent.getChildAt(v);
+ if (!(currentKey instanceof KeyButtonView)) {
+ continue;
+ }
+ View nextPadding = viewParent.getChildAt(v + 1);
+ if (nextPadding == null) {
+ continue;
+ }
+
+ View nextKey = viewParent.getChildAt(v + 2);
+ ButtonInfo nextInfo = nextKey == null ? null : (ButtonInfo) nextKey.getTag();
+ ButtonInfo currentInfo = (ButtonInfo) currentKey.getTag();
+
+ if (nextInfo != null && currentInfo != null && currentInfo != NAVBAR_EMPTY) {
+ if (nextInfo != NAVBAR_EMPTY || visibleCount > 1) {
+ nextPadding.setVisibility(View.VISIBLE);
+ } else {
+ nextPadding.setVisibility(View.GONE);
+ }
+ visibleCount--;
+ } else {
+ nextPadding.setVisibility(View.GONE);
+ }
+ }
+ }
+
+ protected void updateLowLights(int visibleCount) {
+ ViewGroup lowLights = (ViewGroup) mParent.findViewById(R.id.lights_out);
+ int totalViews = lowLights.getChildCount();
+
+ for (int v = 0;v < totalViews; v++) {
+ View currentView = lowLights.getChildAt(v);
+ if (!(currentView instanceof ImageView)) {
+ continue;
+ }
+
+ if (visibleCount <= 0) {
+ currentView.setVisibility(View.GONE);
+ } else {
+ currentView.setVisibility(View.VISIBLE);
+ visibleCount--;
+ }
+
+ View blank = lowLights.getChildAt(v + 1);
+ if (blank != null) {
+ blank.setVisibility(visibleCount > 0 ? View.VISIBLE : View.GONE);
+ }
+ }
+ }
+
+ /**
+ * Class to store info about supported buttons
+ */
+ public static final class ButtonInfo {
+ private final String key;
+ public int displayId;
+ public int contentDescription;
+ public int keyCode;
+ public int portResource;
+ public int landResource;
+ public int sideResource;
+ /**
+ * Constructor for new button type
+ * @param key - the internal key of the button
+ * @param rId - resource id of text shown to user in choose dialog
+ * @param cD - accessibility information regarding button
+ * @param mC - keyCode to execute on button press
+ * @param pR - portrait resource used to display button
+ * @param lR - landscape resource used to display button
+ * @param sR - smaller scaled resource for side buttons
+ */
+ ButtonInfo (String key, int rId, int cD, int mC, int pR, int lR, int sR) {
+ this.key = key;
+ displayId = rId;
+ contentDescription = cD;
+ keyCode = mC;
+ portResource = pR;
+ landResource = lR;
+ sideResource = sR;
+ }
+
+ @Override
+ public String toString() {
+ return "ButtonInfo[" + key + "]";
+ }
+ }
+
+ private static class ButtonAdapter extends ArrayAdapter<ButtonInfo> {
+ private ArrayList<ButtonInfo> mTakenItems;
+
+ public ButtonAdapter(Context context,
+ ArrayList<KeyButtonView> buttons, boolean smallButtons) {
+ super(context, R.layout.navigation_bar_edit_menu_item, R.id.key_text,
+ buildItems(smallButtons));
+
+ mTakenItems = new ArrayList<ButtonInfo>();
+ for (KeyButtonView button : buttons) {
+ ButtonInfo info = (ButtonInfo) button.getTag();
+ if (info != null && info != NAVBAR_EMPTY) {
+ mTakenItems.add(info);
+ }
+ }
+ }
+
+ private static List<ButtonInfo> buildItems(boolean smallButtons) {
+ List<ButtonInfo> items = new ArrayList<ButtonInfo>(Arrays.asList(ALL_BUTTONS));
+
+ // Not re-assignable
+ items.remove(NAVBAR_HOME);
+ items.remove(NAVBAR_RECENT);
+ items.remove(NAVBAR_BACK);
+ // menu buttons can only be assigned to side buttons
+ if (!smallButtons) {
+ items.remove(NAVBAR_CONDITIONAL_MENU);
+ items.remove(NAVBAR_ALWAYS_MENU);
+ } else {
+ items.remove(NAVBAR_MENU_BIG);
+ }
+
+ return items;
+ }
+
+ @Override
+ public View getView(int position, View convertView, ViewGroup parent) {
+ View view = super.getView(position, convertView, parent);
+ ButtonInfo info = getItem(position);
+ boolean enabled = isEnabled(position);
+
+ TextView text = (TextView) view.findViewById(R.id.key_text);
+ text.setText(getContext().getResources().getString(info.displayId));
+ text.setEnabled(enabled);
+
+ ImageView icon = (ImageView) view.findViewById(R.id.key_icon);
+ icon.setImageResource(info.portResource);
+ icon.setColorFilter(new PorterDuffColorFilter(
+ text.getCurrentTextColor(), PorterDuff.Mode.SRC_IN));
+
+ return view;
+ }
+
+ @Override
+ public boolean areAllItemsEnabled() {
+ return true;
+ }
+
+ @Override
+ public boolean isEnabled(int position) {
+ return !mTakenItems.contains(getItem(position));
+ }
+ }
+}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java
index 1acfe57..53ccf49 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java
@@ -23,7 +23,10 @@ import android.animation.TimeInterpolator;
import android.animation.ValueAnimator;
import android.app.ActivityManagerNative;
import android.app.StatusBarManager;
+import android.content.BroadcastReceiver;
import android.content.Context;
+import android.content.Intent;
+import android.content.IntentFilter;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.graphics.Point;
@@ -32,6 +35,7 @@ import android.graphics.drawable.Drawable;
import android.os.Handler;
import android.os.Message;
import android.os.RemoteException;
+import android.os.UserHandle;
import android.util.AttributeSet;
import android.util.Log;
import android.view.Display;
@@ -89,6 +93,16 @@ public class NavigationBarView extends LinearLayout {
final static boolean WORKAROUND_INVALID_LAYOUT = true;
final static int MSG_CHECK_INVALID_LAYOUT = 8686;
+ final static String NAVBAR_EDIT_ACTION = "android.intent.action.NAVBAR_EDIT";
+
+ private boolean mInEditMode;
+ private NavbarEditor mEditBar;
+ private NavBarReceiver mNavBarReceiver;
+ private OnClickListener mRecentsClickListener;
+ private OnTouchListener mRecentsPreloadListener;
+ private OnTouchListener mHomeSearchActionListener;
+ private OnLongClickListener mRecentsBackListener;
+
// performs manual animation in sync with layout transitions
private final NavTransitionListener mTransitionListener = new NavTransitionListener();
@@ -109,9 +123,9 @@ public class NavigationBarView extends LinearLayout {
@Override
public void startTransition(LayoutTransition transition, ViewGroup container,
View view, int transitionType) {
- if (view.getId() == R.id.back) {
+ if (NavbarEditor.NAVBAR_BACK.equals(view.getTag())) {
mBackTransitioning = true;
- } else if (view.getId() == R.id.home && transitionType == LayoutTransition.APPEARING) {
+ } else if (NavbarEditor.NAVBAR_HOME.equals(view.getTag()) && transitionType == LayoutTransition.APPEARING) {
mHomeAppearing = true;
mStartDelay = transition.getStartDelay(transitionType);
mDuration = transition.getDuration(transitionType);
@@ -122,9 +136,9 @@ public class NavigationBarView extends LinearLayout {
@Override
public void endTransition(LayoutTransition transition, ViewGroup container,
View view, int transitionType) {
- if (view.getId() == R.id.back) {
+ if (NavbarEditor.NAVBAR_BACK.equals(view.getTag())) {
mBackTransitioning = false;
- } else if (view.getId() == R.id.home && transitionType == LayoutTransition.APPEARING) {
+ } else if (NavbarEditor.NAVBAR_HOME.equals(view.getTag()) && transitionType == LayoutTransition.APPEARING) {
mHomeAppearing = false;
}
}
@@ -190,6 +204,9 @@ public class NavigationBarView extends LinearLayout {
getIcons(res);
mBarTransitions = new NavigationBarTransitions(this);
+
+ mNavBarReceiver = new NavBarReceiver();
+ getContext().registerReceiver(mNavBarReceiver, new IntentFilter(NAVBAR_EDIT_ACTION));
}
@Override
@@ -216,7 +233,7 @@ public class NavigationBarView extends LinearLayout {
@Override
public boolean onTouchEvent(MotionEvent event) {
- if (mTaskSwitchHelper.onTouchEvent(event)) {
+ if (!mInEditMode && mTaskSwitchHelper.onTouchEvent(event)) {
return true;
}
if (mDeadZone != null && event.getAction() == MotionEvent.ACTION_OUTSIDE) {
@@ -227,7 +244,7 @@ public class NavigationBarView extends LinearLayout {
@Override
public boolean onInterceptTouchEvent(MotionEvent event) {
- return mTaskSwitchHelper.onInterceptTouchEvent(event);
+ return !mInEditMode && mTaskSwitchHelper.onInterceptTouchEvent(event);
}
public void abortCurrentGesture() {
@@ -241,19 +258,19 @@ public class NavigationBarView extends LinearLayout {
}
public View getRecentsButton() {
- return mCurrentView.findViewById(R.id.recent_apps);
+ return mCurrentView.findViewWithTag(NavbarEditor.NAVBAR_RECENT);
}
public View getMenuButton() {
- return mCurrentView.findViewById(R.id.menu);
+ return mCurrentView.findViewWithTag(NavbarEditor.NAVBAR_CONDITIONAL_MENU);
}
public View getBackButton() {
- return mCurrentView.findViewById(R.id.back);
+ return mCurrentView.findViewWithTag(NavbarEditor.NAVBAR_BACK);
}
public KeyButtonView getHomeButton() {
- return (KeyButtonView) mCurrentView.findViewById(R.id.home);
+ return (KeyButtonView) mCurrentView.findViewWithTag(NavbarEditor.NAVBAR_HOME);
}
public View getImeSwitchButton() {
@@ -380,9 +397,9 @@ public class NavigationBarView extends LinearLayout {
disableRecent = false;
}
- getBackButton() .setVisibility(disableBack ? View.INVISIBLE : View.VISIBLE);
- getHomeButton() .setVisibility(disableHome ? View.INVISIBLE : View.VISIBLE);
- getRecentsButton().setVisibility(disableRecent ? View.INVISIBLE : View.VISIBLE);
+ setButtonWithTagVisibility(NavbarEditor.NAVBAR_BACK, !disableBack);
+ setButtonWithTagVisibility(NavbarEditor.NAVBAR_HOME, !disableHome);
+ setButtonWithTagVisibility(NavbarEditor.NAVBAR_RECENT, !disableRecent);
}
private boolean inLockTask() {
@@ -473,19 +490,17 @@ public class NavigationBarView extends LinearLayout {
// Only show Menu if IME switcher not shown.
final boolean shouldShow = mShowMenu &&
((mNavigationIconHints & StatusBarManager.NAVIGATION_HINT_IME_SHOWN) == 0);
- getMenuButton().setVisibility(shouldShow ? View.VISIBLE : View.INVISIBLE);
+ final boolean shouldShowAlwaysMenu = (mNavigationIconHints &
+ StatusBarManager.NAVIGATION_HINT_IME_SHOWN) == 0;
+ setButtonWithTagVisibility(NavbarEditor.NAVBAR_ALWAYS_MENU, shouldShowAlwaysMenu);
+ setButtonWithTagVisibility(NavbarEditor.NAVBAR_CONDITIONAL_MENU, shouldShow);
}
@Override
public void onFinishInflate() {
- mRotatedViews[Surface.ROTATION_0] =
- mRotatedViews[Surface.ROTATION_180] = findViewById(R.id.rot0);
-
- mRotatedViews[Surface.ROTATION_90] = findViewById(R.id.rot90);
-
- mRotatedViews[Surface.ROTATION_270] = mRotatedViews[Surface.ROTATION_90];
-
- mCurrentView = mRotatedViews[Surface.ROTATION_0];
+ mRotatedViews[Configuration.ORIENTATION_PORTRAIT] = findViewById(R.id.rot0);
+ mRotatedViews[Configuration.ORIENTATION_LANDSCAPE] = findViewById(R.id.rot90);
+ mCurrentView = mRotatedViews[getResources().getConfiguration().orientation];
getImeSwitchButton().setOnClickListener(mImeSwitcherClickListener);
@@ -502,14 +517,23 @@ public class NavigationBarView extends LinearLayout {
}
public void reorient() {
- final int rot = mDisplay.getRotation();
- for (int i=0; i<4; i++) {
- mRotatedViews[i].setVisibility(View.GONE);
- }
- mCurrentView = mRotatedViews[rot];
+ int orientation = getResources().getConfiguration().orientation;
+ mRotatedViews[Configuration.ORIENTATION_PORTRAIT].setVisibility(View.GONE);
+ mRotatedViews[Configuration.ORIENTATION_LANDSCAPE].setVisibility(View.GONE);
+ mCurrentView = mRotatedViews[orientation];
mCurrentView.setVisibility(View.VISIBLE);
+
updateLayoutTransitionsEnabled();
+ if (NavbarEditor.isDevicePhone(getContext())) {
+ int rotation = mDisplay.getRotation();
+ mVertical = rotation == Surface.ROTATION_90 || rotation == Surface.ROTATION_270;
+ } else {
+ mVertical = getWidth() > 0 && getHeight() > getWidth();
+ }
+ mEditBar = new NavbarEditor(mCurrentView, mVertical, mIsLayoutRtl);
+ updateSettings();
+
getImeSwitchButton().setOnClickListener(mImeSwitcherClickListener);
mDeadZone = (DeadZone) mCurrentView.findViewById(R.id.deadzone);
@@ -572,55 +596,8 @@ public class NavigationBarView extends LinearLayout {
boolean isLayoutRtl = getResources().getConfiguration()
.getLayoutDirection() == LAYOUT_DIRECTION_RTL;
if (mIsLayoutRtl != isLayoutRtl) {
-
- // 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
- *
- * @param group The LinearLayout to swap the children from.
- */
- private void swapChildrenOrderIfVertical(View group) {
- if (group instanceof LinearLayout) {
- LinearLayout linearLayout = (LinearLayout) group;
- if (linearLayout.getOrientation() == VERTICAL) {
- int childCount = linearLayout.getChildCount();
- ArrayList<View> childList = new ArrayList<>(childCount);
- for (int i = 0; i < childCount; i++) {
- childList.add(linearLayout.getChildAt(i));
- }
- linearLayout.removeAllViews();
- for (int i = childCount - 1; i >= 0; i--) {
- linearLayout.addView(childList.get(i));
- }
- }
+ reorient();
}
}
@@ -714,9 +691,9 @@ public class NavigationBarView extends LinearLayout {
pw.print("null");
} else {
pw.print(PhoneStatusBar.viewInfo(button)
- + " " + visibilityToString(button.getVisibility())
- + " alpha=" + button.getAlpha()
- );
+ + " " + visibilityToString(button.getVisibility())
+ + " alpha=" + button.getAlpha()
+ );
}
pw.println();
}
@@ -724,4 +701,89 @@ public class NavigationBarView extends LinearLayout {
public interface OnVerticalChangedListener {
void onVerticalChanged(boolean isVertical);
}
+
+ void setListeners(OnClickListener recentsClickListener, OnTouchListener recentsPreloadListener,
+ OnLongClickListener recentsBackListener, OnTouchListener homeSearchActionListener) {
+ mRecentsClickListener = recentsClickListener;
+ mRecentsPreloadListener = recentsPreloadListener;
+ mHomeSearchActionListener = homeSearchActionListener;
+ mRecentsBackListener = recentsBackListener;
+ updateButtonListeners();
+ }
+
+ private void removeButtonListeners() {
+ ViewGroup container = (ViewGroup) mCurrentView.findViewById(R.id.container);
+ int viewCount = container.getChildCount();
+ for (int i = 0; i < viewCount; i++) {
+ View button = container.getChildAt(i);
+ if (button instanceof KeyButtonView) {
+ button.setOnClickListener(null);
+ button.setOnTouchListener(null);
+ }
+ }
+ }
+
+ protected void updateButtonListeners() {
+ View recentView = mCurrentView.findViewWithTag(NavbarEditor.NAVBAR_RECENT);
+ if (recentView != null) {
+ recentView.setOnClickListener(mRecentsClickListener);
+ recentView.setOnTouchListener(mRecentsPreloadListener);
+ recentView.setLongClickable(true);
+ recentView.setOnLongClickListener(mRecentsBackListener);
+ }
+ View backView = mCurrentView.findViewWithTag(NavbarEditor.NAVBAR_BACK);
+ if (backView != null) {
+ backView.setLongClickable(true);
+ backView.setOnLongClickListener(mRecentsBackListener);
+ }
+ View homeView = mCurrentView.findViewWithTag(NavbarEditor.NAVBAR_HOME);
+ if (homeView != null) {
+ homeView.setOnTouchListener(mHomeSearchActionListener);
+ }
+ }
+
+ public boolean isInEditMode() {
+ return mInEditMode;
+ }
+
+ private void setButtonWithTagVisibility(Object tag, boolean visible) {
+ View findView = mCurrentView.findViewWithTag(tag);
+ if (findView != null) {
+ findView.setVisibility(visible ? View.VISIBLE : View.INVISIBLE);
+ }
+ }
+
+ // TODO LINK TO THIS ONCE THEMES GOES IN
+ protected void updateResources() {
+ getIcons(mContext.getResources());
+ }
+
+ public class NavBarReceiver extends BroadcastReceiver {
+ @Override
+ public void onReceive(Context context, Intent intent) {
+ boolean edit = intent.getBooleanExtra("edit", false);
+ boolean save = intent.getBooleanExtra("save", false);
+ if (edit != mInEditMode) {
+ mInEditMode = edit;
+ if (edit) {
+ removeButtonListeners();
+ mEditBar.setEditMode(true);
+ } else {
+ if (save) {
+ mEditBar.saveKeys();
+ }
+ mEditBar.setEditMode(false);
+ updateSettings();
+ }
+ }
+ }
+ }
+
+ public void updateSettings() {
+ mEditBar.updateKeys();
+ removeButtonListeners();
+ updateButtonListeners();
+ setDisabledFlags(mDisabledFlags, true /* force */);
+ setMenuVisibility(mShowMenu, true);
+ }
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
index e3a8925..30dcd4d 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
@@ -1352,14 +1352,8 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
private void prepareNavigationBarView() {
mNavigationBarView.reorient();
- mNavigationBarView.getRecentsButton().setOnClickListener(mRecentsClickListener);
- mNavigationBarView.getRecentsButton().setOnTouchListener(mRecentsPreloadOnTouchListener);
- mNavigationBarView.getRecentsButton().setLongClickable(true);
- mNavigationBarView.getRecentsButton().setOnLongClickListener(mLongPressBackRecentsListener);
- mNavigationBarView.getBackButton().setLongClickable(true);
- mNavigationBarView.getBackButton().setOnLongClickListener(mLongPressBackRecentsListener);
- mNavigationBarView.getHomeButton().setOnTouchListener(mHomeActionListener);
- mNavigationBarView.getHomeButton().setOnLongClickListener(mLongPressHomeListener);
+ mNavigationBarView.setListeners(mRecentsClickListener, mRecentsPreloadOnTouchListener,
+ mLongPressBackRecentsListener, mHomeActionListener);
mAssistManager.onConfigurationChanged();
}
@@ -3425,6 +3419,9 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
mKeyguardWallpaper = wm.getKeyguardBitmap();
updateMediaMetaData(true);
+ if (mNavigationBarView != null) {
+ mNavigationBarView.updateSettings();
+ }
}
private void setControllerUsers() {
@@ -3777,7 +3774,8 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
@Override
public boolean shouldDisableNavbarGestures() {
- return !isDeviceProvisioned() || (mDisabled1 & StatusBarManager.DISABLE_SEARCH) != 0;
+ return !isDeviceProvisioned() || (mDisabled1 & StatusBarManager.DISABLE_SEARCH) != 0
+ || (mNavigationBarView != null && mNavigationBarView.isInEditMode());
}
public void postStartActivityDismissingKeyguard(final Intent intent, int delay) {
@@ -4563,20 +4561,20 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
activityManager.stopLockTaskModeOnCurrent();
// When exiting refresh disabled flags.
mNavigationBarView.setDisabledFlags(mDisabled1, true);
- } else if ((v.getId() == R.id.back)
+ } else if ((NavbarEditor.NAVBAR_BACK.equals(v.getTag()))
&& !mNavigationBarView.getRecentsButton().isPressed()) {
// If we aren't pressing recents right now then they presses
// won't be together, so send the standard long-press action.
sendBackLongPress = true;
- } else if ((v.getId() == R.id.recent_apps)) {
+ } else if ((NavbarEditor.NAVBAR_RECENT.equals(v.getTag()))) {
hijackRecentsLongPress = true;
}
mLastLockToAppLongPress = time;
} else {
// If this is back still need to handle sending the long-press event.
- if (v.getId() == R.id.back) {
+ if (NavbarEditor.NAVBAR_BACK.equals(v.getTag())) {
sendBackLongPress = true;
- } else if (v.getId() == R.id.recent_apps) {
+ } else if (NavbarEditor.NAVBAR_RECENT.equals(v.getTag())) {
hijackRecentsLongPress = true;
} else if (isAccessiblityEnabled && activityManager.isInLockTaskMode()) {
// When in accessibility mode a long press that is recents (not back)
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyButtonView.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyButtonView.java
index e9ead4c..6d5ade7 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyButtonView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyButtonView.java
@@ -40,6 +40,7 @@ import android.view.accessibility.AccessibilityNodeInfo;
import android.widget.ImageView;
import com.android.systemui.R;
+import com.android.systemui.statusbar.phone.NavbarEditor;
import static android.view.accessibility.AccessibilityNodeInfo.ACTION_CLICK;
import static android.view.accessibility.AccessibilityNodeInfo.ACTION_LONG_CLICK;
@@ -50,8 +51,10 @@ public class KeyButtonView extends ImageView {
private long mDownTime;
private int mCode;
+ private boolean mIsSmall;
private int mTouchSlop;
private boolean mSupportsLongpress = true;
+ private boolean mInEditMode;
private AudioManager mAudioManager;
private boolean mGestureAborted;
private boolean mPerformedLongClick;
@@ -155,7 +158,57 @@ public class KeyButtonView extends ImageView {
return res != null ? res : super.getResources();
}
+ public void setEditMode(boolean editMode) {
+ mInEditMode = editMode;
+ updateVisibility();
+ }
+
+ public void setInfo(NavbarEditor.ButtonInfo item, boolean isVertical, boolean isSmall) {
+ final Resources res = getResources();
+ final int keyDrawableResId;
+
+ setTag(item);
+ setContentDescription(res.getString(item.contentDescription));
+ mCode = item.keyCode;
+ mIsSmall = isSmall;
+
+ if (isSmall) {
+ keyDrawableResId = item.sideResource;
+ } else if (!isVertical) {
+ keyDrawableResId = item.portResource;
+ } else {
+ keyDrawableResId = item.landResource;
+ }
+ // The reason for setImageDrawable vs setImageResource is because setImageResource calls
+ // relayout() w/o any checks. setImageDrawable performs size checks and only calls relayout
+ // if necessary. We rely on this because otherwise the setX/setY attributes which are post
+ // layout cause it to mess up the layout.
+ setImageDrawable(res.getDrawable(keyDrawableResId));
+ updateVisibility();
+ }
+
+ private void updateVisibility() {
+ if (mInEditMode) {
+ setVisibility(View.VISIBLE);
+ return;
+ }
+
+ NavbarEditor.ButtonInfo info = (NavbarEditor.ButtonInfo) getTag();
+ if (info == NavbarEditor.NAVBAR_EMPTY) {
+ setVisibility(mIsSmall ? View.INVISIBLE : View.GONE);
+ } else if (info == NavbarEditor.NAVBAR_CONDITIONAL_MENU) {
+ setVisibility(View.INVISIBLE);
+ }
+ }
+
+ private boolean supportsLongPress() {
+ return mSupportsLongpress && getTag() != NavbarEditor.NAVBAR_HOME;
+ }
+
public boolean onTouchEvent(MotionEvent ev) {
+ if (mInEditMode) {
+ return false;
+ }
final int action = ev.getAction();
int x, y;
if (action == MotionEvent.ACTION_DOWN) {
@@ -178,8 +231,12 @@ public class KeyButtonView extends ImageView {
// Provide the same haptic feedback that the system offers for virtual keys.
performHapticFeedback(HapticFeedbackConstants.VIRTUAL_KEY);
}
- removeCallbacks(mCheckLongPress);
- postDelayed(mCheckLongPress, ViewConfiguration.getLongPressTimeout());
+
+ if (supportsLongPress()) {
+ removeCallbacks(mCheckLongPress);
+ postDelayed(mCheckLongPress, ViewConfiguration.getLongPressTimeout());
+ }
+
break;
case MotionEvent.ACTION_MOVE:
x = (int)ev.getX();
@@ -194,7 +251,13 @@ public class KeyButtonView extends ImageView {
if (mCode != 0) {
sendEvent(KeyEvent.ACTION_UP, KeyEvent.FLAG_CANCELED);
}
+
removeCallbacks(mCheckLongPress);
+
+ if (supportsLongPress()) {
+ removeCallbacks(mCheckLongPress);
+ }
+
break;
case MotionEvent.ACTION_UP:
final boolean doIt = isPressed();
@@ -213,7 +276,12 @@ public class KeyButtonView extends ImageView {
performClick();
}
}
+
removeCallbacks(mCheckLongPress);
+
+ if (supportsLongPress()) {
+ removeCallbacks(mCheckLongPress);
+ }
mPerformedLongClick = false;
break;
}