diff options
author | daniel oeh <daniel.oeh@gmail.com> | 2012-10-10 17:36:14 +0200 |
---|---|---|
committer | daniel oeh <daniel.oeh@gmail.com> | 2012-10-10 17:36:14 +0200 |
commit | 6f4cf5fbdcc312bae9139bd347b4d085b300ee26 (patch) | |
tree | 113a653cb6cb356c4afb7578c09bf70d4cd7ecf0 | |
parent | 2d2102b7abfbde16290994e4f9abe2a321ec65c3 (diff) | |
download | AntennaPod-6f4cf5fbdcc312bae9139bd347b4d085b300ee26.zip |
Improved visibility change animation in videoplayer
-rw-r--r-- | AndroidManifest.xml | 2 | ||||
-rw-r--r-- | res/anim/fade_in.xml | 9 | ||||
-rw-r--r-- | res/anim/fade_out.xml | 10 | ||||
-rw-r--r-- | src/de/danoeh/antennapod/activity/VideoplayerActivity.java | 22 |
4 files changed, 39 insertions, 4 deletions
diff --git a/AndroidManifest.xml b/AndroidManifest.xml index 5e1ec8641..013c965e3 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -25,7 +25,7 @@ <application android:name="de.danoeh.antennapod.PodcastApp" - android:debuggable="true" + android:debuggable="false" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:logo="@drawable/ic_launcher" diff --git a/res/anim/fade_in.xml b/res/anim/fade_in.xml new file mode 100644 index 000000000..d3567dc31 --- /dev/null +++ b/res/anim/fade_in.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="500" + android:fromAlpha="0.0" + android:interpolator="@android:anim/accelerate_interpolator" + android:toAlpha="1.0" /> +</set>
\ No newline at end of file diff --git a/res/anim/fade_out.xml b/res/anim/fade_out.xml new file mode 100644 index 000000000..ddf12d13f --- /dev/null +++ b/res/anim/fade_out.xml @@ -0,0 +1,10 @@ +<?xml version="1.0" encoding="utf-8"?> +<set xmlns:android="http://schemas.android.com/apk/res/android"> + + <alpha + android:duration="500" + android:fromAlpha="1.0" + android:interpolator="@android:anim/accelerate_interpolator" + android:toAlpha="0.0" /> + +</set>
\ No newline at end of file diff --git a/src/de/danoeh/antennapod/activity/VideoplayerActivity.java b/src/de/danoeh/antennapod/activity/VideoplayerActivity.java index 79bb60522..97437120a 100644 --- a/src/de/danoeh/antennapod/activity/VideoplayerActivity.java +++ b/src/de/danoeh/antennapod/activity/VideoplayerActivity.java @@ -1,5 +1,7 @@ package de.danoeh.antennapod.activity; +import com.actionbarsherlock.view.Window; + import android.annotation.SuppressLint; import android.content.Intent; import android.os.AsyncTask; @@ -9,6 +11,7 @@ import android.view.MotionEvent; import android.view.SurfaceHolder; import android.view.View; import android.view.WindowManager; +import android.view.animation.AnimationUtils; import android.widget.LinearLayout; import android.widget.ProgressBar; import android.widget.SeekBar; @@ -34,6 +37,7 @@ public class VideoplayerActivity extends MediaplayerActivity implements @Override protected void onCreate(Bundle savedInstanceState) { + requestWindowFeature(Window.FEATURE_ACTION_BAR_OVERLAY); super.onCreate(savedInstanceState); } @@ -121,10 +125,10 @@ public class VideoplayerActivity extends MediaplayerActivity implements private void toggleVideoControlsVisibility() { if (videoControlsShowing) { getSupportActionBar().hide(); - videoOverlay.setVisibility(View.GONE); + hideVideoControls(); } else { getSupportActionBar().show(); - videoOverlay.setVisibility(View.VISIBLE); + showVideoControls(); } videoControlsShowing = !videoControlsShowing; } @@ -150,7 +154,7 @@ public class VideoplayerActivity extends MediaplayerActivity implements if (AppConfig.DEBUG) Log.d(TAG, "Hiding video controls"); getSupportActionBar().hide(); - videoOverlay.setVisibility(View.GONE); + hideVideoControls(); videoControlsShowing = false; } } @@ -232,4 +236,16 @@ public class VideoplayerActivity extends MediaplayerActivity implements progressIndicator.setVisibility(View.INVISIBLE); } + private void showVideoControls() { + videoOverlay.setVisibility(View.VISIBLE); + videoOverlay.startAnimation(AnimationUtils.loadAnimation(this, + R.anim.fade_in)); + } + + private void hideVideoControls() { + videoOverlay.startAnimation(AnimationUtils.loadAnimation(this, + R.anim.fade_out)); + videoOverlay.setVisibility(View.GONE); + } + } |