Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(406)

Unified Diff: remoting/android/java/src/org/chromium/chromoting/Desktop.java

Issue 2393073003: [Remoting Android] Fading transition animation for desktop actionbar (Closed)
Patch Set: Not using AnimationListener, which made onSystemUiVisibilityChange flaky (why?) Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/android/java/src/org/chromium/chromoting/Desktop.java
diff --git a/remoting/android/java/src/org/chromium/chromoting/Desktop.java b/remoting/android/java/src/org/chromium/chromoting/Desktop.java
index c115749677ffb9dab8db7ecd28567fc8e5b79200..e340f51af4f9b49eacd5dc460e41674f49c989fb 100644
--- a/remoting/android/java/src/org/chromium/chromoting/Desktop.java
+++ b/remoting/android/java/src/org/chromium/chromoting/Desktop.java
@@ -18,6 +18,8 @@ import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnLayoutChangeListener;
import android.view.View.OnTouchListener;
+import android.view.animation.Animation;
+import android.view.animation.AnimationUtils;
import android.view.inputmethod.InputMethodManager;
import org.chromium.chromoting.help.HelpContext;
@@ -49,6 +51,9 @@ public class Desktop
/** The amount of time to wait to hide the ActionBar after user input is seen. */
private static final int ACTIONBAR_AUTO_HIDE_DELAY_MS = 3000;
+ /** Animation duration for fade-in and fade-out. */
joedow 2016/10/05 22:10:25 I'd change this to 'Duration for fade-in and fade-
Yuwei 2016/10/05 22:22:22 Done.
+ private static final int ACTIONBAR_ANIMATION_DURATION_MS = 250;
+
private final Event.Raisable<SystemUiVisibilityChangedEventParameter>
mOnSystemUiVisibilityChanged = new Event.Raisable<>();
@@ -78,6 +83,12 @@ public class Desktop
private DesktopView mRemoteHostDesktop;
+ private Animation createAnimation(int animationId) {
joedow 2016/10/05 22:10:25 rename to 'createToolbarVisibilityAnimation'? It
Yuwei 2016/10/05 22:22:22 Done.
+ Animation animation = AnimationUtils.loadAnimation(this, animationId);
+ animation.setDuration(ACTIONBAR_ANIMATION_DURATION_MS);
+ return animation;
+ }
+
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
@@ -400,6 +411,8 @@ public class Desktop
/** Shows the action bar without changing SystemUiVisibility. */
private void showActionBar() {
+ mToolbar.startAnimation(createAnimation(android.R.anim.fade_in));
+
getSupportActionBar().show();
startActionBarAutoHideTimer();
}
@@ -437,6 +450,8 @@ public class Desktop
/** Hides the action bar without changing SystemUiVisibility. */
private void hideActionBar() {
+ mToolbar.startAnimation(createAnimation(android.R.anim.fade_out));
+
getSupportActionBar().hide();
stopActionBarAutoHideTimer();
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698