summaryrefslogtreecommitdiffstats
path: root/src/com/android/gallery3d/app/MovieControllerOverlay.java
diff options
context:
space:
mode:
authorOwen Lin <owenlin@google.com>2012-05-23 15:47:36 -0700
committerOwen Lin <owenlin@google.com>2012-05-25 16:02:23 -0700
commitb603e674b9e0bc7372fd535f7f3ac0b9b4e3a689 (patch)
tree1584623b261f7ae75794c6fd0d5ab41ba9745e7d /src/com/android/gallery3d/app/MovieControllerOverlay.java
parentb1475e112677eac0f58e7e2925f801016e7982da (diff)
downloadandroid_packages_apps_Snap-b603e674b9e0bc7372fd535f7f3ac0b9b4e3a689.tar.gz
android_packages_apps_Snap-b603e674b9e0bc7372fd535f7f3ac0b9b4e3a689.tar.bz2
android_packages_apps_Snap-b603e674b9e0bc7372fd535f7f3ac0b9b4e3a689.zip
Add back the background when we show the action bar
This change fix the following UI issues: 1. We add a black backgorund when ActionBar shows and remove it when we hide the action bar. 2. Make the postion of video stable when opening 3. Prevent glitching when opening a video 4. Make it really full-screen. 5. Hide ControlOverlay at begining. bug:6519765 bug:6491674 Change-Id: I3ab033642df2c4a158b99385b02e3e967eebeabd
Diffstat (limited to 'src/com/android/gallery3d/app/MovieControllerOverlay.java')
-rw-r--r--src/com/android/gallery3d/app/MovieControllerOverlay.java62
1 files changed, 41 insertions, 21 deletions
diff --git a/src/com/android/gallery3d/app/MovieControllerOverlay.java b/src/com/android/gallery3d/app/MovieControllerOverlay.java
index ae9f085a1..f2c9e05dd 100644
--- a/src/com/android/gallery3d/app/MovieControllerOverlay.java
+++ b/src/com/android/gallery3d/app/MovieControllerOverlay.java
@@ -17,6 +17,7 @@
package com.android.gallery3d.app;
import android.content.Context;
+import android.graphics.Rect;
import android.os.Handler;
import android.view.Gravity;
import android.view.KeyEvent;
@@ -227,6 +228,7 @@ public class MovieControllerOverlay extends FrameLayout implements
}
private void startHiding() {
+ startHideAnimation(background);
startHideAnimation(timeBar);
startHideAnimation(playPauseReplayView);
}
@@ -302,36 +304,54 @@ public class MovieControllerOverlay extends FrameLayout implements
return true;
}
+ // The paddings of 4 sides which covered by system components. E.g.
+ // +-----------------+\
+ // | Action Bar | insets.top
+ // +-----------------+/
+ // | |
+ // | Content Area | insets.right = insets.left = 0
+ // | |
+ // +-----------------+\
+ // | Navigation Bar | insets.bottom
+ // +-----------------+/
+ // Please see View.fitSystemWindows() for more details.
+ private final Rect mWindowInsets = new Rect();
+
@Override
- protected void onLayout(boolean changed, int l, int t, int r, int b) {
- int bw;
- int bh;
- int y;
- int h = b - t;
- int w = r - l;
- boolean error = errorView.getVisibility() == View.VISIBLE;
+ protected boolean fitSystemWindows(Rect insets) {
+ // We don't set the paddings of this View, otherwise,
+ // the content will get cropped outside window
+ mWindowInsets.set(insets);
+ return true;
+ }
- bw = timeBar.getBarHeight();
- bh = bw;
- y = b - bh;
+ @Override
+ protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
+ Rect insets = mWindowInsets;
+ int pl = insets.left; // the left paddings
+ int pr = insets.right;
+ int pt = insets.top;
+ int pb = insets.bottom;
+
+ int h = bottom - top;
+ int w = right - left;
+ boolean error = errorView.getVisibility() == View.VISIBLE;
- background.layout(l, y, r, b);
+ int y = h - pb;
+ // Put both TimeBar and Background just above the bottom system component.
+ // But extend the background to the width of the screen, since we don't
+ // care if it will be covered by a system component and it looks better.
+ background.layout(0, y - timeBar.getBarHeight(), w, y);
+ timeBar.layout(pl, y - timeBar.getPreferredHeight(), w - pr, y);
- timeBar.layout(l, b - timeBar.getPreferredHeight(), r, b);
// Needed, otherwise the framework will not re-layout in case only the padding is changed
timeBar.requestLayout();
- // play pause / next / previous buttons
- int cx = l + w / 2; // center x
- int playbackButtonsCenterline = t + h / 2;
- bw = playPauseReplayView.getMeasuredWidth();
- bh = playPauseReplayView.getMeasuredHeight();
- playPauseReplayView.layout(
- cx - bw / 2, playbackButtonsCenterline - bh / 2, cx + bw / 2,
- playbackButtonsCenterline + bh / 2);
+ // Put the play/pause/next/ previous button in the center of the screen
+ layoutCenteredView(playPauseReplayView, 0, 0, w, h);
if (mainView != null) {
- layoutCenteredView(mainView, l, t, r, b);
+ layoutCenteredView(mainView, 0, 0, w, h);
}
}