Skip to content

Instantly share code, notes, and snippets.

@yuriyskulskiy
Last active August 16, 2020 00:28
Show Gist options
  • Save yuriyskulskiy/41ae1839e3919e03e4f787ecf67fda61 to your computer and use it in GitHub Desktop.
Save yuriyskulskiy/41ae1839e3919e03e4f787ecf67fda61 to your computer and use it in GitHub Desktop.
AnimatedLayout part 2: add additional view into the layout class.
public class AnimatedLayout extends ConstraintLayout {
...
private CircleImageView mWeatherIcon;
...
@Override
protected void onFinishInflate() {
super.onFinishInflate();
...
mWeatherIcon = findViewById(R.id.weatherIconIV);
}
...
private void applySummerIcon() {
mWeatherIcon.setImageResource(R.drawable.ic_sun);
mWeatherIcon.setCircleBackgroundColorResource(R.color.weather_icon_background_summer);
mWeatherIcon.setBorderColor(Color.WHITE);
}
private void applyWinterIcon() {
mWeatherIcon.setCircleBackgroundColorResource(R.color.snowflake_background);
mWeatherIcon.setImageResource(R.drawable.ic_snow);
mWeatherIcon.setBorderColor(Color.BLACK);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment