Add CollapsingToolbarLayout for sub settings

Settings app is planning to make toolbar collapsible for next
Android release. This CL is to add a new layout for
CollapsingToolbarLayout in the Settings app and to update the theme
correspondly. This feature will be controlled by feature flag, which
makes Settings app compacitible with the existing layout.

Bug: 174451673
Test: manul test and visual verification
1) Enable the feature and open Settings app
2) Navigate to each sub page and check if toolbar is collapsible

Change-Id: Ibef524bbaa7ae3f0a43db7e40e599f42e009437f
This commit is contained in:
Mill Chen
2021-01-06 07:46:46 +08:00
parent 90c976b8c0
commit 14cfd2f2ca
8 changed files with 187 additions and 10 deletions

View File

@@ -26,6 +26,7 @@ import android.content.pm.PackageManager;
import android.os.Bundle;
import android.text.TextUtils;
import android.util.ArrayMap;
import android.util.FeatureFlagUtils;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
@@ -42,6 +43,7 @@ import androidx.preference.PreferenceScreen;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.android.settings.core.FeatureFlags;
import com.android.settings.core.InstrumentedPreferenceFragment;
import com.android.settings.core.instrumentation.InstrumentedDialogFragment;
import com.android.settings.search.actionbar.SearchMenuController;
@@ -126,8 +128,11 @@ public abstract class SettingsPreferenceFragment extends InstrumentedPreferenceF
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
SearchMenuController.init(this /* host */);
HelpMenuController.init(this /* host */);
// TODO(b/176883483): Remove both search and help menu if this feature rolled out
if (!FeatureFlagUtils.isEnabled(getContext(), FeatureFlags.SILKY_HOME)) {
SearchMenuController.init(this /* host */);
HelpMenuController.init(this /* host */);
}
if (icicle != null) {
mPreferenceHighlighted = icicle.getBoolean(SAVE_HIGHLIGHTED_KEY);