commit 0d118d557e171f96a09d139f3450497a4f672d75 Author: Hashik Donthineni HashikDonthineni@gmail.com Date: Fri Aug 7 01:58:07 2020 +0530
Add animations to note TextView --- .../java/org/torproject/snowflake/fragments/MainFragment.java | 6 ++++++ app/src/main/res/anim/fade.xml | 9 +++++++++ 2 files changed, 15 insertions(+)
diff --git a/app/src/main/java/org/torproject/snowflake/fragments/MainFragment.java b/app/src/main/java/org/torproject/snowflake/fragments/MainFragment.java index d24c891..efcddc1 100644 --- a/app/src/main/java/org/torproject/snowflake/fragments/MainFragment.java +++ b/app/src/main/java/org/torproject/snowflake/fragments/MainFragment.java @@ -9,6 +9,8 @@ import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; +import android.view.animation.Animation; +import android.view.animation.AnimationUtils; import android.widget.ImageView; import android.widget.Switch; import android.widget.TextView; @@ -30,6 +32,7 @@ public class MainFragment extends Fragment { MainFragmentCallback callback; TextView usersServedTV; TextView noteTV; + Animation textViewFade; ImageView snowflakeLogo; Switch startButton;
@@ -63,6 +66,7 @@ public class MainFragment extends Fragment { noteTV = rootView.findViewById(R.id.note_tv); startButton = rootView.findViewById(R.id.snowflake_switch); snowflakeLogo = rootView.findViewById(R.id.snowflake_logo); + textViewFade = AnimationUtils.loadAnimation(getActivity(), R.anim.fade);
//If the service is running, set the button to on if (callback.isServiceRunning()) { @@ -108,6 +112,8 @@ public class MainFragment extends Fragment { */ private void setSnowflakeStatus(boolean status) { int from, to; + noteTV.startAnimation(textViewFade); + if (status) { //Status on from = this.getResources().getColor(R.color.snowflakeOff); to = this.getResources().getColor(R.color.snowflakeOn); diff --git a/app/src/main/res/anim/fade.xml b/app/src/main/res/anim/fade.xml new file mode 100644 index 0000000..611eb62 --- /dev/null +++ b/app/src/main/res/anim/fade.xml @@ -0,0 +1,9 @@ +<?xml version="1.0" encoding="UTF-8"?> +<set xmlns:android="http://schemas.android.com/apk/res/android"> + <alpha + android:duration="300" + android:fromAlpha="0.0" + android:interpolator="@android:anim/accelerate_interpolator" + android:repeatCount="0" + android:toAlpha="1.0" /> +</set> \ No newline at end of file
tor-commits@lists.torproject.org