diff options
author | zdi <zdi@codeaurora.org> | 2016-03-11 13:08:08 +0800 |
---|---|---|
committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2016-03-23 04:07:13 -0700 |
commit | 042f105268e2791671d589fa65c20226807e9c0f (patch) | |
tree | c5ddda70269f3249675254d693470a6143154fcf /src/com/android/gallery3d/app | |
parent | 20a40e098cf5bcacb15ac6fd5502fa2105d52dcb (diff) | |
download | android_packages_apps_Gallery2-042f105268e2791671d589fa65c20226807e9c0f.tar.gz android_packages_apps_Gallery2-042f105268e2791671d589fa65c20226807e9c0f.tar.bz2 android_packages_apps_Gallery2-042f105268e2791671d589fa65c20226807e9c0f.zip |
Gallery2: Modify video play UI according to UI spec.
Modify the UI of video play according to UX specification document.
Change-Id: I7fe6daa43c40a49bc2727f39e8238799e07e4de6
CRs-Fixed: 988706 988719
Diffstat (limited to 'src/com/android/gallery3d/app')
6 files changed, 146 insertions, 13 deletions
diff --git a/src/com/android/gallery3d/app/CommonControllerOverlay.java b/src/com/android/gallery3d/app/CommonControllerOverlay.java index 7a553e906..28b6988f5 100644 --- a/src/com/android/gallery3d/app/CommonControllerOverlay.java +++ b/src/com/android/gallery3d/app/CommonControllerOverlay.java @@ -104,7 +104,6 @@ public abstract class CommonControllerOverlay extends FrameLayout implements mPlayPauseReplayView = new ImageView(context); mPlayPauseReplayView.setContentDescription( context.getResources().getString(R.string.accessibility_play_video)); - mPlayPauseReplayView.setBackgroundResource(R.drawable.bg_vidcontrol); mPlayPauseReplayView.setScaleType(ScaleType.CENTER); mPlayPauseReplayView.setFocusable(true); mPlayPauseReplayView.setClickable(true); diff --git a/src/com/android/gallery3d/app/MovieControllerOverlay.java b/src/com/android/gallery3d/app/MovieControllerOverlay.java index de68a4579..b2851e020 100644 --- a/src/com/android/gallery3d/app/MovieControllerOverlay.java +++ b/src/com/android/gallery3d/app/MovieControllerOverlay.java @@ -21,6 +21,7 @@ import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.graphics.Color; import android.graphics.Rect; +import android.graphics.drawable.VectorDrawable; import android.os.Handler; import android.text.TextUtils; import android.util.DisplayMetrics; @@ -63,7 +64,7 @@ public class MovieControllerOverlay extends CommonControllerOverlay implements private static final boolean LOG = true; private ScreenModeManager mScreenModeManager; - private ScreenModeExt mScreenModeExt = new ScreenModeExt(); + protected ScreenModeExt mScreenModeExt = new ScreenModeExt(); private ControllerRewindAndForwardExt mControllerRewindAndForwardExt = new ControllerRewindAndForwardExt(); private OverlayExtension mOverlayExt = new OverlayExtension(); private boolean hidden; @@ -73,7 +74,7 @@ public class MovieControllerOverlay extends CommonControllerOverlay implements private final Animation hideAnimation; private boolean enableRewindAndForward = false; - private Context mContext; + protected Context mContext; public MovieControllerOverlay(Context context) { super(context); @@ -89,8 +90,6 @@ public class MovieControllerOverlay extends CommonControllerOverlay implements hideAnimation = AnimationUtils.loadAnimation(context, R.anim.player_out); hideAnimation.setAnimationListener(this); - enableRewindAndForward = true; - Log.v(TAG, "enableRewindAndForward is " + enableRewindAndForward); mControllerRewindAndForwardExt.init(context); mScreenModeExt.init(context, mTimeBar); mBackground.setClickable(true); @@ -200,7 +199,7 @@ public class MovieControllerOverlay extends CommonControllerOverlay implements public void maybeStartHiding() { cancelHiding(); - if (mState == State.PLAYING) { + if (mState == State.PLAYING || mState == State.PAUSED) { handler.postDelayed(startHidingRunnable, 2500); } } @@ -706,11 +705,10 @@ public class MovieControllerOverlay extends CommonControllerOverlay implements } // for screen layout - Bitmap screenButton = BitmapFactory.decodeResource(context.getResources(), + VectorDrawable screenButton = VectorDrawable.create(context.getResources(), R.drawable.ic_media_bigscreen); - mScreenWidth = screenButton.getWidth(); + mScreenWidth = screenButton.getIntrinsicWidth(); mScreenPadding = (int) (metrics.density * MARGIN); - screenButton.recycle(); } private void updateScreenModeDrawable() { @@ -769,7 +767,7 @@ public class MovieControllerOverlay extends CommonControllerOverlay implements } public int getAddedRightPadding() { - return mScreenPadding * 2 + mScreenWidth; + return mScreenWidth; } @Override diff --git a/src/com/android/gallery3d/app/MovieControllerOverlayNew.java b/src/com/android/gallery3d/app/MovieControllerOverlayNew.java new file mode 100644 index 000000000..a11a74a51 --- /dev/null +++ b/src/com/android/gallery3d/app/MovieControllerOverlayNew.java @@ -0,0 +1,82 @@ +/* + * Copyright (c) 2016, The Linux Foundation. All rights reserved. + + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * * Neither the name of The Linux Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + + * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +package com.android.gallery3d.app; + +import android.content.Context; +import android.graphics.Rect; +import android.view.MotionEvent; +import android.view.View; + +public class MovieControllerOverlayNew extends MovieControllerOverlay { + + public MovieControllerOverlayNew(Context context) { + super(context); + } + + @Override + protected void createTimeBar(Context context) { + mTimeBar = new TimeBarNew(context, this); + } + + @Override + public boolean onTouchEvent(MotionEvent event) { + if (event.getAction() == MotionEvent.ACTION_DOWN) { + cancelHiding(); + return true; + } else if (event.getAction() == MotionEvent.ACTION_UP) { + maybeStartHiding(); + return true; + } else { + return super.onTouchEvent(event); + } + } + + @Override + protected void onLayout(boolean changed, int left, int top, int right, int bottom) { + int width = ((MovieActivity) mContext).getWindowManager().getDefaultDisplay().getWidth(); + Rect insets = mWindowInsets; + int pr = insets.right; + int pb = insets.bottom; + + int h = bottom - top; + int w = right - left; + + int y = h - pb; + + mBackground.layout(0, y - mTimeBar.getPreferredHeight(), w, y); + mScreenModeExt.onLayout(w, pr, y); + + mPlayPauseReplayView.layout(0, y - mTimeBar.getPreferredHeight(), + mTimeBar.getPreferredHeight(), y); + mTimeBar.layout(mTimeBar.getPreferredHeight(), y - mTimeBar.getPreferredHeight(), + width - mScreenModeExt.getAddedRightPadding(), y); + } + +} diff --git a/src/com/android/gallery3d/app/MoviePlayer.java b/src/com/android/gallery3d/app/MoviePlayer.java index c5aa61095..e1b8709b3 100755 --- a/src/com/android/gallery3d/app/MoviePlayer.java +++ b/src/com/android/gallery3d/app/MoviePlayer.java @@ -262,7 +262,7 @@ public class MoviePlayer implements mVideoView = (CodeauroraVideoView) rootView.findViewById(R.id.surface_view); mBookmarker = new Bookmarker(movieActivity); - mController = new MovieControllerOverlay(movieActivity); + mController = new MovieControllerOverlayNew(movieActivity); ((ViewGroup)rootView).addView(mController.getView()); mController.setListener(this); mController.setCanReplay(canReplay); diff --git a/src/com/android/gallery3d/app/TimeBar.java b/src/com/android/gallery3d/app/TimeBar.java index 7bd37b1cd..aed8eeccc 100755 --- a/src/com/android/gallery3d/app/TimeBar.java +++ b/src/com/android/gallery3d/app/TimeBar.java @@ -48,7 +48,7 @@ public class TimeBar extends View { } // Padding around the scrubber to increase its touch target - private static final int SCRUBBER_PADDING_IN_DP = 10; + private static final int SCRUBBER_PADDING_IN_DP = 3; // The total padding, top plus bottom private static final int V_PADDING_IN_DP = 30; @@ -106,7 +106,7 @@ public class TimeBar extends View { mProgressPaint = new Paint(); mProgressPaint.setColor(0xFF808080); mPlayedPaint = new Paint(); - mPlayedPaint.setColor(0xFFFFFFFF); + mPlayedPaint.setColor(0xFF4F92E9); DisplayMetrics metrics = context.getResources().getDisplayMetrics(); float textSizeInPx = metrics.density * TEXT_SIZE_IN_DP; diff --git a/src/com/android/gallery3d/app/TimeBarNew.java b/src/com/android/gallery3d/app/TimeBarNew.java new file mode 100644 index 000000000..9f57ef692 --- /dev/null +++ b/src/com/android/gallery3d/app/TimeBarNew.java @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2016, The Linux Foundation. All rights reserved. + + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * * Neither the name of The Linux Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + + * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +package com.android.gallery3d.app; + +import android.content.Context; + +import com.android.gallery3d.R; + +public class TimeBarNew extends TimeBar { + + private int mTimeBarHeight; + + public TimeBarNew(Context context, Listener listener) { + super(context, listener); + mTimeBarHeight = context.getResources().getDimensionPixelSize(R.dimen.timebar_height); + } + + @Override + public int getPreferredHeight() { + return mTimeBarHeight; + } + + @Override + public void setInfo(String info) { + // Do nothing here, show nothing in timeBar's info. + } +}
\ No newline at end of file |