Loading Android.mk +3 −2 Original line number Diff line number Diff line Loading @@ -22,9 +22,10 @@ LOCAL_SRC_FILES := $(call all-java-files-under, src) LOCAL_STATIC_ANDROID_LIBRARIES := \ android-support-v4 \ android-support-v13 \ android-support-v7-recyclerview \ android-support-v7-preference \ android-support-v7-appcompat \ android-support-v7-cardview \ android-support-v7-preference \ android-support-v7-recyclerview \ android-support-v14-preference LOCAL_JAVA_LIBRARIES := \ Loading res/layout/dashboard_header_spacer.xml 0 → 100644 +25 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- Copyright (C) 2017 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:padding="@dimen/search_bar_margin"> <View android:layout_width="match_parent" android:layout_height="?android:attr/actionBarSize"/> </LinearLayout> res/layout/settings_main_dashboard.xml +28 −4 Original line number Diff line number Diff line Loading @@ -18,7 +18,31 @@ --> <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_height="match_parent" android:layout_width="match_parent"> <FrameLayout android:id="@+id/main_content" android:layout_height="match_parent" android:layout_width="match_parent"/> <android.support.v7.widget.CardView android:id="@+id/search_bar" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_margin="@dimen/search_bar_margin" app:cardCornerRadius="2dp" app:cardBackgroundColor="?android:attr/colorBackground" app:cardElevation="2dp"> <Toolbar android:id="@+id/search_action_bar" android:layout_width="match_parent" /> android:layout_height="wrap_content" android:layout_marginStart="@dimen/search_bar_negative_margin" android:background="?android:attr/selectableItemBackground" android:navigationIcon="@drawable/ic_search_24dp" android:title="@string/search_menu" android:titleTextAppearance="?android:attr/subtitleTextAppearance" android:titleTextColor="?android:attr/textColorHint" android:theme="?android:attr/actionBarTheme"/> </android.support.v7.widget.CardView> </FrameLayout> res/values/dimens.xml +6 −0 Original line number Diff line number Diff line Loading @@ -140,6 +140,12 @@ <dimen name="search_suggestion_item_image_margin_start">32dp</dimen> <dimen name="search_suggestion_item_image_margin_end">32dp</dimen> <!-- The following two margins need to match, with the caveat that the second should be negative. The second one ensures that the icons and text align despite the additional padding caused by the search bar's card background. --> <dimen name="search_bar_margin">8dp</dimen> <dimen name="search_bar_negative_margin">-8dp</dimen> <!-- Dimensions for Wifi Assistant Card --> <dimen name="wifi_assistant_padding_top_bottom">16dp</dimen> <dimen name="wifi_assistant_padding_start_end">16dp</dimen> Loading src/com/android/settings/SettingsActivity.java +22 −6 Original line number Diff line number Diff line Loading @@ -50,6 +50,7 @@ import android.view.View; import android.view.View.OnClickListener; import android.view.ViewGroup; import android.widget.Button; import android.widget.Toolbar; import com.android.internal.util.ArrayUtils; import com.android.settings.Settings.WifiSettingsActivity; Loading @@ -62,6 +63,7 @@ import com.android.settings.dashboard.DashboardSummary; import com.android.settings.development.DevelopmentSettings; import com.android.settings.overlay.FeatureFactory; import com.android.settings.search.DynamicIndexableContentMonitor; import com.android.settings.search2.SearchActivity; import com.android.settings.search2.SearchFeatureProvider; import com.android.settings.wfd.WifiDisplaySettings; import com.android.settings.widget.SwitchBar; Loading @@ -75,7 +77,7 @@ import java.util.Set; public class SettingsActivity extends SettingsDrawerActivity implements PreferenceManager.OnPreferenceTreeClickListener, PreferenceFragment.OnPreferenceStartFragmentCallback, ButtonBarHandler, FragmentManager.OnBackStackChangedListener { ButtonBarHandler, FragmentManager.OnBackStackChangedListener, OnClickListener { private static final String LOG_TAG = "Settings"; Loading Loading @@ -345,6 +347,14 @@ public class SettingsActivity extends SettingsDrawerActivity launchSettingFragment(initialFragmentName, isSubSettings, intent); } if (mIsShowingDashboard) { findViewById(R.id.search_bar).setVisibility(View.VISIBLE); findViewById(R.id.action_bar).setVisibility(View.GONE); Toolbar toolbar = findViewById(R.id.search_action_bar); toolbar.setOnClickListener(this); setActionBar(toolbar); } mActionBar = getActionBar(); if (mActionBar != null) { mActionBar.setDisplayHomeAsUpEnabled(mDisplayHomeAsUpEnabled); Loading Loading @@ -432,10 +442,10 @@ public class SettingsActivity extends SettingsDrawerActivity switchToFragment(initialFragmentName, initialArguments, true, false, mInitialTitleResId, mInitialTitle, false); } else { // No UP affordance if we are displaying the main Dashboard mDisplayHomeAsUpEnabled = false; // Show Search affordance mDisplaySearch = true; // Show search icon as up affordance if we are displaying the main Dashboard mDisplayHomeAsUpEnabled = true; // toolbar is search affordance so don't show search mDisplaySearch = false; mInitialTitleResId = R.string.dashboard_title; switchToFragment(DashboardSummary.class.getName(), null /* args */, false, false, Loading Loading @@ -939,4 +949,10 @@ public class SettingsActivity extends SettingsDrawerActivity return bitmap; } @Override public void onClick(View v) { Intent intent = new Intent(this, SearchActivity.class); startActivity(intent); } } Loading
Android.mk +3 −2 Original line number Diff line number Diff line Loading @@ -22,9 +22,10 @@ LOCAL_SRC_FILES := $(call all-java-files-under, src) LOCAL_STATIC_ANDROID_LIBRARIES := \ android-support-v4 \ android-support-v13 \ android-support-v7-recyclerview \ android-support-v7-preference \ android-support-v7-appcompat \ android-support-v7-cardview \ android-support-v7-preference \ android-support-v7-recyclerview \ android-support-v14-preference LOCAL_JAVA_LIBRARIES := \ Loading
res/layout/dashboard_header_spacer.xml 0 → 100644 +25 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- Copyright (C) 2017 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:padding="@dimen/search_bar_margin"> <View android:layout_width="match_parent" android:layout_height="?android:attr/actionBarSize"/> </LinearLayout>
res/layout/settings_main_dashboard.xml +28 −4 Original line number Diff line number Diff line Loading @@ -18,7 +18,31 @@ --> <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_height="match_parent" android:layout_width="match_parent"> <FrameLayout android:id="@+id/main_content" android:layout_height="match_parent" android:layout_width="match_parent"/> <android.support.v7.widget.CardView android:id="@+id/search_bar" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_margin="@dimen/search_bar_margin" app:cardCornerRadius="2dp" app:cardBackgroundColor="?android:attr/colorBackground" app:cardElevation="2dp"> <Toolbar android:id="@+id/search_action_bar" android:layout_width="match_parent" /> android:layout_height="wrap_content" android:layout_marginStart="@dimen/search_bar_negative_margin" android:background="?android:attr/selectableItemBackground" android:navigationIcon="@drawable/ic_search_24dp" android:title="@string/search_menu" android:titleTextAppearance="?android:attr/subtitleTextAppearance" android:titleTextColor="?android:attr/textColorHint" android:theme="?android:attr/actionBarTheme"/> </android.support.v7.widget.CardView> </FrameLayout>
res/values/dimens.xml +6 −0 Original line number Diff line number Diff line Loading @@ -140,6 +140,12 @@ <dimen name="search_suggestion_item_image_margin_start">32dp</dimen> <dimen name="search_suggestion_item_image_margin_end">32dp</dimen> <!-- The following two margins need to match, with the caveat that the second should be negative. The second one ensures that the icons and text align despite the additional padding caused by the search bar's card background. --> <dimen name="search_bar_margin">8dp</dimen> <dimen name="search_bar_negative_margin">-8dp</dimen> <!-- Dimensions for Wifi Assistant Card --> <dimen name="wifi_assistant_padding_top_bottom">16dp</dimen> <dimen name="wifi_assistant_padding_start_end">16dp</dimen> Loading
src/com/android/settings/SettingsActivity.java +22 −6 Original line number Diff line number Diff line Loading @@ -50,6 +50,7 @@ import android.view.View; import android.view.View.OnClickListener; import android.view.ViewGroup; import android.widget.Button; import android.widget.Toolbar; import com.android.internal.util.ArrayUtils; import com.android.settings.Settings.WifiSettingsActivity; Loading @@ -62,6 +63,7 @@ import com.android.settings.dashboard.DashboardSummary; import com.android.settings.development.DevelopmentSettings; import com.android.settings.overlay.FeatureFactory; import com.android.settings.search.DynamicIndexableContentMonitor; import com.android.settings.search2.SearchActivity; import com.android.settings.search2.SearchFeatureProvider; import com.android.settings.wfd.WifiDisplaySettings; import com.android.settings.widget.SwitchBar; Loading @@ -75,7 +77,7 @@ import java.util.Set; public class SettingsActivity extends SettingsDrawerActivity implements PreferenceManager.OnPreferenceTreeClickListener, PreferenceFragment.OnPreferenceStartFragmentCallback, ButtonBarHandler, FragmentManager.OnBackStackChangedListener { ButtonBarHandler, FragmentManager.OnBackStackChangedListener, OnClickListener { private static final String LOG_TAG = "Settings"; Loading Loading @@ -345,6 +347,14 @@ public class SettingsActivity extends SettingsDrawerActivity launchSettingFragment(initialFragmentName, isSubSettings, intent); } if (mIsShowingDashboard) { findViewById(R.id.search_bar).setVisibility(View.VISIBLE); findViewById(R.id.action_bar).setVisibility(View.GONE); Toolbar toolbar = findViewById(R.id.search_action_bar); toolbar.setOnClickListener(this); setActionBar(toolbar); } mActionBar = getActionBar(); if (mActionBar != null) { mActionBar.setDisplayHomeAsUpEnabled(mDisplayHomeAsUpEnabled); Loading Loading @@ -432,10 +442,10 @@ public class SettingsActivity extends SettingsDrawerActivity switchToFragment(initialFragmentName, initialArguments, true, false, mInitialTitleResId, mInitialTitle, false); } else { // No UP affordance if we are displaying the main Dashboard mDisplayHomeAsUpEnabled = false; // Show Search affordance mDisplaySearch = true; // Show search icon as up affordance if we are displaying the main Dashboard mDisplayHomeAsUpEnabled = true; // toolbar is search affordance so don't show search mDisplaySearch = false; mInitialTitleResId = R.string.dashboard_title; switchToFragment(DashboardSummary.class.getName(), null /* args */, false, false, Loading Loading @@ -939,4 +949,10 @@ public class SettingsActivity extends SettingsDrawerActivity return bitmap; } @Override public void onClick(View v) { Intent intent = new Intent(this, SearchActivity.class); startActivity(intent); } }