diff options
author | Winson Chung <winsonc@google.com> | 2015-06-04 17:18:17 -0700 |
---|---|---|
committer | Winson Chung <winsonc@google.com> | 2015-06-15 14:22:47 -0700 |
commit | ef7f874a889b609bd34e692b9c9a1f8cefd1ea95 (patch) | |
tree | 23d364f99ae51ea31a9d4e9e9c5bcf7048db7184 /res/layout | |
parent | e89cf793ab22fcb8cea3ff94ca981659208446db (diff) | |
download | android_packages_apps_Trebuchet-ef7f874a889b609bd34e692b9c9a1f8cefd1ea95.tar.gz android_packages_apps_Trebuchet-ef7f874a889b609bd34e692b9c9a1f8cefd1ea95.tar.bz2 android_packages_apps_Trebuchet-ef7f874a889b609bd34e692b9c9a1f8cefd1ea95.zip |
Refactoring all apps search to support external search bar.
- Adding support for an external search bar that can be used
to search a container view. This adds a new interface
AllAppsSearchController which manages the external search
bar. Each controller will have its own search implementation
which means that we no longer need a common AppSearchManager
interface.
- Removing elevation controller as we no longer have a builtin
search bar in all apps
- Refactoring container view insets so that they behave
the same in all containers.
- Refactoring apps view to ensure that we only update the number
of columns with the available width
- Cleaning up LauncherCallbacks interface
Bug: 20127840
Bug: 21494973
Change-Id: I710b8e18196961d77d8a29f0c345531d480936fe
Diffstat (limited to 'res/layout')
-rw-r--r-- | res/layout/all_apps.xml | 40 | ||||
-rw-r--r-- | res/layout/all_apps_container.xml | 80 | ||||
-rw-r--r-- | res/layout/all_apps_reveal.xml | 24 | ||||
-rw-r--r-- | res/layout/all_apps_search_bar.xml | 72 | ||||
-rw-r--r-- | res/layout/widgets_view.xml | 22 |
5 files changed, 126 insertions, 112 deletions
diff --git a/res/layout/all_apps.xml b/res/layout/all_apps.xml index b907c34f1..1bf54eefb 100644 --- a/res/layout/all_apps.xml +++ b/res/layout/all_apps.xml @@ -21,15 +21,37 @@ android:id="@+id/apps_view" android:layout_width="match_parent" android:layout_height="match_parent" - android:descendantFocusability="afterDescendants"> - <include - layout="@layout/all_apps_reveal" + android:orientation="vertical"> + + <!-- Both android:focusable and android:focusableInTouchMode are needed for + the view to get focus change events. --> + <FrameLayout + android:id="@+id/search_box_container" android:layout_width="match_parent" - android:layout_height="match_parent" - android:layout_gravity="center" /> - <include - layout="@layout/all_apps_container" + android:layout_height="wrap_content" + android:focusable="true" + android:focusableInTouchMode="true" + android:visibility="gone" /> + + <FrameLayout + android:id="@+id/content" android:layout_width="match_parent" - android:layout_height="match_parent" - android:layout_gravity="center" /> + android:layout_height="0dp" + android:layout_weight="1"> + <FrameLayout + android:id="@+id/all_apps_reveal" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:layout_gravity="center" + android:focusable="false" + android:elevation="2dp" + android:visibility="invisible" /> + <include + layout="@layout/all_apps_container" + android:id="@+id/all_apps_container" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:layout_gravity="center" + android:visibility="gone" /> + </FrameLayout> </com.android.launcher3.allapps.AllAppsContainerView>
\ No newline at end of file diff --git a/res/layout/all_apps_container.xml b/res/layout/all_apps_container.xml index fc77cd31f..5801a0e8e 100644 --- a/res/layout/all_apps_container.xml +++ b/res/layout/all_apps_container.xml @@ -14,95 +14,35 @@ See the License for the specific language governing permissions and limitations under the License. --> +<!-- Both android:focusable and android:focusableInTouchMode are needed for + the view to get focus change events. --> <com.android.launcher3.allapps.AllAppsRecyclerViewContainerView xmlns:android="http://schemas.android.com/apk/res/android" - android:id="@+id/apps_list" android:layout_width="match_parent" android:layout_height="match_parent" android:elevation="15dp" - android:focusableInTouchMode="true" - android:visibility="gone" > + android:focusable="true" + android:focusableInTouchMode="true"> <com.android.launcher3.allapps.AllAppsRecyclerView - android:id="@+id/apps_list_view" + android:id="@+id/collection" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_gravity="center_horizontal|top" - android:layout_marginTop="@dimen/all_apps_search_bar_height" android:clipToPadding="false" - android:descendantFocusability="afterDescendants" - android:focusable="true" /> + android:focusable="true" + android:descendantFocusability="afterDescendants" /> <LinearLayout android:id="@+id/prediction_bar" android:layout_width="match_parent" android:layout_height="wrap_content" - android:layout_marginTop="@dimen/all_apps_search_bar_height" - android:paddingBottom="@dimen/all_apps_prediction_bar_bottom_padding" + android:paddingTop="@dimen/all_apps_prediction_bar_top_bottom_padding" + android:paddingBottom="@dimen/all_apps_prediction_bar_top_bottom_padding" android:orientation="horizontal" - android:descendantFocusability="afterDescendants" android:focusable="true" + android:descendantFocusability="afterDescendants" android:visibility="invisible" > </LinearLayout> - <!-- We always want the search bar on top, so it goes last. --> - - <FrameLayout - android:id="@+id/header" - android:layout_width="match_parent" - android:layout_height="@dimen/all_apps_search_bar_height" - android:background="@drawable/all_apps_search_bg" > - - <LinearLayout - android:id="@+id/app_search_container" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:orientation="horizontal" - android:visibility="invisible" > - - <ImageView - android:id="@+id/dismiss_search_button" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_gravity="start|center_vertical" - android:layout_marginLeft="4dp" - android:layout_marginStart="4dp" - android:contentDescription="@string/all_apps_button_label" - android:paddingBottom="13dp" - android:paddingTop="13dp" - android:src="@drawable/ic_arrow_back_grey" /> - - <com.android.launcher3.allapps.AllAppsSearchEditView - android:id="@+id/apps_search_box" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:background="@android:color/transparent" - android:focusableInTouchMode="true" - android:gravity="fill_horizontal" - android:hint="@string/all_apps_search_bar_hint" - android:imeOptions="actionDone|flagNoExtractUi" - android:maxLines="1" - android:paddingBottom="16dp" - android:paddingLeft="8dp" - android:paddingTop="16dp" - android:scrollHorizontally="true" - android:singleLine="true" - android:textColor="#4c4c4c" - android:textColorHint="#9c9c9c" - android:textSize="16sp" /> - </LinearLayout> - - <ImageView - android:id="@+id/search_button" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_gravity="end|center_vertical" - android:layout_marginEnd="6dp" - android:layout_marginRight="6dp" - android:contentDescription="@string/all_apps_search_bar_hint" - android:paddingBottom="13dp" - android:paddingTop="13dp" - android:src="@drawable/ic_search_grey" /> - </FrameLayout> - </com.android.launcher3.allapps.AllAppsRecyclerViewContainerView>
\ No newline at end of file diff --git a/res/layout/all_apps_reveal.xml b/res/layout/all_apps_reveal.xml deleted file mode 100644 index 5f4665642..000000000 --- a/res/layout/all_apps_reveal.xml +++ /dev/null @@ -1,24 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- Copyright (C) 2015 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/apps_view_transition_overlay" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:layout_gravity="center" - android:elevation="2dp" - android:visibility="invisible" - android:focusable="false" />
\ No newline at end of file diff --git a/res/layout/all_apps_search_bar.xml b/res/layout/all_apps_search_bar.xml new file mode 100644 index 000000000..9f4e3228c --- /dev/null +++ b/res/layout/all_apps_search_bar.xml @@ -0,0 +1,72 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + Copyright (C) 2015 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_width="match_parent" + android:layout_height="wrap_content" + android:background="@drawable/all_apps_search_bg" > + + <LinearLayout + android:id="@+id/search_container" + android:layout_width="match_parent" + android:layout_height="@dimen/all_apps_search_bar_height" + android:layout_gravity="start|center_vertical" + android:orientation="horizontal" + android:visibility="invisible" > + + <ImageView + android:id="@+id/dismiss_search_button" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginLeft="4dp" + android:layout_marginStart="4dp" + android:contentDescription="@string/all_apps_button_label" + android:paddingBottom="13dp" + android:paddingTop="13dp" + android:src="@drawable/ic_arrow_back_grey" /> + + <com.android.launcher3.allapps.AllAppsSearchEditView + android:id="@+id/search_box" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:background="@android:color/transparent" + android:focusableInTouchMode="true" + android:gravity="fill_horizontal|center_vertical" + android:hint="@string/all_apps_search_bar_hint" + android:inputType="text|textNoSuggestions|textCapWords" + android:imeOptions="actionDone|flagNoExtractUi" + android:maxLines="1" + android:paddingLeft="8dp" + android:scrollHorizontally="true" + android:singleLine="true" + android:textColor="#4c4c4c" + android:textColorHint="#9c9c9c" + android:textSize="16sp" /> + </LinearLayout> + + <ImageView + android:id="@+id/search_button" + android:layout_width="wrap_content" + android:layout_height="@dimen/all_apps_search_bar_height" + android:layout_gravity="end|center_vertical" + android:layout_marginEnd="6dp" + android:layout_marginRight="6dp" + android:contentDescription="@string/all_apps_search_bar_hint" + android:paddingBottom="13dp" + android:paddingTop="13dp" + android:src="@drawable/ic_search_grey" /> +</FrameLayout>
\ No newline at end of file diff --git a/res/layout/widgets_view.xml b/res/layout/widgets_view.xml index a1a62b32a..c27e79bbd 100644 --- a/res/layout/widgets_view.xml +++ b/res/layout/widgets_view.xml @@ -21,25 +21,29 @@ android:id="@+id/widgets_view" android:layout_width="match_parent" android:layout_height="match_parent" - android:paddingTop="@dimen/widget_container_inset" - android:paddingBottom="@dimen/widget_container_inset" + android:orientation="vertical" android:descendantFocusability="afterDescendants"> <FrameLayout - android:id="@+id/widgets_reveal_view" + android:id="@+id/content" android:layout_width="match_parent" - android:layout_height="match_parent" - android:layout_gravity="center" - android:elevation="2dp" - android:focusable="false" - android:visibility="invisible" /> + android:layout_height="match_parent"> + <FrameLayout + android:id="@+id/widgets_reveal_view" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:layout_gravity="center" + android:focusable="false" + android:elevation="2dp" + android:visibility="invisible" /> <com.android.launcher3.widget.WidgetsRecyclerView android:id="@+id/widgets_list_view" android:layout_width="match_parent" android:layout_height="match_parent" - android:background="@drawable/quantum_panel_dark" + android:layout_gravity="center" android:elevation="15dp" android:visibility="gone" /> + </FrameLayout> </com.android.launcher3.widget.WidgetsContainerView>
\ No newline at end of file |