diff options
81 files changed, 557 insertions, 237 deletions
diff --git a/Android.mk b/Android.mk index 0edfca54d..216c9d693 100755 --- a/Android.mk +++ b/Android.mk @@ -10,19 +10,8 @@ LOCAL_STATIC_JAVA_LIBRARIES := android-support-v13 LOCAL_STATIC_JAVA_LIBRARIES += com.android.gallery3d.common2 LOCAL_STATIC_JAVA_LIBRARIES += xmp_toolkit LOCAL_STATIC_JAVA_LIBRARIES += mp4parser -LOCAL_STATIC_JAVA_LIBRARIES += android-support-v8-renderscript -LOCAL_RENDERSCRIPT_TARGET_API := 18 -LOCAL_RENDERSCRIPT_COMPATIBILITY := 18 -LOCAL_RENDERSCRIPT_FLAGS := -rs-package-name=android.support.v8.renderscript - -# Keep track of previously compiled RS files too (from bundled GalleryGoogle). -prev_compiled_rs_files := $(call all-renderscript-files-under, src) - -# We already have these files from GalleryGoogle, so don't install them. -LOCAL_RENDERSCRIPT_SKIP_INSTALL := $(prev_compiled_rs_files) - -LOCAL_SRC_FILES := $(call all-java-files-under, src) $(prev_compiled_rs_files) +LOCAL_SRC_FILES := $(call all-java-files-under, src) $(call all-renderscript-files-under, src) LOCAL_SRC_FILES += $(call all-java-files-under, src_pd) LOCAL_RESOURCE_DIR += $(LOCAL_PATH)/res diff --git a/AndroidManifest.xml b/AndroidManifest.xml index 4c9bf20cb..8b15d6cd0 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -24,7 +24,7 @@ <original-package android:name="com.android.gallery3d" /> - <uses-sdk android:minSdkVersion="14" android:targetSdkVersion="17" /> + <uses-sdk android:minSdkVersion="21" android:targetSdkVersion="21" /> <permission android:name="com.android.gallery3d.permission.GALLERY_PROVIDER" android:protectionLevel="signatureOrSystem" /> @@ -116,8 +116,9 @@ </intent-filter> </activity> - <activity android:name="com.android.gallery3d.app.GalleryActivity" android:label="@string/app_name" - android:configChanges="keyboardHidden|orientation|screenSize"> + <activity android:name="com.android.gallery3d.app.GalleryActivity" + android:label="@string/app_name" + android:configChanges="keyboardHidden|orientation|screenSize"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.DEFAULT" /> @@ -195,8 +196,7 @@ <!-- This activity acts as a trampoline to the new Gallery activity, so that existing shortcuts are preserved. --> - <activity android:name="com.android.gallery3d.app.Gallery" - android:theme="@style/android:Theme.NoDisplay"> + <activity android:name="com.android.gallery3d.app.Gallery"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.DEFAULT" /> diff --git a/res/drawable-hdpi/dropdown_ic_arrow_normal_holo_dark.png b/res/drawable-hdpi/dropdown_ic_arrow_normal_holo_dark.png Binary files differdeleted file mode 100644 index 06e5b4730..000000000 --- a/res/drawable-hdpi/dropdown_ic_arrow_normal_holo_dark.png +++ /dev/null diff --git a/res/drawable-hdpi/frame_overlay_gallery_camera.png b/res/drawable-hdpi/frame_overlay_gallery_camera.png Binary files differindex b27bbe57f..aa3a3e571 100644 --- a/res/drawable-hdpi/frame_overlay_gallery_camera.png +++ b/res/drawable-hdpi/frame_overlay_gallery_camera.png diff --git a/res/drawable-hdpi/ic_cameraalbum_overlay.png b/res/drawable-hdpi/ic_cameraalbum_overlay.png Binary files differindex e58777f11..90ffbbd1a 100644 --- a/res/drawable-hdpi/ic_cameraalbum_overlay.png +++ b/res/drawable-hdpi/ic_cameraalbum_overlay.png diff --git a/res/drawable-hdpi/ic_menu_edit_holo_dark.png b/res/drawable-hdpi/ic_menu_edit_holo_dark.png Binary files differdeleted file mode 100644 index 54952f5d3..000000000 --- a/res/drawable-hdpi/ic_menu_edit_holo_dark.png +++ /dev/null diff --git a/res/drawable-hdpi/ic_menu_share_holo_light.png b/res/drawable-hdpi/ic_menu_share_holo_light.png Binary files differdeleted file mode 100644 index 492d6090c..000000000 --- a/res/drawable-hdpi/ic_menu_share_holo_light.png +++ /dev/null diff --git a/res/drawable-hdpi/ic_menu_trash_holo_light.png b/res/drawable-hdpi/ic_menu_trash_holo_light.png Binary files differdeleted file mode 100644 index 721ee5ca2..000000000 --- a/res/drawable-hdpi/ic_menu_trash_holo_light.png +++ /dev/null diff --git a/res/drawable-hdpi/ic_switch_camera.png b/res/drawable-hdpi/ic_switch_camera.png Binary files differindex 11dd39ad7..509657dac 100644 --- a/res/drawable-hdpi/ic_switch_camera.png +++ b/res/drawable-hdpi/ic_switch_camera.png diff --git a/res/drawable-mdpi/dropdown_ic_arrow_normal_holo_dark.png b/res/drawable-mdpi/dropdown_ic_arrow_normal_holo_dark.png Binary files differdeleted file mode 100644 index 81de1bb46..000000000 --- a/res/drawable-mdpi/dropdown_ic_arrow_normal_holo_dark.png +++ /dev/null diff --git a/res/drawable-mdpi/frame_overlay_gallery_camera.png b/res/drawable-mdpi/frame_overlay_gallery_camera.png Binary files differindex 3736a5c02..994b3f340 100644 --- a/res/drawable-mdpi/frame_overlay_gallery_camera.png +++ b/res/drawable-mdpi/frame_overlay_gallery_camera.png diff --git a/res/drawable-mdpi/ic_cameraalbum_overlay.png b/res/drawable-mdpi/ic_cameraalbum_overlay.png Binary files differindex 5d14c32e9..2cce0d472 100644 --- a/res/drawable-mdpi/ic_cameraalbum_overlay.png +++ b/res/drawable-mdpi/ic_cameraalbum_overlay.png diff --git a/res/drawable-mdpi/ic_menu_camera_holo_light.png b/res/drawable-mdpi/ic_menu_camera_holo_light.png Binary files differindex d42508410..aa3a3e571 100644 --- a/res/drawable-mdpi/ic_menu_camera_holo_light.png +++ b/res/drawable-mdpi/ic_menu_camera_holo_light.png diff --git a/res/drawable-mdpi/ic_menu_edit_holo_dark.png b/res/drawable-mdpi/ic_menu_edit_holo_dark.png Binary files differdeleted file mode 100644 index ca9188e18..000000000 --- a/res/drawable-mdpi/ic_menu_edit_holo_dark.png +++ /dev/null diff --git a/res/drawable-mdpi/ic_menu_share_holo_light.png b/res/drawable-mdpi/ic_menu_share_holo_light.png Binary files differdeleted file mode 100644 index 29574f5bd..000000000 --- a/res/drawable-mdpi/ic_menu_share_holo_light.png +++ /dev/null diff --git a/res/drawable-mdpi/ic_menu_single_track.png b/res/drawable-mdpi/ic_menu_single_track.png Binary files differdeleted file mode 100755 index b11c2e434..000000000 --- a/res/drawable-mdpi/ic_menu_single_track.png +++ /dev/null diff --git a/res/drawable-mdpi/ic_menu_stereo.png b/res/drawable-mdpi/ic_menu_stereo.png Binary files differdeleted file mode 100755 index ef3ee9fe3..000000000 --- a/res/drawable-mdpi/ic_menu_stereo.png +++ /dev/null diff --git a/res/drawable-mdpi/ic_menu_trash_holo_light.png b/res/drawable-mdpi/ic_menu_trash_holo_light.png Binary files differdeleted file mode 100644 index f45540b21..000000000 --- a/res/drawable-mdpi/ic_menu_trash_holo_light.png +++ /dev/null diff --git a/res/drawable-mdpi/ic_switch_camera.png b/res/drawable-mdpi/ic_switch_camera.png Binary files differindex a97811757..90dd073be 100644 --- a/res/drawable-mdpi/ic_switch_camera.png +++ b/res/drawable-mdpi/ic_switch_camera.png diff --git a/res/drawable-xhdpi/dropdown_ic_arrow_normal_holo_dark.png b/res/drawable-xhdpi/dropdown_ic_arrow_normal_holo_dark.png Binary files differdeleted file mode 100644 index 36d8cf47e..000000000 --- a/res/drawable-xhdpi/dropdown_ic_arrow_normal_holo_dark.png +++ /dev/null diff --git a/res/drawable-xhdpi/frame_overlay_gallery_camera.png b/res/drawable-xhdpi/frame_overlay_gallery_camera.png Binary files differindex e2109ac4d..aa3a3e571 100644 --- a/res/drawable-xhdpi/frame_overlay_gallery_camera.png +++ b/res/drawable-xhdpi/frame_overlay_gallery_camera.png diff --git a/res/drawable-xhdpi/ic_cameraalbum_overlay.png b/res/drawable-xhdpi/ic_cameraalbum_overlay.png Binary files differindex bf71eaacf..6056fcc88 100644 --- a/res/drawable-xhdpi/ic_cameraalbum_overlay.png +++ b/res/drawable-xhdpi/ic_cameraalbum_overlay.png diff --git a/res/drawable-xhdpi/ic_menu_camera_holo_light.png b/res/drawable-xhdpi/ic_menu_camera_holo_light.png Binary files differnew file mode 100644 index 000000000..c1a3549bf --- /dev/null +++ b/res/drawable-xhdpi/ic_menu_camera_holo_light.png diff --git a/res/drawable-xhdpi/ic_menu_edit_holo_dark.png b/res/drawable-xhdpi/ic_menu_edit_holo_dark.png Binary files differdeleted file mode 100644 index 65e72c1e2..000000000 --- a/res/drawable-xhdpi/ic_menu_edit_holo_dark.png +++ /dev/null diff --git a/res/drawable-xhdpi/ic_switch_camera.png b/res/drawable-xhdpi/ic_switch_camera.png Binary files differindex 7d2406290..852225124 100644 --- a/res/drawable-xhdpi/ic_switch_camera.png +++ b/res/drawable-xhdpi/ic_switch_camera.png diff --git a/res/drawable-xxhdpi/ic_cameraalbum_overlay.png b/res/drawable-xxhdpi/ic_cameraalbum_overlay.png Binary files differnew file mode 100644 index 000000000..abf97ec64 --- /dev/null +++ b/res/drawable-xxhdpi/ic_cameraalbum_overlay.png diff --git a/res/drawable-xxxhdpi/ic_cameraalbum_overlay.png b/res/drawable-xxxhdpi/ic_cameraalbum_overlay.png Binary files differnew file mode 100644 index 000000000..762a41f18 --- /dev/null +++ b/res/drawable-xxxhdpi/ic_cameraalbum_overlay.png diff --git a/res/drawable/dropdown_ic_arrow.xml b/res/drawable/dropdown_ic_arrow.xml new file mode 100644 index 000000000..f9464faf3 --- /dev/null +++ b/res/drawable/dropdown_ic_arrow.xml @@ -0,0 +1,11 @@ +<?xml version="1.0" encoding="utf-8"?> +<vector xmlns:android="http://schemas.android.com/apk/res/android" + android:width="24dp" + android:height="24dp" + android:viewportWidth="24" + android:viewportHeight="24"> + + <path + android:fillColor="#ffffff" + android:pathData="M7,10l5,5l5-5H7Z" /> +</vector> diff --git a/res/drawable/fab_accent.xml b/res/drawable/fab_accent.xml new file mode 100644 index 000000000..f334676e8 --- /dev/null +++ b/res/drawable/fab_accent.xml @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2014 The CyanogenMod Project + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +--> + +<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="oval"> + <solid android:color="@color/fab" /> +</shape> diff --git a/res/drawable/filtershow_background.png b/res/drawable/filtershow_background.png Binary files differdeleted file mode 100644 index 22e1641dd..000000000 --- a/res/drawable/filtershow_background.png +++ /dev/null diff --git a/res/drawable/filtershow_background_new.png b/res/drawable/filtershow_background_new.png Binary files differdeleted file mode 100644 index a11538944..000000000 --- a/res/drawable/filtershow_background_new.png +++ /dev/null diff --git a/res/drawable/filtershow_tiled_background.xml b/res/drawable/filtershow_tiled_background.xml deleted file mode 100644 index dfc7592d0..000000000 --- a/res/drawable/filtershow_tiled_background.xml +++ /dev/null @@ -1,21 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- - Copyright (C) 2013 The Android Open Source Project - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. ---> -<bitmap - xmlns:android="http://schemas.android.com/apk/res/android" - android:src="@drawable/filtershow_background_new" - android:tileMode="repeat" - android:dither="false" />
\ No newline at end of file diff --git a/res/drawable/floating_action_button.xml b/res/drawable/floating_action_button.xml new file mode 100644 index 000000000..57a4c8fa9 --- /dev/null +++ b/res/drawable/floating_action_button.xml @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2014 The CyanogenMod Project + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +--> + +<ripple xmlns:android="http://schemas.android.com/apk/res/android" + android:color="@color/floating_action_button_touch_tint"> + <item android:id="@android:id/mask"> + <shape android:shape="oval"> + <solid android:color="@color/fab" /> + </shape> + </item> +</ripple> diff --git a/res/drawable/ic_edit.xml b/res/drawable/ic_edit.xml new file mode 100644 index 000000000..1116c1c09 --- /dev/null +++ b/res/drawable/ic_edit.xml @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="utf-8"?> +<vector xmlns:android="http://schemas.android.com/apk/res/android" + android:width="30dp" + android:height="30dp" + android:viewportWidth="48" + android:viewportHeight="48"> + + <path + android:fillColor="#ffffff" + android:pathData="M14,28c-3.31,0-6,2.689-6,6c0,2.62-2.31,4-4,4c1.84, + 2.439,4.99,4,8,4c4.42,0,8-3.58,8-8C20,30.689,17.31,28,14,28Z + M41.41,9.26l-2.67-2.67c-0.78-0.78-2.051-0.78-2.83,0L18, + 24.5l5.5,5.5l17.91-17.91C42.2,11.3,42.2,10.04,41.41,9.26z" /> + </vector> diff --git a/res/drawable/ic_menu_share.xml b/res/drawable/ic_menu_share.xml new file mode 100644 index 000000000..4f15606c0 --- /dev/null +++ b/res/drawable/ic_menu_share.xml @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="utf-8"?> +<vector xmlns:android="http://schemas.android.com/apk/res/android" + android:width="24dp" + android:height="24dp" + android:viewportWidth="48" + android:viewportHeight="48"> + + <path + android:fillColor="#ffffff" + android:pathData="M36,32.17c-1.52,0-2.891,0.59-3.93,1.54L17.82, + 25.4C17.93,24.95,18,24.48,18,24s-0.07-0.95-0.18-1.4l14.1-8.23 + c1.07,1,2.5,1.62,4.08,1.62c3.311,0,6-2.69,6-6c0-3.31-2.689-6-6-6s-6, + 2.69-6,6c0,0.48,0.07,0.95,0.18,1.4l-14.1,8.23 + c-1.07-1-2.5-1.62-4.08-1.62c-3.31,0-6,2.69-6,6c0,3.311,2.69,6,6,6c1.58, + 0,3.01-0.62,4.08-1.62l14.25,8.31c-0.1,0.42-0.16,0.86-0.16,1.311c0, + 3.221,2.609,5.83,5.83,5.83s5.83-2.609,5.83-5.83S39.221,32.17,36,32.17Z" + /> +</vector> diff --git a/res/drawable/ic_menu_single_track.xml b/res/drawable/ic_menu_single_track.xml new file mode 100644 index 000000000..9ca139a18 --- /dev/null +++ b/res/drawable/ic_menu_single_track.xml @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="utf-8"?> +<vector xmlns:android="http://schemas.android.com/apk/res/android" + android:width="48dp" + android:height="48dp" + android:viewportWidth="48" + android:viewportHeight="48"> + + <path + android:fillColor="#ffffff" + android:pathData="M24,4C12.97,4,4,12.97,4,24c0,11.029,8.97,20,20, + 20c11.029,0,20-8.971,20-20C44,12.97,35.029,4,24,4ZM24,40c-8.82, + 0-16-7.18-16-16c0-8.82,7.18-16,16-16c8.82,0,16,7.18,16,16C40,32.82, + 32.82,40,24,40zM30,24c0,3.311-2.689,6-6,6 + c-3.31,0-6-2.689-6-6c0-3.31,2.69-6,6-6C27.311,18,30,20.69,30,24z" /> +</vector> diff --git a/res/drawable/ic_menu_stereo.xml b/res/drawable/ic_menu_stereo.xml new file mode 100644 index 000000000..1d105878f --- /dev/null +++ b/res/drawable/ic_menu_stereo.xml @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="utf-8"?> +<vector xmlns:android="http://schemas.android.com/apk/res/android" + android:width="48dp" + android:height="48dp" + android:viewportWidth="48" + android:viewportHeight="48"> + + <path + android:fillColor="#ffffff" + android:pathData="M34,4H14c-2.21,0-4,1.79-4,4v32c0,2.21,1.79,3.98,4, + 3.98L34,44c2.21,0,4-1.79,4-4V8C38,5.79,36.21,4,34,4Z + M24,8 c2.21,0,4,1.79,4,4s-1.79,4-4,4s-4-1.79-4-4S21.79,8,24,8z + M24,40c-5.52,0-10-4.48-10-10c0-5.52,4.48-10,10-10c5.52,0,10,4.48,10,10 + C34,35.52,29.52,40,24,40zM24,24c-3.31,0-6,2.689-6,6s2.69,6,6,6c3.311, + 0,6-2.689,6-6S27.311,24,24,24z" /> +</vector> diff --git a/res/drawable/ic_menu_trash.xml b/res/drawable/ic_menu_trash.xml new file mode 100644 index 000000000..8c5f85ab2 --- /dev/null +++ b/res/drawable/ic_menu_trash.xml @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="utf-8"?> +<vector xmlns:android="http://schemas.android.com/apk/res/android" + android:width="24dp" + android:height="24dp" + android:viewportWidth="48" + android:viewportHeight="48"> + + <path + android:fillColor="#ffffff" + android:pathData="M12,38c0,2.21,1.79,4,4,4h16c2.21,0,4-1.79, + 4-4V14H12V38ZM38,8h-7l-2-2H19l-2,2h-7v4h28V8z" /> +</vector> diff --git a/res/layout-land/filtershow_activity.xml b/res/layout-land/filtershow_activity.xml index f4380126e..c1c7e0e69 100644 --- a/res/layout-land/filtershow_activity.xml +++ b/res/layout-land/filtershow_activity.xml @@ -19,7 +19,7 @@ android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/mainView" - android:background="@drawable/filtershow_tiled_background"> + android:background="@color/filtershow_background"> <LinearLayout android:layout_width="match_parent" @@ -35,7 +35,7 @@ <ProgressBar android:id="@+id/loading" - style="@android:style/Widget.Holo.ProgressBar.Large" + style="@android:style/Widget.Material.ProgressBar.Large" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" diff --git a/res/layout-land/filtershow_grad_ui.xml b/res/layout-land/filtershow_grad_ui.xml index 71aa22ac5..8f6a8ae09 100644 --- a/res/layout-land/filtershow_grad_ui.xml +++ b/res/layout-land/filtershow_grad_ui.xml @@ -136,7 +136,7 @@ android:scaleType="centerInside" android:layout_weight="0" android:background="@drawable/filtershow_button_background" - android:src="@drawable/ic_menu_trash_holo_light" + android:src="@drawable/ic_menu_trash" android:paddingBottom="8dp" android:layout_marginEnd="48dp" /> diff --git a/res/layout/action_mode.xml b/res/layout/action_mode.xml index f107c26ee..096187b95 100644 --- a/res/layout/action_mode.xml +++ b/res/layout/action_mode.xml @@ -14,35 +14,22 @@ limitations under the License. --> -<LinearLayout - xmlns:android="http://schemas.android.com/apk/res/android" - android:id="@+id/navigation_bar" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:orientation="horizontal"> - - <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" - android:layout_width="wrap_content" +<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="match_parent" android:layout_height="match_parent"> - <ImageView android:layout_gravity="end" - android:layout_width="wrap_content" - android:layout_height="match_parent" - android:src="@drawable/dropdown_ic_arrow_normal_holo_dark" /> - <Button android:id="@+id/selection_menu" - style="?android:attr/actionButtonStyle" - android:divider="?android:attr/listDividerAlertDialog" - android:textAppearance="?android:attr/textAppearanceLargePopupMenu" - android:textColor="?android:attr/actionMenuTextColor" - android:singleLine="true" - android:gravity="left|center_vertical" - android:paddingEnd="25dip" - android:layout_width="wrap_content" - android:layout_height="match_parent" /> - </FrameLayout> - <ImageView android:layout_marginStart="16dip" - android:layout_marginEnd="8dip" + <Button android:id="@+id/selection_menu" + style="?android:attr/actionButtonStyle" + android:divider="?android:attr/listDividerAlertDialog" + android:textAppearance="?android:attr/textAppearanceLargePopupMenu" + android:textColor="?android:attr/actionMenuTextColor" + android:singleLine="true" + android:gravity="left|center_vertical" + android:paddingRight="25dip" android:layout_width="wrap_content" - android:layout_height="match_parent" - android:gravity="bottom" - android:src="@drawable/cab_divider_vertical_dark" /> -</LinearLayout> + android:layout_height="match_parent" /> + <ImageView android:layout_width="wrap_content" + android:layout_height="match_parent" + android:src="@drawable/dropdown_ic_arrow" + android:layout_toRightOf="@id/selection_menu"/> + +</RelativeLayout> diff --git a/res/layout/filtershow_actionbar.xml b/res/layout/filtershow_actionbar.xml index 2b77dfcd1..924d7178d 100644 --- a/res/layout/filtershow_actionbar.xml +++ b/res/layout/filtershow_actionbar.xml @@ -17,7 +17,6 @@ <TextView xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="match_parent" - android:background="@drawable/filtershow_button_background" android:id="@+id/filtershow_done" android:textAllCaps="true" android:text="@string/save" diff --git a/res/layout/filtershow_activity.xml b/res/layout/filtershow_activity.xml index 79c315b7b..e3f4a0eeb 100644 --- a/res/layout/filtershow_activity.xml +++ b/res/layout/filtershow_activity.xml @@ -19,7 +19,7 @@ android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/mainView" - android:background="@drawable/filtershow_tiled_background"> + android:background="@color/filtershow_background"> <LinearLayout android:layout_width="match_parent" @@ -33,7 +33,7 @@ <ProgressBar android:id="@+id/loading" - style="@android:style/Widget.Holo.ProgressBar.Large" + style="@android:style/Widget.Material.ProgressBar.Large" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" diff --git a/res/layout/filtershow_control_action_slider.xml b/res/layout/filtershow_control_action_slider.xml index 34eac1e69..ebaf7be18 100644 --- a/res/layout/filtershow_control_action_slider.xml +++ b/res/layout/filtershow_control_action_slider.xml @@ -48,7 +48,7 @@ android:scaleType="centerInside" android:layout_weight="0" android:background="@drawable/filtershow_button_background" - android:src="@drawable/ic_menu_trash_holo_light" + android:src="@drawable/ic_menu_trash" android:paddingBottom="8dp" /> </LinearLayout> diff --git a/res/layout/filtershow_presets_management_row.xml b/res/layout/filtershow_presets_management_row.xml index bd3e47928..d4e05bafe 100644 --- a/res/layout/filtershow_presets_management_row.xml +++ b/res/layout/filtershow_presets_management_row.xml @@ -47,6 +47,6 @@ android:background="@android:color/transparent" android:layout_weight=".1" android:gravity="center" - android:src="@drawable/ic_menu_trash_holo_light" + android:src="@drawable/ic_menu_trash" android:visibility="gone"/> </LinearLayout>
\ No newline at end of file diff --git a/res/layout/multigrid_content.xml b/res/layout/multigrid_content.xml index b1cb145a2..618af4898 100644 --- a/res/layout/multigrid_content.xml +++ b/res/layout/multigrid_content.xml @@ -36,7 +36,7 @@ </LinearLayout> - <FrameLayout android:id="@+id/gridContainer" + <HorizontalScrollView android:id="@+id/gridContainer" android:layout_width="match_parent" android:layout_height="match_parent"> @@ -52,6 +52,6 @@ android:layout_height="match_parent" android:gravity="center" android:textAppearance="?android:attr/textAppearanceMedium" /> - </FrameLayout> + </HorizontalScrollView> -</FrameLayout>
\ No newline at end of file +</FrameLayout> diff --git a/res/layout/photopage_bottom_controls.xml b/res/layout/photopage_bottom_controls.xml index 20b3c11cd..51f714ede 100644 --- a/res/layout/photopage_bottom_controls.xml +++ b/res/layout/photopage_bottom_controls.xml @@ -1,50 +1,80 @@ <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" - android:id="@+id/photopage_bottom_controls" - android:padding="10dp" - android:layout_width="match_parent" + android:id="@+id/photopage_bottom_controls" + android:padding="10dp" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_alignParentBottom="true" + android:layout_alignParentRight="true" + android:orientation="horizontal" + android:visibility="gone"> + + <FrameLayout + android:id="@+id/photopage_bottom_control_tiny_planet" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginStart="@dimen/floating_action_button_margin_left" + android:layout_marginBottom="@dimen/floating_action_button_margin_bottom" + android:layout_alignParentLeft="true" + android:layout_alignParentBottom="true" + android:background="@drawable/floating_action_button" + android:elevation="@dimen/floating_action_button_translation_z" + android:clickable="true" + android:visibility="gone"> + <ImageButton + android:layout_width="@dimen/floating_action_button_width" + android:layout_height="@dimen/floating_action_button_height" + android:id="@+id/floating_action_button_tiny_planet" + android:background="@drawable/floating_action_button" + android:tint="@color/floating_action_button_icon_color" + android:src="@drawable/ic_menu_tiny_planet" + android:clickable="false" + android:duplicateParentState="true"/> + </FrameLayout> + + <FrameLayout + android:id="@+id/photopage_bottom_control_panorama" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginEnd="@dimen/floating_action_button_margin_left" + android:layout_marginBottom="@dimen/floating_action_button_margin_bottom" + android:layout_centerHorizontal="true" + android:layout_alignParentBottom="true" + android:background="@drawable/floating_action_button" + android:elevation="@dimen/floating_action_button_translation_z" + android:clickable="true" + android:visibility="gone"> + <ImageButton + android:layout_width="70dp" + android:layout_height="70dp" + android:id="@+id/floating_action_button_panorama" + android:background="@drawable/floating_action_button" + android:tint="@color/floating_action_button_icon_color" + android:src="@drawable/ic_view_photosphere" + android:clickable="false" + android:duplicateParentState="true"/> + </FrameLayout> + + <FrameLayout + android:id="@+id/photopage_bottom_control_edit" + android:layout_width="wrap_content" android:layout_height="wrap_content" + android:layout_marginEnd="@dimen/floating_action_button_margin_right" + android:layout_marginBottom="@dimen/floating_action_button_margin_bottom" + android:layout_alignParentEnd="true" android:layout_alignParentBottom="true" - android:layout_alignParentStart="true" - android:orientation="horizontal" + android:background="@drawable/fab_accent" + android:elevation="@dimen/floating_action_button_translation_z" + android:clickable="true" android:visibility="gone"> <ImageButton - android:id="@+id/photopage_bottom_control_edit" - android:src="@drawable/ic_menu_edit_holo_dark" - android:background="@drawable/photopage_bottom_button_background" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_alignParentStart="true" - android:layout_alignParentBottom="true" - android:paddingTop="5dp" - android:paddingBottom="5dp" - android:paddingStart="15dp" - android:paddingEnd="15dp" - android:visibility="gone"/> - <ImageButton - android:id="@+id/photopage_bottom_control_panorama" - android:src="@drawable/ic_view_photosphere" - android:background="@drawable/transparent_button_background" - android:layout_width="70dp" - android:layout_height="70dp" - android:layout_centerHorizontal="true" - android:layout_alignParentBottom="true" - android:paddingTop="5dp" - android:paddingBottom="5dp" - android:paddingStart="5dp" - android:paddingEnd="5dp" - android:visibility="gone"/> - <ImageButton - android:id="@+id/photopage_bottom_control_tiny_planet" - android:src="@drawable/ic_menu_tiny_planet" - android:background="@drawable/photopage_bottom_button_background" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_alignParentEnd="true" - android:layout_alignParentBottom="true" - android:paddingTop="5dp" - android:paddingBottom="5dp" - android:paddingStart="15dp" - android:paddingEnd="15dp" - android:visibility="gone"/> -</RelativeLayout> + android:layout_width="@dimen/floating_action_button_width" + android:layout_height="@dimen/floating_action_button_height" + android:id="@+id/floating_action_button_edit" + android:background="@drawable/floating_action_button" + android:tint="@color/floating_action_button_icon_color" + android:src="@drawable/ic_edit" + android:clickable="false" + android:duplicateParentState="true"/> + </FrameLayout> + </RelativeLayout> diff --git a/res/menu/movie.xml b/res/menu/movie.xml index fde235cba..0676efb73 100644 --- a/res/menu/movie.xml +++ b/res/menu/movie.xml @@ -15,7 +15,7 @@ --> <menu xmlns:android="http://schemas.android.com/apk/res/android"> <item android:id="@+id/action_share" - android:icon="@drawable/ic_menu_share_holo_light" + android:icon="@drawable/ic_menu_share" android:title="@string/share" android:enabled="true" android:actionProviderClass="android.widget.ShareActionProvider" diff --git a/res/menu/operation.xml b/res/menu/operation.xml index ffc5afa4a..d6f954459 100644 --- a/res/menu/operation.xml +++ b/res/menu/operation.xml @@ -23,21 +23,21 @@ But, if share_panorama is set to never, it doesn't seem to get promoted to the action bar and stays on the overflow menu. --> <item android:id="@+id/action_share_panorama" - android:icon="@drawable/ic_menu_share_holo_light" + android:icon="@drawable/ic_menu_share" android:title="@string/share_panorama" android:visible="false" android:actionProviderClass="android.widget.ShareActionProvider" android:showAsAction="ifRoom"> </item> <item android:id="@+id/action_share" - android:icon="@drawable/ic_menu_share_holo_light" + android:icon="@drawable/ic_menu_share" android:title="@string/share" android:visible="false" android:actionProviderClass="android.widget.ShareActionProvider" android:showAsAction="never"> </item> <item android:id="@+id/action_delete" - android:icon="@drawable/ic_menu_trash_holo_light" + android:icon="@drawable/ic_menu_trash" android:title="@string/delete" android:visible="false" android:showAsAction="ifRoom" /> diff --git a/res/menu/photo.xml b/res/menu/photo.xml index 67e700b9f..9cc375601 100644 --- a/res/menu/photo.xml +++ b/res/menu/photo.xml @@ -23,19 +23,19 @@ But, if share_panorama is set to never, it doesn't seem to get promoted to the action bar and stays on the overflow menu. --> <item android:id="@+id/action_share_panorama" - android:icon="@drawable/ic_menu_share_holo_light" + android:icon="@drawable/ic_menu_share" android:title="@string/share_panorama" android:visible="false" android:actionProviderClass="android.widget.ShareActionProvider" android:showAsAction="ifRoom" /> <item android:id="@+id/action_share" - android:icon="@drawable/ic_menu_share_holo_light" + android:icon="@drawable/ic_menu_share" android:title="@string/share" android:visible="false" android:actionProviderClass="android.widget.ShareActionProvider" android:showAsAction="never" /> <item android:id="@+id/action_delete" - android:icon="@drawable/ic_menu_trash_holo_light" + android:icon="@drawable/ic_menu_trash" android:title="@string/delete" android:visible="false" android:showAsAction="never" /> diff --git a/res/mipmap-hdpi/ic_launcher_gallery.png b/res/mipmap-hdpi/ic_launcher_gallery.png Binary files differindex 23ea99890..72391b504 100644..100755 --- a/res/mipmap-hdpi/ic_launcher_gallery.png +++ b/res/mipmap-hdpi/ic_launcher_gallery.png diff --git a/res/mipmap-mdpi/ic_launcher_gallery.png b/res/mipmap-mdpi/ic_launcher_gallery.png Binary files differindex e1a99498d..c9a7bc86c 100644..100755 --- a/res/mipmap-mdpi/ic_launcher_gallery.png +++ b/res/mipmap-mdpi/ic_launcher_gallery.png diff --git a/res/mipmap-xhdpi/ic_launcher_gallery.png b/res/mipmap-xhdpi/ic_launcher_gallery.png Binary files differindex 79544a2b6..7ad882fda 100644..100755 --- a/res/mipmap-xhdpi/ic_launcher_gallery.png +++ b/res/mipmap-xhdpi/ic_launcher_gallery.png diff --git a/res/mipmap-xxhdpi/ic_launcher_gallery.png b/res/mipmap-xxhdpi/ic_launcher_gallery.png Binary files differnew file mode 100755 index 000000000..4b955009d --- /dev/null +++ b/res/mipmap-xxhdpi/ic_launcher_gallery.png diff --git a/res/mipmap-xxxhdpi/ic_launcher_gallery.png b/res/mipmap-xxxhdpi/ic_launcher_gallery.png Binary files differnew file mode 100755 index 000000000..fd4deea7d --- /dev/null +++ b/res/mipmap-xxxhdpi/ic_launcher_gallery.png diff --git a/res/values-v21/colors.xml b/res/values-v21/colors.xml new file mode 100644 index 000000000..4ebfd2881 --- /dev/null +++ b/res/values-v21/colors.xml @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2012 The Android Open Source Project + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> +<resources> + <!-- configuration for album set page --> + <color name="albumset_background">#ff21272b</color> + <color name="albumset_placeholder">#37474F</color> + <color name="albumset_label_background">#EE37474F</color> + <color name="albumset_label_title">#FBFBFB</color> + <color name="albumset_label_count">#A9ABAD</color> + + <!-- configuration for album page --> + <color name="album_background">#ff21272b</color> + <color name="album_placeholder">#37474F</color> + + <!-- configuration for photo page --> + <color name="photo_background">#ff21272b</color> + <color name="photo_placeholder">#37474F</color> + + <!-- configuration for manage cache page --> + <color name="cache_background">#ff21272b</color> + <color name="cache_placeholder">#37474F</color> + + <color name="bitmap_screennail_placeholder">#37474F</color> + + <color name="slideshow_background">#ff21272b</color> + + <color name="button_dark_transparent_background">#263238</color> + + <color name="ingest_highlight_semitransparent">#8833b5e5</color> + <color name="ingest_date_tile_text">#33b5e5</color> + + <!-- FAB --> + <color name="fab">#FF9800</color> + <color name="floating_action_button_touch_tint">#FFB74D</color> + <color name="floating_action_button_icon_color">#ffffff</color> + +</resources> diff --git a/res/values-v21/styles.xml b/res/values-v21/styles.xml new file mode 100644 index 000000000..75457ca1a --- /dev/null +++ b/res/values-v21/styles.xml @@ -0,0 +1,64 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2012 The Android Open Source Project + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> + +<resources> + <style name="Theme.GalleryBase" parent="android:Theme.Material"> + <item name="android:colorPrimary">@color/primary</item> + <item name="android:colorPrimaryDark">@color/primary_dark</item> + <item name="android:colorAccent">@color/accent</item> + <item name="listPreferredItemHeightSmall">?android:attr/listPreferredItemHeightSmall</item> + <item name="switchStyle">@android:style/Widget.CompoundButton</item> + </style> + <style name="Theme.Gallery.Dialog" parent="android:Theme.Material.Dialog"/> + <style name="Theme.Gallery" parent="Theme.GalleryBase"> + <item name="android:displayOptions"></item> + <item name="android:windowContentOverlay">@null</item> + <item name="android:actionBarStyle">@style/Material.ActionBar</item> + <item name="android:colorBackground">@color/material_blue_grey_950</item> + <item name="android:colorBackgroundCacheHint">@color/material_blue_grey_950</item> + <item name="android:actionModeBackground">@color/primary</item> + </style> + <style name="Theme.Crop" parent="Theme.GalleryBase"> + <item name="android:displayOptions"></item> + <item name="android:windowContentOverlay">@null</item> + <item name="android:actionBarStyle">@style/Material.ActionBar</item> + <item name="android:colorBackground">@null</item> + <item name="android:colorBackgroundCacheHint">@null</item> + <item name="android:windowBackground">@color/filtershow_background</item> + </style> + <style name="Material.ActionBar" parent="android:Widget.Material.ActionBar"> + <item name="android:title"></item> + <item name="android:displayOptions">useLogo|showTitle</item> + <item name="android:background">@color/primary</item> + <item name="android:backgroundStacked">@null</item> + <item name="android:titleTextStyle">@style/ActionBarTitle</item> + <item name="android:elevation">@dimen/action_bar_elevation</item> + </style> + <style name="ActionBarTitle" parent="android:style/TextAppearance.Material.Widget.ActionBar.Title"> + <item name="android:textStyle">bold</item> + <item name="android:textSize">18sp</item> + <item name="android:textAllCaps">true</item> + </style> + <style name="ActionBarTwoLinePrimary" parent="@android:style/TextAppearance.Material.Widget.ActionBar.Title"></style> + <style name="ActionBarTwoLineSecondary" parent="@android:style/TextAppearance.Material.Widget.ActionBar.Subtitle"></style> + <style name="ActionBarTwoLineItem"> + <item name="android:background">?android:attr/activatedBackgroundIndicator</item> + </style> + <style name="Theme.Photos.Gallery" parent="android:Theme.Material"> + </style> + <style name="Theme.Photos.Fullscreen" parent="android:Theme.Material"> + </style> +</resources> diff --git a/res/values-xlarge/dimensions.xml b/res/values-xlarge/dimensions.xml index 85329e012..ba654d5a5 100644 --- a/res/values-xlarge/dimensions.xml +++ b/res/values-xlarge/dimensions.xml @@ -22,6 +22,8 @@ <!-- configuration for album set page --> <integer name="albumset_rows_land">3</integer> <integer name="albumset_rows_port">5</integer> + <integer name="albumset_cols_land">5</integer> + <integer name="albumset_cols_port">3</integer> <dimen name="albumset_title_font_size">14sp</dimen> <dimen name="albumset_count_font_size">11sp</dimen> <dimen name="albumset_title_right_margin">23dp</dimen> @@ -30,4 +32,6 @@ <!-- configuration for album page --> <integer name="album_rows_land">3</integer> <integer name="album_rows_port">5</integer> + <integer name="album_cols_land">5</integer> + <integer name="album_cols_port">3</integer> </resources> diff --git a/res/values/colors.xml b/res/values/colors.xml index 20b2930d7..9396a99cf 100644 --- a/res/values/colors.xml +++ b/res/values/colors.xml @@ -15,7 +15,10 @@ --> <resources> <color name="default_background">#000</color> - + <color name="primary">#37474F</color> + <color name="primary_dark">#263238</color> + <color name="accent">#607D8B</color> + <color name="material_blue_grey_950">#ff21272b</color> <!-- configuration for album set page --> <color name="albumset_background">#1A1A1A</color> <color name="albumset_placeholder">#333</color> diff --git a/res/values/config.xml b/res/values/config.xml index 5af45db56..25b8e6a49 100644 --- a/res/values/config.xml +++ b/res/values/config.xml @@ -23,4 +23,6 @@ <!-- Maximum recording length in milliseconds. 0 means unlimited. --> <integer name="max_video_recording_length">0</integer> <bool name="config_show_more_images">false</bool> + + <bool name="config_scroll_horizontal">false</bool> </resources> diff --git a/res/values/dimens.xml b/res/values/dimens.xml index ef742d2b5..308f31c41 100644 --- a/res/values/dimens.xml +++ b/res/values/dimens.xml @@ -112,9 +112,13 @@ <!-- configuration for legacy album set page --> <integer name="albumset_rows_land">2</integer> <integer name="albumset_rows_port">3</integer> - <dimen name="albumset_padding_top">7dp</dimen> - <dimen name="albumset_padding_bottom">7dp</dimen> - <dimen name="albumset_slot_gap">7dp</dimen> + <integer name="albumset_cols_land">3</integer> + <integer name="albumset_cols_port">2</integer> + <dimen name="albumset_padding_top">3dp</dimen> + <dimen name="albumset_padding_bottom">3dp</dimen> + <dimen name="albumset_padding_left">3dp</dimen> + <dimen name="albumset_padding_right">3dp</dimen> + <dimen name="albumset_slot_gap">3dp</dimen> <dimen name="albumset_label_background_height">30dp</dimen> <dimen name="albumset_title_offset">10dp</dimen> @@ -126,9 +130,15 @@ <dimen name="albumset_icon_size">25dp</dimen> <!-- configuration for album page --> - <integer name="album_rows_land">2</integer> + <integer name="album_rows_land">3</integer> <integer name="album_rows_port">4</integer> - <dimen name="album_slot_gap">5dp</dimen> + <integer name="album_cols_land">6</integer> + <integer name="album_cols_port">3</integer> + <dimen name="album_padding_top">3dp</dimen> + <dimen name="album_padding_bottom">3dp</dimen> + <dimen name="album_padding_left">3dp</dimen> + <dimen name="album_padding_right">3dp</dimen> + <dimen name="album_slot_gap">3dp</dimen> <!-- configuration for manage page --> <dimen name="cache_pin_size">24dp</dimen> @@ -152,4 +162,20 @@ <dimen name="photoeditor_text_padding">10dp</dimen> <dimen name="photoeditor_original_text_size">18dp</dimen> <dimen name="photoeditor_original_text_margin">4dp</dimen> + + <dimen name="action_bar_elevation">8dp</dimen> + + <!-- FAB --> + <!-- Floating action button --> + <dimen name="floating_action_button_height">56dp</dimen> + <dimen name="floating_action_button_width">56dp</dimen> + <dimen name="floating_action_button_radius">28dp</dimen> + <dimen name="floating_action_button_translation_z">5dp</dimen> + <dimen name="floating_action_button_margin_left">5dp</dimen> + <dimen name="floating_action_button_margin_right">5dp</dimen> + <dimen name="floating_action_button_margin_bottom">16dp</dimen> + <dimen name="elevation_low">1dp</dimen> + <dimen name="elevation_high">4dp</dimen> + <dimen name="add_button_margin">16dp</dimen> + </resources> diff --git a/res/values/filtershow_color.xml b/res/values/filtershow_color.xml index 4fb4495e7..9cdec49e2 100644 --- a/res/values/filtershow_color.xml +++ b/res/values/filtershow_color.xml @@ -20,29 +20,29 @@ <color name="red">#FF0000</color> <color name="blue">#0000FF</color> <color name="text_toolbar">#FFFFFF</color> - <color name="background_screen">#101010</color> - <color name="background_toolbar">#363949</color> - <color name="background_main_toolbar">#232323</color> + <color name="background_screen">#ff21272b</color> + <color name="background_toolbar">#37474F</color> + <color name="background_main_toolbar">#37474F</color> <color name="toolbar_separation_line">#333333</color> <color name="slider_dot_color">#646464</color> <color name="slider_line_color">#888888</color> - <color name="state_panel_separation_line">#232323</color> - <color name="filtershow_background">#333333</color> + <color name="state_panel_separation_line">#263238</color> + <color name="filtershow_background">#ff21272b</color> <color name="filtershow_graphic">#717171</color> - <color name="filtershow_stateview_end_background">#232323</color> + <color name="filtershow_stateview_end_background">#263238</color> <color name="filtershow_stateview_end_text">#a7a7a7</color> <color name="filtershow_stateview_background">#464646</color> <color name="filtershow_stateview_text">#FFFFFF</color> <color name="filtershow_stateview_selected_background">#c8c8c8</color> <color name="filtershow_stateview_selected_text">#000000</color> - <color name="filtershow_categoryview_background">#1a1a1a</color> + <color name="filtershow_categoryview_background">#ff21272b</color> <color name="filtershow_categoryview_text">#a7a7a7</color> <color name="filtershow_category_selection">#ffffffff</color> <color name="gradcontrol_point_center">#ffffffff</color> <color name="gradcontrol_point_edge">#ffffffff</color> <color name="gradcontrol_graypoint_center">#888888</color> <color name="gradcontrol_graypoint_edge">#BBBBBB</color> - <color name="gradcontrol_point_shadow_start">#66000000</color> + <color name="gradcontrol_point_shadow_start">#6621272b</color> <color name="gradcontrol_point_shadow_end">#00000000</color> <color name="gradcontrol_line_color">#FFFFFF</color> <color name="gradcontrol_line_shadow">#000000</color> diff --git a/res/values/styles.xml b/res/values/styles.xml index 14e8e299b..45a965f6b 100644 --- a/res/values/styles.xml +++ b/res/values/styles.xml @@ -37,7 +37,7 @@ <item name="android:actionBarStyle">@style/Holo.ActionBar</item> <item name="android:colorBackground">@null</item> <item name="android:colorBackgroundCacheHint">@null</item> - <item name="android:windowBackground">@drawable/filtershow_tiled_background</item> + <item name="android:windowBackground">@color/filtershow_background</item> </style> <style name="Holo.ActionBar" parent="android:Widget.Holo.ActionBar"> <item name="android:displayOptions">useLogo|showHome</item> diff --git a/src/com/android/gallery3d/app/AlbumPage.java b/src/com/android/gallery3d/app/AlbumPage.java index f6bb47d39..436ecbb8b 100644 --- a/src/com/android/gallery3d/app/AlbumPage.java +++ b/src/com/android/gallery3d/app/AlbumPage.java @@ -113,6 +113,7 @@ public class AlbumPage extends ActivityState implements GalleryActionBar.Cluster private Path mMediaSetPath; private String mParentMediaSetString; private SlotView mSlotView; + private Config.AlbumPage mConfig; private AlbumDataLoader mAlbumDataAdapter; @@ -179,9 +180,9 @@ public class AlbumPage extends ActivityState implements GalleryActionBar.Cluster protected void onLayout( boolean changed, int left, int top, int right, int bottom) { - int slotViewTop = mActivity.getGalleryActionBar().getHeight(); - int slotViewBottom = bottom - top; - int slotViewRight = right - left; + int slotViewTop = mActivity.getGalleryActionBar().getHeight() + mConfig.paddingTop; + int slotViewBottom = bottom - top - mConfig.paddingBottom; + int slotViewRight = right - left - mConfig.paddingRight; if (mShowDetails) { mDetailsHelper.layout(left, slotViewTop, right, bottom); @@ -190,8 +191,8 @@ public class AlbumPage extends ActivityState implements GalleryActionBar.Cluster } // Set the mSlotView as a reference point to the open animation - mOpenCenter.setReferencePosition(0, slotViewTop); - mSlotView.layout(0, slotViewTop, slotViewRight, slotViewBottom); + mOpenCenter.setReferencePosition(mConfig.paddingLeft, slotViewTop); + mSlotView.layout(mConfig.paddingLeft, slotViewTop, slotViewRight, slotViewBottom); GalleryUtils.setViewPointMatrix(mMatrix, (right - left) / 2, (bottom - top) / 2, -mUserDistance); } @@ -614,10 +615,10 @@ public class AlbumPage extends ActivityState implements GalleryActionBar.Cluster private void initializeViews() { mSelectionManager = new SelectionManager(mActivity, false); mSelectionManager.setSelectionListener(this); - Config.AlbumPage config = Config.AlbumPage.get(mActivity); - mSlotView = new SlotView(mActivity, config.slotViewSpec); + mConfig = Config.AlbumPage.get(mActivity); + mSlotView = new SlotView(mActivity, mConfig.slotViewSpec); mAlbumView = new AlbumSlotRenderer(mActivity, mSlotView, - mSelectionManager, config.placeholderColor); + mSelectionManager, mConfig.placeholderColor); mSlotView.setSlotRenderer(mAlbumView); mRootPane.addComponent(mSlotView); mSlotView.setListener(new SlotView.SimpleListener() { diff --git a/src/com/android/gallery3d/app/AlbumSetPage.java b/src/com/android/gallery3d/app/AlbumSetPage.java index f01585328..a82c64e12 100644 --- a/src/com/android/gallery3d/app/AlbumSetPage.java +++ b/src/com/android/gallery3d/app/AlbumSetPage.java @@ -154,7 +154,7 @@ public class AlbumSetPage extends ActivityState implements int slotViewTop = mActionBar.getHeight() + mConfig.paddingTop; int slotViewBottom = bottom - top - mConfig.paddingBottom; - int slotViewRight = right - left; + int slotViewRight = right - left - mConfig.paddingRight; if (mShowDetails) { mDetailsHelper.layout(left, slotViewTop, right, bottom); @@ -162,7 +162,7 @@ public class AlbumSetPage extends ActivityState implements mAlbumSetView.setHighlightItemPath(null); } - mSlotView.layout(0, slotViewTop, slotViewRight, slotViewBottom); + mSlotView.layout(mConfig.paddingLeft, slotViewTop, slotViewRight, slotViewBottom); } @Override diff --git a/src/com/android/gallery3d/app/Config.java b/src/com/android/gallery3d/app/Config.java index 7183acc33..3625dafe4 100644 --- a/src/com/android/gallery3d/app/Config.java +++ b/src/com/android/gallery3d/app/Config.java @@ -31,6 +31,8 @@ final class Config { public AlbumSetSlotRenderer.LabelSpec labelSpec; public int paddingTop; public int paddingBottom; + public int paddingLeft; + public int paddingRight; public int placeholderColor; public static synchronized AlbumSetPage get(Context context) { @@ -48,11 +50,15 @@ final class Config { slotViewSpec = new SlotView.Spec(); slotViewSpec.rowsLand = r.getInteger(R.integer.albumset_rows_land); slotViewSpec.rowsPort = r.getInteger(R.integer.albumset_rows_port); + slotViewSpec.colsLand = r.getInteger(R.integer.albumset_cols_land); + slotViewSpec.colsPort = r.getInteger(R.integer.albumset_cols_port); slotViewSpec.slotGap = r.getDimensionPixelSize(R.dimen.albumset_slot_gap); slotViewSpec.slotHeightAdditional = 0; paddingTop = r.getDimensionPixelSize(R.dimen.albumset_padding_top); paddingBottom = r.getDimensionPixelSize(R.dimen.albumset_padding_bottom); + paddingLeft = r.getDimensionPixelSize(R.dimen.albumset_padding_left); + paddingRight = r.getDimensionPixelSize(R.dimen.albumset_padding_right); labelSpec = new AlbumSetSlotRenderer.LabelSpec(); labelSpec.labelBackgroundHeight = r.getDimensionPixelSize( @@ -82,6 +88,10 @@ final class Config { private static AlbumPage sInstance; public SlotView.Spec slotViewSpec; + public int paddingTop; + public int paddingBottom; + public int paddingLeft; + public int paddingRight; public int placeholderColor; public static synchronized AlbumPage get(Context context) { @@ -99,7 +109,14 @@ final class Config { slotViewSpec = new SlotView.Spec(); slotViewSpec.rowsLand = r.getInteger(R.integer.album_rows_land); slotViewSpec.rowsPort = r.getInteger(R.integer.album_rows_port); + slotViewSpec.colsLand = r.getInteger(R.integer.album_cols_land); + slotViewSpec.colsPort = r.getInteger(R.integer.album_cols_port); slotViewSpec.slotGap = r.getDimensionPixelSize(R.dimen.album_slot_gap); + + paddingTop = r.getDimensionPixelSize(R.dimen.album_padding_top); + paddingBottom = r.getDimensionPixelSize(R.dimen.album_padding_bottom); + paddingLeft = r.getDimensionPixelSize(R.dimen.album_padding_left); + paddingRight = r.getDimensionPixelSize(R.dimen.album_padding_right); } } diff --git a/src/com/android/gallery3d/app/GalleryActionBar.java b/src/com/android/gallery3d/app/GalleryActionBar.java index 588f5842a..11057fb02 100644 --- a/src/com/android/gallery3d/app/GalleryActionBar.java +++ b/src/com/android/gallery3d/app/GalleryActionBar.java @@ -47,6 +47,7 @@ public class GalleryActionBar implements OnNavigationListener { private ClusterRunner mClusterRunner; private CharSequence[] mTitles; + private CharSequence mTitle; private ArrayList<Integer> mActions; private Context mContext; private LayoutInflater mInflater; @@ -159,7 +160,8 @@ public class GalleryActionBar implements OnNavigationListener { parent, false); } TwoLineListItem view = (TwoLineListItem) convertView; - view.getText1().setText(mActionBar.getTitle()); + CharSequence title = mActionBar.getTitle(); + view.getText1().setText(title == null ? mTitle : title); view.getText2().setText((CharSequence) getItem(position)); return convertView; } @@ -326,12 +328,14 @@ public class GalleryActionBar implements OnNavigationListener { } public void setTitle(String title) { + mTitle = title; if (mActionBar != null) mActionBar.setTitle(title); } public void setTitle(int titleId) { if (mActionBar != null) { - mActionBar.setTitle(mContext.getString(titleId)); + mTitle = mContext.getString(titleId); + mActionBar.setTitle(mTitle); } } diff --git a/src/com/android/gallery3d/filtershow/FilterShowActivity.java b/src/com/android/gallery3d/filtershow/FilterShowActivity.java index f00117702..f80b28e5c 100644 --- a/src/com/android/gallery3d/filtershow/FilterShowActivity.java +++ b/src/com/android/gallery3d/filtershow/FilterShowActivity.java @@ -351,8 +351,6 @@ public class FilterShowActivity extends FragmentActivity implements OnItemClickL ActionBar actionBar = getActionBar(); actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM); actionBar.setCustomView(R.layout.filtershow_actionbar); - actionBar.setBackgroundDrawable(new ColorDrawable( - getResources().getColor(R.color.background_screen))); mSaveButton = actionBar.getCustomView(); mSaveButton.setOnClickListener(new OnClickListener() { diff --git a/src/com/android/gallery3d/filtershow/filters/ImageFilter.java b/src/com/android/gallery3d/filtershow/filters/ImageFilter.java index 437137416..1fcd3008c 100644 --- a/src/com/android/gallery3d/filtershow/filters/ImageFilter.java +++ b/src/com/android/gallery3d/filtershow/filters/ImageFilter.java @@ -19,7 +19,7 @@ package com.android.gallery3d.filtershow.filters; import android.app.Activity; import android.graphics.Bitmap; import android.graphics.Matrix; -import android.support.v8.renderscript.Allocation; +import android.renderscript.Allocation; import android.widget.Toast; import com.android.gallery3d.filtershow.imageshow.GeometryMathUtils; diff --git a/src/com/android/gallery3d/filtershow/filters/ImageFilterChanSat.java b/src/com/android/gallery3d/filtershow/filters/ImageFilterChanSat.java index 1ea8edfb8..6c48a6a9f 100644 --- a/src/com/android/gallery3d/filtershow/filters/ImageFilterChanSat.java +++ b/src/com/android/gallery3d/filtershow/filters/ImageFilterChanSat.java @@ -18,11 +18,11 @@ package com.android.gallery3d.filtershow.filters; import android.graphics.Bitmap; import android.graphics.Matrix; -import android.support.v8.renderscript.Allocation; -import android.support.v8.renderscript.Element; -import android.support.v8.renderscript.RenderScript; -import android.support.v8.renderscript.Script.LaunchOptions; -import android.support.v8.renderscript.Type; +import android.renderscript.Allocation; +import android.renderscript.Element; +import android.renderscript.RenderScript; +import android.renderscript.Script; +import android.renderscript.Type; import com.android.gallery3d.R; import com.android.gallery3d.filtershow.pipeline.FilterEnvironment; @@ -77,7 +77,7 @@ public class ImageFilterChanSat extends ImageFilterRS { Type.Builder tb_float = new Type.Builder(rsCtx, Element.F32_4(rsCtx)); tb_float.setX(in.getType().getX()); tb_float.setY(in.getType().getY()); - mScript = new ScriptC_saturation(rsCtx, res, R.raw.saturation); + mScript = new ScriptC_saturation(rsCtx); } @@ -132,7 +132,7 @@ public class ImageFilterChanSat extends ImageFilterRS { int width = in.getType().getX(); int height = in.getType().getY(); - LaunchOptions options = new LaunchOptions(); + Script.LaunchOptions options = new Script.LaunchOptions(); int ty; options.setX(0, width); diff --git a/src/com/android/gallery3d/filtershow/filters/ImageFilterGrad.java b/src/com/android/gallery3d/filtershow/filters/ImageFilterGrad.java index cbdfaa623..7f10af990 100644 --- a/src/com/android/gallery3d/filtershow/filters/ImageFilterGrad.java +++ b/src/com/android/gallery3d/filtershow/filters/ImageFilterGrad.java @@ -26,11 +26,12 @@ import com.android.gallery3d.filtershow.pipeline.FilterEnvironment; import android.graphics.Bitmap; import android.graphics.Color; import android.graphics.Matrix; -import android.support.v8.renderscript.Allocation; -import android.support.v8.renderscript.Element; -import android.support.v8.renderscript.RenderScript; -import android.support.v8.renderscript.Script.LaunchOptions; -import android.support.v8.renderscript.Type; + +import android.renderscript.Allocation; +import android.renderscript.Element; +import android.renderscript.RenderScript; +import android.renderscript.Script; +import android.renderscript.Type; import android.util.Log; import com.android.gallery3d.R; @@ -87,7 +88,7 @@ public class ImageFilterGrad extends ImageFilterRS { Type.Builder tb_float = new Type.Builder(rsCtx, Element.F32_4(rsCtx)); tb_float.setX(in.getType().getX()); tb_float.setY(in.getType().getY()); - mScript = new ScriptC_grad(rsCtx, res, R.raw.grad); + mScript = new ScriptC_grad(rsCtx); } @@ -161,7 +162,7 @@ public class ImageFilterGrad extends ImageFilterRS { int width = in.getType().getX(); int height = in.getType().getY(); - LaunchOptions options = new LaunchOptions(); + Script.LaunchOptions options = new Script.LaunchOptions(); int ty; options.setX(0, width); diff --git a/src/com/android/gallery3d/filtershow/filters/ImageFilterRS.java b/src/com/android/gallery3d/filtershow/filters/ImageFilterRS.java index 9a494d823..b7c4d80e0 100644 --- a/src/com/android/gallery3d/filtershow/filters/ImageFilterRS.java +++ b/src/com/android/gallery3d/filtershow/filters/ImageFilterRS.java @@ -18,7 +18,10 @@ package com.android.gallery3d.filtershow.filters; import android.graphics.Bitmap; import android.graphics.BitmapFactory; -import android.support.v8.renderscript.*; +import android.renderscript.Allocation; +import android.renderscript.Element; +import android.renderscript.RenderScript; +import android.renderscript.Type; import android.util.Log; import android.content.res.Resources; import com.android.gallery3d.R; @@ -159,8 +162,7 @@ public abstract class ImageFilterRS extends ImageFilter { private static Allocation convertRGBAtoA(RenderScript RS, Bitmap bitmap) { if (RS != mRScache || mGreyConvert == null) { - mGreyConvert = new ScriptC_grey(RS, RS.getApplicationContext().getResources(), - R.raw.grey); + mGreyConvert = new ScriptC_grey(RS); mRScache = RS; } diff --git a/src/com/android/gallery3d/filtershow/filters/ImageFilterSharpen.java b/src/com/android/gallery3d/filtershow/filters/ImageFilterSharpen.java index 418afc40f..bfec89f6b 100644 --- a/src/com/android/gallery3d/filtershow/filters/ImageFilterSharpen.java +++ b/src/com/android/gallery3d/filtershow/filters/ImageFilterSharpen.java @@ -64,7 +64,7 @@ public class ImageFilterSharpen extends ImageFilterRS { protected void createFilter(android.content.res.Resources res, float scaleFactor, int quality) { if (mScript == null) { - mScript = new ScriptC_convolve3x3(getRenderScriptContext(), res, R.raw.convolve3x3); + mScript = new ScriptC_convolve3x3(getRenderScriptContext()); } } diff --git a/src/com/android/gallery3d/filtershow/filters/ImageFilterVignette.java b/src/com/android/gallery3d/filtershow/filters/ImageFilterVignette.java index 49ac5959c..279bd1857 100644 --- a/src/com/android/gallery3d/filtershow/filters/ImageFilterVignette.java +++ b/src/com/android/gallery3d/filtershow/filters/ImageFilterVignette.java @@ -24,11 +24,8 @@ import android.graphics.Rect; import com.android.gallery3d.R; import com.android.gallery3d.filtershow.imageshow.MasterImage; import com.android.gallery3d.filtershow.pipeline.FilterEnvironment; -import android.support.v8.renderscript.Allocation; -import android.support.v8.renderscript.Element; -import android.support.v8.renderscript.RenderScript; -import android.support.v8.renderscript.Script.LaunchOptions; -import android.support.v8.renderscript.Type; + +import android.renderscript.RenderScript; import android.util.Log; public class ImageFilterVignette extends ImageFilterRS { @@ -79,7 +76,7 @@ public class ImageFilterVignette extends ImageFilterRS { protected void createFilter(Resources res, float scaleFactor, int quality) { RenderScript rsCtx = getRenderScriptContext(); - mScript = new ScriptC_vignette(rsCtx, res, R.raw.vignette); + mScript = new ScriptC_vignette(rsCtx); } @Override diff --git a/src/com/android/gallery3d/filtershow/pipeline/Buffer.java b/src/com/android/gallery3d/filtershow/pipeline/Buffer.java index c378eb994..a487a5d8d 100644 --- a/src/com/android/gallery3d/filtershow/pipeline/Buffer.java +++ b/src/com/android/gallery3d/filtershow/pipeline/Buffer.java @@ -18,8 +18,8 @@ package com.android.gallery3d.filtershow.pipeline; import android.graphics.Bitmap; import android.graphics.Canvas; -import android.support.v8.renderscript.Allocation; -import android.support.v8.renderscript.RenderScript; +import android.renderscript.Allocation; +import android.renderscript.RenderScript; import android.util.Log; import com.android.gallery3d.filtershow.cache.BitmapCache; import com.android.gallery3d.filtershow.imageshow.MasterImage; diff --git a/src/com/android/gallery3d/filtershow/pipeline/CachingPipeline.java b/src/com/android/gallery3d/filtershow/pipeline/CachingPipeline.java index 8ae9a7c7b..e8c9b0f5c 100644 --- a/src/com/android/gallery3d/filtershow/pipeline/CachingPipeline.java +++ b/src/com/android/gallery3d/filtershow/pipeline/CachingPipeline.java @@ -24,8 +24,9 @@ import android.graphics.Matrix; import android.graphics.Paint; import android.graphics.Rect; import android.graphics.RectF; -import android.support.v8.renderscript.Allocation; -import android.support.v8.renderscript.RenderScript; + +import android.renderscript.Allocation; +import android.renderscript.RenderScript; import android.util.Log; import com.android.gallery3d.filtershow.cache.BitmapCache; diff --git a/src/com/android/gallery3d/filtershow/pipeline/FilterEnvironment.java b/src/com/android/gallery3d/filtershow/pipeline/FilterEnvironment.java index ebf83b720..0b84f5203 100644 --- a/src/com/android/gallery3d/filtershow/pipeline/FilterEnvironment.java +++ b/src/com/android/gallery3d/filtershow/pipeline/FilterEnvironment.java @@ -18,7 +18,7 @@ package com.android.gallery3d.filtershow.pipeline; import android.graphics.Bitmap; import android.graphics.Canvas; -import android.support.v8.renderscript.Allocation; +import android.renderscript.Allocation; import com.android.gallery3d.app.Log; import com.android.gallery3d.filtershow.cache.BitmapCache; diff --git a/src/com/android/gallery3d/filtershow/pipeline/ImagePreset.java b/src/com/android/gallery3d/filtershow/pipeline/ImagePreset.java index 18321f567..1460ad434 100644 --- a/src/com/android/gallery3d/filtershow/pipeline/ImagePreset.java +++ b/src/com/android/gallery3d/filtershow/pipeline/ImagePreset.java @@ -18,7 +18,7 @@ package com.android.gallery3d.filtershow.pipeline; import android.graphics.Bitmap; import android.graphics.Rect; -import android.support.v8.renderscript.Allocation; +import android.renderscript.Allocation; import android.util.JsonReader; import android.util.JsonWriter; import android.util.Log; diff --git a/src/com/android/gallery3d/filtershow/pipeline/PipelineInterface.java b/src/com/android/gallery3d/filtershow/pipeline/PipelineInterface.java index d53768c95..ad59e0c44 100644 --- a/src/com/android/gallery3d/filtershow/pipeline/PipelineInterface.java +++ b/src/com/android/gallery3d/filtershow/pipeline/PipelineInterface.java @@ -18,8 +18,8 @@ package com.android.gallery3d.filtershow.pipeline; import android.content.res.Resources; import android.graphics.Bitmap; -import android.support.v8.renderscript.Allocation; -import android.support.v8.renderscript.RenderScript; +import android.renderscript.Allocation; +import android.renderscript.RenderScript; public interface PipelineInterface { public String getName(); diff --git a/src/com/android/gallery3d/ui/Paper.java b/src/com/android/gallery3d/ui/Paper.java index b36f5c3a2..6ed5013a2 100644 --- a/src/com/android/gallery3d/ui/Paper.java +++ b/src/com/android/gallery3d/ui/Paper.java @@ -28,53 +28,76 @@ class Paper { @SuppressWarnings("unused") private static final String TAG = "Paper"; private static final int ROTATE_FACTOR = 4; - private EdgeAnimation mAnimationLeft = new EdgeAnimation(); - private EdgeAnimation mAnimationRight = new EdgeAnimation(); + private EdgeAnimation mAnimationBegin = new EdgeAnimation(); + private EdgeAnimation mAnimationEnd = new EdgeAnimation(); private int mWidth; + private int mHeight; private float[] mMatrix = new float[16]; + private final boolean mIsWide; + + public Paper(boolean wide) { + mIsWide = wide; + } + public void overScroll(float distance) { distance /= mWidth; // make it relative to width if (distance < 0) { - mAnimationLeft.onPull(-distance); + mAnimationBegin.onPull(-distance); } else { - mAnimationRight.onPull(distance); + mAnimationEnd.onPull(distance); } } public void edgeReached(float velocity) { velocity /= mWidth; // make it relative to width if (velocity < 0) { - mAnimationRight.onAbsorb(-velocity); + mAnimationEnd.onAbsorb(-velocity); } else { - mAnimationLeft.onAbsorb(velocity); + mAnimationBegin.onAbsorb(velocity); } } public void onRelease() { - mAnimationLeft.onRelease(); - mAnimationRight.onRelease(); + mAnimationBegin.onRelease(); + mAnimationEnd.onRelease(); } public boolean advanceAnimation() { // Note that we use "|" because we want both animations get updated. - return mAnimationLeft.update() | mAnimationRight.update(); + return mAnimationBegin.update() | mAnimationEnd.update(); } public void setSize(int width, int height) { mWidth = width; + mHeight = height; } - public float[] getTransform(Rect rect, float scrollX) { - float left = mAnimationLeft.getValue(); - float right = mAnimationRight.getValue(); - float screenX = rect.centerX() - scrollX; - // We linearly interpolate the value [left, right] for the screenX - // range int [-1/4, 5/4]*mWidth. So if part of the thumbnail is outside + public float[] getTransform(Rect rect, float scroll) { + Log.d(TAG, rect.toString()); + float start = mAnimationBegin.getValue(); + float end = mAnimationEnd.getValue(); + int center = 0; + int screenWidth = mWidth; + int rotateX = 0; + int rotateY = 0; + final boolean wide = mIsWide; + if (wide) { + center = rect.centerX(); + rotateY = 1; + } else { + center = rect.centerY(); + rotateX = 1; + screenWidth = mHeight; + } + float screen = center - scroll; + // We linearly interpolate the value [start, end] for the screen + // range int [-1/4, 5/4]*screenWidth. So if part of the thumbnail is outside // the screen, we still get some transform. - float x = screenX + mWidth / 4; - int range = 3 * mWidth / 2; - float t = ((range - x) * left - x * right) / range; + float x = screen + screenWidth / 4; + int range = 3 * screenWidth / 2; + float t = ((range - x) * start - x * end) / range; + // compress t to the range (-1, 1) by the function // f(t) = (1 / (1 + e^-t) - 0.5) * 2 // then multiply by 90 to make the range (-45, 45) @@ -82,8 +105,9 @@ class Paper { (1 / (1 + (float) Math.exp(-t * ROTATE_FACTOR)) - 0.5f) * 2 * -45; Matrix.setIdentityM(mMatrix, 0); Matrix.translateM(mMatrix, 0, mMatrix, 0, rect.centerX(), rect.centerY(), 0); - Matrix.rotateM(mMatrix, 0, degrees, 0, 1, 0); + Matrix.rotateM(mMatrix, 0, degrees, rotateX, rotateY, 0); Matrix.translateM(mMatrix, 0, mMatrix, 0, -rect.width() / 2, -rect.height() / 2, 0); + return mMatrix; } } diff --git a/src/com/android/gallery3d/ui/SlotView.java b/src/com/android/gallery3d/ui/SlotView.java index eaf23f553..c9a1ff303 100644 --- a/src/com/android/gallery3d/ui/SlotView.java +++ b/src/com/android/gallery3d/ui/SlotView.java @@ -24,6 +24,7 @@ import android.view.MotionEvent; import android.view.View; import android.view.animation.DecelerateInterpolator; +import com.android.gallery3d.R; import com.android.gallery3d.anim.Animation; import com.android.gallery3d.app.AbstractGalleryActivity; import com.android.gallery3d.common.Utils; @@ -35,7 +36,6 @@ public class SlotView extends GLView { @SuppressWarnings("unused") private static final String TAG = "SlotView"; - private static final boolean WIDE = true; private static final int INDEX_NONE = -1; public static final int RENDER_MORE_PASS = 1; @@ -66,7 +66,7 @@ public class SlotView extends GLView { private final GestureDetector mGestureDetector; private final ScrollerHelper mScroller; - private final Paper mPaper = new Paper(); + private final Paper mPaper; private Listener mListener; private UserInteractionListener mUIListener; @@ -95,10 +95,14 @@ public class SlotView extends GLView { // Flag to check whether it is come from Photo Page. private boolean isFromPhotoPage = false; + private final boolean mIsWide; + public SlotView(AbstractGalleryActivity activity, Spec spec) { + mIsWide = activity.getResources().getBoolean(R.bool.config_scroll_horizontal); mGestureDetector = new GestureDetector(activity, new MyGestureListener()); mScroller = new ScrollerHelper(activity); mHandler = new SynchronizedHandler(activity.getGLRoot()); + mPaper = new Paper(mIsWide); setSlotSpec(spec); } @@ -116,7 +120,7 @@ public class SlotView extends GLView { return; } Rect rect = mLayout.getSlotRect(index, mTempRect); - int position = WIDE + int position = mIsWide ? (rect.left + rect.right - getWidth()) / 2 : (rect.top + rect.bottom - getHeight()) / 2; setScrollPosition(position); @@ -124,11 +128,11 @@ public class SlotView extends GLView { public void makeSlotVisible(int index) { Rect rect = mLayout.getSlotRect(index, mTempRect); - int visibleBegin = WIDE ? mScrollX : mScrollY; - int visibleLength = WIDE ? getWidth() : getHeight(); + int visibleBegin = mIsWide ? mScrollX : mScrollY; + int visibleLength = mIsWide ? getWidth() : getHeight(); int visibleEnd = visibleBegin + visibleLength; - int slotBegin = WIDE ? rect.left : rect.top; - int slotEnd = WIDE ? rect.right : rect.bottom; + int slotBegin = mIsWide ? rect.left : rect.top; + int slotEnd = mIsWide ? rect.right : rect.bottom; int position = visibleBegin; if (visibleLength < slotEnd - slotBegin) { @@ -199,8 +203,8 @@ public class SlotView extends GLView { } private void updateScrollPosition(int position, boolean force) { - if (!force && (WIDE ? position == mScrollX : position == mScrollY)) return; - if (WIDE) { + if (!force && (mIsWide ? position == mScrollX : position == mScrollY)) return; + if (mIsWide) { mScrollX = position; } else { mScrollY = position; @@ -335,7 +339,7 @@ public class SlotView extends GLView { canvas.save(GLCanvas.SAVE_FLAG_ALPHA | GLCanvas.SAVE_FLAG_MATRIX); Rect rect = mLayout.getSlotRect(index, mTempRect); if (paperActive) { - canvas.multiplyMatrix(mPaper.getTransform(rect, mScrollX), 0); + canvas.multiplyMatrix(mPaper.getTransform(rect, (mIsWide ? mScrollX : mScrollY)), 0); } else { canvas.translate(rect.left, rect.top, 0); } @@ -409,6 +413,8 @@ public class SlotView extends GLView { public int rowsLand = -1; public int rowsPort = -1; + public int colsLand = -1; + public int colsPort = -1; public int slotGap = -1; } @@ -454,7 +460,7 @@ public class SlotView extends GLView { public Rect getSlotRect(int index, Rect rect) { int col, row; - if (WIDE) { + if (mIsWide) { if (View.LAYOUT_DIRECTION_RTL == TextUtils .getLayoutDirectionFromLocale(Locale.getDefault())) { // If RTL, recalculate the columns and rows. @@ -526,10 +532,17 @@ public class SlotView extends GLView { mSlotWidth = mSpec.slotWidth; mSlotHeight = mSpec.slotHeight; } else { - int rows = (mWidth > mHeight) ? mSpec.rowsLand : mSpec.rowsPort; - mSlotGap = mSpec.slotGap; - mSlotHeight = Math.max(1, (mHeight - (rows - 1) * mSlotGap) / rows); - mSlotWidth = mSlotHeight - mSpec.slotHeightAdditional; + if (mIsWide) { + int rows = (mWidth > mHeight) ? mSpec.rowsLand : mSpec.rowsPort; + mSlotGap = mSpec.slotGap; + mSlotHeight = Math.max(1, (mHeight - (rows - 1) * mSlotGap) / rows); + mSlotWidth = mSlotHeight - mSpec.slotHeightAdditional; + } else { + int cols = (mWidth > mHeight) ? mSpec.colsLand : mSpec.colsPort; + mSlotGap = mSpec.slotGap; + mSlotHeight = Math.max(1, (mWidth - (cols - 1) * mSlotGap) / cols); + mSlotWidth = mSlotHeight - mSpec.slotHeightAdditional; + } } if (mRenderer != null) { @@ -537,7 +550,7 @@ public class SlotView extends GLView { } int[] padding = new int[2]; - if (WIDE) { + if (mIsWide) { initLayoutParameters(mWidth, mHeight, mSlotWidth, mSlotHeight, padding); mVerticalPadding.startAnimateTo(padding[0]); mHorizontalPadding.startAnimateTo(padding[1]); @@ -558,7 +571,7 @@ public class SlotView extends GLView { private void updateVisibleSlotRange() { int position = mScrollPosition; - if (WIDE) { + if (mIsWide) { if (View.LAYOUT_DIRECTION_RTL == TextUtils .getLayoutDirectionFromLocale(Locale.getDefault())) { // If RTL, recalculate the position. @@ -610,8 +623,8 @@ public class SlotView extends GLView { } public int getSlotIndexByPosition(float x, float y) { - int absoluteX = Math.round(x) + (WIDE ? mScrollPosition : 0); - int absoluteY = Math.round(y) + (WIDE ? 0 : mScrollPosition); + int absoluteX = Math.round(x) + (mIsWide ? mScrollPosition : 0); + int absoluteY = Math.round(y) + (mIsWide ? 0 : mScrollPosition); if (View.LAYOUT_DIRECTION_RTL == TextUtils .getLayoutDirectionFromLocale(Locale.getDefault())) { // If RTL, recalculate the absoluteX. @@ -628,11 +641,11 @@ public class SlotView extends GLView { int columnIdx = absoluteX / (mSlotWidth + mSlotGap); int rowIdx = absoluteY / (mSlotHeight + mSlotGap); - if (!WIDE && columnIdx >= mUnitCount) { + if (!mIsWide && columnIdx >= mUnitCount) { return INDEX_NONE; } - if (WIDE && rowIdx >= mUnitCount) { + if (mIsWide && rowIdx >= mUnitCount) { return INDEX_NONE; } @@ -644,7 +657,7 @@ public class SlotView extends GLView { return INDEX_NONE; } - int index = WIDE + int index = mIsWide ? (columnIdx * mUnitCount + rowIdx) : (rowIdx * mUnitCount + columnIdx); @@ -652,7 +665,7 @@ public class SlotView extends GLView { } public int getScrollLimit() { - int limit = WIDE ? mContentLength - mWidth : mContentLength - mHeight; + int limit = mIsWide ? mContentLength - mWidth : mContentLength - mHeight; return limit <= 0 ? 0 : limit; } @@ -700,7 +713,7 @@ public class SlotView extends GLView { cancelDown(false); int scrollLimit = mLayout.getScrollLimit(); if (scrollLimit == 0) return false; - float velocity = WIDE ? velocityX : velocityY; + float velocity = mIsWide ? velocityX : velocityY; mScroller.fling((int) -velocity, 0, scrollLimit); if (mUIListener != null) mUIListener.onUserInteractionBegin(); invalidate(); @@ -711,7 +724,7 @@ public class SlotView extends GLView { public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY) { cancelDown(false); - float distance = WIDE ? distanceX : distanceY; + float distance = mIsWide ? distanceX : distanceY; int overDistance = mScroller.startScroll( Math.round(distance), 0, mLayout.getScrollLimit()); if (mOverscrollEffect == OVERSCROLL_3D && overDistance != 0) { @@ -758,7 +771,7 @@ public class SlotView extends GLView { mStartIndex = INDEX_NONE; } // Reset the scroll position to avoid scrolling over the updated limit. - setScrollPosition(WIDE ? mScrollX : mScrollY); + setScrollPosition(mIsWide ? mScrollX : mScrollY); return changed; } |