Skip to content

Commit

Permalink
[M3][Color] Color Component demo update
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 518320238
  • Loading branch information
Material Design Team authored and pekingme committed Mar 21, 2023
1 parent 206a468 commit 2aa1cf3
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions catalog/java/io/material/catalog/color/ColorsFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import android.content.Intent;
import androidx.fragment.app.Fragment;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.google.android.material.color.DynamicColors;
import com.google.android.material.color.HarmonizedColors;
import dagger.Provides;
Expand Down Expand Up @@ -58,6 +59,16 @@ public Fragment createFragment() {
};
}

@Nullable
public Demo getColorHarmonizationDemo() {
return new Demo(R.string.cat_color_harmonization) {
@Override
public Intent createActivityIntent() {
return new Intent(getContext(), ColorHarmonizationDemoActivity.class);
}
};
}

@NonNull
@Override
public List<Demo> getAdditionalDemos() {
Expand All @@ -71,14 +82,8 @@ public Fragment createFragment() {
}
});
}
if (HarmonizedColors.isHarmonizedColorAvailable()) {
additionalDemos.add(
new Demo(R.string.cat_color_harmonization) {
@Override
public Intent createActivityIntent() {
return new Intent(getContext(), ColorHarmonizationDemoActivity.class);
}
});
if (HarmonizedColors.isHarmonizedColorAvailable() && getColorHarmonizationDemo() != null) {
additionalDemos.add(getColorHarmonizationDemo());
}
return additionalDemos;
}
Expand Down

0 comments on commit 2aa1cf3

Please sign in to comment.