Remove empty space when searching language list

Collasping the tool bar when search menu item is invoked.

Bug: 266383101
Test: visual test, open the page and the large empty space will be
collapsed when searching language list.

Change-Id: I6548d3d572082a66778cb27d9333dff760619dab
This commit is contained in:
Mill Chen
2023-02-03 16:30:44 +08:00
parent ef241b863f
commit e09177c081

View File

@@ -31,7 +31,7 @@ import com.android.settings.core.SettingsBaseActivity;
/** A activity to show the locale picker page. */
public class LocalePickerWithRegionActivity extends SettingsBaseActivity
implements LocalePickerWithRegion.LocaleSelectedListener {
implements LocalePickerWithRegion.LocaleSelectedListener, MenuItem.OnActionExpandListener {
private static final String TAG = LocalePickerWithRegionActivity.class.getSimpleName();
private static final String PARENT_FRAGMENT_NAME = "localeListEditor";
@@ -53,7 +53,9 @@ public class LocalePickerWithRegionActivity extends SettingsBaseActivity
this,
LocalePickerWithRegionActivity.this,
false /* translate only */,
explicitLocales);
explicitLocales,
null /* appPackageName */,
this);
getFragmentManager()
.beginTransaction()
.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN)
@@ -97,5 +99,17 @@ public class LocalePickerWithRegionActivity extends SettingsBaseActivity
return Settings.Global.getInt(
getContentResolver(), Settings.Global.DEVICE_DEMO_MODE, 0) == 1;
}
@Override
public boolean onMenuItemActionExpand(MenuItem item) {
mAppBarLayout.setExpanded(false /*expanded*/, false /*animate*/);
return true;
}
@Override
public boolean onMenuItemActionCollapse(MenuItem item) {
mAppBarLayout.setExpanded(false /*expanded*/, false /*animate*/);
return true;
}
}