diff options
| author | Chao Zhang <chaoz@codeaurora.org> | 2016-06-06 10:39:35 +0800 |
|---|---|---|
| committer | Likai Ding <likaid@codeaurora.org> | 2016-07-08 09:51:55 +0800 |
| commit | ad5509e1fcd462a95d6ded18cd2260bb2ea7f370 (patch) | |
| tree | b785f2f0a45d9ac38f26906c99f1f226fbc18caa | |
| parent | 8724b7e9dd3f64403f9469d20f797d7df379b9e8 (diff) | |
| download | android_packages_apps_Gallery2-ad5509e1fcd462a95d6ded18cd2260bb2ea7f370.tar.gz android_packages_apps_Gallery2-ad5509e1fcd462a95d6ded18cd2260bb2ea7f370.tar.bz2 android_packages_apps_Gallery2-ad5509e1fcd462a95d6ded18cd2260bb2ea7f370.zip | |
Gallery: Modify some layout according to UX.
1. change MovieActivity Theme.
2. change toolbar's theme.
3. modify Straighten editor layout.
4. modify click effect of "Video Snapshot" and "Editor Comparison".
5. modify layout of trim video's timebar.
6. change video gesture's max to 1min.
7. fix the selected picture is not selected after onPause() in AlbumPage.
Change-Id: Ief77f0efa3c9c1134eb3032992c797218a46db46
CRs-Fixed: 1032085
| -rw-r--r-- | AndroidManifest.xml | 2 | ||||
| -rw-r--r-- | res/drawable/comparison.xml | 35 | ||||
| -rw-r--r-- | res/drawable/ic_video_snapshot.xml | 2 | ||||
| -rw-r--r-- | res/drawable/ic_video_snapshot_padding_pressed.xml | 38 | ||||
| -rw-r--r-- | res/drawable/ic_video_snapshot_pressed.xml | 43 | ||||
| -rw-r--r-- | res/drawable/ic_video_snapshot_selector.xml | 36 | ||||
| -rw-r--r-- | res/layout/filtershow_activity.xml | 2 | ||||
| -rw-r--r-- | res/values/styles.xml | 9 | ||||
| -rw-r--r-- | src/com/android/gallery3d/app/AlbumPage.java | 3 | ||||
| -rw-r--r-- | src/com/android/gallery3d/app/GestureControllerOverlay.java | 2 | ||||
| -rw-r--r-- | src/com/android/gallery3d/app/MovieControllerOverlayNew.java | 2 | ||||
| -rw-r--r-- | src/com/android/gallery3d/app/TrimTimeBar.java | 17 | ||||
| -rw-r--r-- | src/com/android/gallery3d/app/TrimVideo.java | 4 | ||||
| -rw-r--r-- | src/com/android/gallery3d/filtershow/imageshow/ImageStraighten.java | 7 |
14 files changed, 180 insertions, 22 deletions
diff --git a/AndroidManifest.xml b/AndroidManifest.xml index 6a9f1ae97..72a239b3d 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -66,6 +66,7 @@ <uses-library android:name="org.apache.http.legacy" android:required="false" /> <activity android:name="com.android.gallery3d.app.MovieActivity" android:label="@string/movie_view_label" + android:theme="@style/Theme.MovieActivity" android:configChanges="orientation|keyboardHidden|screenSize|keyboard"> <intent-filter> <action android:name="android.intent.action.VIEW" /> @@ -262,6 +263,7 @@ </activity> <activity android:name="com.android.gallery3d.app.TrimVideo" android:label="@string/trim_label" + android:theme="@style/Theme.MovieActivity" android:configChanges="keyboardHidden|orientation|screenSize"> <intent-filter android:label="@string/crop_label"> <action android:name="com.android.camera.action.TRIM" /> diff --git a/res/drawable/comparison.xml b/res/drawable/comparison.xml new file mode 100644 index 000000000..36c5331ea --- /dev/null +++ b/res/drawable/comparison.xml @@ -0,0 +1,35 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + 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. +--> + +<selector xmlns:android="http://schemas.android.com/apk/res/android"> + <item android:state_pressed="true" android:drawable="@drawable/comparison_after" /> + <item android:drawable="@drawable/comparison_before" /> +</selector> + diff --git a/res/drawable/ic_video_snapshot.xml b/res/drawable/ic_video_snapshot.xml index df5b00f5e..a0d7f45e6 100644 --- a/res/drawable/ic_video_snapshot.xml +++ b/res/drawable/ic_video_snapshot.xml @@ -35,7 +35,7 @@ android:viewportWidth="108.0"> <path android:fillColor="#FF000000" - android:fillAlpha="0.30" + android:fillAlpha="0.50" android:pathData="M54,54m-54,0a54,54 0,1 1,108 0a54,54 0,1 1,-108 0"/> <path android:fillColor="#FFFFFFFF" diff --git a/res/drawable/ic_video_snapshot_padding_pressed.xml b/res/drawable/ic_video_snapshot_padding_pressed.xml new file mode 100644 index 000000000..a66444db5 --- /dev/null +++ b/res/drawable/ic_video_snapshot_padding_pressed.xml @@ -0,0 +1,38 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + 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. +--> + +<inset + xmlns:android="http://schemas.android.com/apk/res/android" + android:drawable="@drawable/ic_video_snapshot_pressed" + android:insetTop="12dp" + android:insetRight="12dp" + android:insetBottom="12dp" + android:insetLeft="12dp"/> + diff --git a/res/drawable/ic_video_snapshot_pressed.xml b/res/drawable/ic_video_snapshot_pressed.xml new file mode 100644 index 000000000..da65406cf --- /dev/null +++ b/res/drawable/ic_video_snapshot_pressed.xml @@ -0,0 +1,43 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + 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. +--> + +<vector xmlns:android="http://schemas.android.com/apk/res/android" + android:height="36dp" + android:width="36dp" + android:viewportHeight="108.0" + android:viewportWidth="108.0"> + <path + android:fillColor="#FF000000" + android:fillAlpha="0.26" + android:pathData="M54,54m-54,0a54,54 0,1 1,108 0a54,54 0,1 1,-108 0"/> + <path + android:fillColor="#FFFFFFFF" + android:pathData="M42,36h6v-6h-6V36zM30,72h6v-6h-6V72zM72,30h-6v6h6V30zM60,30h-6v6h6V30zM72,42h-6v6h6V42zM30,60h6v-6h-6V60zM72,66V54h-6v12H54v6h12v10h6V72h10v-6H72zM42,72h6v-6h-6V72zM30,48h6v-6h-6V48zM30,36h6v-6h-6V36z"/> +</vector> diff --git a/res/drawable/ic_video_snapshot_selector.xml b/res/drawable/ic_video_snapshot_selector.xml new file mode 100644 index 000000000..22846e05b --- /dev/null +++ b/res/drawable/ic_video_snapshot_selector.xml @@ -0,0 +1,36 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + 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. +--> + +<selector xmlns:android="http://schemas.android.com/apk/res/android"> + <item android:drawable="@drawable/ic_video_snapshot_padding_pressed" + android:state_pressed="true" /> + <item android:drawable="@drawable/ic_video_snapshot_padding" /> +</selector> + diff --git a/res/layout/filtershow_activity.xml b/res/layout/filtershow_activity.xml index 2a7ea6d33..1c58e1209 100644 --- a/res/layout/filtershow_activity.xml +++ b/res/layout/filtershow_activity.xml @@ -54,7 +54,7 @@ android:layout_marginRight="@dimen/compare_margin_right" android:layout_marginTop="@dimen/compare_margin_top" android:background="@android:color/transparent" - android:src="@drawable/comparison_before" + android:src="@drawable/comparison" android:visibility="visible" /> </RelativeLayout> diff --git a/res/values/styles.xml b/res/values/styles.xml index 02a79df5f..dc4b9ae7d 100644 --- a/res/values/styles.xml +++ b/res/values/styles.xml @@ -41,6 +41,8 @@ <style name="FilterShowToolbar" parent="@android:style/Widget.Toolbar"> <item name="android:contentInsetStart">0dp</item> </style> + <style name="Theme.MovieActivity" parent="android:Theme.DeviceDefault.Light.DarkActionBar"> + </style> <style name="Theme.Crop" parent="Theme.GalleryBase"> <item name="android:displayOptions"></item> <item name="android:windowContentOverlay">@null</item> @@ -339,13 +341,14 @@ <style name="ToolbarPopUpTheme" parent="android:Theme.Material.Light" /> <!-- Styles --> - <style name="MyOverFlow" parent="@android:style/Widget.Holo.ActionButton.Overflow"> + <style name="MyOverFlow" parent="@android:style/Widget.DeviceDefault.ActionButton"> <item name="android:src">@drawable/multiselect_more</item> </style> - <style name="WhiteOverflow" parent="@android:style/Widget.Holo.ActionButton.Overflow"> + <style name="WhiteOverflow" parent="@android:style/Widget.DeviceDefault.ActionButton"> <item name="android:src">@drawable/more</item> </style> - <style name="FilterShowActionBar" parent="@android:style/Widget.Holo.Light.ActionBar"> + <style name="FilterShowActionBar" parent="@android:style/Widget.DeviceDefault.Light.ActionBar"> <item name="android:background">@color/edit_actionbar_background</item> + <item name="android:contentInsetStart">0dp</item> </style> </resources> diff --git a/src/com/android/gallery3d/app/AlbumPage.java b/src/com/android/gallery3d/app/AlbumPage.java index 05cc1f8a1..0ff76e751 100644 --- a/src/com/android/gallery3d/app/AlbumPage.java +++ b/src/com/android/gallery3d/app/AlbumPage.java @@ -529,9 +529,6 @@ public class AlbumPage extends ActivityState implements GalleryActionBar.Cluster super.onPause(); mIsActive = false; - if (mSelectionManager.inSelectionMode()) { - mSelectionManager.leaveSelectionMode(); - } mAlbumView.setSlotFilter(null); mActionModeHandler.pause(); mAlbumDataAdapter.pause(); diff --git a/src/com/android/gallery3d/app/GestureControllerOverlay.java b/src/com/android/gallery3d/app/GestureControllerOverlay.java index fee9b3ab5..c7f497d16 100644 --- a/src/com/android/gallery3d/app/GestureControllerOverlay.java +++ b/src/com/android/gallery3d/app/GestureControllerOverlay.java @@ -49,7 +49,7 @@ public class GestureControllerOverlay extends FrameLayout implements ControllerOverlay, GestureController.GestureControlListener { private GestureController mGestureController; - private static final int MAX_VIDEO_STEP_TIME = 2 * 60 * 1000; + private static final int MAX_VIDEO_STEP_TIME = 60 * 1000; private static final int MAX_BRIGHTNESS = 100; private float mStartBrightness = -1.0f; diff --git a/src/com/android/gallery3d/app/MovieControllerOverlayNew.java b/src/com/android/gallery3d/app/MovieControllerOverlayNew.java index 824f8a469..6b32c142a 100644 --- a/src/com/android/gallery3d/app/MovieControllerOverlayNew.java +++ b/src/com/android/gallery3d/app/MovieControllerOverlayNew.java @@ -164,7 +164,7 @@ public class MovieControllerOverlayNew extends MovieControllerOverlay { LayoutParams wrapContent = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); mVideoSnapshotButton = new ImageView(context); - mVideoSnapshotButton.setImageResource(R.drawable.ic_video_snapshot_padding); + mVideoSnapshotButton.setImageResource(R.drawable.ic_video_snapshot_selector); mVideoSnapshotButton.setScaleType(ImageView.ScaleType.CENTER); mVideoSnapshotButton.setFocusable(true); mVideoSnapshotButton.setClickable(true); diff --git a/src/com/android/gallery3d/app/TrimTimeBar.java b/src/com/android/gallery3d/app/TrimTimeBar.java index 06e8741bb..6fea3d690 100644 --- a/src/com/android/gallery3d/app/TrimTimeBar.java +++ b/src/com/android/gallery3d/app/TrimTimeBar.java @@ -83,11 +83,11 @@ public class TrimTimeBar extends TimeBar { } private int trimStartScrubberTipOffset() { - return mTrimStartScrubber.getWidth() * 3 / 4; + return mTrimStartScrubber.getWidth(); } private int trimEndScrubberTipOffset() { - return mTrimEndScrubber.getWidth() / 4; + return 0; } // Based on all the time info (current, total, trimStart, trimEnd), we @@ -153,9 +153,10 @@ public class TrimTimeBar extends TimeBar { } private boolean inScrubber(float x, float y, int startX, int startY, Bitmap scrubber) { - int scrubberRight = startX + scrubber.getWidth(); - int scrubberBottom = startY + scrubber.getHeight(); - return startX < x && x < scrubberRight && startY < y && y < scrubberBottom; + int scrubberRight = startX + scrubber.getWidth() * 2; + int scrubberBottom = startY + scrubber.getHeight() * 2; + return startX - mScrubberPadding < x && x < scrubberRight + mScrubberPadding + && startY - mScrubberPadding < y && y < scrubberBottom + mScrubberPadding; } private int clampScrubber(int scrubberLeft, int offset, int lowerBound, int upperBound) { @@ -182,12 +183,12 @@ public class TrimTimeBar extends TimeBar { } margin = mLayoutExt.getProgressMargin(margin); int progressY = (h + mScrubberPadding) / 2; - mTrimStartScrubberTop = progressY; - mTrimEndScrubberTop = progressY; mScrubberTop = progressY - mScrubber.getHeight() / 2 + 1; mProgressBar.set( mTimeBarMargin + margin, progressY, w - mTimeBarMargin - margin, progressY + 6); + mTrimStartScrubberTop = progressY + mProgressBar.height(); + mTrimEndScrubberTop = progressY + mProgressBar.height(); } update(); } @@ -341,6 +342,6 @@ public class TrimTimeBar extends TimeBar { break; } } - return false; + return true; } } diff --git a/src/com/android/gallery3d/app/TrimVideo.java b/src/com/android/gallery3d/app/TrimVideo.java index d2d6cd336..ec85de234 100644 --- a/src/com/android/gallery3d/app/TrimVideo.java +++ b/src/com/android/gallery3d/app/TrimVideo.java @@ -122,7 +122,7 @@ public class TrimVideo extends Activity implements trimVideo(); } }); - mSaveVideoTextView.setEnabled(false); + mSaveVideoTextView.setVisibility(View.GONE); Intent intent = getIntent(); mUri = intent.getData(); @@ -232,7 +232,7 @@ public class TrimVideo extends Activity implements } mController.setTimes(mVideoPosition, duration, mTrimStartTime, mTrimEndTime); // Enable save if there's modifications - mSaveVideoTextView.setEnabled(isModified()); + mSaveVideoTextView.setVisibility(isModified() ? View.VISIBLE : View.GONE); return mVideoPosition; } diff --git a/src/com/android/gallery3d/filtershow/imageshow/ImageStraighten.java b/src/com/android/gallery3d/filtershow/imageshow/ImageStraighten.java index cec45f15f..d83c0ad75 100644 --- a/src/com/android/gallery3d/filtershow/imageshow/ImageStraighten.java +++ b/src/com/android/gallery3d/filtershow/imageshow/ImageStraighten.java @@ -29,6 +29,7 @@ import android.graphics.RectF; import android.util.AttributeSet; import android.view.MotionEvent; +import org.codeaurora.gallery.R; import com.android.gallery3d.filtershow.crop.CropDrawingUtils; import com.android.gallery3d.filtershow.editors.EditorStraighten; import com.android.gallery3d.filtershow.filters.FilterCropRepresentation; @@ -257,9 +258,11 @@ public class ImageStraighten extends ImageShow { int viewWidth = canvas.getWidth(); int viewHeight = canvas.getHeight(); + int panelHeight = getContext().getResources().getDimensionPixelOffset( + R.dimen.category_actionbar_panel_height); // Get matrix for drawing bitmap Matrix m = GeometryMathUtils.getFullGeometryToScreenMatrix(mDrawHolder, imageWidth, - imageHeight, viewWidth, viewHeight); + imageHeight, viewWidth, viewHeight - panelHeight); mPaint.reset(); mPaint.setAntiAlias(true); mPaint.setFilterBitmap(true); @@ -270,7 +273,7 @@ public class ImageStraighten extends ImageShow { mPaint.setStrokeWidth(2); mPaint.setStyle(Paint.Style.FILL_AND_STROKE); updateCurrentCrop(m, mDrawHolder, mDrawRect, imageWidth, - imageHeight, viewWidth, viewHeight); + imageHeight, viewWidth, viewHeight - panelHeight); if (mFirstDrawSinceUp) { mPriorCropAtUp.set(mCrop); mLocalRep.setStraighten(mAngle); |
