Update Search Bar layout in Homepage
Bug: 340513864 Bug: 340773713 Bug: 340799397 Bug: 340759836 Test: visual Change-Id: I4bd5c3438aa55ca764f61b180a37c10206ee78be
This commit is contained in:
@@ -406,7 +406,7 @@ public class SettingsHomepageActivity extends FragmentActivity implements
|
||||
|
||||
private void initSearchBarView() {
|
||||
if (Flags.homepageRevamp()) {
|
||||
Toolbar toolbar = findViewById(R.id.search_action_bar_unified);
|
||||
View toolbar = findViewById(R.id.search_action_bar);
|
||||
FeatureFactory.getFeatureFactory().getSearchFeatureProvider()
|
||||
.initSearchToolbar(this /* activity */, toolbar,
|
||||
SettingsEnums.SETTINGS_HOMEPAGE);
|
||||
@@ -469,6 +469,10 @@ public class SettingsHomepageActivity extends FragmentActivity implements
|
||||
window.setStatusBarColor(color);
|
||||
// Update content background.
|
||||
findViewById(android.R.id.content).setBackgroundColor(color);
|
||||
if (Flags.homepageRevamp()) {
|
||||
//Update search bar background
|
||||
findViewById(R.id.app_bar_container).setBackgroundColor(color);
|
||||
}
|
||||
}
|
||||
|
||||
private void showSuggestionFragment(boolean scrollNeeded) {
|
||||
|
||||
@@ -30,6 +30,7 @@ import android.view.ViewGroup;
|
||||
import android.widget.Toolbar;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.FragmentActivity;
|
||||
|
||||
import com.android.settings.R;
|
||||
@@ -80,8 +81,9 @@ public interface SearchFeatureProvider {
|
||||
/**
|
||||
* Initializes the search toolbar.
|
||||
*/
|
||||
default void initSearchToolbar(FragmentActivity activity, Toolbar toolbar, int pageId) {
|
||||
if (activity == null || toolbar == null) {
|
||||
default void initSearchToolbar(@NonNull FragmentActivity activity, @Nullable View toolbar,
|
||||
int pageId) {
|
||||
if (toolbar == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -98,11 +100,13 @@ public interface SearchFeatureProvider {
|
||||
//
|
||||
// Need to make the navigation icon non-clickable so that the entire card is clickable
|
||||
// and goes to the search UI. Also set the background to null so there's no ripple.
|
||||
final View navView = toolbar.getNavigationView();
|
||||
navView.setClickable(false);
|
||||
navView.setFocusable(false);
|
||||
navView.setImportantForAccessibility(IMPORTANT_FOR_ACCESSIBILITY_NO);
|
||||
navView.setBackground(null);
|
||||
if (toolbar instanceof Toolbar) {
|
||||
final View navView = ((Toolbar) toolbar).getNavigationView();
|
||||
navView.setClickable(false);
|
||||
navView.setFocusable(false);
|
||||
navView.setImportantForAccessibility(IMPORTANT_FOR_ACCESSIBILITY_NO);
|
||||
navView.setBackground(null);
|
||||
}
|
||||
|
||||
final Context context = activity.getApplicationContext();
|
||||
final Intent intent = buildSearchIntent(context, pageId)
|
||||
|
||||
Reference in New Issue
Block a user