Verified Commit 0fbd7b41 authored by HashikD's avatar HashikD
Browse files

Add dynamic note change

parent 77ad8550
......@@ -29,6 +29,7 @@ public class MainFragment extends Fragment {
private static final String TAG = "MainFragment";
MainFragmentCallback callback;
TextView usersServedTV;
TextView noteTV;
ImageView snowflakeLogo;
Switch startButton;
......@@ -59,6 +60,7 @@ public class MainFragment extends Fragment {
Log.d(TAG, "onCreateView: ");
View rootView = inflater.inflate(R.layout.fragment_main, container, false);
usersServedTV = rootView.findViewById(R.id.users_served);
noteTV = rootView.findViewById(R.id.note_tv);
startButton = rootView.findViewById(R.id.snowflake_switch);
snowflakeLogo = rootView.findViewById(R.id.snowflake_logo);
......@@ -110,13 +112,15 @@ public class MainFragment extends Fragment {
from = this.getResources().getColor(R.color.snowflakeOff);
to = this.getResources().getColor(R.color.snowflakeOn);
startButton.setText(getString(R.string.Snowflake_On));
noteTV.setText(getString(R.string.snowflake_ready_note));
} else { //off
from = this.getResources().getColor(R.color.snowflakeOn);
to = this.getResources().getColor(R.color.snowflakeOff);
startButton.setText(getString(R.string.Snowflake_Off));
noteTV.setText(getString(R.string.turn_on_note));
}
//Animating the transition
//Animating the transition of logo
ValueAnimator colorAnimation = ValueAnimator.ofObject(new ArgbEvaluator(), from, to);
colorAnimation.setDuration(300); // milliseconds
colorAnimation.addUpdateListener(animator -> snowflakeLogo.setColorFilter((int) animator.getAnimatedValue(), PorterDuff.Mode.SRC_ATOP));
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment