File tree Expand file tree Collapse file tree 1 file changed +13
-8
lines changed
catalog/java/io/material/catalog/color Expand file tree Collapse file tree 1 file changed +13
-8
lines changed Original file line number Diff line number Diff line change 2121import android .content .Intent ;
2222import androidx .fragment .app .Fragment ;
2323import androidx .annotation .NonNull ;
24+ import androidx .annotation .Nullable ;
2425import com .google .android .material .color .DynamicColors ;
2526import com .google .android .material .color .HarmonizedColors ;
2627import dagger .Provides ;
@@ -58,6 +59,16 @@ public Fragment createFragment() {
5859 };
5960 }
6061
62+ @ Nullable
63+ public Demo getColorHarmonizationDemo () {
64+ return new Demo (R .string .cat_color_harmonization ) {
65+ @ Override
66+ public Intent createActivityIntent () {
67+ return new Intent (getContext (), ColorHarmonizationDemoActivity .class );
68+ }
69+ };
70+ }
71+
6172 @ NonNull
6273 @ Override
6374 public List <Demo > getAdditionalDemos () {
@@ -71,14 +82,8 @@ public Fragment createFragment() {
7182 }
7283 });
7384 }
74- if (HarmonizedColors .isHarmonizedColorAvailable ()) {
75- additionalDemos .add (
76- new Demo (R .string .cat_color_harmonization ) {
77- @ Override
78- public Intent createActivityIntent () {
79- return new Intent (getContext (), ColorHarmonizationDemoActivity .class );
80- }
81- });
85+ if (HarmonizedColors .isHarmonizedColorAvailable () && getColorHarmonizationDemo () != null ) {
86+ additionalDemos .add (getColorHarmonizationDemo ());
8287 }
8388 return additionalDemos ;
8489 }
You can’t perform that action at this time.
0 commit comments