diff options
author | Jorim Jaggi <jjaggi@google.com> | 2014-08-04 22:49:41 +0200 |
---|---|---|
committer | Jorim Jaggi <jjaggi@google.com> | 2014-08-05 15:24:26 +0200 |
commit | f479792e05485a536c3fa68db9d8a71f34591b78 (patch) | |
tree | fa7b98bf149c8f75d2ceb599e98f52d8a0bbc4e6 /packages/SystemUI | |
parent | 05204dc2275e0292d902884c6ec298d2e6afdd98 (diff) | |
download | frameworks_base-f479792e05485a536c3fa68db9d8a71f34591b78.zip frameworks_base-f479792e05485a536c3fa68db9d8a71f34591b78.tar.gz frameworks_base-f479792e05485a536c3fa68db9d8a71f34591b78.tar.bz2 |
New swipe-up assist animation for L.
Bug: 16307470
Bug: 14623152
Change-Id: Ib7e0381d118bda177981cc56ec9a8fb418dfb0e3
Diffstat (limited to 'packages/SystemUI')
30 files changed, 468 insertions, 491 deletions
diff --git a/packages/SystemUI/res/drawable-hdpi/ic_action_assist_generic_activated.png b/packages/SystemUI/res/drawable-hdpi/ic_action_assist_generic_activated.png Binary files differdeleted file mode 100644 index c0e2098..0000000 --- a/packages/SystemUI/res/drawable-hdpi/ic_action_assist_generic_activated.png +++ /dev/null diff --git a/packages/SystemUI/res/drawable-hdpi/ic_action_assist_generic_normal.png b/packages/SystemUI/res/drawable-hdpi/ic_action_assist_generic_normal.png Binary files differdeleted file mode 100644 index a852e2c..0000000 --- a/packages/SystemUI/res/drawable-hdpi/ic_action_assist_generic_normal.png +++ /dev/null diff --git a/packages/SystemUI/res/drawable-land/search_panel_scrim.xml b/packages/SystemUI/res/drawable-land/search_panel_scrim.xml new file mode 100644 index 0000000..102cc9c --- /dev/null +++ b/packages/SystemUI/res/drawable-land/search_panel_scrim.xml @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="utf-8"?> + +<!-- + ~ Copyright (C) 2014 The Android Open Source Project + ~ + ~ Licensed under the Apache License, Version 2.0 (the "License"); + ~ you may not use this file except in compliance with the License. + ~ You may obtain a copy of the License at + ~ + ~ http://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, software + ~ distributed under the License is distributed on an "AS IS" BASIS, + ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + ~ See the License for the specific language governing permissions and + ~ limitations under the License + --> + +<shape xmlns:android="http://schemas.android.com/apk/res/android"> + <gradient + android:type="linear" + android:angle="180" + android:startColor="#55000000" + android:endColor="#00000000" /> +</shape>
\ No newline at end of file diff --git a/packages/SystemUI/res/drawable-mdpi/ic_action_assist_generic_activated.png b/packages/SystemUI/res/drawable-mdpi/ic_action_assist_generic_activated.png Binary files differdeleted file mode 100644 index f88f7e1..0000000 --- a/packages/SystemUI/res/drawable-mdpi/ic_action_assist_generic_activated.png +++ /dev/null diff --git a/packages/SystemUI/res/drawable-mdpi/ic_action_assist_generic_normal.png b/packages/SystemUI/res/drawable-mdpi/ic_action_assist_generic_normal.png Binary files differdeleted file mode 100644 index 7426994..0000000 --- a/packages/SystemUI/res/drawable-mdpi/ic_action_assist_generic_normal.png +++ /dev/null diff --git a/packages/SystemUI/res/drawable-sw600dp/search_panel_scrim.xml b/packages/SystemUI/res/drawable-sw600dp/search_panel_scrim.xml new file mode 100644 index 0000000..bbb2617 --- /dev/null +++ b/packages/SystemUI/res/drawable-sw600dp/search_panel_scrim.xml @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="utf-8"?> + +<!-- + ~ Copyright (C) 2014 The Android Open Source Project + ~ + ~ Licensed under the Apache License, Version 2.0 (the "License"); + ~ you may not use this file except in compliance with the License. + ~ You may obtain a copy of the License at + ~ + ~ http://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, software + ~ distributed under the License is distributed on an "AS IS" BASIS, + ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + ~ See the License for the specific language governing permissions and + ~ limitations under the License + --> + +<shape xmlns:android="http://schemas.android.com/apk/res/android"> + <gradient + android:type="linear" + android:angle="90" + android:startColor="#55000000" + android:endColor="#00000000" /> +</shape>
\ No newline at end of file diff --git a/packages/SystemUI/res/drawable-xhdpi/ic_action_assist_generic_activated.png b/packages/SystemUI/res/drawable-xhdpi/ic_action_assist_generic_activated.png Binary files differdeleted file mode 100644 index 500b157..0000000 --- a/packages/SystemUI/res/drawable-xhdpi/ic_action_assist_generic_activated.png +++ /dev/null diff --git a/packages/SystemUI/res/drawable-xhdpi/ic_action_assist_generic_normal.png b/packages/SystemUI/res/drawable-xhdpi/ic_action_assist_generic_normal.png Binary files differdeleted file mode 100644 index d0e4cf3..0000000 --- a/packages/SystemUI/res/drawable-xhdpi/ic_action_assist_generic_normal.png +++ /dev/null diff --git a/packages/SystemUI/res/drawable-xxhdpi/ic_action_assist_generic_activated.png b/packages/SystemUI/res/drawable-xxhdpi/ic_action_assist_generic_activated.png Binary files differdeleted file mode 100644 index cc38e83..0000000 --- a/packages/SystemUI/res/drawable-xxhdpi/ic_action_assist_generic_activated.png +++ /dev/null diff --git a/packages/SystemUI/res/drawable-xxhdpi/ic_action_assist_generic_normal.png b/packages/SystemUI/res/drawable-xxhdpi/ic_action_assist_generic_normal.png Binary files differdeleted file mode 100644 index 42f96eb..0000000 --- a/packages/SystemUI/res/drawable-xxhdpi/ic_action_assist_generic_normal.png +++ /dev/null diff --git a/packages/SystemUI/res/drawable/ic_action_assist_generic.xml b/packages/SystemUI/res/drawable/ic_action_assist_generic.xml deleted file mode 100644 index 60f5d5d..0000000 --- a/packages/SystemUI/res/drawable/ic_action_assist_generic.xml +++ /dev/null @@ -1,36 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- Copyright (C) 2012 The Android Open Source Project - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - 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. ---> -<selector xmlns:android="http://schemas.android.com/apk/res/android"> - - <item - android:state_enabled="true" - android:state_active="false" - android:state_focused="false" - android:drawable="@drawable/ic_action_assist_generic_normal" /> - - <item - android:state_enabled="true" - android:state_active="true" - android:state_focused="false" - android:drawable="@drawable/ic_action_assist_generic_activated" /> - - <item - android:state_enabled="true" - android:state_active="false" - android:state_focused="true" - android:drawable="@drawable/ic_action_assist_generic_activated" /> - -</selector> diff --git a/packages/SystemUI/res/drawable/search_panel_card_bg.xml b/packages/SystemUI/res/drawable/search_panel_card_bg.xml new file mode 100644 index 0000000..c19f900 --- /dev/null +++ b/packages/SystemUI/res/drawable/search_panel_card_bg.xml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="utf-8"?> + +<!-- + ~ Copyright (C) 2014 The Android Open Source Project + ~ + ~ Licensed under the Apache License, Version 2.0 (the "License"); + ~ you may not use this file except in compliance with the License. + ~ You may obtain a copy of the License at + ~ + ~ http://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, software + ~ distributed under the License is distributed on an "AS IS" BASIS, + ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + ~ See the License for the specific language governing permissions and + ~ limitations under the License + --> +<shape xmlns:android="http://schemas.android.com/apk/res/android"> + <solid android:color="@color/search_panel_card_color" /> + <corners android:radius="@dimen/notification_material_rounded_rect_radius" /> +</shape> diff --git a/packages/SystemUI/res/drawable/search_panel_scrim.xml b/packages/SystemUI/res/drawable/search_panel_scrim.xml new file mode 100644 index 0000000..bbb2617 --- /dev/null +++ b/packages/SystemUI/res/drawable/search_panel_scrim.xml @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="utf-8"?> + +<!-- + ~ Copyright (C) 2014 The Android Open Source Project + ~ + ~ Licensed under the Apache License, Version 2.0 (the "License"); + ~ you may not use this file except in compliance with the License. + ~ You may obtain a copy of the License at + ~ + ~ http://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, software + ~ distributed under the License is distributed on an "AS IS" BASIS, + ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + ~ See the License for the specific language governing permissions and + ~ limitations under the License + --> + +<shape xmlns:android="http://schemas.android.com/apk/res/android"> + <gradient + android:type="linear" + android:angle="90" + android:startColor="#55000000" + android:endColor="#00000000" /> +</shape>
\ No newline at end of file diff --git a/packages/SystemUI/res/layout-land/status_bar_search_panel.xml b/packages/SystemUI/res/layout-land/status_bar_search_panel.xml deleted file mode 100644 index ddffd6e..0000000 --- a/packages/SystemUI/res/layout-land/status_bar_search_panel.xml +++ /dev/null @@ -1,67 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- -/* apps/common/assets/default/default/skins/StatusBar.xml -** -** Copyright 2012, The Android Open Source Project -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** 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.SearchPanelView - xmlns:prvandroid="http://schemas.android.com/apk/prv/res/android" - xmlns:android="http://schemas.android.com/apk/res/android" - android:id="@+id/search_panel_container" - android:layout_height="match_parent" - android:layout_width="match_parent" - android:paddingBottom="0dip"> - - <RelativeLayout - android:id="@+id/search_bg_protect" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:layout_marginBottom="0dip"> - - <RelativeLayout - android:id="@+id/search_panel_container" - android:layout_width="wrap_content" - android:layout_height="match_parent" - android:layout_alignParentEnd="true"> - - <com.android.internal.widget.multiwaveview.GlowPadView - android:id="@+id/glow_pad_view" - android:orientation="vertical" - android:layout_width="@dimen/navbar_search_panel_height" - android:layout_height="match_parent" - android:layout_alignParentBottom="true" - android:gravity="start" - - prvandroid:targetDrawables="@array/navbar_search_targets" - prvandroid:targetDescriptions="@array/navbar_search_target_descriptions" - prvandroid:directionDescriptions="@array/navbar_search_direction_descriptions" - prvandroid:outerRingDrawable="@drawable/navbar_search_outerring" - prvandroid:outerRadius="@dimen/navbar_search_outerring_radius" - prvandroid:innerRadius="@dimen/glowpadview_inner_radius" - prvandroid:snapMargin="@dimen/navbar_search_snap_margin" - prvandroid:feedbackCount="0" - prvandroid:vibrationDuration="@integer/config_vibration_duration" - prvandroid:alwaysTrackFinger="true" - prvandroid:glowRadius="@dimen/glowpadview_glow_radius" - prvandroid:pointDrawable="@drawable/ic_lockscreen_glowdot" - /> - - </RelativeLayout> - - </RelativeLayout> - -</com.android.systemui.SearchPanelView> diff --git a/packages/SystemUI/res/layout-sw600dp/status_bar_search_panel.xml b/packages/SystemUI/res/layout-sw600dp/status_bar_search_panel.xml deleted file mode 100644 index 08f61bb..0000000 --- a/packages/SystemUI/res/layout-sw600dp/status_bar_search_panel.xml +++ /dev/null @@ -1,48 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- -/* apps/common/assets/default/default/skins/StatusBar.xml -** -** Copyright 2012, The Android Open Source Project -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** 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.SearchPanelView - xmlns:prvandroid="http://schemas.android.com/apk/prv/res/android" - xmlns:android="http://schemas.android.com/apk/res/android" - android:id="@+id/search_panel_container" - android:layout_height="match_parent" - android:layout_width="match_parent"> - - <com.android.internal.widget.multiwaveview.GlowPadView - android:id="@+id/glow_pad_view" - android:layout_width="wrap_content" - android:layout_height="@dimen/navbar_search_panel_height" - android:layout_gravity="center_horizontal|bottom" - android:gravity="center_horizontal|top" - - prvandroid:targetDrawables="@array/navbar_search_targets" - prvandroid:targetDescriptions="@array/navbar_search_target_descriptions" - prvandroid:directionDescriptions="@array/navbar_search_direction_descriptions" - prvandroid:outerRingDrawable="@drawable/navbar_search_outerring" - prvandroid:outerRadius="@dimen/navbar_search_outerring_radius" - prvandroid:innerRadius="@dimen/glowpadview_inner_radius" - prvandroid:snapMargin="@dimen/navbar_search_snap_margin" - prvandroid:feedbackCount="0" - prvandroid:vibrationDuration="@integer/config_vibration_duration" - prvandroid:alwaysTrackFinger="true" - prvandroid:glowRadius="@dimen/glowpadview_glow_radius" - prvandroid:pointDrawable="@drawable/ic_lockscreen_glowdot"/> - -</com.android.systemui.SearchPanelView> diff --git a/packages/SystemUI/res/layout/status_bar_search_panel.xml b/packages/SystemUI/res/layout/status_bar_search_panel.xml index c01db7c..f025abd 100644 --- a/packages/SystemUI/res/layout/status_bar_search_panel.xml +++ b/packages/SystemUI/res/layout/status_bar_search_panel.xml @@ -18,50 +18,29 @@ */ --> +<!-- Extends FrameLayout --> <com.android.systemui.SearchPanelView - xmlns:prvandroid="http://schemas.android.com/apk/prv/res/android" xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/search_panel_container" android:layout_height="match_parent" - android:layout_width="match_parent" - android:paddingBottom="0dip"> - - <RelativeLayout - android:id="@+id/search_bg_protect" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:layout_marginBottom="0dip"> - - <RelativeLayout - android:id="@+id/search_panel_container" - android:layout_width="match_parent" + android:layout_width="match_parent"> + + <com.android.systemui.statusbar.AlphaOptimizedView + style="@style/SearchPanelScrim" + android:id="@+id/search_panel_scrim" + android:background="@drawable/search_panel_scrim" /> + + <FrameLayout + style="@style/SearchPanelCard" + android:id="@+id/search_panel_card" + android:background="@drawable/search_panel_card_bg" + android:elevation="12dp"> + + <ImageView + style="@style/SearchPanelLogo" + android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_alignParentBottom="true"> - - <com.android.internal.widget.multiwaveview.GlowPadView - android:id="@+id/glow_pad_view" - android:orientation="horizontal" - android:layout_width="match_parent" - android:layout_height="@dimen/navbar_search_panel_height" - android:layout_alignParentBottom="true" - android:gravity="top" - - prvandroid:targetDrawables="@array/navbar_search_targets" - prvandroid:targetDescriptions="@array/navbar_search_target_descriptions" - prvandroid:directionDescriptions="@array/navbar_search_direction_descriptions" - prvandroid:outerRingDrawable="@drawable/navbar_search_outerring" - prvandroid:outerRadius="@dimen/navbar_search_outerring_radius" - prvandroid:innerRadius="@dimen/glowpadview_inner_radius" - prvandroid:snapMargin="@dimen/navbar_search_snap_margin" - prvandroid:feedbackCount="0" - prvandroid:vibrationDuration="@integer/config_vibration_duration" - prvandroid:alwaysTrackFinger="true" - prvandroid:glowRadius="@dimen/glowpadview_glow_radius" - prvandroid:pointDrawable="@drawable/ic_lockscreen_glowdot" - /> - - </RelativeLayout> - - </RelativeLayout> + android:id="@+id/search_logo" /> + </FrameLayout> </com.android.systemui.SearchPanelView> diff --git a/packages/SystemUI/res/values-land/arrays.xml b/packages/SystemUI/res/values-land/arrays.xml deleted file mode 100644 index c32ce12..0000000 --- a/packages/SystemUI/res/values-land/arrays.xml +++ /dev/null @@ -1,43 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- -/* //device/apps/common/assets/res/any/colors.xml -** -** Copyright 2012, The Android Open Source Project -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** 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:xliff="urn:oasis:names:tc:xliff:document:1.2"> - - <array name="navbar_search_targets"> - <item>@null</item> - <item>@null</item> - <item>@drawable/ic_action_assist_generic</item> - <item>@null</item> - </array> - - <array name="navbar_search_target_descriptions"> - <item>@null</item> - <item>@null</item> - <item>@string/description_target_search</item> - <item>@null</item> - </array> - - <array name="navbar_search_direction_descriptions"> - <item>@null</item> - <item>@null</item> - <item>@string/description_direction_left</item> - <item>@null</item> - </array> - -</resources> diff --git a/packages/SystemUI/res/values-land/styles.xml b/packages/SystemUI/res/values-land/styles.xml index 8919198..682998d 100644 --- a/packages/SystemUI/res/values-land/styles.xml +++ b/packages/SystemUI/res/values-land/styles.xml @@ -18,4 +18,22 @@ <style name="BrightnessDialogContainer" parent="@style/BaseBrightnessDialogContainer"> <item name="android:layout_width">360dp</item> </style> + + <style name="SearchPanelCard"> + <item name="android:layout_width">@dimen/search_panel_card_height</item> + <item name="android:layout_height">match_parent</item> + <item name="android:layout_marginTop">16dp</item> + <item name="android:layout_marginBottom">16dp</item> + <item name="android:layout_gravity">right</item> + </style> + + <style name="SearchPanelLogo"> + <item name="android:layout_gravity">top|left</item> + </style> + + <style name="SearchPanelScrim"> + <item name="android:layout_width">@dimen/search_panel_scrim_height</item> + <item name="android:layout_height">match_parent</item> + <item name="android:layout_gravity">right</item> + </style> </resources> diff --git a/packages/SystemUI/res/values-sw600dp/arrays.xml b/packages/SystemUI/res/values-sw600dp/arrays.xml deleted file mode 100644 index 21c4bd3..0000000 --- a/packages/SystemUI/res/values-sw600dp/arrays.xml +++ /dev/null @@ -1,43 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- -/* //device/apps/common/assets/res/any/colors.xml -** -** Copyright 2012, The Android Open Source Project -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** 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:xliff="urn:oasis:names:tc:xliff:document:1.2"> - - <array name="navbar_search_targets"> - <item>@null</item> - <item>@drawable/ic_action_assist_generic</item> - <item>@null</item> - <item>@null</item> - </array> - - <array name="navbar_search_target_descriptions"> - <item>@null</item> - <item>@string/description_target_search</item> - <item>@null</item> - <item>@null</item> - </array> - - <array name="navbar_search_direction_descriptions"> - <item>@null</item> - <item>@string/description_direction_left</item> - <item>@null</item> - <item>@null</item> - </array> - -</resources> diff --git a/packages/SystemUI/res/values-sw600dp/styles.xml b/packages/SystemUI/res/values-sw600dp/styles.xml index d4a9986..88372bc 100644 --- a/packages/SystemUI/res/values-sw600dp/styles.xml +++ b/packages/SystemUI/res/values-sw600dp/styles.xml @@ -29,4 +29,20 @@ <item name="android:layout_width">@dimen/notification_panel_width</item> <item name="android:layout_gravity">center_horizontal</item> </style> + + <style name="SearchPanelCard"> + <item name="android:layout_width">550dp</item> + <item name="android:layout_height">@dimen/search_panel_card_height</item> + <item name="android:layout_gravity">center_horizontal|bottom</item> + </style> + + <style name="SearchPanelLogo"> + <item name="android:layout_gravity">top|center_horizontal</item> + </style> + + <style name="SearchPanelScrim"> + <item name="android:layout_width">match_parent</item> + <item name="android:layout_height">@dimen/search_panel_scrim_height</item> + <item name="android:layout_gravity">bottom</item> + </style> </resources> diff --git a/packages/SystemUI/res/values/arrays.xml b/packages/SystemUI/res/values/arrays.xml index 6628f3b..630a48d 100644 --- a/packages/SystemUI/res/values/arrays.xml +++ b/packages/SystemUI/res/values/arrays.xml @@ -18,27 +18,6 @@ */ --> <resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> - - <array name="navbar_search_targets"> - <item>@null</item> - <item>@drawable/ic_action_assist_generic</item> - <item>@null</item> - <item>@null</item> - </array> - - <array name="navbar_search_target_descriptions"> - <item>@null</item> - <item>@string/description_target_search</item> - <item>@null</item> - <item>@null</item> - </array> - - <array name="navbar_search_direction_descriptions"> - <item>@null</item> - <item>@string/description_direction_up</item> - <item>@null</item> - <item>@null</item> - </array> <!-- BatteryMeterView parameters --> <array name="batterymeter_color_levels"> diff --git a/packages/SystemUI/res/values/colors.xml b/packages/SystemUI/res/values/colors.xml index a63deb0..1cdcc2b 100644 --- a/packages/SystemUI/res/values/colors.xml +++ b/packages/SystemUI/res/values/colors.xml @@ -101,4 +101,6 @@ <color name="notification_guts_title_color">#FFFFFFFF</color> <color name="notification_guts_text_color">#99FFFFFF</color> <color name="notification_guts_btn_color">#FFFFFFFF</color> + + <color name="search_panel_card_color">#ffffff</color> </resources> diff --git a/packages/SystemUI/res/values/dimens.xml b/packages/SystemUI/res/values/dimens.xml index 2b1cde5..f2c9e85 100644 --- a/packages/SystemUI/res/values/dimens.xml +++ b/packages/SystemUI/res/values/dimens.xml @@ -399,4 +399,17 @@ <!-- Additional translation (downwards) for appearing notifications when going to the full shade from Keyguard. --> <dimen name="go_to_full_shade_appearing_translation">200dp</dimen> + + <!-- The height of the search panel card. --> + <dimen name="search_panel_card_height">300dp</dimen> + + <!-- The height of the scrim behind the search panel card. --> + <dimen name="search_panel_scrim_height">250dp</dimen> + + <!-- How much from the bottom of the screen the card should peek in when activating the search + panel --> + <dimen name="search_card_peek_height">100dp</dimen> + + <!-- How far the user needs to drag up to invoke search. --> + <dimen name="search_panel_threshold">150dp</dimen> </resources> diff --git a/packages/SystemUI/res/values/styles.xml b/packages/SystemUI/res/values/styles.xml index 61e6121..197c0f1 100644 --- a/packages/SystemUI/res/values/styles.xml +++ b/packages/SystemUI/res/values/styles.xml @@ -280,4 +280,22 @@ <item name="android:textStyle">italic</item> <item name="android:textColor">#60000000</item> </style> + + <style name="SearchPanelCard"> + <item name="android:layout_width">match_parent</item> + <item name="android:layout_height">@dimen/search_panel_card_height</item> + <item name="android:layout_marginStart">8dp</item> + <item name="android:layout_marginEnd">8dp</item> + <item name="android:layout_gravity">bottom</item> + </style> + + <style name="SearchPanelLogo"> + <item name="android:layout_gravity">top|center_horizontal</item> + </style> + + <style name="SearchPanelScrim"> + <item name="android:layout_width">match_parent</item> + <item name="android:layout_height">@dimen/search_panel_scrim_height</item> + <item name="android:layout_gravity">bottom</item> + </style> </resources> diff --git a/packages/SystemUI/src/com/android/systemui/SearchPanelView.java b/packages/SystemUI/src/com/android/systemui/SearchPanelView.java index ed03733..7d0ca14 100644 --- a/packages/SystemUI/src/com/android/systemui/SearchPanelView.java +++ b/packages/SystemUI/src/com/android/systemui/SearchPanelView.java @@ -16,46 +16,41 @@ package com.android.systemui; -import android.animation.LayoutTransition; -import android.app.ActivityManagerNative; +import android.animation.Animator; +import android.animation.AnimatorListenerAdapter; +import android.animation.ObjectAnimator; +import android.animation.PropertyValuesHolder; import android.app.ActivityOptions; import android.app.SearchManager; import android.content.ActivityNotFoundException; import android.content.ComponentName; import android.content.Context; import android.content.Intent; +import android.content.pm.PackageManager; import android.content.res.Resources; import android.media.AudioAttributes; -import android.os.RemoteException; -import android.os.ServiceManager; +import android.os.AsyncTask; +import android.os.Bundle; import android.os.UserHandle; import android.os.Vibrator; import android.provider.Settings; import android.util.AttributeSet; -import android.util.EventLog; import android.util.Log; -import android.view.IWindowManager; import android.view.MotionEvent; import android.view.View; -import android.view.ViewGroup; -import android.view.ViewTreeObserver; -import android.view.ViewTreeObserver.OnPreDrawListener; +import android.view.animation.AnimationUtils; +import android.view.animation.Interpolator; import android.widget.FrameLayout; +import android.widget.ImageView; -import com.android.internal.widget.multiwaveview.GlowPadView; -import com.android.internal.widget.multiwaveview.GlowPadView.OnTriggerListener; import com.android.systemui.statusbar.BaseStatusBar; import com.android.systemui.statusbar.CommandQueue; import com.android.systemui.statusbar.StatusBarPanel; -import com.android.systemui.statusbar.phone.KeyguardTouchDelegate; import com.android.systemui.statusbar.phone.PhoneStatusBar; -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 = PhoneStatusBar.DEBUG || false; - public static final boolean DEBUG_GESTURES = true; +public class SearchPanelView extends FrameLayout implements StatusBarPanel { + + private static final String TAG = "SearchPanelView"; private static final String ASSIST_ICON_METADATA_NAME = "com.android.systemui.action_assist_icon"; @@ -67,10 +62,26 @@ public class SearchPanelView extends FrameLayout implements private final Context mContext; private BaseStatusBar mBar; - private boolean mShowing; - private View mSearchTargetsContainer; - private GlowPadView mGlowPadView; - private IWindowManager mWm; + private View mCard; + private ImageView mLogo; + private View mScrim; + + private int mPeekHeight; + private int mThreshold; + private boolean mHorizontal; + private final Interpolator mLinearOutSlowInInterpolator; + private final Interpolator mFastOutLinearInInterpolator; + + private boolean mAnimatingIn; + private boolean mAnimatingOut; + private boolean mDragging; + private boolean mDraggedFarEnough; + private float mStartTouch; + private float mStartDrag; + + private ObjectAnimator mEnterAnimator; + + private boolean mStartExitAfterAnimatingIn; public SearchPanelView(Context context, AttributeSet attrs) { this(context, attrs, 0); @@ -79,7 +90,12 @@ public class SearchPanelView extends FrameLayout implements public SearchPanelView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); mContext = context; - mWm = IWindowManager.Stub.asInterface(ServiceManager.getService("window")); + mPeekHeight = context.getResources().getDimensionPixelSize(R.dimen.search_card_peek_height); + mThreshold = context.getResources().getDimensionPixelSize(R.dimen.search_panel_threshold); + mLinearOutSlowInInterpolator = + AnimationUtils.loadInterpolator(context, android.R.interpolator.linear_out_slow_in); + mFastOutLinearInInterpolator = + AnimationUtils.loadInterpolator(context, android.R.interpolator.fast_out_linear_in); } private void startAssistActivity() { @@ -87,92 +103,34 @@ public class SearchPanelView extends FrameLayout implements // Close Recent Apps if needed mBar.animateCollapsePanels(CommandQueue.FLAG_EXCLUDE_SEARCH_PANEL); - boolean isKeyguardShowing = false; - try { - isKeyguardShowing = mWm.isKeyguardLocked(); - } catch (RemoteException e) { - - } - - if (isKeyguardShowing) { - // Have keyguard show the bouncer and launch the activity if the user succeeds. - KeyguardTouchDelegate.getInstance(getContext()).showAssistant(); - onAnimationStarted(); - } else { - // Otherwise, keyguard isn't showing so launch it from here. - Intent intent = ((SearchManager) mContext.getSystemService(Context.SEARCH_SERVICE)) - .getAssistIntent(mContext, true, UserHandle.USER_CURRENT); - if (intent == null) return; - - try { - ActivityManagerNative.getDefault().dismissKeyguardOnNextActivity(); - } catch (RemoteException e) { - // too bad, so sad... - } - - try { - ActivityOptions opts = ActivityOptions.makeCustomAnimation(mContext, - R.anim.search_launch_enter, R.anim.search_launch_exit, - getHandler(), this); - intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); - mContext.startActivityAsUser(intent, opts.toBundle(), - new UserHandle(UserHandle.USER_CURRENT)); - } catch (ActivityNotFoundException e) { - Log.w(TAG, "Activity not found for " + intent.getAction()); - onAnimationStarted(); - } - } - } - class GlowPadTriggerListener implements GlowPadView.OnTriggerListener { - boolean mWaitingForLaunch; + final Intent intent = ((SearchManager) mContext.getSystemService(Context.SEARCH_SERVICE)) + .getAssistIntent(mContext, true, UserHandle.USER_CURRENT); + if (intent == null) return; - public void onGrabbed(View v, int handle) { - } - - public void onReleased(View v, int handle) { - } - - public void onGrabbedStateChange(View v, int handle) { - if (!mWaitingForLaunch && OnTriggerListener.NO_HANDLE == handle) { - mBar.hideSearchPanel(); - } - } - - public void onTrigger(View v, final int target) { - final int resId = mGlowPadView.getResourceIdForTarget(target); - switch (resId) { - case R.drawable.ic_action_assist_generic: - mWaitingForLaunch = true; - startAssistActivity(); - vibrate(); - break; - } - } - - public void onFinishFinalAnimation() { + try { + final ActivityOptions opts = ActivityOptions.makeCustomAnimation(mContext, + R.anim.search_launch_enter, R.anim.search_launch_exit); + intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); + AsyncTask.execute(new Runnable() { + @Override + public void run() { + mContext.startActivityAsUser(intent, opts.toBundle(), + new UserHandle(UserHandle.USER_CURRENT)); + } + }); + } catch (ActivityNotFoundException e) { + Log.w(TAG, "Activity not found for " + intent.getAction()); } } - final GlowPadTriggerListener mGlowPadViewListener = new GlowPadTriggerListener(); - - @Override - public void onAnimationStarted() { - postDelayed(new Runnable() { - public void run() { - mGlowPadViewListener.mWaitingForLaunch = false; - mBar.hideSearchPanel(); - } - }, SEARCH_PANEL_HOLD_DURATION); - } @Override protected void onFinishInflate() { super.onFinishInflate(); mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE); - mSearchTargetsContainer = findViewById(R.id.search_panel_container); - // TODO: fetch views - mGlowPadView = (GlowPadView) findViewById(R.id.glow_pad_view); - mGlowPadView.setOnTriggerListener(mGlowPadViewListener); + mCard = findViewById(R.id.search_panel_card); + mLogo = (ImageView) findViewById(R.id.search_logo); + mScrim = findViewById(R.id.search_panel_scrim); } private void maybeSwapSearchIcon() { @@ -180,12 +138,36 @@ public class SearchPanelView extends FrameLayout implements .getAssistIntent(mContext, false, UserHandle.USER_CURRENT); if (intent != null) { ComponentName component = intent.getComponent(); - if (component == null || !mGlowPadView.replaceTargetDrawablesIfPresent(component, - ASSIST_ICON_METADATA_NAME, - R.drawable.ic_action_assist_generic)) { - if (DEBUG) Log.v(TAG, "Couldn't grab icon for component " + component); + replaceDrawable(mLogo, component, ASSIST_ICON_METADATA_NAME); + } else { + mLogo.setImageDrawable(null); + } + } + + public void replaceDrawable(ImageView v, ComponentName component, String name) { + if (component != null) { + try { + PackageManager packageManager = mContext.getPackageManager(); + // Look for the search icon specified in the activity meta-data + Bundle metaData = packageManager.getActivityInfo( + component, PackageManager.GET_META_DATA).metaData; + if (metaData != null) { + int iconResId = metaData.getInt(name); + if (iconResId != 0) { + Resources res = packageManager.getResourcesForActivity(component); + v.setImageDrawable(res.getDrawable(iconResId)); + return; + } + } + } catch (PackageManager.NameNotFoundException e) { + Log.w(TAG, "Failed to swap drawable; " + + component.flattenToShortString() + " not found", e); + } catch (Resources.NotFoundException nfe) { + Log.w(TAG, "Failed to swap drawable from " + + component.flattenToShortString(), nfe); } } + v.setImageDrawable(null); } private boolean pointInside(int x, int y, View v) { @@ -197,17 +179,9 @@ public class SearchPanelView extends FrameLayout implements } public boolean isInContentArea(int x, int y) { - return pointInside(x, y, mSearchTargetsContainer); + return pointInside(x, y, mCard); } - private final OnPreDrawListener mPreDrawListener = new ViewTreeObserver.OnPreDrawListener() { - public boolean onPreDraw() { - getViewTreeObserver().removeOnPreDrawListener(this); - mGlowPadView.resumeAnimations(); - return false; - } - }; - private void vibrate() { Context context = getContext(); if (Settings.System.getIntForUser(context.getContentResolver(), @@ -220,28 +194,93 @@ public class SearchPanelView extends FrameLayout implements } public void show(final boolean show, boolean animate) { - if (!show) { - final LayoutTransition transitioner = animate ? createLayoutTransitioner() : null; - ((ViewGroup) mSearchTargetsContainer).setLayoutTransition(transitioner); - } - mShowing = show; if (show) { maybeSwapSearchIcon(); if (getVisibility() != View.VISIBLE) { setVisibility(View.VISIBLE); - // Don't start the animation until we've created the layer, which is done - // right before we are drawn - mGlowPadView.suspendAnimations(); - mGlowPadView.ping(); - getViewTreeObserver().addOnPreDrawListener(mPreDrawListener); vibrate(); + mCard.setAlpha(1f); + if (animate) { + startEnterAnimation(); + } else { + mScrim.setAlpha(1f); + if (mHorizontal) { + mCard.setX(getWidth() - mPeekHeight); + } else { + mCard.setY(getHeight() - mPeekHeight); + } + } } setFocusable(true); setFocusableInTouchMode(true); requestFocus(); } else { - setVisibility(View.INVISIBLE); + if (animate) { + startAbortAnimation(); + } else { + setVisibility(View.INVISIBLE); + } + } + } + + private void startEnterAnimation() { + if (mHorizontal) { + mCard.setX(getWidth()); + } else { + mCard.setY(getHeight()); } + mAnimatingIn = true; + mCard.animate().cancel(); + mEnterAnimator = ObjectAnimator.ofFloat(mCard, mHorizontal ? View.X : View.Y, + mHorizontal ? mCard.getX() : mCard.getY(), + mHorizontal ? getWidth() - mPeekHeight : getHeight() - mPeekHeight); + mEnterAnimator.setDuration(300); + mEnterAnimator.setStartDelay(50); + mEnterAnimator.setInterpolator(mLinearOutSlowInInterpolator); + mEnterAnimator.addListener(new AnimatorListenerAdapter() { + @Override + public void onAnimationEnd(Animator animation) { + mEnterAnimator = null; + mAnimatingIn = false; + if (mStartExitAfterAnimatingIn) { + startExitAnimation(); + } + } + }); + mEnterAnimator.start(); + mScrim.setAlpha(0f); + mScrim.animate() + .alpha(1f) + .setDuration(300) + .setStartDelay(50) + .setInterpolator(PhoneStatusBar.ALPHA_IN) + .start(); + + } + + private void startAbortAnimation() { + mCard.animate().cancel(); + mAnimatingOut = true; + if (mHorizontal) { + mCard.animate().x(getWidth()); + } else { + mCard.animate().y(getHeight()); + } + mCard.animate() + .setDuration(150) + .setInterpolator(mFastOutLinearInInterpolator) + .withEndAction(new Runnable() { + @Override + public void run() { + mAnimatingOut = false; + setVisibility(View.INVISIBLE); + } + }); + mScrim.animate() + .alpha(0f) + .setDuration(150) + .setStartDelay(0) + .setInterpolator(PhoneStatusBar.ALPHA_OUT); } public void hide(boolean animate) { @@ -249,20 +288,14 @@ public class SearchPanelView extends FrameLayout implements // This will indirectly cause show(false, ...) to get called mBar.animateCollapsePanels(CommandQueue.FLAG_EXCLUDE_NONE); } else { - setVisibility(View.INVISIBLE); + if (animate) { + startAbortAnimation(); + } else { + setVisibility(View.INVISIBLE); + } } } - /** - * We need to be aligned at the bottom. LinearLayout can't do this, so instead, - * let LinearLayout do all the hard work, and then shift everything down to the bottom. - */ - @Override - protected void onLayout(boolean changed, int l, int t, int r, int b) { - super.onLayout(changed, l, t, r, b); - // setPanelHeight(mSearchTargetsContainer.getHeight()); - } - @Override public boolean dispatchHoverEvent(MotionEvent event) { // Ignore hover events outside of this panel bounds since such events @@ -281,34 +314,113 @@ public class SearchPanelView extends FrameLayout implements * when the animation is done. */ public boolean isShowing() { - return mShowing; + return getVisibility() == View.VISIBLE && !mAnimatingOut; } public void setBar(BaseStatusBar bar) { mBar = bar; } + public boolean isAssistantAvailable() { + return ((SearchManager) mContext.getSystemService(Context.SEARCH_SERVICE)) + .getAssistIntent(mContext, false, UserHandle.USER_CURRENT) != null; + } + + private float rubberband(float diff) { + return Math.signum(diff) * (float) Math.pow(Math.abs(diff), 0.8f); + } + @Override public boolean onTouchEvent(MotionEvent event) { - if (DEBUG_GESTURES) { - if (event.getActionMasked() != MotionEvent.ACTION_MOVE) { - EventLog.writeEvent(EventLogTags.SYSUI_SEARCHPANEL_TOUCH, - event.getActionMasked(), (int) event.getX(), (int) event.getY()); - } + int action = event.getActionMasked(); + switch (action) { + case MotionEvent.ACTION_DOWN: + mStartTouch = mHorizontal ? event.getX() : event.getY(); + mDragging = false; + mDraggedFarEnough = false; + mStartExitAfterAnimatingIn = false; + break; + case MotionEvent.ACTION_MOVE: + float currentTouch = mHorizontal ? event.getX() : event.getY(); + if (getVisibility() == View.VISIBLE && !mDragging && + (!mAnimatingIn || Math.abs(mStartTouch - currentTouch) > mThreshold)) { + mStartDrag = currentTouch; + mDragging = true; + } + if (!mDraggedFarEnough && Math.abs(mStartTouch - currentTouch) > mThreshold) { + mDraggedFarEnough = true; + } + if (mDragging) { + if (!mAnimatingIn && !mAnimatingOut) { + if (Math.abs(currentTouch - mStartDrag) > mThreshold) { + startExitAnimation(); + } else { + if (mHorizontal) { + mCard.setX(getWidth() - mPeekHeight + rubberband( + currentTouch - mStartDrag)); + } else { + mCard.setY(getHeight() - mPeekHeight + rubberband( + currentTouch - mStartDrag)); + } + } + } else if (mAnimatingIn ) { + float diff = rubberband(currentTouch - mStartDrag); + PropertyValuesHolder[] values = mEnterAnimator.getValues(); + values[0].setFloatValues( + mHorizontal ? getWidth() + diff : getHeight() + diff, + mHorizontal + ? getWidth() - mPeekHeight + diff + : getHeight() - mPeekHeight + diff); + mEnterAnimator.setCurrentPlayTime(mEnterAnimator.getCurrentPlayTime()); + } + } + break; + case MotionEvent.ACTION_UP: + case MotionEvent.ACTION_CANCEL: + if (mDraggedFarEnough) { + if (mAnimatingIn) { + mStartExitAfterAnimatingIn = true; + } else { + startExitAnimation(); + } + } else { + startAbortAnimation(); + } + break; } - return super.onTouchEvent(event); + return true; } - private LayoutTransition createLayoutTransitioner() { - LayoutTransition transitioner = new LayoutTransition(); - transitioner.setDuration(200); - transitioner.setStartDelay(LayoutTransition.CHANGE_DISAPPEARING, 0); - transitioner.setAnimator(LayoutTransition.DISAPPEARING, null); - return transitioner; + private void startExitAnimation() { + if (mAnimatingOut || getVisibility() != View.VISIBLE) { + return; + } + if (mEnterAnimator != null) { + mEnterAnimator.cancel(); + } + mAnimatingOut = true; + startAssistActivity(); + vibrate(); + mCard.animate() + .alpha(0f) + .withLayer() + .setDuration(250) + .setInterpolator(PhoneStatusBar.ALPHA_OUT) + .withEndAction(new Runnable() { + @Override + public void run() { + mAnimatingOut = false; + setVisibility(View.INVISIBLE); + } + }); + mScrim.animate() + .alpha(0f) + .setDuration(250) + .setStartDelay(0) + .setInterpolator(PhoneStatusBar.ALPHA_OUT); } - public boolean isAssistantAvailable() { - return ((SearchManager) mContext.getSystemService(Context.SEARCH_SERVICE)) - .getAssistIntent(mContext, false, UserHandle.USER_CURRENT) != null; + public void setHorizontal(boolean horizontal) { + mHorizontal = horizontal; } } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java index 617c445..c2f6aa4 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java @@ -909,14 +909,12 @@ public abstract class BaseStatusBar extends SystemUI implements if (DEBUG) Log.d(TAG, "opening search panel"); if (mSearchPanelView != null && mSearchPanelView.isAssistantAvailable()) { mSearchPanelView.show(true, true); - onShowSearchPanel(); } break; case MSG_CLOSE_SEARCH_PANEL: if (DEBUG) Log.d(TAG, "closing search panel"); if (mSearchPanelView != null && mSearchPanelView.isShowing()) { mSearchPanelView.show(false, true); - onHideSearchPanel(); } break; } @@ -948,12 +946,6 @@ public abstract class BaseStatusBar extends SystemUI implements protected void workAroundBadLayerDrawableOpacity(View v) { } - protected void onHideSearchPanel() { - } - - protected void onShowSearchPanel() { - } - private boolean inflateViews(NotificationData.Entry entry, ViewGroup parent) { return inflateViews(entry, parent, false); } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/BarTransitions.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/BarTransitions.java index 303454b..152bfdc 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/BarTransitions.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/BarTransitions.java @@ -109,10 +109,6 @@ public class BarTransitions { mBarBackground.finishAnimation(); } - public void setContentVisible(boolean visible) { - // for subclasses - } - private static class BarBackgroundDrawable extends Drawable { private final int mOpaque; private final int mSemiTransparent; diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarTransitions.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarTransitions.java index 3753a72..50ddeb3 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarTransitions.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarTransitions.java @@ -108,18 +108,6 @@ public final class NavigationBarTransitions extends BarTransitions { return max; } - @Override - public void setContentVisible(boolean visible) { - final float alpha = visible ? 1 : 0; - fadeContent(mView.getBackButton(), alpha); - } - - private void fadeContent(View v, float alpha) { - if (v != null) { - v.animate().alpha(alpha).setDuration(CONTENT_FADE_DURATION); - } - } - private void setKeyButtonViewQuiescentAlpha(View button, float alpha, boolean animate) { if (button instanceof KeyButtonView) { ((KeyButtonView) button).setQuiescentAlpha(alpha, animate); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java index 21842bf..95cb9a1 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java @@ -88,6 +88,8 @@ public class NavigationBarView extends LinearLayout { // performs manual animation in sync with layout transitions private final NavTransitionListener mTransitionListener = new NavTransitionListener(); + private OnVerticalChangedListener mOnVerticalChangedListener; + private class NavTransitionListener implements TransitionListener { private boolean mBackTransitioning; private boolean mHomeAppearing; @@ -193,6 +195,10 @@ public class NavigationBarView extends LinearLayout { mDelegateHelper.setBar(phoneStatusBar); } + public void setOnVerticalChangedListener(OnVerticalChangedListener onVerticalChangedListener) { + mOnVerticalChangedListener = onVerticalChangedListener; + } + @Override public boolean onTouchEvent(MotionEvent event) { if (mDeadZone != null && event.getAction() == MotionEvent.ACTION_OUTSIDE) { @@ -413,7 +419,7 @@ public class NavigationBarView extends LinearLayout { // swap to x coordinate if orientation is not in vertical if (mDelegateHelper != null) { - mDelegateHelper.setSwapXY(!mVertical); + mDelegateHelper.setSwapXY(mVertical); } setNavigationIconHints(mNavigationIconHints, true); @@ -435,6 +441,9 @@ public class NavigationBarView extends LinearLayout { mVertical = newVertical; //Log.v(TAG, String.format("onSizeChanged: h=%d, w=%d, vert=%s", h, w, mVertical?"y":"n")); reorient(); + if (mOnVerticalChangedListener != null) { + mOnVerticalChangedListener.onVerticalChanged(newVertical); + } } postCheckForInvalidLayout("sizeChanged"); @@ -542,4 +551,7 @@ public class NavigationBarView extends LinearLayout { pw.println(); } + public interface OnVerticalChangedListener { + void onVerticalChanged(boolean isVertical); + } } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java index 99b0259..8dfed92 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java @@ -641,6 +641,15 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, mNavigationBarView.setDisabledFlags(mDisabled); mNavigationBarView.setBar(this); + mNavigationBarView.setOnVerticalChangedListener( + new NavigationBarView.OnVerticalChangedListener() { + @Override + public void onVerticalChanged(boolean isVertical) { + if (mSearchPanelView != null) { + mSearchPanelView.setHorizontal(isVertical); + } + } + }); mNavigationBarView.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { @@ -951,20 +960,6 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, } @Override - protected void onShowSearchPanel() { - if (mNavigationBarView != null) { - mNavigationBarView.getBarTransitions().setContentVisible(false); - } - } - - @Override - protected void onHideSearchPanel() { - if (mNavigationBarView != null) { - mNavigationBarView.getBarTransitions().setContentVisible(true); - } - } - - @Override protected View getStatusBarView() { return mStatusBarView; } @@ -989,8 +984,6 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, } 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; @@ -1066,7 +1059,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, View.OnTouchListener mHomeActionListener = new View.OnTouchListener() { public boolean onTouch(View v, MotionEvent event) { switch(event.getAction()) { - case MotionEvent.ACTION_DOWN: + case MotionEvent.ACTION_DOWN: if (!shouldDisableNavbarGestures()) { mHandler.removeCallbacks(mShowSearchPanel); mHandler.postDelayed(mShowSearchPanel, mShowSearchHoldoff); |