+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- * Copyright (C) 2010 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
--->
-
-<!-- TabletStatusBarView extends FrameLayout -->
-<com.android.systemui.statusbar.tablet.TabletStatusBarView
- xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:systemui="http://schemas.android.com/apk/res/com.android.systemui"
- android:background="@drawable/system_bar_background"
- >
-
- <FrameLayout
- android:id="@+id/bar_contents_holder"
- android:layout_width="match_parent"
- android:layout_height="@*android:dimen/system_bar_height"
- android:layout_gravity="bottom"
- >
- <RelativeLayout
- android:id="@+id/bar_contents"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:clipChildren="false"
- >
-
- <!-- notification icons & panel access -->
- <include layout="@layout/system_bar_notification_area"
- android:layout_width="wrap_content"
- android:layout_height="match_parent"
- android:layout_alignParentEnd="true"
- android:layout_marginTop="1dp"
- />
-
- <!-- navigation controls -->
- <LinearLayout
- android:id="@+id/navigationArea"
- android:layout_width="wrap_content"
- android:layout_height="match_parent"
- android:layout_alignParentStart="true"
- android:orientation="horizontal"
- android:clipChildren="false"
- android:clipToPadding="false"
- >
- <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:contentDescription="@string/accessibility_back"
- systemui:glowBackground="@drawable/ic_sysbar_highlight"
- />
- <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"
- android:contentDescription="@string/accessibility_home"
- systemui:glowBackground="@drawable/ic_sysbar_highlight"
- />
- <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:contentDescription="@string/accessibility_recent"
- systemui:glowBackground="@drawable/ic_sysbar_highlight"
- />
- <com.android.systemui.statusbar.policy.KeyButtonView android:id="@+id/menu"
- android:layout_width="@dimen/navigation_menu_key_width"
- android:layout_height="match_parent"
- android:src="@drawable/ic_sysbar_menu"
- systemui:keyCode="82"
- android:visibility="invisible"
- android:contentDescription="@string/accessibility_menu"
- systemui:glowBackground="@drawable/ic_sysbar_highlight"
- />
- </LinearLayout>
-
- <!-- fake space bar zone -->
- <com.android.systemui.statusbar.policy.EventHole android:id="@+id/fake_space_bar"
- android:layout_height="match_parent"
- android:layout_width="0dp"
- android:paddingStart="8dip"
- android:paddingEnd="8dip"
- android:layout_toEndOf="@+id/navigationArea"
- android:layout_toStartOf="@+id/notificationArea"
- android:visibility="gone"
- />
- </RelativeLayout>
- </FrameLayout>
-
- <FrameLayout
- android:id="@+id/bar_shadow_holder"
- android:layout_width="match_parent"
- android:layout_height="@*android:dimen/system_bar_height"
- android:layout_gravity="bottom"
- >
- <!-- lights out shade -->
- <RelativeLayout
- android:id="@+id/bar_shadow"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:background="#FF000000"
- android:visibility="gone"
- >
- <ImageView
- android:id="@+id/dot0"
- android:layout_width="80dip"
- android:layout_height="48dip"
- android:src="@drawable/ic_sysbar_lights_out_dot_small"
- android:layout_alignParentStart="true"
- android:layout_alignParentBottom="true"
- />
- <ImageView
- android:id="@+id/dot1"
- android:layout_width="80dip"
- android:layout_height="48dip"
- android:src="@drawable/ic_sysbar_lights_out_dot_large"
- android:layout_toEndOf="@+id/dot0"
- android:layout_alignParentBottom="true"
- />
- <ImageView
- android:id="@+id/dot2"
- android:layout_width="80dip"
- android:layout_height="48dip"
- android:src="@drawable/ic_sysbar_lights_out_dot_small"
- android:layout_toEndOf="@+id/dot1"
- android:layout_alignParentBottom="true"
- />
- <ImageView
- android:id="@+id/dot3"
- android:layout_width="80dip"
- android:layout_height="48dip"
- android:src="@drawable/ic_sysbar_lights_out_dot_small"
- android:layout_alignParentEnd="true"
- android:layout_alignParentBottom="true"
- />
- </RelativeLayout>
- </FrameLayout>
-</com.android.systemui.statusbar.tablet.TabletStatusBarView>
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-**
-** Copyright 2011, The Android Open Source Project
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
--->
-
-<com.android.systemui.statusbar.tablet.CompatModePanel
- xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_height="wrap_content"
- android:layout_width="match_parent"
- android:paddingBottom="@dimen/panel_float"
- android:paddingEnd="20dp"
- >
- <RadioGroup android:id="@+id/compat_mode_radio_group"
- android:background="@*android:drawable/dialog_full_holo_dark"
- android:layout_height="wrap_content"
- android:layout_width="match_parent"
- android:orientation="vertical"
- android:padding="10dp"
- >
- <RadioButton android:id="@+id/compat_mode_off_radio"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="@string/compat_mode_off" />
- <RadioButton android:id="@+id/compat_mode_on_radio"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="@string/compat_mode_on" />
- </RadioGroup>
-</com.android.systemui.statusbar.tablet.CompatModePanel>
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/*
-** Copyright 2011, The Android Open Source Project
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
--->
-
-<LinearLayout
- xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:minHeight="?android:attr/listPreferredItemHeight"
- android:background="@drawable/status_bar_item_background"
- android:orientation="vertical"
- android:paddingEnd="6dip"
- android:paddingStart="6dip"
- android:paddingTop="5dip"
- android:paddingBottom="5dip"
- android:gravity="center_vertical">
- <LinearLayout
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_weight="1"
- android:gravity="center_vertical"
- android:orientation="horizontal">
- <LinearLayout
- android:id="@+id/item_subtype"
- android:layout_width="wrap_content"
- android:layout_height="match_parent"
- android:layout_weight="1"
- android:gravity="center_vertical"
- android:orientation="horizontal"
- android:background="?android:attr/selectableItemBackground">
- <RadioButton
- android:id="@+id/item_radio"
- android:layout_width="30dip"
- android:layout_height="wrap_content"
- android:focusable="false"
- android:clickable="false" />
- <ImageView
- android:id="@+id/item_icon"
- android:layout_width="@android:dimen/app_icon_size"
- android:layout_height="wrap_content"
- android:scaleType="fitCenter"
- android:contentDescription="@null" />
- <LinearLayout
- android:orientation="vertical"
- android:layout_width="0px"
- android:layout_weight="1"
- android:layout_height="wrap_content">
- <TextView
- android:id="@+id/item_title"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:textAppearance="?android:attr/textAppearanceMedium"
- android:singleLine="true"
- android:ellipsize="marquee"
- android:layout_marginBottom="2dip" />
- <TextView
- android:id="@+id/item_subtitle"
- android:layout_marginTop="-4dip"
- android:layout_gravity="center_vertical|start"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:textAppearance="?android:attr/textAppearanceSmall" />
- </LinearLayout>
- </LinearLayout>
- <View
- android:id="@+id/item_vertical_separator"
- android:layout_width="2dip"
- android:layout_height="match_parent"
- android:layout_marginBottom="5dip"
- android:background="@android:drawable/divider_horizontal_dark" />
- <ImageView
- android:id="@+id/item_settings_icon"
- android:layout_width="wrap_content"
- android:layout_height="match_parent"
- android:layout_marginStart="5dip"
- android:layout_gravity="center_vertical"
- android:paddingEnd="10dip"
- android:paddingStart="10dip"
- android:src="@drawable/ic_sysbar_quicksettings"
- android:visibility="visible"
- android:clickable="true"
- android:focusable="true"
- android:background="?android:attr/selectableItemBackground"
- android:contentDescription="@string/accessibility_settings_button" />
- </LinearLayout>
- <View
- android:layout_width="match_parent"
- android:layout_height="1dip"
- android:background="@android:drawable/divider_horizontal_dark" />
-</LinearLayout>
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-**
-** Copyright 2011, The Android Open Source Project
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
--->
-
-<com.android.systemui.statusbar.tablet.InputMethodsPanel
- xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_height="match_parent"
- android:layout_width="match_parent"
- android:paddingBottom="7dip"
- android:orientation="vertical"
- android:visibility="gone">
- <View
- android:layout_width="match_parent"
- android:layout_height="0dip"
- android:layout_weight="1" />
- <FrameLayout
- android:id="@+id/glow"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:background="@drawable/recents_blue_glow">
- <LinearLayout
- android:layout_width="450dip"
- android:layout_height="wrap_content"
- android:layout_marginStart="20dip"
- android:orientation="vertical"
- android:background="@drawable/notify_panel_clock_bg">
- <!-- Hard keyboard switch -->
- <LinearLayout
- android:id="@+id/hard_keyboard_section"
- android:layout_height="wrap_content"
- android:layout_width="match_parent"
- android:orientation="vertical">
- <LinearLayout
- android:layout_height="wrap_content"
- android:layout_width="match_parent"
- android:orientation="horizontal">
- <TextView
- android:id="@+id/use_physical_keyboard_label"
- android:layout_width="0dip"
- android:layout_height="wrap_content"
- android:layout_weight="1"
- android:minHeight="?android:attr/listPreferredItemHeight"
- android:background="?android:attr/selectableItemBackground"
- android:orientation="vertical"
- android:paddingEnd="6dip"
- android:paddingStart="30dip"
- android:paddingTop="5dip"
- android:paddingBottom="5dip"
- android:gravity="center_vertical"
- android:singleLine="true"
- android:text="@string/status_bar_use_physical_keyboard"
- android:textAppearance="?android:attr/textAppearanceMedium"
- android:ellipsize="marquee" />
- <Switch
- android:id="@+id/hard_keyboard_switch"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="center_vertical"
- android:layout_marginEnd="16dip" />
- </LinearLayout>
- <View
- android:layout_width="match_parent"
- android:layout_height="1dip"
- android:background="@android:drawable/divider_horizontal_dark" />
- </LinearLayout>
-
- <!-- Input method list -->
- <ScrollView
- android:layout_width="wrap_content"
- android:layout_height="0dip"
- android:overScrollMode="ifContentScrolls"
- android:layout_marginTop="3dip"
- android:layout_weight="1"
- android:scrollbarAlwaysDrawVerticalTrack="true"
- android:scrollbarDefaultDelayBeforeFade="75000">
- <LinearLayout
- android:id="@+id/input_method_menu_list"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:orientation="vertical" />
- </ScrollView>
-
- <!-- Configure input methods -->
- <TextView
- android:id="@+id/ime_settings_shortcut"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:minHeight="?android:attr/listPreferredItemHeight"
- android:background="?android:attr/selectableItemBackground"
- android:orientation="vertical"
- android:paddingEnd="6dip"
- android:paddingStart="30dip"
- android:paddingTop="5dip"
- android:paddingBottom="5dip"
- android:gravity="center_vertical"
- android:singleLine="true"
- android:text="@string/status_bar_input_method_settings_configure_input_methods"
- android:textAppearance="?android:attr/textAppearanceMedium"
- android:ellipsize="marquee" />
- </LinearLayout>
- </FrameLayout>
-</com.android.systemui.statusbar.tablet.InputMethodsPanel>
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/* apps/common/assets/default/default/skins/StatusBar.xml
-**
-** Copyright 2011, The Android Open Source Project
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
--->
-
-<FrameLayout
- xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_height="match_parent"
- android:layout_width="match_parent"
- >
-
- <TextView
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:textSize="20dp"
- android:textColor="@android:color/holo_blue_light"
- android:text="@string/status_bar_no_recent_apps"
- android:gravity="start"
- android:layout_gravity="bottom|start"
- />
-</FrameLayout>
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- * Copyright (C) 2010 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
--->
-
-<!-- notification icons & panel access -->
-<com.android.systemui.statusbar.tablet.NotificationArea
- xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:systemui="http://schemas.android.com/apk/res/com.android.systemui"
- android:id="@+id/notificationArea"
- android:layout_width="wrap_content"
- android:layout_height="match_parent"
- android:layout_alignParentEnd="true"
- android:orientation="horizontal"
- android:background="?android:attr/listChoiceBackgroundIndicator"
- android:clickable="true"
- >
-
- <LinearLayout
- android:id="@+id/feedbackIconArea"
- android:layout_width="wrap_content"
- android:layout_height="match_parent"
- android:orientation="horizontal"
- >
-
- <com.android.systemui.statusbar.tablet.InputMethodButton
- android:id="@+id/imeSwitchButton"
- android:layout_width="wrap_content"
- android:layout_height="match_parent"
- android:layout_marginStart="8dip"
- android:src="@drawable/ic_sysbar_ime_default"
- android:visibility="gone"
- android:contentDescription="@string/accessibility_ime_switch_button"
- />
-
- <com.android.systemui.statusbar.policy.CompatModeButton
- android:id="@+id/compatModeButton"
- android:layout_width="wrap_content"
- android:layout_height="match_parent"
- android:layout_marginStart="8dip"
- android:src="@drawable/ic_sysbar_zoom"
- android:visibility="gone"
- android:contentDescription="@string/accessibility_compatibility_zoom_button"
- />
-
- <com.android.systemui.statusbar.tablet.NotificationIconArea
- android:id="@+id/notificationIcons"
- android:layout_width="wrap_content"
- android:layout_height="match_parent"
- >
- <view
- class="com.android.systemui.statusbar.tablet.NotificationIconArea$IconLayout"
- android:id="@+id/icons"
- android:layout_width="wrap_content"
- android:layout_height="match_parent"
- android:layout_gravity="center_vertical"
- android:layout_marginStart="8dp"
- android:alpha="0.4"
- />
- </com.android.systemui.statusbar.tablet.NotificationIconArea>
- </LinearLayout>
-
- <LinearLayout
- android:id="@+id/notificationTrigger"
- android:layout_width="wrap_content"
- android:layout_height="match_parent"
- android:gravity="center"
- >
- <com.android.systemui.statusbar.policy.Clock
- android:id="@+id/clock"
- android:textAppearance="@style/TextAppearance.StatusBar.Clock"
- android:layout_width="wrap_content"
- android:layout_height="match_parent"
- android:singleLine="true"
- android:paddingStart="6dip"
- android:layout_marginEnd="8dip"
- android:gravity="center_vertical|start"
- />
-
- <TextView
- android:id="@+id/network_text"
- android:layout_width="wrap_content"
- android:layout_height="match_parent"
- android:layout_marginEnd="6dip"
- android:layout_marginStart="6dip"
- android:gravity="center"
- android:singleLine="true"
- android:visibility="gone"
- android:textSize="16sp"
- android:textColor="#606060"
- />
-
- <LinearLayout
- android:id="@+id/signal_battery_cluster"
- android:layout_width="wrap_content"
- android:layout_height="match_parent"
- android:layout_marginEnd="16dp"
- android:orientation="horizontal"
- android:gravity="center"
- >
- <include layout="@layout/signal_cluster_view"
- android:id="@+id/signal_cluster"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- />
- <ImageView
- android:id="@+id/bluetooth"
- android:layout_height="wrap_content"
- android:layout_width="wrap_content"
- android:paddingStart="4dip"
- android:visibility="gone"
- />
- <ImageView
- android:id="@+id/battery"
- android:layout_height="wrap_content"
- android:layout_width="wrap_content"
- android:paddingStart="4dip"
- />
- </LinearLayout>
- </LinearLayout>
-</com.android.systemui.statusbar.tablet.NotificationArea>
+++ /dev/null
-<!--
- Copyright (C) 2006 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-
-<!-- android:background="@drawable/system_bar_closed_default_background" -->
-<com.android.systemui.statusbar.tablet.NotificationPanel
- xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:systemui="http://schemas.android.com/apk/res/com.android.systemui"
- android:id="@+id/content_parent"
- android:layout_height="match_parent"
- android:layout_width="match_parent"
- android:gravity="end"
- >
-
- <!-- lift the panel up off the status bar while leaving a touchable are -->
- <Space
- android:id="@+id/system_bar_notification_panel_bottom_space"
- android:layout_height="56dp"
- android:layout_width="478dp"
- android:layout_alignParentEnd="true"
- android:layout_alignParentBottom="true"
- />
-
- <LinearLayout
- android:id="@+id/content_frame"
- android:background="@drawable/notification_panel_bg"
- android:layout_height="wrap_content"
- android:layout_width="478dp"
- android:orientation="vertical"
- android:layout_alignParentEnd="true"
- android:layout_above="@id/system_bar_notification_panel_bottom_space"
- android:paddingBottom="8dp"
- >
-
- <include layout="@layout/system_bar_notification_panel_title"
- android:layout_width="match_parent"
- android:layout_height="130dp"
- android:layout_above="@id/content_frame"
- android:layout_alignParentEnd="true"
- android:layout_weight="0"
- />
-
- <ScrollView
-
- android:id="@+id/notification_scroller"
- android:layout_height="wrap_content"
- android:layout_width="match_parent"
- android:overScrollMode="ifContentScrolls"
- android:layout_weight="1"
- >
- <com.android.systemui.statusbar.policy.NotificationRowLayout
- android:id="@+id/content"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:gravity="center_horizontal|bottom"
- android:clickable="true"
- android:focusable="true"
- android:descendantFocusability="afterDescendants"
- systemui:rowHeight="@dimen/notification_row_min_height"
- />
- </ScrollView>
- </LinearLayout>
-</com.android.systemui.statusbar.tablet.NotificationPanel>
+++ /dev/null
-<!--
- Copyright (C) 2006 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-
-<com.android.systemui.statusbar.tablet.NotificationPanelTitle
- xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:systemui="http://schemas.android.com/apk/res/com.android.systemui"
- android:id="@+id/title_area"
- android:background="@drawable/system_bar_notification_header_bg"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:clickable="true"
- android:orientation="vertical"
- android:paddingStart="26dp"
- android:paddingTop="14dp"
- android:paddingEnd="26dp"
- >
-
- <TableLayout
- android:id="@+id/icons"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_alignParentStart="true"
- android:layout_alignParentBottom="true"
- android:layout_marginTop="16dp"
- android:layout_marginBottom="16dp"
- android:shrinkColumns="2,4"
- android:stretchColumns="7"
- >
- <TableRow>
-
- <!-- to keep the column ids stable we wrap disappearing views in
- frames -->
- <FrameLayout
- android:layout_height="wrap_content"
- android:layout_width="wrap_content"
- android:layout_gravity="center_vertical"
- >
- <ImageView
- android:id="@+id/bluetooth"
- android:layout_height="wrap_content"
- android:layout_width="wrap_content"
- android:paddingEnd="16dp"
- android:visibility="gone"
- android:contentDescription="@null"
- android:layout_gravity="center_vertical"
- />
- </FrameLayout>
-
- <!-- mobile data -->
- <FrameLayout
- android:id="@+id/mobile_icon"
- android:layout_height="wrap_content"
- android:layout_width="wrap_content"
- android:layout_gravity="center_vertical"
- android:paddingEnd="6dp"
- >
-
- <ImageView
- android:id="@+id/mobile_signal"
- android:layout_height="wrap_content"
- android:layout_width="wrap_content"
- android:contentDescription="@null"
- />
-
- <ImageView
- android:id="@+id/mobile_type"
- android:layout_height="wrap_content"
- android:layout_width="wrap_content"
- android:contentDescription="@null"
- />
-
- </FrameLayout>
- <TextView
- android:id="@+id/mobile_text"
- style="@style/SystemBarNotificationText"
- android:layout_gravity="start|center_vertical"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:paddingEnd="12dp"
- android:singleLine="true"
- android:ellipsize="end"
- android:text="@string/status_bar_settings_settings_button"
- />
-
- <!-- wifi -->
- <FrameLayout
- android:id="@+id/wifi_icon"
- android:layout_height="wrap_content"
- android:layout_width="wrap_content"
- android:layout_gravity="center_vertical"
- android:paddingEnd="6dp"
- >
-
- <ImageView
- android:id="@+id/wifi_signal"
- android:layout_height="wrap_content"
- android:layout_width="wrap_content"
- android:contentDescription="@null"
- />
-
- <ImageView
- android:id="@+id/wifi_direction"
- android:layout_height="wrap_content"
- android:layout_width="wrap_content"
- android:contentDescription="@null"
- />
-
- </FrameLayout>
- <TextView
- android:id="@+id/wifi_text"
- style="@style/SystemBarNotificationText"
- android:layout_gravity="start|center_vertical"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:paddingEnd="12dp"
- android:singleLine="true"
- android:ellipsize="end"
- android:text="@string/status_bar_settings_settings_button"
- />
-
- <ImageView
- android:id="@+id/battery"
- android:layout_height="wrap_content"
- android:layout_width="wrap_content"
- android:scaleType="centerInside"
- android:layout_gravity="center_vertical"
- android:layout_alignBaseline="@id/wifi_signal"
- android:paddingEnd="6dp"
- android:contentDescription="@null"
- />
-
- <TextView
- android:id="@+id/battery_text"
- style="@style/SystemBarNotificationText"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="start|center_vertical"
- android:paddingEnd="2dp"
- android:singleLine="true"
- android:text="@string/status_bar_settings_settings_button"
- />
-
- <!-- this will stretch to eat up available space -->
- <View
- android:layout_width="0dp"
- android:layout_height="0dp"
- />
-
- <FrameLayout
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="center_vertical"
- >
-
- <ImageView
- android:id="@+id/settings_button"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:src="@drawable/ic_sysbar_quicksettings"
- android:contentDescription="@string/accessibility_desc_quick_settings"
- />
-
- <ImageView
- android:id="@+id/notification_button"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:src="@drawable/ic_notification_open"
- android:visibility="invisible"
- android:contentDescription="@string/accessibility_notifications_button"
- />
- </FrameLayout>
-
- </TableRow>
- </TableLayout>
-
- <LinearLayout
- xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:systemui="http://schemas.android.com/apk/res/com.android.systemui"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:paddingTop="@dimen/notification_panel_header_padding_top"
- android:orientation="horizontal"
- android:gravity="center_vertical"
- android:baselineAligned="false"
- >
-
- <com.android.systemui.statusbar.policy.Clock
- android:id="@+id/clock"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:singleLine="true"
- android:textAppearance="@style/TextAppearance.SystemBar.Expanded.Clock"
- />
-
- <com.android.systemui.statusbar.policy.DateView
- android:id="@+id/date"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_marginStart="8dp"
- android:layout_marginEnd="8dp"
- android:textAppearance="@style/TextAppearance.SystemBar.Expanded.Date"
- />
-
- <Space
- android:layout_width="0dp"
- android:layout_height="48dp"
- android:layout_weight="1"
- />
-
- <ImageView android:id="@+id/clear_all_button"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:scaleType="center"
- android:src="@drawable/ic_notify_clear"
- android:contentDescription="@string/accessibility_clear_all"
- />
- </LinearLayout>
-</com.android.systemui.statusbar.tablet.NotificationPanelTitle>
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/* apps/common/assets/default/default/skins/StatusBar.xml
-**
-** Copyright 2006, The Android Open Source Project
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
--->
-
-<!-- android:background="@drawable/system_bar_closed_default_background" -->
-<com.android.systemui.statusbar.tablet.NotificationPeekPanel
- xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_height="wrap_content"
- android:layout_width="match_parent"
- android:background="@*android:drawable/dialog_full_holo_dark"
- android:orientation="vertical"
- >
-
- <FrameLayout
- android:id="@+id/content"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:gravity="center_horizontal|bottom"
- android:animationCache="false"
- android:orientation="vertical"
- android:background="@drawable/system_bar_background"
- android:clickable="true"
- android:focusable="true"
- android:descendantFocusability="afterDescendants"
- >
- </FrameLayout>
-</com.android.systemui.statusbar.tablet.NotificationPeekPanel>
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/* apps/common/assets/default/default/skins/StatusBar.xml
-**
-** Copyright 2010, The Android Open Source Project
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
--->
-
-<RelativeLayout
- xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_height="match_parent"
- android:layout_width="match_parent"
- android:background="@*android:drawable/dialog_full_holo_dark"
- >
- <TextView
- android:id="@+id/description"
- android:textAppearance="@android:style/TextAppearance.Small"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:gravity="center"
- android:textStyle="bold"
- android:maxLines="1"
- android:layout_alignParentBottom="true"
- />
-
- <FrameLayout
- android:id="@+id/preview"
- android:layout_height="match_parent"
- android:layout_width="match_parent"
- android:layout_above="@+id/description"
- android:descendantFocusability="blocksDescendants"
- >
- <ImageView
- android:id="@+id/icon"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:scaleType="centerInside"
- android:visibility="gone"
- />
- <TextView
- android:id="@+id/alt"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:textAppearance="@android:style/TextAppearance.Large"
- android:gravity="center"
- android:visibility="gone"
- />
- </FrameLayout>
-</RelativeLayout>
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/* apps/common/assets/default/default/skins/StatusBar.xml
-**
-** Copyright 2006, The Android Open Source Project
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
--->
-
-<RelativeLayout android:id="@+id/recent_item"
- xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_height="wrap_content"
- android:layout_width="wrap_content">
-
- <TextView android:id="@+id/app_label"
- android:layout_width="@dimen/status_bar_recents_app_label_width"
- android:layout_height="wrap_content"
- android:textSize="@dimen/status_bar_recents_app_label_text_size"
- android:fadingEdge="horizontal"
- android:fadingEdgeLength="@dimen/status_bar_recents_text_fading_edge_length"
- android:scrollHorizontally="true"
- android:layout_alignParentStart="true"
- android:layout_alignParentTop="true"
- android:layout_marginStart="@dimen/status_bar_recents_app_label_left_margin"
- android:layout_marginTop="32dip"
- android:singleLine="true"
- android:ellipsize="marquee"
- android:textColor="@color/status_bar_recents_app_label_color"
- android:importantForAccessibility="no"
- />
-
- <FrameLayout android:id="@+id/app_thumbnail"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_toEndOf="@id/app_label"
- android:layout_marginStart="@dimen/status_bar_recents_thumbnail_left_margin"
- android:scaleType="center"
- android:background="@drawable/recents_thumbnail_bg"
- android:foreground="@drawable/recents_thumbnail_fg"
- android:visibility="invisible">
- <ImageView android:id="@+id/app_thumbnail_image"
- android:layout_width="@dimen/status_bar_recents_thumbnail_width"
- android:layout_height="@dimen/status_bar_recents_thumbnail_height"
- />
- </FrameLayout>
-
-
- <ImageView android:id="@+id/app_icon"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_toEndOf="@id/app_label"
- android:layout_marginStart="@dimen/status_bar_recents_app_icon_left_margin"
- android:layout_marginTop="@dimen/status_bar_recents_app_icon_top_margin"
- android:maxWidth="@dimen/status_bar_recents_app_icon_max_width"
- android:maxHeight="@dimen/status_bar_recents_app_icon_max_height"
- android:scaleType="centerInside"
- android:adjustViewBounds="true"
- android:visibility="invisible"
- />
-
-
- <View android:id="@+id/recents_callout_line"
- android:layout_width="@dimen/status_bar_recents_app_label_width"
- android:layout_height="1dip"
- android:layout_below="@id/app_label"
- android:layout_marginTop="3dip"
- android:layout_alignParentStart="true"
- android:layout_marginStart="@dimen/status_bar_recents_app_label_left_margin"
- android:layout_toStartOf="@id/app_thumbnail"
- android:layout_marginEnd="3dip"
- android:background="@drawable/recents_callout_line"
- />
-
- <TextView android:id="@+id/app_description"
- android:layout_width="@dimen/status_bar_recents_app_label_width"
- android:layout_height="wrap_content"
- android:textSize="@dimen/status_bar_recents_app_description_text_size"
- android:fadingEdge="horizontal"
- android:fadingEdgeLength="@dimen/status_bar_recents_text_fading_edge_length"
- android:scrollHorizontally="true"
- android:layout_alignParentStart="true"
- android:layout_below="@id/recents_callout_line"
- android:layout_marginStart="@dimen/status_bar_recents_app_label_left_margin"
- android:layout_marginTop="3dip"
- android:singleLine="true"
- android:ellipsize="marquee"
- />
-
-</RelativeLayout>
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/* apps/common/assets/default/default/skins/StatusBar.xml
-**
-** Copyright 2010, The Android Open Source Project
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
--->
-
-<com.android.systemui.recent.RecentsPanelView
- xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:systemui="http://schemas.android.com/apk/res/com.android.systemui"
- android:id="@+id/recents_root"
- android:layout_height="match_parent"
- android:layout_width="wrap_content"
- android:clipToPadding="false"
- android:clipChildren="false"
- systemui:recentItemLayout="@layout/system_bar_recent_item"
- >
- <FrameLayout
- android:id="@+id/recents_bg_protect"
- android:background="@drawable/recents_bg_protect_tile"
- android:layout_width="wrap_content"
- android:layout_height="match_parent"
- android:layout_alignParentBottom="true"
- android:layout_marginBottom="@*android:dimen/system_bar_height"
- android:clipToPadding="false"
- android:clipChildren="false">
-
- <com.android.systemui.recent.RecentsVerticalScrollView android:id="@+id/recents_container"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_marginEnd="@dimen/status_bar_recents_right_glow_margin"
- android:divider="@null"
- android:stackFromBottom="true"
- android:fadingEdge="vertical"
- android:scrollbars="none"
- android:fadingEdgeLength="20dip"
- android:layout_gravity="bottom|start"
- android:clipToPadding="false"
- android:clipChildren="false"
- android:fitsSystemWindows="true">
-
- <LinearLayout android:id="@+id/recents_linear_layout"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:orientation="vertical"
- android:clipToPadding="false"
- android:clipChildren="false">
- </LinearLayout>
-
- </com.android.systemui.recent.RecentsVerticalScrollView>
-
- <include layout="@layout/system_bar_no_recent_apps"
- android:id="@+id/recents_no_apps"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:layout_marginStart="58dip"
- android:layout_marginBottom="36dip"
- android:visibility="invisible" />
-
- </FrameLayout>
-
- <com.android.systemui.recent.StatusBarTouchProxy
- android:id="@+id/status_bar_touch_proxy"
- android:layout_width="match_parent"
- android:layout_height="@*android:dimen/system_bar_height"
- android:layout_alignParentBottom="true"
- android:layout_alignParentStart="true"
- />
-
-
-</com.android.systemui.recent.RecentsPanelView>
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/* apps/common/assets/default/default/skins/StatusBar.xml
-**
-** Copyright 2011, The Android Open Source Project
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
--->
-
-<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:id="@+id/listview_footer_padding"
- android:layout_height="24dip"
- android:layout_width="match_parent">
-</FrameLayout>
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- * Copyright (C) 2010 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
--->
-
-<com.android.systemui.statusbar.tablet.SettingsView
- xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:systemui="http://schemas.android.com/apk/res/com.android.systemui"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:orientation="vertical"
- >
-
- <!-- Airplane mode -->
- <LinearLayout
- android:id="@+id/airplane"
- style="@style/SystemBarPanelSettingsRow"
- >
- <ImageView
- android:id="@+id/airplane_icon"
- style="@style/SystemBarPanelSettingsIcon"
- android:src="@drawable/ic_sysbar_airplane_on"
- />
- <TextView
- android:id="@+id/airplane_label"
- style="@style/SystemBarPanelSettingsContents"
- android:text="@string/status_bar_settings_airplane"
- />
- <Switch
- android:id="@+id/airplane_checkbox"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="center_vertical"
- android:layout_marginEnd="5dp"
- />
- </LinearLayout>
- <View style="@style/SystemBarPanelSettingsPanelSeparator" />
-
- <!-- Network -->
- <LinearLayout
- android:id="@+id/network"
- style="@style/SystemBarPanelSettingsRow"
- >
- <ImageView
- android:id="@+id/network_icon"
- style="@style/SystemBarPanelSettingsIcon"
- android:src="@drawable/ic_sysbar_wifi_on"
- />
- <TextView
- android:id="@+id/network_label"
- style="@style/SystemBarPanelSettingsContents"
- android:text="@string/status_bar_settings_wifi_button"
- />
- </LinearLayout>
- <View style="@style/SystemBarPanelSettingsPanelSeparator" />
-
- <!-- Rotation lock -->
- <LinearLayout
- android:id="@+id/rotate"
- style="@style/SystemBarPanelSettingsRow"
- >
- <ImageView
- android:id="@+id/rotate_icon"
- style="@style/SystemBarPanelSettingsIcon"
- android:src="@drawable/ic_sysbar_rotate_on"
- />
- <TextView
- android:id="@+id/rotate_label"
- style="@style/SystemBarPanelSettingsContents"
- android:text="@string/status_bar_settings_auto_rotation"
- />
- <Switch
- android:id="@+id/rotate_checkbox"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="center_vertical"
- android:layout_marginEnd="5dp"
- />
- </LinearLayout>
- <View
- android:id="@+id/rotate_separator"
- style="@style/SystemBarPanelSettingsPanelSeparator" />
-
- <!-- Brightness -->
- <LinearLayout style="@style/SystemBarPanelSettingsRow" >
- <ImageView
- android:id="@+id/brightness_icon"
- style="@style/SystemBarPanelSettingsIcon"
- android:src="@drawable/ic_sysbar_brightness"
- />
- <com.android.systemui.settings.ToggleSlider
- android:id="@+id/brightness"
- android:layout_width="0dp"
- android:layout_height="fill_parent"
- android:layout_weight="1"
- android:layout_marginEnd="2dp"
- systemui:text="@string/status_bar_settings_auto_brightness_label"
- />
- </LinearLayout>
- <View style="@style/SystemBarPanelSettingsPanelSeparator" />
-
- <!-- Notifications / Do not disturb -->
- <LinearLayout
- android:id="@+id/do_not_disturb"
- style="@style/SystemBarPanelSettingsRow"
- >
- <ImageView
- android:id="@+id/do_not_disturb_icon"
- style="@style/SystemBarPanelSettingsIcon"
- android:src="@drawable/ic_notification_open"
- />
- <TextView
- style="@style/SystemBarPanelSettingsContents"
- android:text="@string/status_bar_settings_notifications"
- />
- <Switch
- android:id="@+id/do_not_disturb_checkbox"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="center_vertical"
- android:layout_marginEnd="5dp"
- />
- </LinearLayout>
- <View style="@style/SystemBarPanelSettingsPanelSeparator" />
-
- <!-- Link to settings -->
- <LinearLayout
- android:id="@+id/settings"
- style="@style/SystemBarPanelSettingsRow"
- >
-
- <ImageView
- android:id="@+id/settings"
- style="@style/SystemBarPanelSettingsIcon"
- android:src="@drawable/ic_sysbar_quicksettings"
- />
- <TextView
- style="@style/SystemBarPanelSettingsContents"
- android:text="@string/status_bar_settings_settings_button"
- />
- </LinearLayout>
- <View style="@style/SystemBarPanelSettingsPanelSeparator" />
-
-</com.android.systemui.statusbar.tablet.SettingsView>
-
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- * Copyright (C) 2010 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
--->
-
-<LinearLayout
- xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:orientation="horizontal"
- android:gravity="bottom"
- >
-
- <ImageView
- android:id="@+id/large_icon"
- android:layout_width="@android:dimen/notification_large_icon_width"
- android:layout_height="@android:dimen/notification_large_icon_height"
- android:scaleType="center"
- android:visibility="gone"
- />
-
- <LinearLayout
- android:layout_width="wrap_content"
- android:layout_height="@*android:dimen/system_bar_height"
- android:layout_weight="1"
- android:background="@drawable/system_bar_ticker_background"
- >
-
- <ImageView android:id="@+id/left_icon"
- android:layout_width="64dp"
- android:layout_height="match_parent"
- android:scaleType="center"
- android:visibility="gone"
- />
-
- <TextView android:id="@+id/text"
- android:textAppearance="@*android:style/TextAppearance.StatusBar.Ticker"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:layout_gravity="center_vertical"
- android:layout_marginStart="12dp"
- android:gravity="center_vertical"
- android:maxLines="2"
- />
-
- <ImageView android:id="@+id/right_icon"
- android:layout_width="64dp"
- android:layout_height="match_parent"
- android:scaleType="center"
- android:visibility="gone"
- />
-
- </LinearLayout>
-
-</LinearLayout>
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- * Copyright (C) 2010 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
--->
-
-<RelativeLayout
- xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- >
-
- <View
- android:layout_height="@*android:dimen/system_bar_height"
- android:layout_width="match_parent"
- android:background="@drawable/system_bar_ticker_background"
- android:layout_alignParentStart="true"
- android:layout_alignParentBottom="true"
- android:clickable="false"
- />
-
- <ImageView
- android:id="@+id/large_icon"
- android:layout_width="@android:dimen/notification_large_icon_height"
- android:layout_height="@android:dimen/notification_large_icon_width"
- android:scaleType="center"
- android:visibility="gone"
- android:layout_alignParentStart="true"
- android:layout_alignParentBottom="true"
- />
-
- <FrameLayout
- android:id="@+id/ticker_expanded"
- android:layout_weight="1"
- android:layout_height="@*android:dimen/system_bar_height"
- android:layout_width="match_parent"
- android:layout_toEndOf="@id/large_icon"
- android:layout_alignParentBottom="true"
- android:layout_alignWithParentIfMissing="true"
- />
-</RelativeLayout>
*/
-->
<resources>
- <!-- size at which Notification icons will be drawn in the status bar -->
- <dimen name="system_bar_icon_drawing_size">24dip</dimen>
-
- <!-- opacity at which Notification icons will be drawn in the status bar -->
- <item type="dimen" name="system_bar_icon_drawing_alpha">100%</item>
-
- <!-- The width of the view containing non-menu status bar icons -->
- <dimen name="system_bar_navigation_key_width">80dip</dimen>
-
- <!-- The width of the view containing the menu status bar icon -->
- <dimen name="system_bar_navigation_menu_key_width">80dip</dimen>
<!-- ======================================== -->
<!-- The following resources were recently moved from sw600dp; there may
- be situations where they don't sync up perfectly with
- PhoneStatusBar/TabletStatusBar. -->
+ be situations where they don't sync up perfectly with PhoneStatusBar. -->
<!-- ======================================== -->
<!-- The width of the ticker, including the icon -->
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2010 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-
-<resources xmlns:android="http://schemas.android.com/apk/res/android">
-
- <style name="SystemBarNotificationText">
- <item name="android:textSize">16sp</item>
- <item name="android:textColor">#ff999999</item>
- </style>
-
- <style name="SystemBarPanelSettingsRow">
- <item name="android:paddingRight">16dp</item>
- <item name="android:layout_height">64dp</item>
- <item name="android:layout_width">match_parent</item>
- <item name="android:orientation">horizontal</item>
- <item name="android:background">?android:attr/listChoiceBackgroundIndicator</item>
- </style>
-
- <style name="SystemBarPanelSettingsIcon">
- <item name="android:layout_height">match_parent</item>
- <item name="android:layout_width">64dp</item>
- <item name="android:scaleType">center</item>
- </style>
-
- <style name="SystemBarPanelSettingsContents">
- <item name="android:layout_height">wrap_content</item>
- <item name="android:layout_width">0dp</item>
- <item name="android:layout_weight">1</item>
- <item name="android:layout_gravity">start|center_vertical</item>
- <item name="android:textColor">?android:attr/textColorPrimary</item>
- <item name="android:textSize">18sp</item>
- </style>
-
- <style name="SystemBarPanelSettingsPanelSeparator">
- <item name="android:layout_marginEnd">0dp</item>
- <item name="android:layout_width">match_parent</item>
- <item name="android:layout_height">1dp</item>
- <item name="android:background">@android:drawable/divider_horizontal_dark</item>
- </style>
-
- <style name="TextAppearance.SystemBar.Clock" parent="@*android:style/TextAppearance.StatusBar.Icon">
- <item name="android:textSize">30dp</item>
- <item name="android:textStyle">normal</item>
- <item name="android:textColor">@android:color/holo_blue_light</item>
- </style>
-
- <style name="TextAppearance.SystemBar.Expanded.Clock" parent="@style/TextAppearance.StatusBar.Expanded.Clock">
- <item name="android:textSize">48dp</item>
- <item name="android:fontFamily">sans-serif-light</item>
- <item name="android:textStyle">normal</item>
- <item name="android:textColor">#ffffff</item>
- </style>
-
- <style name="TextAppearance.SystemBar.Expanded.Date" parent="@style/TextAppearance.StatusBar.Expanded.Date">
- <item name="android:textSize">14dp</item>
- <item name="android:textStyle">normal</item>
- <item name="android:textColor">#666666</item>
- <item name="android:textAllCaps">true</item>
- </style>
-
-</resources>
<drawable name="notification_item_background_legacy_color">#ffaaaaaa</drawable>
<drawable name="intruder_bg_pressed">#ff33B5E5</drawable>
<drawable name="notification_header_bg">#FF000000</drawable>
-
- <!-- ==================== system bar only ==================== -->
- <drawable name="system_bar_background">#ff000000</drawable>
- <!-- the darkening filter applied to notifications -->
- <drawable name="notification_icon_area_smoke">#aa000000</drawable>
<color name="notification_panel_scrim_color">#B0000000</color>
</resources>
interface. This name is in the ComponentName flattened format (package/class) -->
<string name="config_statusBarComponent" translatable="false">com.android.systemui.statusbar.phone.PhoneStatusBar</string>
- <!-- Component to be used as the system bar service. Must implement the IStatusBar
- interface. This name is in the ComponentName flattened format (package/class) -->
- <string name="config_systemBarComponent" translatable="false">com.android.systemui.statusbar.tablet.TabletStatusBar</string>
-
<!-- Whether or not we show the number in the bar. -->
<bool name="config_statusBarShowNumber">false</bool>
import com.android.internal.widget.multiwaveview.GlowPadView;
import com.android.internal.widget.multiwaveview.GlowPadView.OnTriggerListener;
-import com.android.systemui.recent.StatusBarTouchProxy;
import com.android.systemui.statusbar.BaseStatusBar;
import com.android.systemui.statusbar.CommandQueue;
+import com.android.systemui.statusbar.StatusBarPanel;
import com.android.systemui.statusbar.phone.PhoneStatusBar;
-import com.android.systemui.statusbar.tablet.StatusBarPanel;
-import com.android.systemui.statusbar.tablet.TabletStatusBar;
public class SearchPanelView extends FrameLayout implements
StatusBarPanel, ActivityOptions.OnAnimationStartedListener {
private static final int SEARCH_PANEL_HOLD_DURATION = 0;
static final String TAG = "SearchPanelView";
- static final boolean DEBUG = TabletStatusBar.DEBUG || PhoneStatusBar.DEBUG || false;
+ static final boolean DEBUG = PhoneStatusBar.DEBUG || false;
public static final boolean DEBUG_GESTURES = true;
private static final String ASSIST_ICON_METADATA_NAME =
"com.android.systemui.action_assist_icon";
private final Context mContext;
private BaseStatusBar mBar;
- private StatusBarTouchProxy mStatusBarTouchProxy;
private boolean mShowing;
private View mSearchTargetsContainer;
super.onFinishInflate();
mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
mSearchTargetsContainer = findViewById(R.id.search_panel_container);
- mStatusBarTouchProxy = (StatusBarTouchProxy) findViewById(R.id.status_bar_touch_proxy);
// TODO: fetch views
mGlowPadView = (GlowPadView) findViewById(R.id.glow_pad_view);
mGlowPadView.setOnTriggerListener(mGlowPadViewListener);
}
public boolean isInContentArea(int x, int y) {
- if (pointInside(x, y, mSearchTargetsContainer)) {
- return true;
- } else if (mStatusBarTouchProxy != null &&
- pointInside(x, y, mStatusBarTouchProxy)) {
- return true;
- } else {
- return false;
- }
+ return pointInside(x, y, mSearchTargetsContainer);
}
private final OnPreDrawListener mPreDrawListener = new ViewTreeObserver.OnPreDrawListener() {
mBar = bar;
}
- public void setStatusBarView(final View statusBarView) {
- if (mStatusBarTouchProxy != null) {
- mStatusBarTouchProxy.setStatusBar(statusBarView);
-// mGlowPadView.setOnTouchListener(new OnTouchListener() {
-// public boolean onTouch(View v, MotionEvent event) {
-// return statusBarView.onTouchEvent(event);
-// }
-// });
- }
- }
-
@Override
public boolean onTouchEvent(MotionEvent event) {
if (DEBUG_GESTURES) {
import android.content.Intent;
import android.content.res.Configuration;
import android.os.IBinder;
-import android.os.RemoteException;
import android.util.Log;
-import android.view.IWindowManager;
-import android.view.WindowManagerGlobal;
+
+import java.io.FileDescriptor;
+import java.io.PrintWriter;
import java.io.FileDescriptor;
import java.io.PrintWriter;
* The class names of the stuff to start.
*/
final Object[] SERVICES = new Object[] {
- 0, // system bar or status bar, filled in below.
+ R.string.config_statusBarComponent,
com.android.systemui.power.PowerUI.class,
com.android.systemui.media.RingtonePlayer.class,
com.android.systemui.settings.SettingsUI.class,
@Override
public void onCreate() {
- // Pick status bar or system bar.
- IWindowManager wm = WindowManagerGlobal.getWindowManagerService();
- try {
- SERVICES[0] = wm.hasSystemNavBar()
- ? R.string.config_systemBarComponent
- : R.string.config_statusBarComponent;
- } catch (RemoteException e) {
- Log.w(TAG, "Failing checking whether status bar can hide", e);
- }
-
final int N = SERVICES.length;
mServices = new SystemUI[N];
for (int i=0; i<N; i++) {
import com.android.systemui.R;
import com.android.systemui.statusbar.phone.PhoneStatusBar;
-import com.android.systemui.statusbar.tablet.TabletStatusBar;
import java.util.ArrayList;
import java.util.List;
public class RecentTasksLoader implements View.OnTouchListener {
static final String TAG = "RecentTasksLoader";
- static final boolean DEBUG = TabletStatusBar.DEBUG || PhoneStatusBar.DEBUG || false;
+ static final boolean DEBUG = PhoneStatusBar.DEBUG || false;
private static final int DISPLAY_TASKS = 20;
private static final int MAX_TASKS = DISPLAY_TASKS + 1; // allow extra for non-apps
import android.view.WindowManager;
import com.android.systemui.R;
-import com.android.systemui.statusbar.tablet.StatusBarPanel;
+import com.android.systemui.statusbar.StatusBarPanel;
import java.util.List;
import com.android.systemui.R;
import com.android.systemui.statusbar.BaseStatusBar;
+import com.android.systemui.statusbar.StatusBarPanel;
import com.android.systemui.statusbar.phone.PhoneStatusBar;
-import com.android.systemui.statusbar.tablet.StatusBarPanel;
-import com.android.systemui.statusbar.tablet.TabletStatusBar;
import java.util.ArrayList;
public class RecentsPanelView extends FrameLayout implements OnItemClickListener, RecentsCallback,
StatusBarPanel, Animator.AnimatorListener {
static final String TAG = "RecentsPanelView";
- static final boolean DEBUG = TabletStatusBar.DEBUG || PhoneStatusBar.DEBUG || false;
+ static final boolean DEBUG = PhoneStatusBar.DEBUG || false;
private PopupMenu mPopup;
private View mRecentsScrim;
private View mRecentsNoApps;
private ViewGroup mRecentsContainer;
- private StatusBarTouchProxy mStatusBarTouchProxy;
private boolean mShowing;
private boolean mWaitingToShow;
}
public boolean isInContentArea(int x, int y) {
- if (pointInside(x, y, mRecentsContainer)) {
- return true;
- } else if (mStatusBarTouchProxy != null &&
- pointInside(x, y, mStatusBarTouchProxy)) {
- return true;
- } else {
- return false;
- }
+ return pointInside(x, y, mRecentsContainer);
}
public void show(boolean show) {
return mShowing;
}
- public void setStatusBarView(View statusBarView) {
- if (mStatusBarTouchProxy != null) {
- mStatusBarTouchProxy.setStatusBar(statusBarView);
- }
- }
-
public void setRecentTasksLoader(RecentTasksLoader loader) {
mRecentTasksLoader = loader;
}
super.onFinishInflate();
mRecentsContainer = (ViewGroup) findViewById(R.id.recents_container);
- mStatusBarTouchProxy = (StatusBarTouchProxy) findViewById(R.id.status_bar_touch_proxy);
mListAdapter = new TaskDescriptionAdapter(mContext);
if (mRecentsContainer instanceof RecentsScrollView){
RecentsScrollView scrollView
+++ /dev/null
-/*
- * Copyright (C) 2011 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.systemui.recent;
-
-import android.content.Context;
-import android.util.AttributeSet;
-import android.view.MotionEvent;
-import android.view.View;
-import android.widget.FrameLayout;
-
-public class StatusBarTouchProxy extends FrameLayout {
-
- private View mStatusBar;
-
- public StatusBarTouchProxy(Context context, AttributeSet attrs) {
- super(context, attrs);
- }
-
- public void setStatusBar(View statusBar) {
- mStatusBar = statusBar;
- }
-
- public boolean onTouchEvent (MotionEvent event) {
- return mStatusBar.dispatchTouchEvent(event);
- }
-}
import com.android.systemui.recent.RecentsActivity;
import com.android.systemui.recent.TaskDescription;
import com.android.systemui.statusbar.policy.NotificationRowLayout;
-import com.android.systemui.statusbar.tablet.StatusBarPanel;
import java.util.ArrayList;
import java.util.Locale;
mDisplay.getMetrics(dm);
// calculate it here, but consider moving it elsewhere
// first, determine which orientation you're in.
- // todo: move the system_bar layouts to sw600dp ?
final Configuration config = res.getConfiguration();
int x, y;
* limitations under the License.
*/
-package com.android.systemui.statusbar.tablet;
+package com.android.systemui.statusbar;
public interface StatusBarPanel {
public boolean isInContentArea(int x, int y);
@Override
protected void updateSearchPanel() {
super.updateSearchPanel();
- mSearchPanelView.setStatusBarView(mNavigationBarView);
mNavigationBarView.setDelegateView(mSearchPanelView);
}
+++ /dev/null
-/*
- * Copyright (C) 2011 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.systemui.statusbar.tablet;
-
-import android.app.ActivityManager;
-import android.content.Context;
-import android.util.AttributeSet;
-import android.view.MotionEvent;
-import android.view.View;
-import android.widget.FrameLayout;
-import android.widget.RadioButton;
-
-import com.android.systemui.R;
-
-public class CompatModePanel extends FrameLayout implements StatusBarPanel,
- View.OnClickListener {
- private static final boolean DEBUG = TabletStatusBar.DEBUG;
- private static final String TAG = "CompatModePanel";
-
- private ActivityManager mAM;
-
- private boolean mAttached = false;
- private Context mContext;
- private RadioButton mOnButton, mOffButton;
-
- private View mTrigger;
-// private InputMethodButton mInputMethodSwitchButton;
-
- public CompatModePanel(Context context, AttributeSet attrs) {
- super(context, attrs);
- mContext = context;
- mAM = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
- }
-
- @Override
- public void onFinishInflate() {
- mOnButton = (RadioButton) findViewById(R.id.compat_mode_on_radio);
- mOffButton = (RadioButton) findViewById(R.id.compat_mode_off_radio);
- mOnButton.setOnClickListener(this);
- mOffButton.setOnClickListener(this);
-
- refresh();
- }
-
- @Override
- protected void onDetachedFromWindow() {
- super.onDetachedFromWindow();
- if (mAttached) {
- mAttached = false;
- }
- }
-
- @Override
- protected void onAttachedToWindow() {
- super.onAttachedToWindow();
- if (!mAttached) {
- mAttached = true;
- }
- }
-
- @Override
- public void onClick(View v) {
- if (v == mOnButton) {
- mAM.setFrontActivityScreenCompatMode(ActivityManager.COMPAT_MODE_ENABLED);
- } else if (v == mOffButton) {
- mAM.setFrontActivityScreenCompatMode(ActivityManager.COMPAT_MODE_DISABLED);
- }
- }
-
- @Override
- public boolean isInContentArea(int x, int y) {
- return false;
- }
-
- @Override
- public boolean dispatchHoverEvent(MotionEvent event) {
- // Ignore hover events outside of this panel bounds since such events
- // generate spurious accessibility events with the panel content when
- // tapping outside of it, thus confusing the user.
- final int x = (int) event.getX();
- final int y = (int) event.getY();
- if (x >= 0 && x < getWidth() && y >= 0 && y < getHeight()) {
- return super.dispatchHoverEvent(event);
- }
- return true;
- }
-
- public void setTrigger(View v) {
- mTrigger = v;
- }
-
- public void openPanel() {
- setVisibility(View.VISIBLE);
- if (mTrigger != null) mTrigger.setSelected(true);
- refresh();
- }
-
- public void closePanel() {
- setVisibility(View.GONE);
- if (mTrigger != null) mTrigger.setSelected(false);
- }
-
- private void refresh() {
- int mode = mAM.getFrontActivityScreenCompatMode();
- if (mode == ActivityManager.COMPAT_MODE_ALWAYS
- || mode == ActivityManager.COMPAT_MODE_NEVER) {
- // No longer have something to switch.
- closePanel();
- return;
- }
- final boolean on = (mode == ActivityManager.COMPAT_MODE_ENABLED);
- mOnButton.setChecked(on);
- mOffButton.setChecked(!on);
- }
-}
+++ /dev/null
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.systemui.statusbar.tablet;
-
-import android.content.Context;
-import android.os.IBinder;
-import android.provider.Settings;
-import android.util.AttributeSet;
-import android.view.View;
-import android.view.inputmethod.InputMethodInfo;
-import android.view.inputmethod.InputMethodManager;
-import android.view.inputmethod.InputMethodSubtype;
-import android.widget.ImageView;
-
-import com.android.systemui.R;
-
-import java.util.List;
-
-public class InputMethodButton extends ImageView {
-
- private static final String TAG = "StatusBar/InputMethodButton";
- private static final boolean DEBUG = false;
-
- // These values are defined in Settings application.
- private static final int ID_IME_BUTTON_VISIBILITY_AUTO = 0;
- private static final int ID_IME_BUTTON_VISIBILITY_ALWAYS_SHOW = 1;
- private static final int ID_IME_BUTTON_VISIBILITY_ALWAYS_HIDE = 2;
-
- // other services we wish to talk to
- private final InputMethodManager mImm;
- private final int mId;
- private ImageView mIcon;
- private IBinder mToken;
- private boolean mShowButton = false;
- private boolean mScreenLocked = false;
- private boolean mHardKeyboardAvailable;
-
- // Please refer to InputMethodManagerService.TAG_TRY_SUPPRESSING_IME_SWITCHER
- private static final String TAG_TRY_SUPPRESSING_IME_SWITCHER = "TrySuppressingImeSwitcher";
-
- public InputMethodButton(Context context, AttributeSet attrs) {
- super(context, attrs);
-
- // Resource Id of the input method button. This id is defined in status_bar.xml
- mId = getId();
- // IME hookup
- mImm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
- }
-
- @Override
- protected void onAttachedToWindow() {
- mIcon = (ImageView) findViewById(mId);
-
- refreshStatusIcon();
- }
-
- // Refer to InputMethodManagerService.needsToShowImeSwitchOngoingNotification()
- private boolean needsToShowIMEButtonWhenVisibilityAuto() {
- List<InputMethodInfo> imis = mImm.getEnabledInputMethodList();
- final int N = imis.size();
- if (N > 2) return true;
- if (N < 1) return false;
- int nonAuxCount = 0;
- int auxCount = 0;
- InputMethodSubtype nonAuxSubtype = null;
- InputMethodSubtype auxSubtype = null;
- for(int i = 0; i < N; ++i) {
- final InputMethodInfo imi = imis.get(i);
- final List<InputMethodSubtype> subtypes = mImm.getEnabledInputMethodSubtypeList(
- imi, true);
- final int subtypeCount = subtypes.size();
- if (subtypeCount == 0) {
- ++nonAuxCount;
- } else {
- for (int j = 0; j < subtypeCount; ++j) {
- final InputMethodSubtype subtype = subtypes.get(j);
- if (!subtype.isAuxiliary()) {
- ++nonAuxCount;
- nonAuxSubtype = subtype;
- } else {
- ++auxCount;
- auxSubtype = subtype;
- }
- }
- }
- }
- if (nonAuxCount > 1 || auxCount > 1) {
- return true;
- } else if (nonAuxCount == 1 && auxCount == 1) {
- if (nonAuxSubtype != null && auxSubtype != null
- && (nonAuxSubtype.getLocale().equals(auxSubtype.getLocale())
- || auxSubtype.overridesImplicitlyEnabledSubtype()
- || nonAuxSubtype.overridesImplicitlyEnabledSubtype())
- && nonAuxSubtype.containsExtraValueKey(TAG_TRY_SUPPRESSING_IME_SWITCHER)) {
- return false;
- }
- return true;
- }
- return false;
- }
-
- private boolean needsToShowIMEButton() {
- if (!mShowButton || mScreenLocked) return false;
-
- if (mHardKeyboardAvailable) {
- return true;
- }
-
- final int visibility = loadInputMethodSelectorVisibility();
- switch (visibility) {
- case ID_IME_BUTTON_VISIBILITY_AUTO:
- return needsToShowIMEButtonWhenVisibilityAuto();
- case ID_IME_BUTTON_VISIBILITY_ALWAYS_SHOW:
- return true;
- case ID_IME_BUTTON_VISIBILITY_ALWAYS_HIDE:
- return false;
- }
- return false;
- }
-
- private void refreshStatusIcon() {
- if (mIcon == null) {
- return;
- }
- if (!needsToShowIMEButton()) {
- setVisibility(View.GONE);
- return;
- } else {
- setVisibility(View.VISIBLE);
- }
- mIcon.setImageResource(R.drawable.ic_sysbar_ime);
- }
-
- private int loadInputMethodSelectorVisibility() {
- return Settings.Secure.getInt(getContext().getContentResolver(),
- Settings.Secure.INPUT_METHOD_SELECTOR_VISIBILITY, ID_IME_BUTTON_VISIBILITY_AUTO);
- }
-
- public void setIconImage(int resId) {
- if (mIcon != null) {
- mIcon.setImageResource(resId);
- }
- }
-
- public void setImeWindowStatus(IBinder token, boolean showButton) {
- mToken = token;
- mShowButton = showButton;
- refreshStatusIcon();
- }
-
- public void setHardKeyboardStatus(boolean available) {
- if (mHardKeyboardAvailable != available) {
- mHardKeyboardAvailable = available;
- refreshStatusIcon();
- }
- }
-
- public void setScreenLocked(boolean locked) {
- mScreenLocked = locked;
- refreshStatusIcon();
- }
-}
+++ /dev/null
-/*
- * Copyright (C) 2011 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.systemui.statusbar.tablet;
-
-import android.content.BroadcastReceiver;
-import android.content.Context;
-import android.content.Intent;
-import android.content.IntentFilter;
-import android.content.pm.PackageManager;
-import android.graphics.drawable.Drawable;
-import android.os.IBinder;
-import android.provider.Settings;
-import android.text.TextUtils;
-import android.util.AttributeSet;
-import android.util.Log;
-import android.util.Pair;
-import android.view.MotionEvent;
-import android.view.View;
-import android.view.inputmethod.InputMethodInfo;
-import android.view.inputmethod.InputMethodManager;
-import android.view.inputmethod.InputMethodSubtype;
-import android.widget.ImageView;
-import android.widget.LinearLayout;
-import android.widget.RadioButton;
-import android.widget.Switch;
-import android.widget.TextView;
-
-import com.android.systemui.R;
-
-import java.util.Comparator;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.TreeMap;
-
-public class InputMethodsPanel extends LinearLayout implements StatusBarPanel,
- View.OnClickListener {
- private static final boolean DEBUG = TabletStatusBar.DEBUG;
- private static final String TAG = "InputMethodsPanel";
-
- private final BroadcastReceiver mBroadcastReceiver = new BroadcastReceiver() {
- @Override
- public void onReceive(Context context, Intent intent) {
- onPackageChanged();
- }
- };
-
- private final InputMethodManager mImm;
- private final IntentFilter mIntentFilter = new IntentFilter();
- private final HashMap<View, Pair<InputMethodInfo, InputMethodSubtype>> mRadioViewAndImiMap =
- new HashMap<View, Pair<InputMethodInfo, InputMethodSubtype>>();
- private final TreeMap<InputMethodInfo, List<InputMethodSubtype>>
- mEnabledInputMethodAndSubtypesCache =
- new TreeMap<InputMethodInfo, List<InputMethodSubtype>>(
- new InputMethodComparator());
-
- private boolean mAttached = false;
- private boolean mPackageChanged = false;
- private Context mContext;
- private IBinder mToken;
- private InputMethodButton mInputMethodSwitchButton;
- private LinearLayout mInputMethodMenuList;
- private boolean mHardKeyboardAvailable;
- private boolean mHardKeyboardEnabled;
- private OnHardKeyboardEnabledChangeListener mHardKeyboardEnabledChangeListener;
- private LinearLayout mHardKeyboardSection;
- private Switch mHardKeyboardSwitch;
- private PackageManager mPackageManager;
- private String mEnabledInputMethodAndSubtypesCacheStr;
- private String mLastSystemLocaleString;
- private View mConfigureImeShortcut;
-
- private class InputMethodComparator implements Comparator<InputMethodInfo> {
- @Override
- public int compare(InputMethodInfo imi1, InputMethodInfo imi2) {
- if (imi2 == null) return 0;
- if (imi1 == null) return 1;
- if (mPackageManager == null) {
- return imi1.getId().compareTo(imi2.getId());
- }
- CharSequence imiId1 = imi1.loadLabel(mPackageManager) + "/" + imi1.getId();
- CharSequence imiId2 = imi2.loadLabel(mPackageManager) + "/" + imi2.getId();
- return imiId1.toString().compareTo(imiId2.toString());
- }
- }
-
- public InputMethodsPanel(Context context, AttributeSet attrs) {
- this(context, attrs, 0);
- }
-
- public InputMethodsPanel(Context context, AttributeSet attrs, int defStyle) {
- super(context, attrs, defStyle);
- mContext = context;
- mImm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
- mIntentFilter.addAction(Intent.ACTION_PACKAGE_REPLACED);
- mIntentFilter.addAction(Intent.ACTION_PACKAGE_ADDED);
- mIntentFilter.addAction(Intent.ACTION_PACKAGE_REMOVED);
- mIntentFilter.addDataScheme("package");
- }
-
- public void setHardKeyboardEnabledChangeListener(
- OnHardKeyboardEnabledChangeListener listener) {
- mHardKeyboardEnabledChangeListener = listener;
- }
-
- @Override
- protected void onDetachedFromWindow() {
- super.onDetachedFromWindow();
- if (mAttached) {
- getContext().unregisterReceiver(mBroadcastReceiver);
- mAttached = false;
- }
- }
-
- @Override
- protected void onAttachedToWindow() {
- super.onAttachedToWindow();
- if (!mAttached) {
- getContext().registerReceiver(mBroadcastReceiver, mIntentFilter);
- mAttached = true;
- }
- }
-
- @Override
- public void onFinishInflate() {
- mInputMethodMenuList = (LinearLayout) findViewById(R.id.input_method_menu_list);
- mHardKeyboardSection = (LinearLayout) findViewById(R.id.hard_keyboard_section);
- mHardKeyboardSwitch = (Switch) findViewById(R.id.hard_keyboard_switch);
- mConfigureImeShortcut = findViewById(R.id.ime_settings_shortcut);
- mConfigureImeShortcut.setOnClickListener(this);
- // TODO: If configurations for IME are not changed, do not update
- // by checking onConfigurationChanged.
- updateUiElements();
- }
-
- @Override
- public boolean isInContentArea(int x, int y) {
- return false;
- }
-
- @Override
- public void onClick(View view) {
- if (view == mConfigureImeShortcut) {
- showConfigureInputMethods();
- closePanel(true);
- }
- }
-
- @Override
- public boolean dispatchHoverEvent(MotionEvent event) {
- // Ignore hover events outside of this panel bounds since such events
- // generate spurious accessibility events with the panel content when
- // tapping outside of it, thus confusing the user.
- final int x = (int) event.getX();
- final int y = (int) event.getY();
- if (x >= 0 && x < getWidth() && y >= 0 && y < getHeight()) {
- return super.dispatchHoverEvent(event);
- }
- return true;
- }
-
- private void updateHardKeyboardEnabled() {
- if (mHardKeyboardAvailable) {
- final boolean checked = mHardKeyboardSwitch.isChecked();
- if (mHardKeyboardEnabled != checked) {
- mHardKeyboardEnabled = checked;
- if (mHardKeyboardEnabledChangeListener != null)
- mHardKeyboardEnabledChangeListener.onHardKeyboardEnabledChange(checked);
- }
- }
- }
-
- public void openPanel() {
- setVisibility(View.VISIBLE);
- updateUiElements();
- if (mInputMethodSwitchButton != null) {
- mInputMethodSwitchButton.setIconImage(R.drawable.ic_sysbar_ime_pressed);
- }
- }
-
- public void closePanel(boolean closeKeyboard) {
- setVisibility(View.GONE);
- if (mInputMethodSwitchButton != null) {
- mInputMethodSwitchButton.setIconImage(R.drawable.ic_sysbar_ime);
- }
- if (closeKeyboard) {
- mImm.hideSoftInputFromWindow(getWindowToken(), 0);
- }
- }
-
- private void startActivity(Intent intent) {
- mContext.startActivity(intent);
- }
-
- private void showConfigureInputMethods() {
- Intent intent = new Intent(Settings.ACTION_INPUT_METHOD_SETTINGS);
- intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK
- | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED
- | Intent.FLAG_ACTIVITY_CLEAR_TOP);
- startActivity(intent);
- }
-
- private View createInputMethodItem(
- final InputMethodInfo imi, final InputMethodSubtype subtype) {
- final CharSequence subtypeName;
- if (subtype == null || subtype.overridesImplicitlyEnabledSubtype()) {
- subtypeName = null;
- } else {
- subtypeName = getSubtypeName(imi, subtype);
- }
- final CharSequence imiName = getIMIName(imi);
- final Drawable icon = getSubtypeIcon(imi, subtype);
- final View view = View.inflate(mContext, R.layout.system_bar_input_methods_item, null);
- final ImageView subtypeIcon = (ImageView)view.findViewById(R.id.item_icon);
- final TextView itemTitle = (TextView)view.findViewById(R.id.item_title);
- final TextView itemSubtitle = (TextView)view.findViewById(R.id.item_subtitle);
- final ImageView settingsIcon = (ImageView)view.findViewById(R.id.item_settings_icon);
- final View subtypeView = view.findViewById(R.id.item_subtype);
- if (subtypeName == null) {
- itemTitle.setText(imiName);
- itemSubtitle.setVisibility(View.GONE);
- } else {
- itemTitle.setText(subtypeName);
- itemSubtitle.setVisibility(View.VISIBLE);
- itemSubtitle.setText(imiName);
- }
- subtypeIcon.setImageDrawable(icon);
- subtypeIcon.setContentDescription(itemTitle.getText());
- final String settingsActivity = imi.getSettingsActivity();
- if (!TextUtils.isEmpty(settingsActivity)) {
- settingsIcon.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View arg0) {
- Intent intent = new Intent(Intent.ACTION_MAIN);
- intent.setClassName(imi.getPackageName(), settingsActivity);
- intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK
- | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED
- | Intent.FLAG_ACTIVITY_CLEAR_TOP);
- startActivity(intent);
- closePanel(true);
- }
- });
- } else {
- // Do not show the settings icon if the IME does not have a settings preference
- view.findViewById(R.id.item_vertical_separator).setVisibility(View.GONE);
- settingsIcon.setVisibility(View.GONE);
- }
- mRadioViewAndImiMap.put(
- subtypeView, new Pair<InputMethodInfo, InputMethodSubtype> (imi, subtype));
- subtypeView.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- Pair<InputMethodInfo, InputMethodSubtype> imiAndSubtype =
- updateRadioButtonsByView(v);
- closePanel(false);
- setInputMethodAndSubtype(imiAndSubtype.first, imiAndSubtype.second);
- }
- });
- return view;
- }
-
- private void updateUiElements() {
- updateHardKeyboardSection();
-
- // TODO: Reuse subtype views.
- mInputMethodMenuList.removeAllViews();
- mRadioViewAndImiMap.clear();
- mPackageManager = mContext.getPackageManager();
-
- Map<InputMethodInfo, List<InputMethodSubtype>> enabledIMIs =
- getEnabledInputMethodAndSubtypeList();
- Set<InputMethodInfo> cachedImiSet = enabledIMIs.keySet();
- for (InputMethodInfo imi: cachedImiSet) {
- List<InputMethodSubtype> subtypes = enabledIMIs.get(imi);
- if (subtypes == null || subtypes.size() == 0) {
- mInputMethodMenuList.addView(
- createInputMethodItem(imi, null));
- continue;
- }
- for (InputMethodSubtype subtype: subtypes) {
- mInputMethodMenuList.addView(createInputMethodItem(imi, subtype));
- }
- }
- updateRadioButtons();
- }
-
- public void setImeToken(IBinder token) {
- mToken = token;
- }
-
- public void setImeSwitchButton(InputMethodButton imb) {
- mInputMethodSwitchButton = imb;
- }
-
- private void setInputMethodAndSubtype(InputMethodInfo imi, InputMethodSubtype subtype) {
- if (mToken != null) {
- mImm.setInputMethodAndSubtype(mToken, imi.getId(), subtype);
- } else {
- Log.w(TAG, "IME Token is not set yet.");
- }
- }
-
- public void setHardKeyboardStatus(boolean available, boolean enabled) {
- if (mHardKeyboardAvailable != available || mHardKeyboardEnabled != enabled) {
- mHardKeyboardAvailable = available;
- mHardKeyboardEnabled = enabled;
- updateHardKeyboardSection();
- }
- }
-
- private void updateHardKeyboardSection() {
- if (mHardKeyboardAvailable) {
- mHardKeyboardSection.setVisibility(View.VISIBLE);
- if (mHardKeyboardSwitch.isChecked() != mHardKeyboardEnabled) {
- mHardKeyboardSwitch.setChecked(mHardKeyboardEnabled);
- updateHardKeyboardEnabled();
- }
- } else {
- mHardKeyboardSection.setVisibility(View.GONE);
- }
- }
-
- // Turn on the selected radio button when the user chooses the item
- private Pair<InputMethodInfo, InputMethodSubtype> updateRadioButtonsByView(View selectedView) {
- Pair<InputMethodInfo, InputMethodSubtype> selectedImiAndSubtype = null;
- if (mRadioViewAndImiMap.containsKey(selectedView)) {
- for (View radioView: mRadioViewAndImiMap.keySet()) {
- RadioButton subtypeRadioButton =
- (RadioButton) radioView.findViewById(R.id.item_radio);
- if (subtypeRadioButton == null) {
- Log.w(TAG, "RadioButton was not found in the selected subtype view");
- return null;
- }
- if (radioView == selectedView) {
- Pair<InputMethodInfo, InputMethodSubtype> imiAndSubtype =
- mRadioViewAndImiMap.get(radioView);
- selectedImiAndSubtype = imiAndSubtype;
- subtypeRadioButton.setChecked(true);
- } else {
- subtypeRadioButton.setChecked(false);
- }
- }
- }
- return selectedImiAndSubtype;
- }
-
- private void updateRadioButtons() {
- updateRadioButtonsByImiAndSubtype(
- getCurrentInputMethodInfo(), mImm.getCurrentInputMethodSubtype());
- }
-
- // Turn on the selected radio button at startup
- private void updateRadioButtonsByImiAndSubtype(
- InputMethodInfo imi, InputMethodSubtype subtype) {
- if (imi == null) return;
- if (DEBUG) {
- Log.d(TAG, "Update radio buttons by " + imi.getId() + ", " + subtype);
- }
- for (View radioView: mRadioViewAndImiMap.keySet()) {
- RadioButton subtypeRadioButton =
- (RadioButton) radioView.findViewById(R.id.item_radio);
- if (subtypeRadioButton == null) {
- Log.w(TAG, "RadioButton was not found in the selected subtype view");
- return;
- }
- Pair<InputMethodInfo, InputMethodSubtype> imiAndSubtype =
- mRadioViewAndImiMap.get(radioView);
- if (imiAndSubtype.first.getId().equals(imi.getId())
- && (imiAndSubtype.second == null || imiAndSubtype.second.equals(subtype))) {
- subtypeRadioButton.setChecked(true);
- } else {
- subtypeRadioButton.setChecked(false);
- }
- }
- }
-
- private TreeMap<InputMethodInfo, List<InputMethodSubtype>>
- getEnabledInputMethodAndSubtypeList() {
- String newEnabledIMIs = Settings.Secure.getString(
- mContext.getContentResolver(), Settings.Secure.ENABLED_INPUT_METHODS);
- String currentSystemLocaleString =
- mContext.getResources().getConfiguration().locale.toString();
- if (!TextUtils.equals(mEnabledInputMethodAndSubtypesCacheStr, newEnabledIMIs)
- || !TextUtils.equals(mLastSystemLocaleString, currentSystemLocaleString)
- || mPackageChanged) {
- mEnabledInputMethodAndSubtypesCache.clear();
- final List<InputMethodInfo> imis = mImm.getEnabledInputMethodList();
- for (InputMethodInfo imi: imis) {
- mEnabledInputMethodAndSubtypesCache.put(imi,
- mImm.getEnabledInputMethodSubtypeList(imi, true));
- }
- mEnabledInputMethodAndSubtypesCacheStr = newEnabledIMIs;
- mPackageChanged = false;
- mLastSystemLocaleString = currentSystemLocaleString;
- }
- return mEnabledInputMethodAndSubtypesCache;
- }
-
- private InputMethodInfo getCurrentInputMethodInfo() {
- String curInputMethodId = Settings.Secure.getString(getContext()
- .getContentResolver(), Settings.Secure.DEFAULT_INPUT_METHOD);
- Set<InputMethodInfo> cachedImiSet = mEnabledInputMethodAndSubtypesCache.keySet();
- // 1. Search IMI in cache
- for (InputMethodInfo imi: cachedImiSet) {
- if (imi.getId().equals(curInputMethodId)) {
- return imi;
- }
- }
- // 2. Get current enabled IMEs and search IMI
- cachedImiSet = getEnabledInputMethodAndSubtypeList().keySet();
- for (InputMethodInfo imi: cachedImiSet) {
- if (imi.getId().equals(curInputMethodId)) {
- return imi;
- }
- }
- return null;
- }
-
- private CharSequence getIMIName(InputMethodInfo imi) {
- if (imi == null) return null;
- return imi.loadLabel(mPackageManager);
- }
-
- private CharSequence getSubtypeName(InputMethodInfo imi, InputMethodSubtype subtype) {
- if (imi == null || subtype == null) return null;
- if (DEBUG) {
- Log.d(TAG, "Get text from: " + imi.getPackageName() + subtype.getNameResId()
- + imi.getServiceInfo().applicationInfo);
- }
- return subtype.getDisplayName(
- mContext, imi.getPackageName(), imi.getServiceInfo().applicationInfo);
- }
-
- private Drawable getSubtypeIcon(InputMethodInfo imi, InputMethodSubtype subtype) {
- if (imi != null) {
- if (DEBUG) {
- Log.d(TAG, "Update icons of IME: " + imi.getPackageName());
- if (subtype != null) {
- Log.d(TAG, "subtype =" + subtype.getLocale() + "," + subtype.getMode());
- }
- }
- if (subtype != null) {
- return mPackageManager.getDrawable(imi.getPackageName(), subtype.getIconResId(),
- imi.getServiceInfo().applicationInfo);
- } else if (imi.getSubtypeCount() > 0) {
- return mPackageManager.getDrawable(imi.getPackageName(),
- imi.getSubtypeAt(0).getIconResId(),
- imi.getServiceInfo().applicationInfo);
- } else {
- try {
- return mPackageManager.getApplicationInfo(
- imi.getPackageName(), 0).loadIcon(mPackageManager);
- } catch (PackageManager.NameNotFoundException e) {
- Log.w(TAG, "IME can't be found: " + imi.getPackageName());
- }
- }
- }
- return null;
- }
-
- private void onPackageChanged() {
- if (DEBUG) {
- Log.d(TAG, "onPackageChanged.");
- }
- mPackageChanged = true;
- }
-
- public interface OnHardKeyboardEnabledChangeListener {
- public void onHardKeyboardEnabledChange(boolean enabled);
- }
-
-}
+++ /dev/null
-/*
- * Copyright (C) 2011 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.systemui.statusbar.tablet;
-
-import android.content.Context;
-import android.util.AttributeSet;
-import android.view.View;
-import android.view.accessibility.AccessibilityEvent;
-import android.widget.LinearLayout;
-
-public class NotificationArea extends LinearLayout {
-
- public NotificationArea(Context context, AttributeSet attrs) {
- super(context, attrs);
- }
-
- @Override
- public boolean onRequestSendAccessibilityEvent(View child, AccessibilityEvent event) {
- if (super.onRequestSendAccessibilityEvent(child, event)) {
- // The event is coming from a descendant like battery but append
- // the content of the entire notification area so accessibility
- // services can choose how to present the content to the user.
- AccessibilityEvent record = AccessibilityEvent.obtain();
- onInitializeAccessibilityEvent(record);
- dispatchPopulateAccessibilityEvent(record);
- event.appendRecord(record);
- return true;
- }
- return false;
- }
-}
+++ /dev/null
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.systemui.statusbar.tablet;
-
-import android.content.Context;
-import android.util.AttributeSet;
-import android.view.MotionEvent;
-import android.widget.LinearLayout;
-import android.widget.RelativeLayout;
-
-import com.android.systemui.R;
-
-
-public class NotificationIconArea extends RelativeLayout {
- private static final String TAG = "NotificationIconArea";
-
- IconLayout mIconLayout;
-
- public NotificationIconArea(Context context, AttributeSet attrs) {
- super(context, attrs);
-
- mIconLayout = (IconLayout)findViewById(R.id.icons);
- }
-
- static class IconLayout extends LinearLayout {
- public IconLayout(Context context, AttributeSet attrs) {
- super(context, attrs);
- }
-
- public boolean onInterceptTouchEvent(MotionEvent e) {
- return true;
- }
- }
-}
-
-
-
+++ /dev/null
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.systemui.statusbar.tablet;
-
-import android.content.Context;
-import android.content.res.Resources;
-import android.content.res.TypedArray;
-import android.graphics.Canvas;
-import android.graphics.Rect;
-import android.graphics.drawable.Drawable;
-import android.util.AttributeSet;
-import android.view.View;
-import android.widget.LinearLayout;
-
-import com.android.systemui.R;
-
-public class NotificationLinearLayout extends LinearLayout {
- private static final String TAG = "NotificationLinearLayout";
-
- Drawable mItemGlow;
- int mInsetLeft;
- Rect mTmp = new Rect();
-
- public NotificationLinearLayout(Context context, AttributeSet attrs) {
- this(context, attrs, 0);
- }
-
- public NotificationLinearLayout(Context context, AttributeSet attrs, int defStyle) {
- super(context, attrs, defStyle);
-
- final Resources res = context.getResources();
-
- mItemGlow = res.getDrawable(R.drawable.notify_item_glow_bottom);
-
- TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.NotificationLinearLayout,
- defStyle, 0);
- mInsetLeft = a.getDimensionPixelSize(R.styleable.NotificationLinearLayout_insetLeft, 0);
- a.recycle();
- }
-
- @Override
- public void onFinishInflate() {
- super.onFinishInflate();
- setWillNotDraw(false);
- }
-
- @Override
- public void onDraw(Canvas canvas) {
- super.onDraw(canvas);
-
- final Rect padding = mTmp;
- final Drawable glow = mItemGlow;
- glow.getPadding(padding);
- final int glowHeight = glow.getIntrinsicHeight();
- final int insetLeft = mInsetLeft;
-
- final int N = getChildCount();
- for (int i=0; i<N; i++) {
- final View child = getChildAt(i);
-
- final int childBottom = child.getBottom();
-
- glow.setBounds(child.getLeft() - padding.left + insetLeft, childBottom,
- child.getRight() - padding.right, childBottom + glowHeight);
- glow.draw(canvas);
- }
- }
-}
+++ /dev/null
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.systemui.statusbar.tablet;
-
-import android.animation.Animator;
-import android.animation.AnimatorListenerAdapter;
-import android.animation.AnimatorSet;
-import android.animation.ObjectAnimator;
-import android.content.Context;
-import android.graphics.Rect;
-import android.util.AttributeSet;
-import android.util.Log;
-import android.view.Gravity;
-import android.view.KeyEvent;
-import android.view.LayoutInflater;
-import android.view.MotionEvent;
-import android.view.View;
-import android.view.ViewGroup;
-import android.view.ViewTreeObserver;
-import android.view.animation.AccelerateInterpolator;
-import android.view.animation.DecelerateInterpolator;
-import android.view.animation.Interpolator;
-import android.widget.ImageView;
-import android.widget.RelativeLayout;
-
-import com.android.systemui.ExpandHelper;
-import com.android.systemui.R;
-import com.android.systemui.statusbar.policy.NotificationRowLayout;
-
-public class NotificationPanel extends RelativeLayout implements StatusBarPanel,
- View.OnClickListener {
- private ExpandHelper mExpandHelper;
- private NotificationRowLayout latestItems;
-
- static final String TAG = "Tablet/NotificationPanel";
- static final boolean DEBUG = false;
-
- final static int PANEL_FADE_DURATION = 150;
-
- boolean mShowing;
- boolean mHasClearableNotifications = false;
- int mNotificationCount = 0;
- NotificationPanelTitle mTitleArea;
- ImageView mSettingsButton;
- ImageView mNotificationButton;
- View mNotificationScroller;
- ViewGroup mContentFrame;
- Rect mContentArea = new Rect();
- View mSettingsView;
- ViewGroup mContentParent;
- TabletStatusBar mBar;
- View mClearButton;
- static Interpolator sAccelerateInterpolator = new AccelerateInterpolator();
- static Interpolator sDecelerateInterpolator = new DecelerateInterpolator();
-
- // amount to slide mContentParent down by when mContentFrame is missing
- float mContentFrameMissingTranslation;
-
- Choreographer mChoreo = new Choreographer();
-
- public NotificationPanel(Context context, AttributeSet attrs) {
- this(context, attrs, 0);
- }
-
- public NotificationPanel(Context context, AttributeSet attrs, int defStyle) {
- super(context, attrs, defStyle);
- }
-
- public void setBar(TabletStatusBar b) {
- mBar = b;
- }
-
- @Override
- public void onFinishInflate() {
- super.onFinishInflate();
-
- setWillNotDraw(false);
-
- mContentParent = (ViewGroup)findViewById(R.id.content_parent);
- mContentParent.bringToFront();
- mTitleArea = (NotificationPanelTitle) findViewById(R.id.title_area);
- mTitleArea.setPanel(this);
-
- mSettingsButton = (ImageView) findViewById(R.id.settings_button);
- mNotificationButton = (ImageView) findViewById(R.id.notification_button);
-
- mNotificationScroller = findViewById(R.id.notification_scroller);
- mContentFrame = (ViewGroup)findViewById(R.id.content_frame);
- mContentFrameMissingTranslation = 0; // not needed with current assets
-
- // the "X" that appears in place of the clock when the panel is showing notifications
- mClearButton = findViewById(R.id.clear_all_button);
- mClearButton.setOnClickListener(mClearButtonListener);
-
- mShowing = false;
- }
-
- @Override
- protected void onAttachedToWindow () {
- super.onAttachedToWindow();
- latestItems = (NotificationRowLayout) findViewById(R.id.content);
- int minHeight = getResources().getDimensionPixelSize(R.dimen.notification_row_min_height);
- int maxHeight = getResources().getDimensionPixelSize(R.dimen.notification_row_max_height);
- mExpandHelper = new ExpandHelper(mContext, latestItems, minHeight, maxHeight);
- mExpandHelper.setEventSource(this);
- mExpandHelper.setGravity(Gravity.BOTTOM);
- }
-
- private View.OnClickListener mClearButtonListener = new View.OnClickListener() {
- public void onClick(View v) {
- mBar.clearAll();
- }
- };
-
- public View getClearButton() {
- return mClearButton;
- }
-
- public void show(boolean show, boolean animate) {
- if (animate) {
- if (mShowing != show) {
- mShowing = show;
- if (show) {
- setVisibility(View.VISIBLE);
- // Don't start the animation until we've created the layer, which is done
- // right before we are drawn
- mContentParent.setLayerType(View.LAYER_TYPE_HARDWARE, null);
- getViewTreeObserver().addOnPreDrawListener(mPreDrawListener);
- } else {
- mChoreo.startAnimation(show);
- }
- }
- } else {
- mShowing = show;
- setVisibility(show ? View.VISIBLE : View.GONE);
- }
- }
-
- /**
- * This is used only when we've created a hardware layer and are waiting until it's
- * been created in order to start the appearing animation.
- */
- private ViewTreeObserver.OnPreDrawListener mPreDrawListener =
- new ViewTreeObserver.OnPreDrawListener() {
- @Override
- public boolean onPreDraw() {
- getViewTreeObserver().removeOnPreDrawListener(this);
- mChoreo.startAnimation(true);
- return false;
- }
- };
-
- /**
- * Whether the panel is showing, or, if it's animating, whether it will be
- * when the animation is done.
- */
- public boolean isShowing() {
- return mShowing;
- }
-
- @Override
- public void onVisibilityChanged(View v, int vis) {
- super.onVisibilityChanged(v, vis);
- // when we hide, put back the notifications
- if (vis != View.VISIBLE) {
- if (mSettingsView != null) removeSettingsView();
- mNotificationScroller.setVisibility(View.VISIBLE);
- mNotificationScroller.setAlpha(1f);
- mNotificationScroller.scrollTo(0, 0);
- updatePanelModeButtons();
- }
- }
-
- @Override
- public boolean dispatchHoverEvent(MotionEvent event) {
- // Ignore hover events outside of this panel bounds since such events
- // generate spurious accessibility events with the panel content when
- // tapping outside of it, thus confusing the user.
- final int x = (int) event.getX();
- final int y = (int) event.getY();
- if (x >= 0 && x < getWidth() && y >= 0 && y < getHeight()) {
- return super.dispatchHoverEvent(event);
- }
- return true;
- }
-
- @Override
- public boolean dispatchKeyEvent(KeyEvent event) {
- final int keyCode = event.getKeyCode();
- switch (keyCode) {
- // We exclusively handle the back key by hiding this panel.
- case KeyEvent.KEYCODE_BACK: {
- if (event.getAction() == KeyEvent.ACTION_UP) {
- mBar.animateCollapsePanels();
- }
- return true;
- }
- // We react to the home key but let the system handle it.
- case KeyEvent.KEYCODE_HOME: {
- if (event.getAction() == KeyEvent.ACTION_UP) {
- mBar.animateCollapsePanels();
- }
- } break;
- }
- return super.dispatchKeyEvent(event);
- }
-
- /*
- @Override
- protected void onLayout(boolean changed, int l, int t, int r, int b) {
- super.onLayout(changed, l, t, r, b);
-
- if (DEBUG) Log.d(TAG, String.format("PANEL: onLayout: (%d, %d, %d, %d)", l, t, r, b));
- }
-
- @Override
- public void onSizeChanged(int w, int h, int oldw, int oldh) {
- super.onSizeChanged(w, h, oldw, oldh);
-
- if (DEBUG) {
- Log.d(TAG, String.format("PANEL: onSizeChanged: (%d -> %d, %d -> %d)",
- oldw, w, oldh, h));
- }
- }
- */
-
- public void onClick(View v) {
- if (mSettingsButton.isEnabled() && v == mTitleArea) {
- swapPanels();
- }
- }
-
- public void setNotificationCount(int n) {
- mNotificationCount = n;
- }
-
- public void setContentFrameVisible(final boolean showing, boolean animate) {
- }
-
- public void swapPanels() {
- final View toShow, toHide;
- if (mSettingsView == null) {
- addSettingsView();
- toShow = mSettingsView;
- toHide = mNotificationScroller;
- } else {
- toShow = mNotificationScroller;
- toHide = mSettingsView;
- }
- Animator a = ObjectAnimator.ofFloat(toHide, "alpha", 1f, 0f)
- .setDuration(PANEL_FADE_DURATION);
- a.addListener(new AnimatorListenerAdapter() {
- @Override
- public void onAnimationEnd(Animator _a) {
- toHide.setVisibility(View.GONE);
- if (toShow != null) {
- toShow.setVisibility(View.VISIBLE);
- if (toShow == mSettingsView || mNotificationCount > 0) {
- ObjectAnimator.ofFloat(toShow, "alpha", 0f, 1f)
- .setDuration(PANEL_FADE_DURATION)
- .start();
- }
-
- if (toHide == mSettingsView) {
- removeSettingsView();
- }
- }
- updateClearButton();
- updatePanelModeButtons();
- }
- });
- a.start();
- }
-
- public void updateClearButton() {
- if (mBar != null) {
- final boolean showX
- = (isShowing()
- && mHasClearableNotifications
- && mNotificationScroller.getVisibility() == View.VISIBLE);
- getClearButton().setVisibility(showX ? View.VISIBLE : View.INVISIBLE);
- }
- }
-
- public void setClearable(boolean clearable) {
- mHasClearableNotifications = clearable;
- }
-
- public void updatePanelModeButtons() {
- final boolean settingsVisible = (mSettingsView != null);
- mSettingsButton.setVisibility(!settingsVisible && mSettingsButton.isEnabled() ? View.VISIBLE : View.GONE);
- mNotificationButton.setVisibility(settingsVisible ? View.VISIBLE : View.GONE);
- }
-
- public boolean isInContentArea(int x, int y) {
- mContentArea.left = mContentFrame.getLeft() + mContentFrame.getPaddingLeft();
- mContentArea.top = mContentFrame.getTop() + mContentFrame.getPaddingTop()
- + (int)mContentParent.getTranslationY(); // account for any adjustment
- mContentArea.right = mContentFrame.getRight() - mContentFrame.getPaddingRight();
- mContentArea.bottom = mContentFrame.getBottom() - mContentFrame.getPaddingBottom();
-
- offsetDescendantRectToMyCoords(mContentParent, mContentArea);
- return mContentArea.contains(x, y);
- }
-
- void removeSettingsView() {
- if (mSettingsView != null) {
- mContentFrame.removeView(mSettingsView);
- mSettingsView = null;
- }
- }
-
- // NB: it will be invisible until you show it
- void addSettingsView() {
- LayoutInflater infl = LayoutInflater.from(getContext());
- mSettingsView = infl.inflate(R.layout.system_bar_settings_view, mContentFrame, false);
- mSettingsView.setVisibility(View.GONE);
- mContentFrame.addView(mSettingsView);
- }
-
- private class Choreographer implements Animator.AnimatorListener {
- boolean mVisible;
- int mPanelHeight;
- AnimatorSet mContentAnim;
-
- // should group this into a multi-property animation
- final static int OPEN_DURATION = 250;
- final static int CLOSE_DURATION = 250;
-
- // the panel will start to appear this many px from the end
- final int HYPERSPACE_OFFRAMP = 200;
-
- Choreographer() {
- }
-
- void createAnimation(boolean appearing) {
- // mVisible: previous state; appearing: new state
-
- float start, end;
-
- // 0: on-screen
- // height: off-screen
- float y = mContentParent.getTranslationY();
- if (appearing) {
- // we want to go from near-the-top to the top, unless we're half-open in the right
- // general vicinity
- end = 0;
- if (mNotificationCount == 0) {
- end += mContentFrameMissingTranslation;
- }
- start = HYPERSPACE_OFFRAMP+end;
- } else {
- start = y;
- end = y + HYPERSPACE_OFFRAMP;
- }
-
- Animator posAnim = ObjectAnimator.ofFloat(mContentParent, "translationY",
- start, end);
- posAnim.setInterpolator(appearing ? sDecelerateInterpolator : sAccelerateInterpolator);
-
- if (mContentAnim != null && mContentAnim.isRunning()) {
- mContentAnim.cancel();
- }
-
- Animator fadeAnim = ObjectAnimator.ofFloat(mContentParent, "alpha",
- appearing ? 1.0f : 0.0f);
- fadeAnim.setInterpolator(appearing ? sAccelerateInterpolator : sDecelerateInterpolator);
-
- mContentAnim = new AnimatorSet();
- mContentAnim
- .play(fadeAnim)
- .with(posAnim)
- ;
- mContentAnim.setDuration((DEBUG?10:1)*(appearing ? OPEN_DURATION : CLOSE_DURATION));
- mContentAnim.addListener(this);
- }
-
- void startAnimation(boolean appearing) {
- if (DEBUG) Log.d(TAG, "startAnimation(appearing=" + appearing + ")");
-
- createAnimation(appearing);
- mContentAnim.start();
-
- mVisible = appearing;
-
- // we want to start disappearing promptly
- if (!mVisible) updateClearButton();
- }
-
- public void onAnimationCancel(Animator animation) {
- if (DEBUG) Log.d(TAG, "onAnimationCancel");
- }
-
- public void onAnimationEnd(Animator animation) {
- if (DEBUG) Log.d(TAG, "onAnimationEnd");
- if (! mVisible) {
- setVisibility(View.GONE);
- }
- mContentParent.setLayerType(View.LAYER_TYPE_NONE, null);
- mContentAnim = null;
-
- // we want to show the X lazily
- if (mVisible) updateClearButton();
- }
-
- public void onAnimationRepeat(Animator animation) {
- }
-
- public void onAnimationStart(Animator animation) {
- }
- }
-
- @Override
- public boolean onInterceptTouchEvent(MotionEvent ev) {
- MotionEvent cancellation = MotionEvent.obtain(ev);
- cancellation.setAction(MotionEvent.ACTION_CANCEL);
-
- boolean intercept = mExpandHelper.onInterceptTouchEvent(ev) ||
- super.onInterceptTouchEvent(ev);
- if (intercept) {
- latestItems.onInterceptTouchEvent(cancellation);
- }
- return intercept;
- }
-
- @Override
- public boolean onTouchEvent(MotionEvent ev) {
- boolean handled = mExpandHelper.onTouchEvent(ev) ||
- super.onTouchEvent(ev);
- return handled;
- }
-
- public void setSettingsEnabled(boolean settingsEnabled) {
- if (mSettingsButton != null) {
- mSettingsButton.setEnabled(settingsEnabled);
- mSettingsButton.setVisibility(settingsEnabled ? View.VISIBLE : View.GONE);
- }
- }
-
- public void refreshLayout(int layoutDirection) {
- // Force asset reloading
- mSettingsButton.setImageDrawable(null);
- mSettingsButton.setImageResource(R.drawable.ic_notify_settings);
-
- // Force asset reloading
- mNotificationButton.setImageDrawable(null);
- mNotificationButton.setImageResource(R.drawable.ic_notifications);
- }
-}
-
+++ /dev/null
-/*
- * Copyright (C) 2011 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.systemui.statusbar.tablet;
-
-import android.content.Context;
-import android.util.AttributeSet;
-import android.view.MotionEvent;
-import android.view.SoundEffectConstants;
-import android.view.View;
-import android.view.accessibility.AccessibilityEvent;
-import android.widget.RelativeLayout;
-
-import com.android.systemui.R;
-
-import java.util.ArrayList;
-
-
-public class NotificationPanelTitle extends RelativeLayout implements View.OnClickListener {
- private NotificationPanel mPanel;
- private ArrayList<View> buttons;
- private View mSettingsButton;
-
- public NotificationPanelTitle(Context context, AttributeSet attrs) {
- super(context, attrs);
- buttons = new ArrayList<View>();
- setOnClickListener(this);
- }
-
- public void setPanel(NotificationPanel p) {
- mPanel = p;
- }
-
- @Override
- public void onFinishInflate() {
- super.onFinishInflate();
- buttons.add(mSettingsButton = findViewById(R.id.settings_button));
- buttons.add(findViewById(R.id.notification_button));
- }
-
- @Override
- public void setPressed(boolean pressed) {
- super.setPressed(pressed);
- for (View button : buttons) {
- if (button != null) {
- button.setPressed(pressed);
- }
- }
- }
-
- @Override
- public boolean onTouchEvent(MotionEvent e) {
- if (!mSettingsButton.isEnabled())
- return false;
- switch (e.getAction()) {
- case MotionEvent.ACTION_DOWN:
- setPressed(true);
- break;
- case MotionEvent.ACTION_MOVE:
- final int x = (int) e.getX();
- final int y = (int) e.getY();
- setPressed(x > 0 && x < getWidth() && y > 0 && y < getHeight());
- break;
- case MotionEvent.ACTION_UP:
- if (isPressed()) {
- playSoundEffect(SoundEffectConstants.CLICK);
- mPanel.swapPanels();
- setPressed(false);
- }
- break;
- case MotionEvent.ACTION_CANCEL:
- setPressed(false);
- break;
- }
- return true;
- }
-
- @Override
- public void onClick(View v) {
- if (mSettingsButton.isEnabled() && v == this) {
- mPanel.swapPanels();
- }
- }
-
- @Override
- public boolean onRequestSendAccessibilityEvent(View child, AccessibilityEvent event) {
- if (super.onRequestSendAccessibilityEvent(child, event)) {
- AccessibilityEvent record = AccessibilityEvent.obtain();
- onInitializeAccessibilityEvent(record);
- dispatchPopulateAccessibilityEvent(record);
- event.appendRecord(record);
- return true;
- }
- return false;
- }
-}
+++ /dev/null
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.systemui.statusbar.tablet;
-
-import android.content.Context;
-import android.util.AttributeSet;
-import android.view.MotionEvent;
-import android.widget.RelativeLayout;
-
-public class NotificationPeekPanel extends RelativeLayout implements StatusBarPanel {
- TabletStatusBar mBar;
-
- public NotificationPeekPanel(Context context, AttributeSet attrs) {
- this(context, attrs, 0);
- }
-
- public NotificationPeekPanel(Context context, AttributeSet attrs, int defStyle) {
- super(context, attrs, defStyle);
- }
-
- public boolean isInContentArea(int x, int y) {
- final int l = getPaddingLeft();
- final int r = getWidth() - getPaddingRight();
- final int t = getPaddingTop();
- final int b = getHeight() - getPaddingBottom();
- return x >= l && x < r && y >= t && y < b;
- }
-
- public void setBar(TabletStatusBar bar) {
- mBar = bar;
- }
-
- // We don't really want to intercept the touch event, but we *do* want to reset the fade timer
- // in case the user is interacting with some custom controls or something.
- @Override
- public boolean onInterceptTouchEvent(MotionEvent ev) {
- mBar.resetNotificationPeekFadeTimer();
- return false;
- }
-
- @Override
- public boolean dispatchHoverEvent(MotionEvent event) {
- // Ignore hover events outside of this panel bounds since such events
- // generate spurious accessibility events with the panel content when
- // tapping outside of it, thus confusing the user.
- final int x = (int) event.getX();
- final int y = (int) event.getY();
- if (x >= 0 && x < getWidth() && y >= 0 && y < getHeight()) {
- return super.dispatchHoverEvent(event);
- }
- return true;
- }
-}
+++ /dev/null
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.systemui.statusbar.tablet;
-
-import android.content.Context;
-import android.graphics.Canvas;
-import android.util.AttributeSet;
-import android.view.View;
-
-public class PanelBackgroundView extends View {
- /*
- private Bitmap mTexture;
- private Paint mPaint;
- private int mTextureWidth;
- private int mTextureHeight;
- */
-
- public PanelBackgroundView(Context context, AttributeSet attrs) {
- super(context, attrs);
- /*
- mTexture = BitmapFactory.decodeResource(getResources(),
- com.android.internal.R.drawable.status_bar_background);
- mTextureWidth = mTexture.getWidth();
- mTextureHeight = mTexture.getHeight();
-
- mPaint = new Paint();
- mPaint.setDither(false);
- */
- }
-
- @Override
- public void onDraw(Canvas canvas) {
- /*
- final Bitmap texture = mTexture;
- final Paint paint = mPaint;
-
- final int width = getWidth();
- final int height = getHeight();
-
- final int textureWidth = mTextureWidth;
- final int textureHeight = mTextureHeight;
-
- int x = 0;
- int y;
-
- while (x < width) {
- y = 0;
- while (y < height) {
- canvas.drawBitmap(texture, x, y, paint);
- y += textureHeight;
- }
- x += textureWidth;
- }
- */
- }
-}
+++ /dev/null
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.systemui.statusbar.tablet;
-
-import android.app.StatusBarManager;
-import android.content.Context;
-import android.content.Intent;
-import android.os.UserHandle;
-import android.provider.Settings;
-import android.util.AttributeSet;
-import android.view.View;
-import android.widget.CompoundButton;
-import android.widget.ImageView;
-import android.widget.LinearLayout;
-
-import com.android.systemui.R;
-import com.android.systemui.settings.BrightnessController;
-import com.android.systemui.settings.ToggleSlider;
-import com.android.systemui.statusbar.policy.AirplaneModeController;
-import com.android.systemui.statusbar.policy.DoNotDisturbController;
-import com.android.systemui.statusbar.policy.RotationLockController;
-
-public class SettingsView extends LinearLayout implements View.OnClickListener {
- static final String TAG = "SettingsView";
-
- AirplaneModeController mAirplane;
- RotationLockController mRotationController;
- BrightnessController mBrightness;
- DoNotDisturbController mDoNotDisturb;
- View mRotationLockContainer;
- View mRotationLockSeparator;
-
- public SettingsView(Context context, AttributeSet attrs) {
- this(context, attrs, 0);
- }
-
- public SettingsView(Context context, AttributeSet attrs, int defStyle) {
- super(context, attrs, defStyle);
- }
-
- @Override
- protected void onFinishInflate() {
- super.onFinishInflate();
-
- final Context context = getContext();
-
- mAirplane = new AirplaneModeController(context,
- (CompoundButton)findViewById(R.id.airplane_checkbox));
- findViewById(R.id.network).setOnClickListener(this);
-
- mRotationLockContainer = findViewById(R.id.rotate);
- mRotationLockSeparator = findViewById(R.id.rotate_separator);
- mRotationController = new RotationLockController(context);
- mRotationController.addRotationLockControllerCallback(
- new RotationLockController.RotationLockControllerCallback() {
- @Override
- public void onRotationLockStateChanged(boolean locked, boolean visible) {
- mRotationLockContainer.setVisibility(visible ? View.VISIBLE : View.GONE);
- mRotationLockSeparator.setVisibility(visible ? View.VISIBLE : View.GONE);
- }
- });
- CompoundButton rotateCheckbox = (CompoundButton) findViewById(R.id.rotate_checkbox);
- rotateCheckbox.setChecked(!mRotationController.isRotationLocked());
- rotateCheckbox.setVisibility(mRotationController.isRotationLockAffordanceVisible()
- ? View.VISIBLE : View.GONE);
- rotateCheckbox.setOnCheckedChangeListener(new CompoundButton. OnCheckedChangeListener() {
- @Override
- public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
- mRotationController.setRotationLocked(!buttonView.isChecked());
- }
- });
-
- mBrightness = new BrightnessController(context,
- (ImageView)findViewById(R.id.brightness_icon),
- (ToggleSlider)findViewById(R.id.brightness));
- mDoNotDisturb = new DoNotDisturbController(context,
- (CompoundButton)findViewById(R.id.do_not_disturb_checkbox));
- findViewById(R.id.settings).setOnClickListener(this);
- }
-
- @Override
- protected void onDetachedFromWindow() {
- super.onDetachedFromWindow();
- mAirplane.release();
- mDoNotDisturb.release();
- mRotationController.release();
- }
-
- public void onClick(View v) {
- switch (v.getId()) {
- case R.id.network:
- onClickNetwork();
- break;
- case R.id.settings:
- onClickSettings();
- break;
- }
- }
-
- private StatusBarManager getStatusBarManager() {
- return (StatusBarManager)getContext().getSystemService(Context.STATUS_BAR_SERVICE);
- }
-
- // Network
- // ----------------------------
- private void onClickNetwork() {
- getContext().startActivity(new Intent(Settings.ACTION_WIFI_SETTINGS)
- .setFlags(Intent.FLAG_ACTIVITY_NEW_TASK));
- getStatusBarManager().collapsePanels();
- }
-
- // Settings
- // ----------------------------
- private void onClickSettings() {
- getContext().startActivityAsUser(new Intent(Settings.ACTION_SETTINGS)
- .setFlags(Intent.FLAG_ACTIVITY_NEW_TASK),
- new UserHandle(UserHandle.USER_CURRENT));
- getStatusBarManager().collapsePanels();
- }
-}
-
+++ /dev/null
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.systemui.statusbar.tablet;
-
-import android.animation.Animator;
-import android.animation.AnimatorListenerAdapter;
-import android.animation.ObjectAnimator;
-import android.content.ClipData;
-import android.content.Context;
-import android.graphics.Bitmap;
-import android.graphics.Canvas;
-import android.graphics.Paint;
-import android.graphics.Point;
-import android.util.AttributeSet;
-import android.util.Log;
-import android.view.DragEvent;
-import android.view.MotionEvent;
-import android.view.View;
-import android.widget.ImageView;
-
-public class ShirtPocket extends ImageView {
- private static final boolean DEBUG = false;
- private static final String TAG = "StatusBar/ShirtPocket";
-
- private ClipData mClipping = null;
-
- private ImageView mPreviewIcon;
-
- public static class DropZone extends View {
- ShirtPocket mPocket;
- public DropZone(Context context, AttributeSet attrs) {
- super(context, attrs);
- }
- public void setPocket(ShirtPocket p) {
- mPocket = p;
- }
-
- public void onAttachedToWindow() {
- super.onAttachedToWindow();
- if (mPocket.holding()) {
- show(false);
- } else {
- hide(false);
- }
- }
-
- // Drag API notes: we must be visible to receive drag events
- private void show(boolean animate) {
- setTranslationY(0f);
- if (animate) {
- setAlpha(0f);
- ObjectAnimator.ofFloat(this, "alpha", 0f, 1f).start();
- } else {
- setAlpha(1f);
- }
- }
-
- private void hide(boolean animate) {
- AnimatorListenerAdapter onEnd = new AnimatorListenerAdapter() {
- @Override
- public void onAnimationEnd(Animator _a) {
- DropZone.this.setTranslationY(getHeight() + 2);
- DropZone.this.setAlpha(0f);
- }
- };
- if (animate) {
- Animator a = ObjectAnimator.ofFloat(this, "alpha", getAlpha(), 0f);
- a.addListener(onEnd);
- a.start();
- } else {
- onEnd.onAnimationEnd(null);
- }
- }
-
- @Override
- public boolean onDragEvent(DragEvent event) {
- if (DEBUG) Log.d(TAG, "onDragEvent: " + event);
- switch (event.getAction()) {
- // We want to appear whenever a potential drag takes off from anywhere in the UI.
- case DragEvent.ACTION_DRAG_STARTED:
- show(true);
- break;
- case DragEvent.ACTION_DRAG_ENTERED:
- if (DEBUG) Log.d(TAG, "entered!");
- // XXX: TODO
- break;
- case DragEvent.ACTION_DRAG_EXITED:
- if (DEBUG) Log.d(TAG, "exited!");
- break;
- case DragEvent.ACTION_DROP:
- if (DEBUG) Log.d(TAG, "dropped!");
- mPocket.stash(event.getClipData());
- break;
- case DragEvent.ACTION_DRAG_ENDED:
- hide(true);
- break;
- }
- return true; // we want everything, thank you
- }
- }
-
- public ShirtPocket(Context context, AttributeSet attrs) {
- super(context, attrs);
- }
-
- // TODO: "pin area" panel, dragging things out
- ObjectAnimator mAnimHide, mAnimShow;
-
- protected void onAttachedToWindow() {
- }
-
- public boolean holding() {
- return (mClipping != null);
- }
-
- private void stash(ClipData clipping) {
- mClipping = clipping;
- if (mClipping != null) {
- setVisibility(View.VISIBLE);
- Bitmap icon = mClipping.getIcon();
-// mDescription.setText(mClipping.getDescription().getLabel());
- if (icon != null) {
- setImageBitmap(icon);
- } else {
- if (mClipping.getItemCount() > 0) {
- // TODO: figure out how to visualize every kind of ClipData!
- //mAltText.setText(mClipping.getItemAt(0).coerceToText(getContext()));
- }
- }
- } else {
- setVisibility(View.GONE);
- }
- }
-
- @Override
- public boolean onTouchEvent(MotionEvent ev) {
- final int action = ev.getAction();
- if (action == MotionEvent.ACTION_DOWN) {
- final ClipData clip = mClipping;
- if (clip != null) {
- final Bitmap icon = clip.getIcon();
- DragShadowBuilder shadow;
- if (icon != null) {
- shadow = new DragShadowBuilder(this) {
- public void onProvideShadowMetrics(Point shadowSize, Point shadowTouchPoint) {
- shadowSize.set(icon.getWidth(), icon.getHeight());
- shadowTouchPoint.set(shadowSize.x / 2, shadowSize.y / 2);
- }
- public void onDrawShadow(Canvas canvas) {
- canvas.drawBitmap(icon, 0, 0, new Paint());
- }
- };
- } else {
- // uhhh, what now?
- shadow = new DragShadowBuilder(this);
- }
-
- startDrag(clip, shadow, null, 0);
-
- // TODO: only discard the clipping if it was accepted
- stash(null);
-
- return true;
- }
- }
- return false;
- }
-
- /*
- private boolean isInViewContentArea(View v, int x, int y) {
- final int l = v.getPaddingLeft();
- final int r = v.getWidth() - v.getPaddingRight();
- final int t = v.getPaddingTop();
- final int b = v.getHeight() - v.getPaddingBottom();
- return x >= l && x < r && y >= t && y < b;
- }
-
- View.OnTouchListener mWindowTouchListener = new View.OnTouchListener() {
- public boolean onTouch(View v, MotionEvent ev) {
- final int action = ev.getAction();
- if (action == MotionEvent.ACTION_OUTSIDE
- || (action == MotionEvent.ACTION_DOWN
- && !isInViewContentArea(mWindow, (int)ev.getX(), (int)ev.getY()))) {
- hideWindow();
- return true;
- } else if (action == MotionEvent.ACTION_DOWN) {
- final ClipData clip = mClipping;
- if (clip != null) {
- final Bitmap icon = clip.getIcon();
- DragShadowBuilder shadow;
- if (icon != null) {
- shadow = new DragShadowBuilder(v) {
- public void onProvideShadowMetrics(Point shadowSize, Point shadowTouchPoint) {
- shadowSize.set(icon.getWidth(), icon.getHeight());
- shadowTouchPoint.set(shadowSize.x / 2, shadowSize.y / 2);
- }
- public void onDrawShadow(Canvas canvas) {
- canvas.drawBitmap(icon, 0, 0, new Paint());
- }
- };
- } else {
- // uhhh, what now?
- shadow = new DragShadowBuilder(mWindow.findViewById(R.id.preview));
- }
-
- v.startDrag(clip, shadow, null, 0);
-
- // TODO: only discard the clipping if it was accepted
- stash(null);
-
- return true;
- }
- }
- return false;
- }
- };
- */
-}
-
+++ /dev/null
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.systemui.statusbar.tablet;
-
-import android.animation.LayoutTransition;
-import android.animation.ObjectAnimator;
-import android.app.ActivityManager;
-import android.app.ActivityManagerNative;
-import android.app.Notification;
-import android.app.PendingIntent;
-import android.app.StatusBarManager;
-import android.content.BroadcastReceiver;
-import android.content.Context;
-import android.content.Intent;
-import android.content.IntentFilter;
-import android.content.SharedPreferences;
-import android.content.res.Configuration;
-import android.content.res.Resources;
-import android.graphics.PixelFormat;
-import android.graphics.Point;
-import android.graphics.drawable.Drawable;
-import android.graphics.drawable.LayerDrawable;
-import android.inputmethodservice.InputMethodService;
-import android.os.IBinder;
-import android.os.Message;
-import android.os.RemoteException;
-import android.service.notification.StatusBarNotification;
-import android.text.TextUtils;
-import android.util.Log;
-import android.view.Display;
-import android.view.Gravity;
-import android.view.KeyEvent;
-import android.view.MotionEvent;
-import android.view.SoundEffectConstants;
-import android.view.VelocityTracker;
-import android.view.View;
-import android.view.ViewConfiguration;
-import android.view.ViewGroup;
-import android.view.ViewGroup.LayoutParams;
-import android.view.WindowManager;
-import android.view.accessibility.AccessibilityEvent;
-import android.widget.ImageView;
-import android.widget.LinearLayout;
-import android.widget.ScrollView;
-import android.widget.TextView;
-
-import com.android.internal.statusbar.StatusBarIcon;
-import com.android.systemui.R;
-import com.android.systemui.statusbar.BaseStatusBar;
-import com.android.systemui.statusbar.CommandQueue;
-import com.android.systemui.statusbar.DoNotDisturb;
-import com.android.systemui.statusbar.NotificationData;
-import com.android.systemui.statusbar.NotificationData.Entry;
-import com.android.systemui.statusbar.SignalClusterView;
-import com.android.systemui.statusbar.StatusBarIconView;
-import com.android.systemui.statusbar.policy.BatteryController;
-import com.android.systemui.statusbar.policy.BluetoothController;
-import com.android.systemui.statusbar.policy.CompatModeButton;
-import com.android.systemui.statusbar.policy.LocationController;
-import com.android.systemui.statusbar.policy.NetworkController;
-import com.android.systemui.statusbar.policy.NotificationRowLayout;
-import com.android.systemui.statusbar.policy.Prefs;
-
-import java.io.FileDescriptor;
-import java.io.PrintWriter;
-import java.util.ArrayList;
-
-public class TabletStatusBar extends BaseStatusBar implements
- InputMethodsPanel.OnHardKeyboardEnabledChangeListener {
- public static final boolean DEBUG = false;
- public static final boolean DEBUG_COMPAT_HELP = false;
- public static final String TAG = "TabletStatusBar";
-
-
- public static final int MSG_OPEN_NOTIFICATION_PANEL = 1000;
- public static final int MSG_CLOSE_NOTIFICATION_PANEL = 1001;
- public static final int MSG_OPEN_NOTIFICATION_PEEK = 1002;
- public static final int MSG_CLOSE_NOTIFICATION_PEEK = 1003;
- // 1020-1029 reserved for BaseStatusBar
- public static final int MSG_SHOW_CHROME = 1030;
- public static final int MSG_HIDE_CHROME = 1031;
- public static final int MSG_OPEN_INPUT_METHODS_PANEL = 1040;
- public static final int MSG_CLOSE_INPUT_METHODS_PANEL = 1041;
- public static final int MSG_OPEN_COMPAT_MODE_PANEL = 1050;
- public static final int MSG_CLOSE_COMPAT_MODE_PANEL = 1051;
- public static final int MSG_STOP_TICKER = 2000;
-
- // Fitts' Law assistance for LatinIME; see policy.EventHole
- private static final boolean FAKE_SPACE_BAR = true;
-
- // Notification "peeking" (flyover preview of individual notifications)
- final static int NOTIFICATION_PEEK_HOLD_THRESH = 200; // ms
- final static int NOTIFICATION_PEEK_FADE_DELAY = 3000; // ms
-
- private static final int NOTIFICATION_PRIORITY_MULTIPLIER = 10; // see NotificationManagerService
- private static final int HIDE_ICONS_BELOW_SCORE = Notification.PRIORITY_LOW * NOTIFICATION_PRIORITY_MULTIPLIER;
-
- // The height of the bar, as definied by the build. It may be taller if we're plugged
- // into hdmi.
- int mNaturalBarHeight = -1;
- int mIconSize = -1;
- int mIconHPadding = -1;
- int mNavIconWidth = -1;
- int mMenuNavIconWidth = -1;
- private int mMaxNotificationIcons = 5;
-
- TabletStatusBarView mStatusBarView;
- View mNotificationArea;
- View mNotificationTrigger;
- NotificationIconArea mNotificationIconArea;
- ViewGroup mNavigationArea;
-
- boolean mNotificationDNDMode;
- NotificationData.Entry mNotificationDNDDummyEntry;
-
- ImageView mBackButton;
- View mHomeButton;
- View mMenuButton;
- View mRecentButton;
- private boolean mAltBackButtonEnabledForIme;
-
- ViewGroup mFeedbackIconArea; // notification icons, IME icon, compat icon
- InputMethodButton mInputMethodSwitchButton;
- CompatModeButton mCompatModeButton;
-
- NotificationPanel mNotificationPanel;
- WindowManager.LayoutParams mNotificationPanelParams;
- NotificationPeekPanel mNotificationPeekWindow;
- ViewGroup mNotificationPeekRow;
- int mNotificationPeekIndex;
- IBinder mNotificationPeekKey;
- LayoutTransition mNotificationPeekScrubLeft, mNotificationPeekScrubRight;
-
- int mNotificationPeekTapDuration;
- int mNotificationFlingVelocity;
-
- BatteryController mBatteryController;
- BluetoothController mBluetoothController;
- LocationController mLocationController;
- NetworkController mNetworkController;
- DoNotDisturb mDoNotDisturb;
-
- ViewGroup mBarContents;
-
- // hide system chrome ("lights out") support
- View mShadow;
-
- NotificationIconArea.IconLayout mIconLayout;
-
- TabletTicker mTicker;
-
- View mFakeSpaceBar;
- KeyEvent mSpaceBarKeyEvent = null;
-
- View mCompatibilityHelpDialog = null;
-
- // for disabling the status bar
- int mDisabled = 0;
-
- private InputMethodsPanel mInputMethodsPanel;
- private CompatModePanel mCompatModePanel;
-
- private int mSystemUiVisibility = 0;
-
- private int mNavigationIconHints = 0;
-
- private int mShowSearchHoldoff = 0;
-
- public Context getContext() { return mContext; }
-
- private Runnable mShowSearchPanel = new Runnable() {
- public void run() {
- showSearchPanel();
- }
- };
-
- private View.OnTouchListener mHomeSearchActionListener = new View.OnTouchListener() {
- public boolean onTouch(View v, MotionEvent event) {
- switch(event.getAction()) {
- case MotionEvent.ACTION_DOWN:
- if (!shouldDisableNavbarGestures() && !inKeyguardRestrictedInputMode()) {
- mHandler.removeCallbacks(mShowSearchPanel);
- mHandler.postDelayed(mShowSearchPanel, mShowSearchHoldoff);
- }
- break;
-
- case MotionEvent.ACTION_UP:
- case MotionEvent.ACTION_CANCEL:
- mHandler.removeCallbacks(mShowSearchPanel);
- break;
- }
- return false;
- }
- };
-
- @Override
- protected void createAndAddWindows() {
- addStatusBarWindow();
- addPanelWindows();
- }
-
- private void addStatusBarWindow() {
- final View sb = makeStatusBarView();
-
- final WindowManager.LayoutParams lp = new WindowManager.LayoutParams(
- ViewGroup.LayoutParams.MATCH_PARENT,
- ViewGroup.LayoutParams.MATCH_PARENT,
- WindowManager.LayoutParams.TYPE_NAVIGATION_BAR,
- WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE
- | WindowManager.LayoutParams.FLAG_TOUCHABLE_WHEN_WAKING
- | WindowManager.LayoutParams.FLAG_SPLIT_TOUCH,
- PixelFormat.OPAQUE);
-
- // We explicitly leave FLAG_HARDWARE_ACCELERATED out of the flags. The status bar occupies
- // very little screen real-estate and is updated fairly frequently. By using CPU rendering
- // for the status bar, we prevent the GPU from having to wake up just to do these small
- // updates, which should help keep power consumption down.
-
- lp.gravity = getStatusBarGravity();
- lp.setTitle("SystemBar");
- lp.packageName = mContext.getPackageName();
- mWindowManager.addView(sb, lp);
- }
-
- protected void addPanelWindows() {
- final Context context = mContext;
- final Resources res = mContext.getResources();
-
- // Notification Panel
- mNotificationPanel = (NotificationPanel)View.inflate(context,
- R.layout.system_bar_notification_panel, null);
- mNotificationPanel.setBar(this);
- mNotificationPanel.show(false, false);
- mNotificationPanel.setOnTouchListener(
- new TouchOutsideListener(MSG_CLOSE_NOTIFICATION_PANEL, mNotificationPanel));
-
- // the battery icon
- mBatteryController.addIconView((ImageView)mNotificationPanel.findViewById(R.id.battery));
- mBatteryController.addLabelView(
- (TextView)mNotificationPanel.findViewById(R.id.battery_text));
-
- // Bt
- mBluetoothController.addIconView(
- (ImageView)mNotificationPanel.findViewById(R.id.bluetooth));
-
- // network icons: either a combo icon that switches between mobile and data, or distinct
- // mobile and data icons
- final ImageView mobileRSSI =
- (ImageView)mNotificationPanel.findViewById(R.id.mobile_signal);
- if (mobileRSSI != null) {
- mNetworkController.addPhoneSignalIconView(mobileRSSI);
- }
- final ImageView wifiRSSI =
- (ImageView)mNotificationPanel.findViewById(R.id.wifi_signal);
- if (wifiRSSI != null) {
- mNetworkController.addWifiIconView(wifiRSSI);
- }
- mNetworkController.addWifiLabelView(
- (TextView)mNotificationPanel.findViewById(R.id.wifi_text));
-
- mNetworkController.addDataTypeIconView(
- (ImageView)mNotificationPanel.findViewById(R.id.mobile_type));
- mNetworkController.addMobileLabelView(
- (TextView)mNotificationPanel.findViewById(R.id.mobile_text));
- mNetworkController.addCombinedLabelView(
- (TextView)mBarContents.findViewById(R.id.network_text));
-
- mStatusBarView.setIgnoreChildren(0, mNotificationTrigger, mNotificationPanel);
-
- WindowManager.LayoutParams lp = mNotificationPanelParams = new WindowManager.LayoutParams(
- res.getDimensionPixelSize(R.dimen.notification_panel_width),
- getNotificationPanelHeight(),
- WindowManager.LayoutParams.TYPE_NAVIGATION_BAR_PANEL,
- WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN
- | WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS
- | WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM
- | WindowManager.LayoutParams.FLAG_SPLIT_TOUCH
- | WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED,
- PixelFormat.TRANSLUCENT);
- lp.gravity = Gravity.BOTTOM | Gravity.END;
- lp.setTitle("NotificationPanel");
- lp.softInputMode = WindowManager.LayoutParams.SOFT_INPUT_STATE_UNCHANGED
- | WindowManager.LayoutParams.SOFT_INPUT_ADJUST_NOTHING;
- lp.windowAnimations = com.android.internal.R.style.Animation; // == no animation
-// lp.windowAnimations = com.android.internal.R.style.Animation_ZoomButtons; // simple fade
-
- mWindowManager.addView(mNotificationPanel, lp);
-
- // Search Panel
- mStatusBarView.setBar(this);
- mHomeButton.setOnTouchListener(mHomeSearchActionListener);
- updateSearchPanel();
-
- // Input methods Panel
- mInputMethodsPanel = (InputMethodsPanel) View.inflate(context,
- R.layout.system_bar_input_methods_panel, null);
- mInputMethodsPanel.setHardKeyboardEnabledChangeListener(this);
- mInputMethodsPanel.setOnTouchListener(new TouchOutsideListener(
- MSG_CLOSE_INPUT_METHODS_PANEL, mInputMethodsPanel));
- mInputMethodsPanel.setImeSwitchButton(mInputMethodSwitchButton);
- mStatusBarView.setIgnoreChildren(2, mInputMethodSwitchButton, mInputMethodsPanel);
- lp = new WindowManager.LayoutParams(
- ViewGroup.LayoutParams.WRAP_CONTENT,
- ViewGroup.LayoutParams.WRAP_CONTENT,
- WindowManager.LayoutParams.TYPE_STATUS_BAR_PANEL,
- WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN
- | WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM
- | WindowManager.LayoutParams.FLAG_SPLIT_TOUCH
- | WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED,
- PixelFormat.TRANSLUCENT);
- lp.gravity = Gravity.BOTTOM | Gravity.END;
- lp.setTitle("InputMethodsPanel");
- lp.windowAnimations = R.style.Animation_RecentPanel;
-
- mWindowManager.addView(mInputMethodsPanel, lp);
-
- // Compatibility mode selector panel
- mCompatModePanel = (CompatModePanel) View.inflate(context,
- R.layout.system_bar_compat_mode_panel, null);
- mCompatModePanel.setOnTouchListener(new TouchOutsideListener(
- MSG_CLOSE_COMPAT_MODE_PANEL, mCompatModePanel));
- mCompatModePanel.setTrigger(mCompatModeButton);
- mCompatModePanel.setVisibility(View.GONE);
- mStatusBarView.setIgnoreChildren(3, mCompatModeButton, mCompatModePanel);
- lp = new WindowManager.LayoutParams(
- 250,
- ViewGroup.LayoutParams.WRAP_CONTENT,
- WindowManager.LayoutParams.TYPE_STATUS_BAR_PANEL,
- WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN
- | WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM
- | WindowManager.LayoutParams.FLAG_SPLIT_TOUCH
- | WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED,
- PixelFormat.TRANSLUCENT);
- lp.gravity = Gravity.BOTTOM | Gravity.END;
- lp.setTitle("CompatModePanel");
- lp.windowAnimations = android.R.style.Animation_Dialog;
-
- mWindowManager.addView(mCompatModePanel, lp);
-
- mRecentButton.setOnTouchListener(mRecentsPreloadOnTouchListener);
-
- mPile = (NotificationRowLayout)mNotificationPanel.findViewById(R.id.content);
- mPile.removeAllViews();
- mPile.setLongPressListener(getNotificationLongClicker());
-
- ScrollView scroller = (ScrollView)mPile.getParent();
- scroller.setFillViewport(true);
- }
-
- @Override
- protected int getExpandedViewMaxHeight() {
- return getNotificationPanelHeight();
- }
-
- private int getNotificationPanelHeight() {
- final Resources res = mContext.getResources();
- final Display d = mWindowManager.getDefaultDisplay();
- final Point size = new Point();
- d.getRealSize(size);
- return Math.max(res.getDimensionPixelSize(R.dimen.notification_panel_min_height), size.y);
- }
-
- @Override
- public void start() {
- super.start(); // will add the main bar view
- }
-
- @Override
- protected void onConfigurationChanged(Configuration newConfig) {
- super.onConfigurationChanged(newConfig);
- loadDimens();
- mNotificationPanelParams.height = getNotificationPanelHeight();
- mWindowManager.updateViewLayout(mNotificationPanel, mNotificationPanelParams);
- mShowSearchHoldoff = mContext.getResources().getInteger(
- R.integer.config_show_search_delay);
- updateSearchPanel();
- }
-
- @Override
- protected void refreshLayout(int layoutDirection) {
- mNotificationPanel.refreshLayout(layoutDirection);
- }
-
- protected void loadDimens() {
- final Resources res = mContext.getResources();
-
- mNaturalBarHeight = res.getDimensionPixelSize(
- com.android.internal.R.dimen.navigation_bar_height);
-
- int newIconSize = res.getDimensionPixelSize(
- com.android.internal.R.dimen.system_bar_icon_size);
- int newIconHPadding = res.getDimensionPixelSize(
- R.dimen.status_bar_icon_padding);
- int newNavIconWidth = res.getDimensionPixelSize(R.dimen.navigation_key_width);
- int newMenuNavIconWidth = res.getDimensionPixelSize(R.dimen.navigation_menu_key_width);
-
- if (mNavigationArea != null && newNavIconWidth != mNavIconWidth) {
- mNavIconWidth = newNavIconWidth;
-
- LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(
- mNavIconWidth, ViewGroup.LayoutParams.MATCH_PARENT);
- mBackButton.setLayoutParams(lp);
- mHomeButton.setLayoutParams(lp);
- mRecentButton.setLayoutParams(lp);
- }
-
- if (mNavigationArea != null && newMenuNavIconWidth != mMenuNavIconWidth) {
- mMenuNavIconWidth = newMenuNavIconWidth;
-
- LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(
- mMenuNavIconWidth, ViewGroup.LayoutParams.MATCH_PARENT);
- mMenuButton.setLayoutParams(lp);
- }
-
- if (newIconHPadding != mIconHPadding || newIconSize != mIconSize) {
-// Log.d(TAG, "size=" + newIconSize + " padding=" + newIconHPadding);
- mIconHPadding = newIconHPadding;
- mIconSize = newIconSize;
- reloadAllNotificationIcons(); // reload the tray
- }
-
- final int numIcons = res.getInteger(R.integer.config_maxNotificationIcons);
- if (numIcons != mMaxNotificationIcons) {
- mMaxNotificationIcons = numIcons;
- if (DEBUG) Log.d(TAG, "max notification icons: " + mMaxNotificationIcons);
- reloadAllNotificationIcons();
- }
- }
-
- @Override
- public View getStatusBarView() {
- return mStatusBarView;
- }
-
- protected View makeStatusBarView() {
- final Context context = mContext;
-
- loadDimens();
-
- final TabletStatusBarView sb = (TabletStatusBarView)View.inflate(
- context, R.layout.system_bar, null);
- mStatusBarView = sb;
-
- sb.setHandler(mHandler);
-
- try {
- // Sanity-check that someone hasn't set up the config wrong and asked for a navigation
- // bar on a tablet that has only the system bar
- if (mWindowManagerService.hasNavigationBar()) {
- Log.e(TAG, "Tablet device cannot show navigation bar and system bar");
- }
- } catch (RemoteException ex) {
- }
-
- mBarContents = (ViewGroup) sb.findViewById(R.id.bar_contents);
-
- // the whole right-hand side of the bar
- mNotificationArea = sb.findViewById(R.id.notificationArea);
- mNotificationArea.setOnTouchListener(new NotificationTriggerTouchListener());
-
- // the button to open the notification area
- mNotificationTrigger = sb.findViewById(R.id.notificationTrigger);
-
- // the more notifications icon
- mNotificationIconArea = (NotificationIconArea)sb.findViewById(R.id.notificationIcons);
-
- // where the icons go
- mIconLayout = (NotificationIconArea.IconLayout) sb.findViewById(R.id.icons);
-
- mNotificationPeekTapDuration = ViewConfiguration.getTapTimeout();
- mNotificationFlingVelocity = 300; // px/s
-
- mTicker = new TabletTicker(this);
-
- // The icons
- mLocationController = new LocationController(mContext); // will post a notification
-
- // watch the PREF_DO_NOT_DISTURB and convert to appropriate disable() calls
- mDoNotDisturb = new DoNotDisturb(mContext);
-
- mBatteryController = new BatteryController(mContext);
- mBatteryController.addIconView((ImageView)sb.findViewById(R.id.battery));
- mBluetoothController = new BluetoothController(mContext);
- mBluetoothController.addIconView((ImageView)sb.findViewById(R.id.bluetooth));
-
- mNetworkController = new NetworkController(mContext);
- final SignalClusterView signalCluster =
- (SignalClusterView)sb.findViewById(R.id.signal_cluster);
- mNetworkController.addSignalCluster(signalCluster);
-
- // The navigation buttons
- mBackButton = (ImageView)sb.findViewById(R.id.back);
- mNavigationArea = (ViewGroup) sb.findViewById(R.id.navigationArea);
- mHomeButton = mNavigationArea.findViewById(R.id.home);
- mMenuButton = mNavigationArea.findViewById(R.id.menu);
- mRecentButton = mNavigationArea.findViewById(R.id.recent_apps);
- mRecentButton.setOnClickListener(mOnClickListener);
-
- LayoutTransition lt = new LayoutTransition();
- lt.setDuration(250);
- // don't wait for these transitions; we just want icons to fade in/out, not move around
- lt.setDuration(LayoutTransition.CHANGE_APPEARING, 0);
- lt.setDuration(LayoutTransition.CHANGE_DISAPPEARING, 0);
- lt.addTransitionListener(new LayoutTransition.TransitionListener() {
- public void endTransition(LayoutTransition transition, ViewGroup container,
- View view, int transitionType) {
- // ensure the menu button doesn't stick around on the status bar after it's been
- // removed
- mBarContents.invalidate();
- }
- public void startTransition(LayoutTransition transition, ViewGroup container,
- View view, int transitionType) {}
- });
- mNavigationArea.setLayoutTransition(lt);
- // no multi-touch on the nav buttons
- mNavigationArea.setMotionEventSplittingEnabled(false);
-
- // The bar contents buttons
- mFeedbackIconArea = (ViewGroup)sb.findViewById(R.id.feedbackIconArea);
- mInputMethodSwitchButton = (InputMethodButton) sb.findViewById(R.id.imeSwitchButton);
- // Overwrite the lister
- mInputMethodSwitchButton.setOnClickListener(mOnClickListener);
-
- mCompatModeButton = (CompatModeButton) sb.findViewById(R.id.compatModeButton);
- mCompatModeButton.setOnClickListener(mOnClickListener);
- mCompatModeButton.setVisibility(View.GONE);
-
- // for redirecting errant bar taps to the IME
- mFakeSpaceBar = sb.findViewById(R.id.fake_space_bar);
-
- // "shadows" of the status bar features, for lights-out mode
- mShadow = sb.findViewById(R.id.bar_shadow);
- mShadow.setOnTouchListener(
- new View.OnTouchListener() {
- public boolean onTouch(View v, MotionEvent ev) {
- if (ev.getAction() == MotionEvent.ACTION_DOWN) {
- // even though setting the systemUI visibility below will turn these views
- // on, we need them to come up faster so that they can catch this motion
- // event
- mShadow.setVisibility(View.GONE);
- mBarContents.setVisibility(View.VISIBLE);
-
- try {
- mBarService.setSystemUiVisibility(0, View.SYSTEM_UI_FLAG_LOW_PROFILE);
- } catch (RemoteException ex) {
- // system process dead
- }
- }
- return false;
- }
- });
-
- // tuning parameters
- final int LIGHTS_GOING_OUT_SYSBAR_DURATION = 750;
- final int LIGHTS_GOING_OUT_SHADOW_DURATION = 750;
- final int LIGHTS_GOING_OUT_SHADOW_DELAY = 0;
-
- final int LIGHTS_COMING_UP_SYSBAR_DURATION = 200;
-// final int LIGHTS_COMING_UP_SYSBAR_DELAY = 50;
- final int LIGHTS_COMING_UP_SHADOW_DURATION = 0;
-
- LayoutTransition xition = new LayoutTransition();
- xition.setAnimator(LayoutTransition.APPEARING,
- ObjectAnimator.ofFloat(null, "alpha", 0.5f, 1f));
- xition.setDuration(LayoutTransition.APPEARING, LIGHTS_COMING_UP_SYSBAR_DURATION);
- xition.setStartDelay(LayoutTransition.APPEARING, 0);
- xition.setAnimator(LayoutTransition.DISAPPEARING,
- ObjectAnimator.ofFloat(null, "alpha", 1f, 0f));
- xition.setDuration(LayoutTransition.DISAPPEARING, LIGHTS_GOING_OUT_SYSBAR_DURATION);
- xition.setStartDelay(LayoutTransition.DISAPPEARING, 0);
- ((ViewGroup)sb.findViewById(R.id.bar_contents_holder)).setLayoutTransition(xition);
-
- xition = new LayoutTransition();
- xition.setAnimator(LayoutTransition.APPEARING,
- ObjectAnimator.ofFloat(null, "alpha", 0f, 1f));
- xition.setDuration(LayoutTransition.APPEARING, LIGHTS_GOING_OUT_SHADOW_DURATION);
- xition.setStartDelay(LayoutTransition.APPEARING, LIGHTS_GOING_OUT_SHADOW_DELAY);
- xition.setAnimator(LayoutTransition.DISAPPEARING,
- ObjectAnimator.ofFloat(null, "alpha", 1f, 0f));
- xition.setDuration(LayoutTransition.DISAPPEARING, LIGHTS_COMING_UP_SHADOW_DURATION);
- xition.setStartDelay(LayoutTransition.DISAPPEARING, 0);
- ((ViewGroup)sb.findViewById(R.id.bar_shadow_holder)).setLayoutTransition(xition);
-
- // set the initial view visibility
- setAreThereNotifications();
-
- // receive broadcasts
- IntentFilter filter = new IntentFilter();
- filter.addAction(Intent.ACTION_CLOSE_SYSTEM_DIALOGS);
- filter.addAction(Intent.ACTION_SCREEN_OFF);
- context.registerReceiver(mBroadcastReceiver, filter);
-
- return sb;
- }
-
- @Override
- protected WindowManager.LayoutParams getRecentsLayoutParams(LayoutParams layoutParams) {
- WindowManager.LayoutParams lp = new WindowManager.LayoutParams(
- (int) mContext.getResources().getDimension(R.dimen.status_bar_recents_width),
- ViewGroup.LayoutParams.MATCH_PARENT,
- WindowManager.LayoutParams.TYPE_NAVIGATION_BAR_PANEL,
- WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN
- | WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM
- | WindowManager.LayoutParams.FLAG_SPLIT_TOUCH
- | WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED,
- PixelFormat.TRANSLUCENT);
- lp.gravity = Gravity.BOTTOM | Gravity.START;
- lp.setTitle("RecentsPanel");
- lp.windowAnimations = com.android.internal.R.style.Animation_RecentApplications;
- lp.softInputMode = WindowManager.LayoutParams.SOFT_INPUT_STATE_UNCHANGED
- | WindowManager.LayoutParams.SOFT_INPUT_ADJUST_NOTHING;
-
- return lp;
- }
-
- @Override
- protected WindowManager.LayoutParams getSearchLayoutParams(LayoutParams layoutParams) {
- boolean opaque = false;
- WindowManager.LayoutParams lp = new WindowManager.LayoutParams(
- LayoutParams.MATCH_PARENT,
- LayoutParams.MATCH_PARENT,
- WindowManager.LayoutParams.TYPE_NAVIGATION_BAR_PANEL,
- WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN
- | WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM
- | WindowManager.LayoutParams.FLAG_SPLIT_TOUCH,
- (opaque ? PixelFormat.OPAQUE : PixelFormat.TRANSLUCENT));
- if (ActivityManager.isHighEndGfx()) {
- lp.flags |= WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED;
- } else {
- lp.flags |= WindowManager.LayoutParams.FLAG_DIM_BEHIND;
- lp.dimAmount = 0.7f;
- }
- lp.gravity = Gravity.BOTTOM | Gravity.START;
- lp.setTitle("SearchPanel");
- // TODO: Define custom animation for Search panel
- lp.windowAnimations = com.android.internal.R.style.Animation_RecentApplications;
- lp.softInputMode = WindowManager.LayoutParams.SOFT_INPUT_STATE_UNCHANGED
- | WindowManager.LayoutParams.SOFT_INPUT_ADJUST_NOTHING;
- return lp;
- }
-
- @Override
- protected void updateSearchPanel() {
- super.updateSearchPanel();
- mSearchPanelView.setStatusBarView(mStatusBarView);
- mStatusBarView.setDelegateView(mSearchPanelView);
- }
-
- @Override
- public void showSearchPanel() {
- super.showSearchPanel();
- WindowManager.LayoutParams lp =
- (android.view.WindowManager.LayoutParams) mStatusBarView.getLayoutParams();
- lp.flags &= ~WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL;
- mWindowManager.updateViewLayout(mStatusBarView, lp);
- }
-
- @Override
- public void hideSearchPanel() {
- super.hideSearchPanel();
- WindowManager.LayoutParams lp =
- (android.view.WindowManager.LayoutParams) mStatusBarView.getLayoutParams();
- lp.flags |= WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL;
- mWindowManager.updateViewLayout(mStatusBarView, lp);
- }
-
- public int getStatusBarHeight() {
- return mStatusBarView != null ? mStatusBarView.getHeight()
- : mContext.getResources().getDimensionPixelSize(
- com.android.internal.R.dimen.navigation_bar_height);
- }
-
- protected int getStatusBarGravity() {
- return Gravity.BOTTOM | Gravity.FILL_HORIZONTAL;
- }
-
- public void onBarHeightChanged(int height) {
- final WindowManager.LayoutParams lp
- = (WindowManager.LayoutParams)mStatusBarView.getLayoutParams();
- if (lp == null) {
- // haven't been added yet
- return;
- }
- if (lp.height != height) {
- lp.height = height;
- mWindowManager.updateViewLayout(mStatusBarView, lp);
- }
- }
-
- @Override
- protected BaseStatusBar.H createHandler() {
- return new TabletStatusBar.H();
- }
-
- private class H extends BaseStatusBar.H {
- public void handleMessage(Message m) {
- super.handleMessage(m);
- switch (m.what) {
- case MSG_OPEN_NOTIFICATION_PEEK:
- if (DEBUG) Log.d(TAG, "opening notification peek window; arg=" + m.arg1);
-
- if (m.arg1 >= 0) {
- final int N = mNotificationData.size();
-
- if (!mNotificationDNDMode) {
- if (mNotificationPeekIndex >= 0 && mNotificationPeekIndex < N) {
- NotificationData.Entry entry = mNotificationData.get(N-1-mNotificationPeekIndex);
- entry.icon.setBackgroundColor(0);
- mNotificationPeekIndex = -1;
- mNotificationPeekKey = null;
- }
- }
-
- final int peekIndex = m.arg1;
- if (peekIndex < N) {
- //Log.d(TAG, "loading peek: " + peekIndex);
- NotificationData.Entry entry =
- mNotificationDNDMode
- ? mNotificationDNDDummyEntry
- : mNotificationData.get(N-1-peekIndex);
- NotificationData.Entry copy = new NotificationData.Entry(
- entry.key,
- entry.notification,
- entry.icon);
- inflateViews(copy, mNotificationPeekRow);
-
- if (mNotificationDNDMode) {
- copy.content.setOnClickListener(new View.OnClickListener() {
- public void onClick(View v) {
- SharedPreferences.Editor editor = Prefs.edit(mContext);
- editor.putBoolean(Prefs.DO_NOT_DISTURB_PREF, false);
- editor.apply();
- animateCollapsePanels();
- visibilityChanged(false);
- }
- });
- }
-
- entry.icon.setBackgroundColor(0x20FFFFFF);
-
-// mNotificationPeekRow.setLayoutTransition(
-// peekIndex < mNotificationPeekIndex
-// ? mNotificationPeekScrubLeft
-// : mNotificationPeekScrubRight);
-
- mNotificationPeekRow.removeAllViews();
- mNotificationPeekRow.addView(copy.row);
-
- mNotificationPeekWindow.setVisibility(View.VISIBLE);
- mNotificationPanel.show(false, true);
-
- mNotificationPeekIndex = peekIndex;
- mNotificationPeekKey = entry.key;
- }
- }
- break;
- case MSG_CLOSE_NOTIFICATION_PEEK:
- if (DEBUG) Log.d(TAG, "closing notification peek window");
- mNotificationPeekWindow.setVisibility(View.GONE);
- mNotificationPeekRow.removeAllViews();
-
- final int N = mNotificationData.size();
- if (mNotificationPeekIndex >= 0 && mNotificationPeekIndex < N) {
- NotificationData.Entry entry =
- mNotificationDNDMode
- ? mNotificationDNDDummyEntry
- : mNotificationData.get(N-1-mNotificationPeekIndex);
- entry.icon.setBackgroundColor(0);
- }
-
- mNotificationPeekIndex = -1;
- mNotificationPeekKey = null;
- break;
- case MSG_OPEN_NOTIFICATION_PANEL:
- if (DEBUG) Log.d(TAG, "opening notifications panel");
- if (!mNotificationPanel.isShowing()) {
- mNotificationPanel.show(true, true);
- mNotificationArea.setVisibility(View.INVISIBLE);
- mTicker.halt();
- }
- break;
- case MSG_CLOSE_NOTIFICATION_PANEL:
- if (DEBUG) Log.d(TAG, "closing notifications panel");
- if (mNotificationPanel.isShowing()) {
- mNotificationPanel.show(false, true);
- mNotificationArea.setVisibility(View.VISIBLE);
- }
- break;
- case MSG_OPEN_INPUT_METHODS_PANEL:
- if (DEBUG) Log.d(TAG, "opening input methods panel");
- if (mInputMethodsPanel != null) mInputMethodsPanel.openPanel();
- break;
- case MSG_CLOSE_INPUT_METHODS_PANEL:
- if (DEBUG) Log.d(TAG, "closing input methods panel");
- if (mInputMethodsPanel != null) mInputMethodsPanel.closePanel(false);
- break;
- case MSG_OPEN_COMPAT_MODE_PANEL:
- if (DEBUG) Log.d(TAG, "opening compat panel");
- if (mCompatModePanel != null) mCompatModePanel.openPanel();
- break;
- case MSG_CLOSE_COMPAT_MODE_PANEL:
- if (DEBUG) Log.d(TAG, "closing compat panel");
- if (mCompatModePanel != null) mCompatModePanel.closePanel();
- break;
- case MSG_SHOW_CHROME:
- if (DEBUG) Log.d(TAG, "hiding shadows (lights on)");
- mBarContents.setVisibility(View.VISIBLE);
- mShadow.setVisibility(View.GONE);
- mSystemUiVisibility &= ~View.SYSTEM_UI_FLAG_LOW_PROFILE;
- notifyUiVisibilityChanged();
- break;
- case MSG_HIDE_CHROME:
- if (DEBUG) Log.d(TAG, "showing shadows (lights out)");
- animateCollapsePanels();
- visibilityChanged(false);
- mBarContents.setVisibility(View.GONE);
- mShadow.setVisibility(View.VISIBLE);
- mSystemUiVisibility |= View.SYSTEM_UI_FLAG_LOW_PROFILE;
- notifyUiVisibilityChanged();
- break;
- case MSG_STOP_TICKER:
- mTicker.halt();
- break;
- }
- }
- }
-
- public void addIcon(String slot, int index, int viewIndex, StatusBarIcon icon) {
- if (DEBUG) Log.d(TAG, "addIcon(" + slot + ") -> " + icon);
- }
-
- public void updateIcon(String slot, int index, int viewIndex,
- StatusBarIcon old, StatusBarIcon icon) {
- if (DEBUG) Log.d(TAG, "updateIcon(" + slot + ") -> " + icon);
- }
-
- public void removeIcon(String slot, int index, int viewIndex) {
- if (DEBUG) Log.d(TAG, "removeIcon(" + slot + ")");
- }
-
- public void addNotification(IBinder key, StatusBarNotification notification) {
- if (DEBUG) Log.d(TAG, "addNotification(" + key + " -> " + notification + ")");
- addNotificationViews(key, notification);
-
- final boolean immersive = isImmersive();
- if (false && immersive) {
- // TODO: immersive mode popups for tablet
- } else if (notification.getNotification().fullScreenIntent != null) {
- // not immersive & a full-screen alert should be shown
- Log.w(TAG, "Notification has fullScreenIntent and activity is not immersive;"
- + " sending fullScreenIntent");
- try {
- notification.getNotification().fullScreenIntent.send();
- } catch (PendingIntent.CanceledException e) {
- }
- } else {
- tick(key, notification, true);
- }
-
- setAreThereNotifications();
- }
-
- public void removeNotification(IBinder key) {
- if (DEBUG) Log.d(TAG, "removeNotification(" + key + ")");
- removeNotificationViews(key);
- mTicker.remove(key);
- setAreThereNotifications();
- }
-
- public void showClock(boolean show) {
- View clock = mBarContents.findViewById(R.id.clock);
- View network_text = mBarContents.findViewById(R.id.network_text);
- if (clock != null) {
- clock.setVisibility(show ? View.VISIBLE : View.GONE);
- }
- if (network_text != null) {
- network_text.setVisibility((!show) ? View.VISIBLE : View.GONE);
- }
- }
-
- public void disable(int state) {
- int old = mDisabled;
- int diff = state ^ old;
- mDisabled = state;
-
- // act accordingly
- if ((diff & StatusBarManager.DISABLE_CLOCK) != 0) {
- boolean show = (state & StatusBarManager.DISABLE_CLOCK) == 0;
- Log.i(TAG, "DISABLE_CLOCK: " + (show ? "no" : "yes"));
- showClock(show);
- }
- if ((diff & StatusBarManager.DISABLE_SYSTEM_INFO) != 0) {
- boolean show = (state & StatusBarManager.DISABLE_SYSTEM_INFO) == 0;
- Log.i(TAG, "DISABLE_SYSTEM_INFO: " + (show ? "no" : "yes"));
- mNotificationTrigger.setVisibility(show ? View.VISIBLE : View.GONE);
- }
- if ((diff & StatusBarManager.DISABLE_EXPAND) != 0) {
- if ((state & StatusBarManager.DISABLE_EXPAND) != 0) {
- Log.i(TAG, "DISABLE_EXPAND: yes");
- animateCollapsePanels();
- visibilityChanged(false);
- }
- }
- if ((diff & StatusBarManager.DISABLE_NOTIFICATION_ICONS) != 0) {
- mNotificationDNDMode = Prefs.read(mContext)
- .getBoolean(Prefs.DO_NOT_DISTURB_PREF, Prefs.DO_NOT_DISTURB_DEFAULT);
-
- if ((state & StatusBarManager.DISABLE_NOTIFICATION_ICONS) != 0) {
- Log.i(TAG, "DISABLE_NOTIFICATION_ICONS: yes" + (mNotificationDNDMode?" (DND)":""));
- mTicker.halt();
- } else {
- Log.i(TAG, "DISABLE_NOTIFICATION_ICONS: no" + (mNotificationDNDMode?" (DND)":""));
- }
-
- // refresh icons to show either notifications or the DND message
- reloadAllNotificationIcons();
- } else if ((diff & StatusBarManager.DISABLE_NOTIFICATION_TICKER) != 0) {
- if ((state & StatusBarManager.DISABLE_NOTIFICATION_TICKER) != 0) {
- mTicker.halt();
- }
- }
- if ((diff & (StatusBarManager.DISABLE_RECENT
- | StatusBarManager.DISABLE_BACK
- | StatusBarManager.DISABLE_HOME)) != 0) {
- setNavigationVisibility(state);
-
- if ((state & StatusBarManager.DISABLE_RECENT) != 0) {
- // close recents if it's visible
- mHandler.removeMessages(MSG_CLOSE_RECENTS_PANEL);
- mHandler.sendEmptyMessage(MSG_CLOSE_RECENTS_PANEL);
- }
- }
- }
-
- private void setNavigationVisibility(int visibility) {
- boolean disableHome = ((visibility & StatusBarManager.DISABLE_HOME) != 0);
- boolean disableRecent = ((visibility & StatusBarManager.DISABLE_RECENT) != 0);
- boolean disableBack = ((visibility & StatusBarManager.DISABLE_BACK) != 0);
-
- mBackButton.setVisibility(disableBack ? View.INVISIBLE : View.VISIBLE);
- mHomeButton.setVisibility(disableHome ? View.INVISIBLE : View.VISIBLE);
- mRecentButton.setVisibility(disableRecent ? View.INVISIBLE : View.VISIBLE);
-
- mInputMethodSwitchButton.setScreenLocked(
- (visibility & StatusBarManager.DISABLE_SYSTEM_INFO) != 0);
- }
-
- private boolean hasTicker(Notification n) {
- return n.tickerView != null || !TextUtils.isEmpty(n.tickerText);
- }
-
- @Override
- protected void tick(IBinder key, StatusBarNotification n, boolean firstTime) {
- // Don't show the ticker when the windowshade is open.
- if (mNotificationPanel.isShowing()) {
- return;
- }
- // If they asked for FLAG_ONLY_ALERT_ONCE, then only show this notification
- // if it's a new notification.
- if (!firstTime && (n.getNotification().flags & Notification.FLAG_ONLY_ALERT_ONCE) != 0) {
- return;
- }
- // Show the ticker if one is requested. Also don't do this
- // until status bar window is attached to the window manager,
- // because... well, what's the point otherwise? And trying to
- // run a ticker without being attached will crash!
- if (hasTicker(n.getNotification()) && mStatusBarView.getWindowToken() != null) {
- if (0 == (mDisabled & (StatusBarManager.DISABLE_NOTIFICATION_ICONS
- | StatusBarManager.DISABLE_NOTIFICATION_TICKER))) {
- mTicker.add(key, n);
- mFeedbackIconArea.setVisibility(View.GONE);
- }
- }
- }
-
- // called by TabletTicker when it's done with all queued ticks
- public void doneTicking() {
- mFeedbackIconArea.setVisibility(View.VISIBLE);
- }
-
- public void animateExpandNotificationsPanel() {
- mHandler.removeMessages(MSG_OPEN_NOTIFICATION_PANEL);
- mHandler.sendEmptyMessage(MSG_OPEN_NOTIFICATION_PANEL);
- }
-
- public void animateCollapsePanels() {
- animateCollapsePanels(CommandQueue.FLAG_EXCLUDE_NONE);
- }
-
- public void animateCollapsePanels(int flags) {
- if ((flags & CommandQueue.FLAG_EXCLUDE_NOTIFICATION_PANEL) == 0) {
- mHandler.removeMessages(MSG_CLOSE_NOTIFICATION_PANEL);
- mHandler.sendEmptyMessage(MSG_CLOSE_NOTIFICATION_PANEL);
- }
- if ((flags & CommandQueue.FLAG_EXCLUDE_RECENTS_PANEL) == 0) {
- mHandler.removeMessages(MSG_CLOSE_RECENTS_PANEL);
- mHandler.sendEmptyMessage(MSG_CLOSE_RECENTS_PANEL);
- }
- if ((flags & CommandQueue.FLAG_EXCLUDE_SEARCH_PANEL) == 0) {
- mHandler.removeMessages(MSG_CLOSE_SEARCH_PANEL);
- mHandler.sendEmptyMessage(MSG_CLOSE_SEARCH_PANEL);
- }
- if ((flags & CommandQueue.FLAG_EXCLUDE_INPUT_METHODS_PANEL) == 0) {
- mHandler.removeMessages(MSG_CLOSE_INPUT_METHODS_PANEL);
- mHandler.sendEmptyMessage(MSG_CLOSE_INPUT_METHODS_PANEL);
- }
- if ((flags & CommandQueue.FLAG_EXCLUDE_COMPAT_MODE_PANEL) == 0) {
- mHandler.removeMessages(MSG_CLOSE_COMPAT_MODE_PANEL);
- mHandler.sendEmptyMessage(MSG_CLOSE_COMPAT_MODE_PANEL);
- }
-
- }
-
- @Override
- public void animateExpandSettingsPanel() {
- // TODO: Implement when TabletStatusBar begins to be used.
- }
-
- @Override // CommandQueue
- public void setNavigationIconHints(int hints) {
- if (hints == mNavigationIconHints) return;
-
- if (DEBUG) {
- android.widget.Toast.makeText(mContext,
- "Navigation icon hints = " + hints,
- 500).show();
- }
-
- mNavigationIconHints = hints;
-
- mBackButton.setAlpha(
- (0 != (hints & StatusBarManager.NAVIGATION_HINT_BACK_NOP)) ? 0.5f : 1.0f);
- mHomeButton.setAlpha(
- (0 != (hints & StatusBarManager.NAVIGATION_HINT_HOME_NOP)) ? 0.5f : 1.0f);
- mRecentButton.setAlpha(
- (0 != (hints & StatusBarManager.NAVIGATION_HINT_RECENT_NOP)) ? 0.5f : 1.0f);
-
- mBackButton.setImageResource(
- (0 != (hints & StatusBarManager.NAVIGATION_HINT_BACK_ALT))
- ? R.drawable.ic_sysbar_back_ime
- : R.drawable.ic_sysbar_back);
- }
-
- private void notifyUiVisibilityChanged() {
- try {
- mWindowManagerService.statusBarVisibilityChanged(mSystemUiVisibility);
- } catch (RemoteException ex) {
- }
- }
-
- @Override // CommandQueue
- public void setSystemUiVisibility(int vis, int mask) {
- final int oldVal = mSystemUiVisibility;
- final int newVal = (oldVal&~mask) | (vis&mask);
- final int diff = newVal ^ oldVal;
-
- if (diff != 0) {
- mSystemUiVisibility = newVal;
-
- if (0 != (diff & View.SYSTEM_UI_FLAG_LOW_PROFILE)) {
- mHandler.removeMessages(MSG_HIDE_CHROME);
- mHandler.removeMessages(MSG_SHOW_CHROME);
- mHandler.sendEmptyMessage(0 == (vis & View.SYSTEM_UI_FLAG_LOW_PROFILE)
- ? MSG_SHOW_CHROME : MSG_HIDE_CHROME);
- }
-
- notifyUiVisibilityChanged();
- }
- }
-
- public void setLightsOn(boolean on) {
- // Policy note: if the frontmost activity needs the menu key, we assume it is a legacy app
- // that can't handle lights-out mode.
- if (mMenuButton.getVisibility() == View.VISIBLE) {
- on = true;
- }
-
- Log.v(TAG, "setLightsOn(" + on + ")");
- if (on) {
- setSystemUiVisibility(0, View.SYSTEM_UI_FLAG_LOW_PROFILE);
- } else {
- setSystemUiVisibility(View.SYSTEM_UI_FLAG_LOW_PROFILE, View.SYSTEM_UI_FLAG_LOW_PROFILE);
- }
- }
-
- public void topAppWindowChanged(boolean showMenu) {
- if (DEBUG) {
- Log.d(TAG, (showMenu?"showing":"hiding") + " the MENU button");
- }
- mMenuButton.setVisibility(showMenu ? View.VISIBLE : View.GONE);
-
- // See above re: lights-out policy for legacy apps.
- if (showMenu) setLightsOn(true);
-
- mCompatModeButton.refresh();
- if (mCompatModeButton.getVisibility() == View.VISIBLE) {
- if (DEBUG_COMPAT_HELP
- || ! Prefs.read(mContext).getBoolean(Prefs.SHOWN_COMPAT_MODE_HELP, false)) {
- showCompatibilityHelp();
- }
- } else {
- hideCompatibilityHelp();
- mCompatModePanel.closePanel();
- }
- }
-
- private void showCompatibilityHelp() {
- if (mCompatibilityHelpDialog != null) {
- return;
- }
-
- mCompatibilityHelpDialog = View.inflate(mContext, R.layout.compat_mode_help, null);
- View button = mCompatibilityHelpDialog.findViewById(R.id.button);
-
- button.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- hideCompatibilityHelp();
- SharedPreferences.Editor editor = Prefs.edit(mContext);
- editor.putBoolean(Prefs.SHOWN_COMPAT_MODE_HELP, true);
- editor.apply();
- }
- });
-
- WindowManager.LayoutParams lp = new WindowManager.LayoutParams(
- ViewGroup.LayoutParams.MATCH_PARENT,
- ViewGroup.LayoutParams.MATCH_PARENT,
- WindowManager.LayoutParams.TYPE_SYSTEM_DIALOG,
- WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN
- | WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS
- | WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM,
- PixelFormat.TRANSLUCENT);
- lp.setTitle("CompatibilityModeDialog");
- lp.softInputMode = WindowManager.LayoutParams.SOFT_INPUT_STATE_UNCHANGED
- | WindowManager.LayoutParams.SOFT_INPUT_ADJUST_NOTHING;
- lp.windowAnimations = com.android.internal.R.style.Animation_ZoomButtons; // simple fade
-
- mWindowManager.addView(mCompatibilityHelpDialog, lp);
- }
-
- private void hideCompatibilityHelp() {
- if (mCompatibilityHelpDialog != null) {
- mWindowManager.removeView(mCompatibilityHelpDialog);
- mCompatibilityHelpDialog = null;
- }
- }
-
- public void setImeWindowStatus(IBinder token, int vis, int backDisposition) {
- mInputMethodSwitchButton.setImeWindowStatus(token,
- (vis & InputMethodService.IME_ACTIVE) != 0);
- updateNotificationIcons();
- mInputMethodsPanel.setImeToken(token);
-
- boolean altBack = (backDisposition == InputMethodService.BACK_DISPOSITION_WILL_DISMISS)
- || ((vis & InputMethodService.IME_VISIBLE) != 0);
- mAltBackButtonEnabledForIme = altBack;
-
- mCommandQueue.setNavigationIconHints(
- altBack ? (mNavigationIconHints | StatusBarManager.NAVIGATION_HINT_BACK_ALT)
- : (mNavigationIconHints & ~StatusBarManager.NAVIGATION_HINT_BACK_ALT));
-
- if (FAKE_SPACE_BAR) {
- mFakeSpaceBar.setVisibility(((vis & InputMethodService.IME_VISIBLE) != 0)
- ? View.VISIBLE : View.GONE);
- }
- }
-
- @Override
- public void setHardKeyboardStatus(boolean available, boolean enabled) {
- if (DEBUG) {
- Log.d(TAG, "Set hard keyboard status: available=" + available
- + ", enabled=" + enabled);
- }
- mInputMethodSwitchButton.setHardKeyboardStatus(available);
- updateNotificationIcons();
- mInputMethodsPanel.setHardKeyboardStatus(available, enabled);
- }
-
- @Override
- public void onHardKeyboardEnabledChange(boolean enabled) {
- try {
- mBarService.setHardKeyboardEnabled(enabled);
- } catch (RemoteException ex) {
- }
- }
-
- private boolean isImmersive() {
- try {
- return ActivityManagerNative.getDefault().isTopActivityImmersive();
- //Log.d(TAG, "Top activity is " + (immersive?"immersive":"not immersive"));
- } catch (RemoteException ex) {
- // the end is nigh
- return false;
- }
- }
-
- @Override
- protected void setAreThereNotifications() {
- if (mNotificationPanel != null) {
- mNotificationPanel.setClearable(isDeviceProvisioned() && mNotificationData.hasClearableItems());
- }
- }
-
- private View.OnClickListener mOnClickListener = new View.OnClickListener() {
- public void onClick(View v) {
- if (v == mRecentButton) {
- onClickRecentButton();
- } else if (v == mInputMethodSwitchButton) {
- onClickInputMethodSwitchButton();
- } else if (v == mCompatModeButton) {
- onClickCompatModeButton();
- }
- }
- };
-
- public void onClickRecentButton() {
- if (DEBUG) Log.d(TAG, "clicked recent apps; disabled=" + mDisabled);
- if ((mDisabled & StatusBarManager.DISABLE_EXPAND) == 0) {
- toggleRecentApps();
- }
- }
-
- public void onClickInputMethodSwitchButton() {
- if (DEBUG) Log.d(TAG, "clicked input methods panel; disabled=" + mDisabled);
- int msg = (mInputMethodsPanel.getVisibility() == View.GONE) ?
- MSG_OPEN_INPUT_METHODS_PANEL : MSG_CLOSE_INPUT_METHODS_PANEL;
- mHandler.removeMessages(msg);
- mHandler.sendEmptyMessage(msg);
- }
-
- public void onClickCompatModeButton() {
- int msg = (mCompatModePanel.getVisibility() == View.GONE) ?
- MSG_OPEN_COMPAT_MODE_PANEL : MSG_CLOSE_COMPAT_MODE_PANEL;
- mHandler.removeMessages(msg);
- mHandler.sendEmptyMessage(msg);
- }
-
- private class NotificationTriggerTouchListener implements View.OnTouchListener {
- VelocityTracker mVT;
- float mInitialTouchX, mInitialTouchY;
- int mTouchSlop;
-
- public NotificationTriggerTouchListener() {
- mTouchSlop = ViewConfiguration.get(getContext()).getScaledTouchSlop();
- }
-
- private Runnable mHiliteOnR = new Runnable() { public void run() {
- mNotificationArea.setBackgroundResource(
- com.android.internal.R.drawable.list_selector_pressed_holo_dark);
- }};
- public void hilite(final boolean on) {
- if (on) {
- mNotificationArea.postDelayed(mHiliteOnR, 100);
- } else {
- mNotificationArea.removeCallbacks(mHiliteOnR);
- mNotificationArea.setBackground(null);
- }
- }
-
- public boolean onTouch(View v, MotionEvent event) {
-// Log.d(TAG, String.format("touch: (%.1f, %.1f) initial: (%.1f, %.1f)",
-// event.getX(),
-// event.getY(),
-// mInitialTouchX,
-// mInitialTouchY));
-
- if ((mDisabled & StatusBarManager.DISABLE_EXPAND) != 0) {
- return true;
- }
-
- final int action = event.getAction();
- switch (action) {
- case MotionEvent.ACTION_DOWN:
- mVT = VelocityTracker.obtain();
- mInitialTouchX = event.getX();
- mInitialTouchY = event.getY();
- hilite(true);
- // fall through
- case MotionEvent.ACTION_OUTSIDE:
- case MotionEvent.ACTION_MOVE:
- // check for fling
- if (mVT != null) {
- mVT.addMovement(event);
- mVT.computeCurrentVelocity(1000); // pixels per second
- // require a little more oomph once we're already in peekaboo mode
- if (mVT.getYVelocity() < -mNotificationFlingVelocity) {
- animateExpandNotificationsPanel();
- visibilityChanged(true);
- hilite(false);
- mVT.recycle();
- mVT = null;
- }
- }
- return true;
- case MotionEvent.ACTION_UP:
- case MotionEvent.ACTION_CANCEL:
- hilite(false);
- if (mVT != null) {
- if (action == MotionEvent.ACTION_UP
- // was this a sloppy tap?
- && Math.abs(event.getX() - mInitialTouchX) < mTouchSlop
- && Math.abs(event.getY() - mInitialTouchY) < (mTouchSlop / 3)
- // dragging off the bottom doesn't count
- && (int)event.getY() < v.getBottom()) {
- animateExpandNotificationsPanel();
- visibilityChanged(true);
- v.sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_CLICKED);
- v.playSoundEffect(SoundEffectConstants.CLICK);
- }
-
- mVT.recycle();
- mVT = null;
- return true;
- }
- }
- return false;
- }
- }
-
- public void resetNotificationPeekFadeTimer() {
- if (DEBUG) {
- Log.d(TAG, "setting peek fade timer for " + NOTIFICATION_PEEK_FADE_DELAY
- + "ms from now");
- }
- mHandler.removeMessages(MSG_CLOSE_NOTIFICATION_PEEK);
- mHandler.sendEmptyMessageDelayed(MSG_CLOSE_NOTIFICATION_PEEK,
- NOTIFICATION_PEEK_FADE_DELAY);
- }
-
- private void reloadAllNotificationIcons() {
- if (mIconLayout == null) return;
- mIconLayout.removeAllViews();
- updateNotificationIcons();
- }
-
- @Override
- protected void updateNotificationIcons() {
- // XXX: need to implement a new limited linear layout class
- // to avoid removing & readding everything
-
- if (mIconLayout == null) return;
-
- // first, populate the main notification panel
- loadNotificationPanel();
-
- final LinearLayout.LayoutParams params
- = new LinearLayout.LayoutParams(mIconSize + 2*mIconHPadding, mNaturalBarHeight);
-
- // alternate behavior in DND mode
- if (mNotificationDNDMode) {
- if (mIconLayout.getChildCount() == 0) {
- final Notification dndNotification = new Notification.Builder(mContext)
- .setContentTitle(mContext.getText(R.string.notifications_off_title))
- .setContentText(mContext.getText(R.string.notifications_off_text))
- .setSmallIcon(R.drawable.ic_notification_dnd)
- .setOngoing(true)
- .getNotification();
-
- final StatusBarIconView iconView = new StatusBarIconView(mContext, "_dnd",
- dndNotification);
- iconView.setImageResource(R.drawable.ic_notification_dnd);
- iconView.setScaleType(ImageView.ScaleType.CENTER_INSIDE);
- iconView.setPadding(mIconHPadding, 0, mIconHPadding, 0);
-
- mNotificationDNDDummyEntry = new NotificationData.Entry(
- null, new StatusBarNotification("", 0, "", 0, 0, Notification.PRIORITY_MAX,
- dndNotification, android.os.Process.myUserHandle()), iconView);
-
- mIconLayout.addView(iconView, params);
- }
-
- return;
- } else if (0 != (mDisabled & StatusBarManager.DISABLE_NOTIFICATION_ICONS)) {
- // if icons are disabled but we're not in DND mode, this is probably Setup and we should
- // just leave the area totally empty
- return;
- }
-
- int N = mNotificationData.size();
-
- if (DEBUG) {
- Log.d(TAG, "refreshing icons: " + N + " notifications, mIconLayout=" + mIconLayout);
- }
-
- ArrayList<View> toShow = new ArrayList<View>();
-
- // Extra Special Icons
- // The IME switcher and compatibility mode icons take the place of notifications. You didn't
- // need to see all those new emails, did you?
- int maxNotificationIconsCount = mMaxNotificationIcons;
- if (mInputMethodSwitchButton.getVisibility() != View.GONE) maxNotificationIconsCount --;
- if (mCompatModeButton.getVisibility() != View.GONE) maxNotificationIconsCount --;
-
- final boolean provisioned = isDeviceProvisioned();
- // If the device hasn't been through Setup, we only show system notifications
- for (int i=0; toShow.size()< maxNotificationIconsCount; i++) {
- if (i >= N) break;
- Entry ent = mNotificationData.get(N-i-1);
- if ((provisioned && ent.notification.getScore() >= HIDE_ICONS_BELOW_SCORE)
- || showNotificationEvenIfUnprovisioned(ent.notification)) {
- toShow.add(ent.icon);
- }
- }
-
- ArrayList<View> toRemove = new ArrayList<View>();
- for (int i=0; i<mIconLayout.getChildCount(); i++) {
- View child = mIconLayout.getChildAt(i);
- if (!toShow.contains(child)) {
- toRemove.add(child);
- }
- }
-
- for (View remove : toRemove) {
- mIconLayout.removeView(remove);
- }
-
- for (int i=0; i<toShow.size(); i++) {
- View v = toShow.get(i);
- v.setPadding(mIconHPadding, 0, mIconHPadding, 0);
- if (v.getParent() == null) {
- mIconLayout.addView(v, i, params);
- }
- }
- }
-
- private void loadNotificationPanel() {
- int N = mNotificationData.size();
-
- ArrayList<View> toShow = new ArrayList<View>();
-
- final boolean provisioned = isDeviceProvisioned();
- // If the device hasn't been through Setup, we only show system notifications
- for (int i=0; i<N; i++) {
- Entry ent = mNotificationData.get(N-i-1);
- if (provisioned || showNotificationEvenIfUnprovisioned(ent.notification)) {
- toShow.add(ent.row);
- }
- }
-
- ArrayList<View> toRemove = new ArrayList<View>();
- for (int i=0; i<mPile.getChildCount(); i++) {
- View child = mPile.getChildAt(i);
- if (!toShow.contains(child)) {
- toRemove.add(child);
- }
- }
-
- for (View remove : toRemove) {
- mPile.removeView(remove);
- }
-
- for (int i=0; i<toShow.size(); i++) {
- View v = toShow.get(i);
- if (v.getParent() == null) {
- // the notification panel has the most important things at the bottom
- mPile.addView(v, Math.min(toShow.size()-1-i, mPile.getChildCount()));
- }
- }
-
- mNotificationPanel.setNotificationCount(toShow.size());
- mNotificationPanel.setSettingsEnabled(isDeviceProvisioned());
- }
-
- @Override
- protected void workAroundBadLayerDrawableOpacity(View v) {
- Drawable bgd = v.getBackground();
- if (!(bgd instanceof LayerDrawable)) return;
-
- LayerDrawable d = (LayerDrawable) bgd;
- v.setBackground(null);
- d.setOpacity(PixelFormat.TRANSLUCENT);
- v.setBackground(d);
- }
-
- public void clearAll() {
- try {
- mBarService.onClearAllNotifications();
- } catch (RemoteException ex) {
- // system process is dead if we're here.
- }
- animateCollapsePanels();
- visibilityChanged(false);
- }
-
- private BroadcastReceiver mBroadcastReceiver = new BroadcastReceiver() {
- public void onReceive(Context context, Intent intent) {
- String action = intent.getAction();
- if (Intent.ACTION_CLOSE_SYSTEM_DIALOGS.equals(action)
- || Intent.ACTION_SCREEN_OFF.equals(action)) {
- int flags = CommandQueue.FLAG_EXCLUDE_NONE;
- if (Intent.ACTION_CLOSE_SYSTEM_DIALOGS.equals(action)) {
- String reason = intent.getStringExtra("reason");
- if (reason != null && reason.equals(SYSTEM_DIALOG_REASON_RECENT_APPS)) {
- flags |= CommandQueue.FLAG_EXCLUDE_RECENTS_PANEL;
- }
- }
- animateCollapsePanels(flags);
- }
- }
- };
-
- public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
- pw.print("mDisabled=0x");
- pw.println(Integer.toHexString(mDisabled));
- pw.println("mNetworkController:");
- mNetworkController.dump(fd, pw, args);
- }
-
- @Override
- protected boolean isTopNotification(ViewGroup parent, NotificationData.Entry entry) {
- if (parent == null || entry == null) return false;
- return parent.indexOfChild(entry.row) == parent.getChildCount()-1;
- }
-
- @Override
- protected void haltTicker() {
- mTicker.halt();
- }
-
- @Override
- protected void updateExpandedViewPos(int expandedPosition) {
- }
-
- @Override
- protected boolean shouldDisableNavbarGestures() {
- return mNotificationPanel.getVisibility() == View.VISIBLE
- || (mDisabled & StatusBarManager.DISABLE_HOME) != 0;
- }
-}
-
-
+++ /dev/null
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.systemui.statusbar.tablet;
-
-import android.content.Context;
-import android.os.Handler;
-import android.util.AttributeSet;
-import android.util.Log;
-import android.view.MotionEvent;
-import android.view.View;
-import android.widget.FrameLayout;
-
-import com.android.systemui.R;
-import com.android.systemui.statusbar.BaseStatusBar;
-import com.android.systemui.statusbar.DelegateViewHelper;
-
-public class TabletStatusBarView extends FrameLayout {
- private Handler mHandler;
-
- private final int MAX_PANELS = 5;
- private final View[] mIgnoreChildren = new View[MAX_PANELS];
- private final View[] mPanels = new View[MAX_PANELS];
- private final int[] mPos = new int[2];
- private DelegateViewHelper mDelegateHelper;
-
- public TabletStatusBarView(Context context) {
- this(context, null);
- }
-
- public TabletStatusBarView(Context context, AttributeSet attrs) {
- super(context, attrs);
- mDelegateHelper = new DelegateViewHelper(this);
- }
-
- public void setDelegateView(View view) {
- mDelegateHelper.setDelegateView(view);
- }
-
- public void setBar(BaseStatusBar phoneStatusBar) {
- mDelegateHelper.setBar(phoneStatusBar);
- }
-
- @Override
- public boolean onTouchEvent(MotionEvent event) {
- if (mDelegateHelper != null) {
- mDelegateHelper.onInterceptTouchEvent(event);
- }
- return true;
- }
-
- @Override
- protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
- super.onLayout(changed, left, top, right, bottom);
- // Find the view we wish to grab events from in order to detect search gesture.
- // Depending on the device, this will be one of the id's listed below.
- // If we don't find one, we'll use the view provided in the constructor above (this view).
- View view = findViewById(R.id.navigationArea);
- if (view == null) {
- view = findViewById(R.id.nav_buttons);
- }
- mDelegateHelper.setSourceView(view);
- mDelegateHelper.setInitialTouchRegion(view);
- }
-
- @Override
- public boolean onInterceptTouchEvent(MotionEvent ev) {
- if (ev.getAction() == MotionEvent.ACTION_DOWN) {
- if (TabletStatusBar.DEBUG) {
- Log.d(TabletStatusBar.TAG, "TabletStatusBarView intercepting touch event: " + ev);
- }
- // do not close the recents panel here- the intended behavior is that recents is dismissed
- // on touch up when clicking on status bar buttons
- // TODO: should we be closing the notification panel and input methods panel?
- mHandler.removeMessages(TabletStatusBar.MSG_CLOSE_NOTIFICATION_PANEL);
- mHandler.sendEmptyMessage(TabletStatusBar.MSG_CLOSE_NOTIFICATION_PANEL);
- mHandler.removeMessages(TabletStatusBar.MSG_CLOSE_INPUT_METHODS_PANEL);
- mHandler.sendEmptyMessage(TabletStatusBar.MSG_CLOSE_INPUT_METHODS_PANEL);
- mHandler.removeMessages(TabletStatusBar.MSG_STOP_TICKER);
- mHandler.sendEmptyMessage(TabletStatusBar.MSG_STOP_TICKER);
-
- for (int i=0; i < mPanels.length; i++) {
- if (mPanels[i] != null && mPanels[i].getVisibility() == View.VISIBLE) {
- if (eventInside(mIgnoreChildren[i], ev)) {
- if (TabletStatusBar.DEBUG) {
- Log.d(TabletStatusBar.TAG,
- "TabletStatusBarView eating event for view: "
- + mIgnoreChildren[i]);
- }
- return true;
- }
- }
- }
- }
- if (TabletStatusBar.DEBUG) {
- Log.d(TabletStatusBar.TAG, "TabletStatusBarView not intercepting event");
- }
- if (mDelegateHelper != null && mDelegateHelper.onInterceptTouchEvent(ev)) {
- return true;
- }
- return super.onInterceptTouchEvent(ev);
- }
-
- private boolean eventInside(View v, MotionEvent ev) {
- // assume that x and y are window coords because we are.
- final int x = (int)ev.getX();
- final int y = (int)ev.getY();
-
- final int[] p = mPos;
- v.getLocationInWindow(p);
-
- final int l = p[0];
- final int t = p[1];
- final int r = p[0] + v.getWidth();
- final int b = p[1] + v.getHeight();
-
- return x >= l && x < r && y >= t && y < b;
- }
-
- public void setHandler(Handler h) {
- mHandler = h;
- }
-
- /**
- * Let the status bar know that if you tap on ignore while panel is showing, don't do anything.
- *
- * Debounces taps on, say, a popup's trigger when the popup is already showing.
- */
- public void setIgnoreChildren(int index, View ignore, View panel) {
- mIgnoreChildren[index] = ignore;
- mPanels[index] = panel;
- }
-}
+++ /dev/null
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.systemui.statusbar.tablet;
-
-import android.animation.LayoutTransition;
-import android.app.Notification;
-import android.app.PendingIntent;
-import android.content.Context;
-import android.content.res.Resources;
-import android.graphics.PixelFormat;
-import android.graphics.drawable.Drawable;
-import android.os.Handler;
-import android.os.IBinder;
-import android.os.Message;
-import android.service.notification.StatusBarNotification;
-import android.util.Log;
-import android.view.Gravity;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-import android.view.WindowManager;
-import android.widget.FrameLayout;
-import android.widget.ImageView;
-import android.widget.TextView;
-
-import com.android.internal.statusbar.StatusBarIcon;
-import com.android.systemui.R;
-import com.android.systemui.statusbar.StatusBarIconView;
-
-import java.util.Arrays;
-
-public class TabletTicker
- extends Handler
- implements LayoutTransition.TransitionListener {
-
- private static final String TAG = "StatusBar.TabletTicker";
-
- private static final boolean CLICKABLE_TICKER = true;
-
- // 3 is enough to let us see most cases, but not get so far behind that it's too annoying.
- private static final int QUEUE_LENGTH = 3;
-
- private static final int MSG_ADVANCE = 1;
-
- private static final int ADVANCE_DELAY = 5000; // 5 seconds
-
- private final Context mContext;
- private final WindowManager mWindowManager;
-
- private ViewGroup mWindow;
- private IBinder mCurrentKey;
- private StatusBarNotification mCurrentNotification;
- private View mCurrentView;
-
- private IBinder[] mKeys = new IBinder[QUEUE_LENGTH];
- private StatusBarNotification[] mQueue = new StatusBarNotification[QUEUE_LENGTH];
- private int mQueuePos;
-
- private final int mLargeIconHeight;
-
- private TabletStatusBar mBar;
-
- private LayoutTransition mLayoutTransition;
- private boolean mWindowShouldClose;
-
- public TabletTicker(TabletStatusBar bar) {
- mBar = bar;
- mContext = bar.getContext();
- mWindowManager = (WindowManager)mContext.getSystemService(Context.WINDOW_SERVICE);
- final Resources res = mContext.getResources();
- mLargeIconHeight = res.getDimensionPixelSize(
- android.R.dimen.notification_large_icon_height);
- }
-
- public void add(IBinder key, StatusBarNotification notification) {
- if (false) {
- Log.d(TAG, "add 1 mCurrentNotification=" + mCurrentNotification
- + " mQueuePos=" + mQueuePos + " mQueue=" + Arrays.toString(mQueue));
- }
-
- // If it's already in here, remove whatever's in there and put the new one at the end.
- remove(key, false);
-
- mKeys[mQueuePos] = key;
- mQueue[mQueuePos] = notification;
-
- // If nothing is running now, start the next one.
- if (mQueuePos == 0 && mCurrentNotification == null) {
- sendEmptyMessage(MSG_ADVANCE);
- }
-
- if (mQueuePos < QUEUE_LENGTH - 1) {
- mQueuePos++;
- }
- }
-
- public void remove(IBinder key) {
- remove(key, true);
- }
-
- public void remove(IBinder key, boolean advance) {
- if (mCurrentKey == key) {
- // Showing now
- if (advance) {
- removeMessages(MSG_ADVANCE);
- sendEmptyMessage(MSG_ADVANCE);
- }
- } else {
- // In the queue
- for (int i=0; i<QUEUE_LENGTH; i++) {
- if (mKeys[i] == key) {
- for (; i<QUEUE_LENGTH-1; i++) {
- mKeys[i] = mKeys[i+1];
- mQueue[i] = mQueue[i+1];
- }
- mKeys[QUEUE_LENGTH-1] = null;
- mQueue[QUEUE_LENGTH-1] = null;
- if (mQueuePos > 0) {
- mQueuePos--;
- }
- break;
- }
- }
- }
- }
-
- public void halt() {
- removeMessages(MSG_ADVANCE);
- if (mCurrentView != null || mQueuePos != 0) {
- for (int i=0; i<QUEUE_LENGTH; i++) {
- mKeys[i] = null;
- mQueue[i] = null;
- }
- mQueuePos = 0;
- sendEmptyMessage(MSG_ADVANCE);
- }
- }
-
- public void handleMessage(Message msg) {
- switch (msg.what) {
- case MSG_ADVANCE:
- advance();
- break;
- }
- }
-
- private void advance() {
- // Out with the old...
- if (mCurrentView != null) {
- if (mWindow != null) {
- mWindow.removeView(mCurrentView);
- }
- mCurrentView = null;
- mCurrentKey = null;
- mCurrentNotification = null;
- }
-
- // In with the new...
- dequeue();
- while (mCurrentNotification != null) {
- mCurrentView = makeTickerView(mCurrentNotification);
- if (mCurrentView != null) {
- if (mWindow == null) {
- mWindow = makeWindow();
- mWindowManager.addView(mWindow, mWindow.getLayoutParams());
- }
-
- mWindow.addView(mCurrentView);
- sendEmptyMessageDelayed(MSG_ADVANCE, ADVANCE_DELAY);
- break;
- }
- dequeue();
- }
-
- // if there's nothing left, close the window
- mWindowShouldClose = (mCurrentView == null && mWindow != null);
- }
-
- private void dequeue() {
- mCurrentKey = mKeys[0];
- mCurrentNotification = mQueue[0];
- if (false) {
- Log.d(TAG, "dequeue mQueuePos=" + mQueuePos + " mQueue=" + Arrays.toString(mQueue));
- }
- final int N = mQueuePos;
- for (int i=0; i<N; i++) {
- mKeys[i] = mKeys[i+1];
- mQueue[i] = mQueue[i+1];
- }
- mKeys[N] = null;
- mQueue[N] = null;
- if (mQueuePos > 0) {
- mQueuePos--;
- }
- }
-
- private ViewGroup makeWindow() {
- final Resources res = mContext.getResources();
- final FrameLayout view = new FrameLayout(mContext);
- final int width = res.getDimensionPixelSize(R.dimen.notification_ticker_width);
- int windowFlags = WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN
- | WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE
- | WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS;
- if (CLICKABLE_TICKER) {
- windowFlags |= WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL;
- } else {
- windowFlags |= WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE;
- }
- WindowManager.LayoutParams lp = new WindowManager.LayoutParams(width, mLargeIconHeight,
- WindowManager.LayoutParams.TYPE_NAVIGATION_BAR_PANEL, windowFlags,
- PixelFormat.TRANSLUCENT);
- lp.gravity = Gravity.BOTTOM | Gravity.END;
-// lp.windowAnimations = com.android.internal.R.style.Animation_Toast;
-
- mLayoutTransition = new LayoutTransition();
- mLayoutTransition.addTransitionListener(this);
- view.setLayoutTransition(mLayoutTransition);
- lp.setTitle("NotificationTicker");
- view.setLayoutParams(lp);
- return view;
- }
-
- public void startTransition(LayoutTransition transition, ViewGroup container,
- View view, int transitionType) {}
-
- public void endTransition(LayoutTransition transition, ViewGroup container,
- View view, int transitionType) {
- if (mWindowShouldClose) {
- mWindowManager.removeView(mWindow);
- mWindow = null;
- mWindowShouldClose = false;
- mBar.doneTicking();
- }
- }
-
- private View makeTickerView(StatusBarNotification notification) {
- final Notification n = notification.getNotification();
-
- LayoutInflater inflater = (LayoutInflater)mContext.getSystemService(
- Context.LAYOUT_INFLATER_SERVICE);
-
- ViewGroup group;
- int layoutId;
- int iconId;
- if (n.largeIcon != null) {
- iconId = R.id.right_icon;
- } else {
- iconId = R.id.left_icon;
- }
- if (n.tickerView != null) {
- group = (ViewGroup)inflater.inflate(R.layout.system_bar_ticker_panel, null, false);
- ViewGroup content = (FrameLayout) group.findViewById(R.id.ticker_expanded);
- View expanded = null;
- Exception exception = null;
- try {
- expanded = n.tickerView.apply(mContext, content);
- }
- catch (RuntimeException e) {
- exception = e;
- }
- if (expanded == null) {
- final String ident = notification.getPackageName()
- + "/0x" + Integer.toHexString(notification.getId());
- Log.e(TAG, "couldn't inflate view for notification " + ident, exception);
- return null;
- }
- FrameLayout.LayoutParams lp = new FrameLayout.LayoutParams(
- ViewGroup.LayoutParams.MATCH_PARENT,
- ViewGroup.LayoutParams.MATCH_PARENT);
- content.addView(expanded, lp);
- } else if (n.tickerText != null) {
- group = (ViewGroup)inflater.inflate(R.layout.system_bar_ticker_compat, mWindow, false);
- final Drawable icon = StatusBarIconView.getIcon(mContext,
- new StatusBarIcon(notification.getPackageName(), notification.getUser(), n.icon, n.iconLevel, 0,
- n.tickerText));
- ImageView iv = (ImageView)group.findViewById(iconId);
- iv.setImageDrawable(icon);
- iv.setVisibility(View.VISIBLE);
- TextView tv = (TextView)group.findViewById(R.id.text);
- tv.setText(n.tickerText);
- } else {
- throw new RuntimeException("tickerView==null && tickerText==null");
- }
- ImageView largeIcon = (ImageView)group.findViewById(R.id.large_icon);
- if (n.largeIcon != null) {
- largeIcon.setImageBitmap(n.largeIcon);
- largeIcon.setVisibility(View.VISIBLE);
- final ViewGroup.LayoutParams lp = largeIcon.getLayoutParams();
- final int statusBarHeight = mBar.getStatusBarHeight();
- if (n.largeIcon.getHeight() <= statusBarHeight) {
- // for smallish largeIcons, it looks a little odd to have them floating halfway up
- // the ticker, so we vertically center them in the status bar area instead
- lp.height = statusBarHeight;
- } else {
- lp.height = mLargeIconHeight;
- }
- largeIcon.setLayoutParams(lp);
- }
-
- if (CLICKABLE_TICKER) {
- PendingIntent contentIntent = notification.getNotification().contentIntent;
- if (contentIntent != null) {
- // create the usual notification clicker, but chain it together with a halt() call
- // to abort the ticker too
- final View.OnClickListener clicker = mBar.makeClicker(contentIntent,
- notification.getPackageName(), notification.getTag(), notification.getId());
- group.setOnClickListener(new View.OnClickListener() {
- public void onClick(View v) {
- halt();
- clicker.onClick(v);
- }
- });
- } else {
- group.setOnClickListener(null);
- }
- }
-
- return group;
- }
-}
-