From af3b44d470657bab2700fd208110d956ab3ff40e Mon Sep 17 00:00:00 2001 From: Agnieszka C <85929121+Aga-C@users.noreply.github.com> Date: Sun, 7 Nov 2021 19:42:08 +0100 Subject: [PATCH 1/4] Added stars to mark favorite items (#2102) --- .../gallery/pro/adapters/MediaAdapter.kt | 3 +++ app/src/main/res/layout/photo_item_grid.xml | 12 ++++++++++++ app/src/main/res/layout/photo_item_list.xml | 12 ++++++++++++ app/src/main/res/layout/video_item_grid.xml | 14 +++++++++++++- app/src/main/res/layout/video_item_list.xml | 12 ++++++++++++ 5 files changed, 52 insertions(+), 1 deletion(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/adapters/MediaAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/adapters/MediaAdapter.kt index f052d1d7e..7a90b9cc9 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/adapters/MediaAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/adapters/MediaAdapter.kt @@ -35,6 +35,7 @@ import kotlinx.android.synthetic.main.photo_item_grid.view.* import kotlinx.android.synthetic.main.thumbnail_section.view.* import kotlinx.android.synthetic.main.video_item_grid.view.* import kotlinx.android.synthetic.main.video_item_grid.view.media_item_holder +import kotlinx.android.synthetic.main.video_item_grid.view.favorite import kotlinx.android.synthetic.main.video_item_grid.view.medium_check import kotlinx.android.synthetic.main.video_item_grid.view.medium_name import kotlinx.android.synthetic.main.video_item_grid.view.medium_thumbnail @@ -524,6 +525,8 @@ class MediaAdapter( media_item_holder.setPadding(padding, padding, padding, padding) + favorite.beVisibleIf(medium.isFavorite) + play_portrait_outline?.beVisibleIf(medium.isVideo() || medium.isPortrait()) if (medium.isVideo()) { play_portrait_outline?.setImageResource(R.drawable.ic_play_outline_vector) diff --git a/app/src/main/res/layout/photo_item_grid.xml b/app/src/main/res/layout/photo_item_grid.xml index 422bba8d1..96e080ee8 100644 --- a/app/src/main/res/layout/photo_item_grid.xml +++ b/app/src/main/res/layout/photo_item_grid.xml @@ -27,6 +27,18 @@ android:textSize="@dimen/bigger_text_size" android:visibility="gone" /> + + + + + + + + Date: Tue, 30 Nov 2021 15:49:00 +0100 Subject: [PATCH 2/4] Hiding mark as favorite, smaller star icon, moved items on thumbnail --- .../gallery/pro/activities/MediaActivity.kt | 13 +++++++------ .../gallery/pro/activities/SettingsActivity.kt | 2 ++ .../gallery/pro/adapters/MediaAdapter.kt | 2 +- .../dialogs/ChangeFileThumbnailStyleDialog.kt | 3 +++ .../gallery/pro/helpers/Config.kt | 4 ++++ .../gallery/pro/helpers/Constants.kt | 1 + .../dialog_change_file_thumbnail_style.xml | 16 ++++++++++++++++ app/src/main/res/layout/photo_item_grid.xml | 11 ++++++----- app/src/main/res/layout/photo_item_list.xml | 7 ++++--- app/src/main/res/layout/video_item_grid.xml | 11 ++++++----- app/src/main/res/layout/video_item_list.xml | 7 ++++--- app/src/main/res/values/dimens.xml | 1 + 12 files changed, 55 insertions(+), 23 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/MediaActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/MediaActivity.kt index 6b8150a60..e179cc945 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/MediaActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/MediaActivity.kt @@ -73,6 +73,7 @@ class MediaActivity : SimpleActivity(), MediaOperationsListener { private var mStoredScrollHorizontally = true private var mStoredShowFileTypes = true private var mStoredRoundedCorners = false + private var mStoredMarkFavoriteItems = true private var mStoredTextColor = 0 private var mStoredAdjustedPrimaryColor = 0 private var mStoredThumbnailSpacing = 0 @@ -149,12 +150,11 @@ class MediaActivity : SimpleActivity(), MediaOperationsListener { getMediaAdapter()?.updatePrimaryColor(config.primaryColor) } - if (mStoredThumbnailSpacing != config.thumbnailSpacing) { - media_grid.adapter = null - setupAdapter() - } - - if (mStoredRoundedCorners != config.fileRoundedCorners) { + if ( + mStoredThumbnailSpacing != config.thumbnailSpacing + || mStoredRoundedCorners != config.fileRoundedCorners + || mStoredMarkFavoriteItems != config.markFavoriteItems + ) { media_grid.adapter = null setupAdapter() } @@ -306,6 +306,7 @@ class MediaActivity : SimpleActivity(), MediaOperationsListener { mStoredCropThumbnails = cropThumbnails mStoredScrollHorizontally = scrollHorizontally mStoredShowFileTypes = showThumbnailFileTypes + mStoredMarkFavoriteItems = markFavoriteItems mStoredTextColor = textColor mStoredThumbnailSpacing = thumbnailSpacing mStoredRoundedCorners = fileRoundedCorners diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/SettingsActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/SettingsActivity.kt index 754357ee8..1075de4b0 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/SettingsActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/SettingsActivity.kt @@ -731,6 +731,7 @@ class SettingsActivity : SimpleActivity() { put(CROP_THUMBNAILS, config.cropThumbnails) put(SHOW_THUMBNAIL_VIDEO_DURATION, config.showThumbnailVideoDuration) put(SHOW_THUMBNAIL_FILE_TYPES, config.showThumbnailFileTypes) + put(MARK_FAVORITE_ITEMS, config.markFavoriteItems) put(SCROLL_HORIZONTALLY, config.scrollHorizontally) put(ENABLE_PULL_TO_REFRESH, config.enablePullToRefresh) put(MAX_BRIGHTNESS, config.maxBrightness) @@ -872,6 +873,7 @@ class SettingsActivity : SimpleActivity() { CROP_THUMBNAILS -> config.cropThumbnails = value.toBoolean() SHOW_THUMBNAIL_VIDEO_DURATION -> config.showThumbnailVideoDuration = value.toBoolean() SHOW_THUMBNAIL_FILE_TYPES -> config.showThumbnailFileTypes = value.toBoolean() + MARK_FAVORITE_ITEMS -> config.markFavoriteItems = value.toBoolean() SCROLL_HORIZONTALLY -> config.scrollHorizontally = value.toBoolean() ENABLE_PULL_TO_REFRESH -> config.enablePullToRefresh = value.toBoolean() MAX_BRIGHTNESS -> config.maxBrightness = value.toBoolean() diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/adapters/MediaAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/adapters/MediaAdapter.kt index 702d25882..64d972482 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/adapters/MediaAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/adapters/MediaAdapter.kt @@ -525,7 +525,7 @@ class MediaAdapter( media_item_holder.setPadding(padding, padding, padding, padding) - favorite.beVisibleIf(medium.isFavorite) + favorite.beVisibleIf(medium.isFavorite && config.markFavoriteItems) play_portrait_outline?.beVisibleIf(medium.isVideo() || medium.isPortrait()) if (medium.isVideo()) { diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/dialogs/ChangeFileThumbnailStyleDialog.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/dialogs/ChangeFileThumbnailStyleDialog.kt index 5498c66b8..fca5eb4b4 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/dialogs/ChangeFileThumbnailStyleDialog.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/dialogs/ChangeFileThumbnailStyleDialog.kt @@ -22,11 +22,13 @@ class ChangeFileThumbnailStyleDialog(val activity: BaseSimpleActivity) : DialogI dialog_file_style_animate_gifs.isChecked = config.animateGifs dialog_file_style_show_thumbnail_video_duration.isChecked = config.showThumbnailVideoDuration dialog_file_style_show_thumbnail_file_types.isChecked = config.showThumbnailFileTypes + dialog_file_style_mark_favorite_items.isChecked = config.markFavoriteItems dialog_file_style_rounded_corners_holder.setOnClickListener { dialog_file_style_rounded_corners.toggle() } dialog_file_style_animate_gifs_holder.setOnClickListener { dialog_file_style_animate_gifs.toggle() } dialog_file_style_show_thumbnail_video_duration_holder.setOnClickListener { dialog_file_style_show_thumbnail_video_duration.toggle() } dialog_file_style_show_thumbnail_file_types_holder.setOnClickListener { dialog_file_style_show_thumbnail_file_types.toggle() } + dialog_file_style_mark_favorite_items_holder.setOnClickListener { dialog_file_style_mark_favorite_items.toggle() } dialog_file_style_spacing_holder.setOnClickListener { val items = arrayListOf( @@ -61,6 +63,7 @@ class ChangeFileThumbnailStyleDialog(val activity: BaseSimpleActivity) : DialogI config.animateGifs = view.dialog_file_style_animate_gifs.isChecked config.showThumbnailVideoDuration = view.dialog_file_style_show_thumbnail_video_duration.isChecked config.showThumbnailFileTypes = view.dialog_file_style_show_thumbnail_file_types.isChecked + config.markFavoriteItems = view.dialog_file_style_mark_favorite_items.isChecked config.thumbnailSpacing = thumbnailSpacing } diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/Config.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/Config.kt index bc9c880cb..75d7045e4 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/Config.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/Config.kt @@ -167,6 +167,10 @@ class Config(context: Context) : BaseConfig(context) { get() = prefs.getBoolean(SHOW_THUMBNAIL_FILE_TYPES, true) set(showThumbnailFileTypes) = prefs.edit().putBoolean(SHOW_THUMBNAIL_FILE_TYPES, showThumbnailFileTypes).apply() + var markFavoriteItems: Boolean + get() = prefs.getBoolean(MARK_FAVORITE_ITEMS, true) + set(markFavoriteItems) = prefs.edit().putBoolean(MARK_FAVORITE_ITEMS, markFavoriteItems).apply() + var screenRotation: Int get() = prefs.getInt(SCREEN_ROTATION, ROTATE_BY_SYSTEM_SETTING) set(screenRotation) = prefs.edit().putInt(SCREEN_ROTATION, screenRotation).apply() diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/Constants.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/Constants.kt index df6c9240d..d48a9cc30 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/Constants.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/Constants.kt @@ -79,6 +79,7 @@ const val SHOW_NOTCH = "show_notch" const val FILE_LOADING_PRIORITY = "file_loading_priority" const val SPAM_FOLDERS_CHECKED = "spam_folders_checked" const val SHOW_THUMBNAIL_FILE_TYPES = "show_thumbnail_file_types" +const val MARK_FAVORITE_ITEMS = "mark_favorite_items" const val EDITOR_BRUSH_COLOR = "editor_brush_color" const val EDITOR_BRUSH_HARDNESS = "editor_brush_hardness" const val EDITOR_BRUSH_SIZE = "editor_brush_size" diff --git a/app/src/main/res/layout/dialog_change_file_thumbnail_style.xml b/app/src/main/res/layout/dialog_change_file_thumbnail_style.xml index 8e14dbc1e..583138789 100644 --- a/app/src/main/res/layout/dialog_change_file_thumbnail_style.xml +++ b/app/src/main/res/layout/dialog_change_file_thumbnail_style.xml @@ -108,5 +108,21 @@ android:text="@string/show_image_file_types" /> + + + + + + diff --git a/app/src/main/res/layout/photo_item_grid.xml b/app/src/main/res/layout/photo_item_grid.xml index 96e080ee8..de16a756e 100644 --- a/app/src/main/res/layout/photo_item_grid.xml +++ b/app/src/main/res/layout/photo_item_grid.xml @@ -17,7 +17,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentStart="true" - android:layout_alignParentTop="true" + android:layout_alignParentBottom="true" android:layout_margin="@dimen/small_margin" android:fontFamily="sans-serif-medium" android:shadowColor="@color/default_background_color" @@ -29,14 +29,15 @@ 100dp 20dp 22dp + 24dp 26dp 34dp 96dp From 2378eaa54785fceeaa7c5c06067006ce5af55df5 Mon Sep 17 00:00:00 2001 From: Agnieszka C <85929121+Aga-C@users.noreply.github.com> Date: Wed, 1 Dec 2021 13:29:17 +0100 Subject: [PATCH 3/4] Moved icons on thumbnails to other positions fix #2102 --- app/src/main/res/layout/photo_item_grid.xml | 6 +++--- app/src/main/res/layout/photo_item_list.xml | 6 +++--- app/src/main/res/layout/video_item_grid.xml | 15 +++++++-------- app/src/main/res/layout/video_item_list.xml | 6 +++--- app/src/main/res/values/dimens.xml | 3 ++- 5 files changed, 18 insertions(+), 18 deletions(-) diff --git a/app/src/main/res/layout/photo_item_grid.xml b/app/src/main/res/layout/photo_item_grid.xml index de16a756e..37f7be306 100644 --- a/app/src/main/res/layout/photo_item_grid.xml +++ b/app/src/main/res/layout/photo_item_grid.xml @@ -17,7 +17,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentStart="true" - android:layout_alignParentBottom="true" + android:layout_alignParentTop="true" android:layout_margin="@dimen/small_margin" android:fontFamily="sans-serif-medium" android:shadowColor="@color/default_background_color" @@ -32,9 +32,9 @@ android:layout_width="@dimen/favorite_icon_size" android:layout_height="@dimen/favorite_icon_size" android:layout_alignParentTop="true" - android:layout_alignParentStart="true" + android:layout_alignParentEnd="true" android:layout_margin="@dimen/small_margin" - android:padding="@dimen/tiny_margin" + android:padding="@dimen/small_margin" android:gravity="end" android:background="@drawable/circle_black_background" android:src="@drawable/ic_star_vector" diff --git a/app/src/main/res/layout/photo_item_list.xml b/app/src/main/res/layout/photo_item_list.xml index 6d49f6f52..dca1dbee2 100644 --- a/app/src/main/res/layout/photo_item_list.xml +++ b/app/src/main/res/layout/photo_item_list.xml @@ -19,11 +19,11 @@ @@ -27,9 +27,9 @@ android:layout_width="@dimen/favorite_icon_size" android:layout_height="@dimen/favorite_icon_size" android:layout_alignParentTop="true" - android:layout_alignParentStart="true" + android:layout_alignParentEnd="true" android:layout_margin="@dimen/small_margin" - android:padding="@dimen/tiny_margin" + android:padding="@dimen/small_margin" android:gravity="end" android:background="@drawable/circle_black_background" android:src="@drawable/ic_star_vector" @@ -37,15 +37,14 @@ 100dp 20dp 22dp - 24dp + 17dp + 26dp 26dp 34dp 96dp From cdcdb41132c35d97aed252559786ff3db91e8d94 Mon Sep 17 00:00:00 2001 From: Tibor Kaputa Date: Thu, 2 Dec 2021 23:12:00 +0100 Subject: [PATCH 4/4] align video duration to the middle of video icon --- app/src/main/res/layout/video_item_grid.xml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/app/src/main/res/layout/video_item_grid.xml b/app/src/main/res/layout/video_item_grid.xml index fe8de5bf4..0b7836121 100644 --- a/app/src/main/res/layout/video_item_grid.xml +++ b/app/src/main/res/layout/video_item_grid.xml @@ -29,9 +29,9 @@ android:layout_alignParentTop="true" android:layout_alignParentEnd="true" android:layout_margin="@dimen/small_margin" - android:padding="@dimen/small_margin" - android:gravity="end" android:background="@drawable/circle_black_background" + android:gravity="end" + android:padding="@dimen/small_margin" android:src="@drawable/ic_star_vector" android:visibility="gone" /> @@ -39,9 +39,10 @@ android:id="@+id/video_duration" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_alignParentTop="true" - android:layout_toRightOf="@id/play_portrait_outline" + android:layout_alignTop="@+id/play_portrait_outline" + android:layout_alignBottom="@+id/play_portrait_outline" android:layout_marginTop="@dimen/small_margin" + android:layout_toEndOf="@id/play_portrait_outline" android:ellipsize="end" android:gravity="end" android:maxLines="1"