Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
The Tor Project
Anti-censorship
Pluggable Transports
Snowflake Mobile
Commits
0d118d55
Verified
Commit
0d118d55
authored
Aug 07, 2020
by
HashikD
Browse files
Add animations to note TextView
parent
0fbd7b41
Changes
2
Hide whitespace changes
Inline
Side-by-side
app/src/main/java/org/torproject/snowflake/fragments/MainFragment.java
View file @
0d118d55
...
...
@@ -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
);
...
...
app/src/main/res/anim/fade.xml
0 → 100644
View file @
0d118d55
<?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
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment