Update dream settings UX to match latest mocks.

Updates:
- removed individual complication toggle
- added single toggle which enables/disables all supported complications
- updated colors to match mocks
- updated grid padding in order to line up with existing content. Note:
  this required more complex padding logic, using an item decorator to
  apply the padding only to inner grid elements.
- updated preview image, removing view nesting to make better use of
  ConstraintLayout
- Updated some strings to match mocks

Test: locally on device
Bug: 217555053
Change-Id: I573e5f4ed807cbe2ae9e00f183d402e6e3339590
This commit is contained in:
Lucas Silva
2022-02-11 22:31:12 +00:00
parent cce99074e9
commit 75c44cd02b
15 changed files with 220 additions and 201 deletions

View File

@@ -21,7 +21,7 @@ import android.content.Context;
import android.graphics.drawable.Drawable;
import androidx.annotation.Nullable;
import androidx.preference.Preference;
import androidx.preference.PreferenceScreen;
import androidx.recyclerview.widget.RecyclerView;
import com.android.settings.R;
@@ -71,16 +71,21 @@ public class DreamPickerController extends BasePreferenceController {
}
@Override
public void updateState(Preference preference) {
super.updateState(preference);
public void displayPreference(PreferenceScreen screen) {
super.displayPreference(screen);
mAdapter = new DreamAdapter(mDreamInfos.stream()
.map(DreamItem::new)
.collect(Collectors.toList()));
final RecyclerView recyclerView =
((LayoutPreference) preference).findViewById(R.id.dream_list);
final LayoutPreference pref = screen.findPreference(getPreferenceKey());
if (pref == null) {
return;
}
final RecyclerView recyclerView = pref.findViewById(R.id.dream_list);
recyclerView.setLayoutManager(new AutoFitGridLayoutManager(mContext));
recyclerView.addItemDecoration(
new GridSpacingItemDecoration(mContext, R.dimen.dream_preference_card_padding));
recyclerView.setHasFixedSize(true);
recyclerView.setAdapter(mAdapter);
}