Update Search Bar layout in Homepage

Bug: 340513864
Bug: 340773713
Bug: 340799397
Bug: 340759836
Test: visual
Change-Id: I4bd5c3438aa55ca764f61b180a37c10206ee78be
This commit is contained in:
Edgar Wang
2024-05-16 12:06:59 +00:00
parent 66b69fbbb8
commit 66c16d57af
7 changed files with 53 additions and 58 deletions

View File

@@ -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)