highlight selected items at list views too

This commit is contained in:
tibbi 2021-01-18 13:31:27 +01:00
parent 9ff50cc48a
commit 1b5040ebcd
4 changed files with 27 additions and 19 deletions

View file

@ -680,6 +680,10 @@ class DirectoryAdapter(activity: BaseSimpleActivity, var dirs: ArrayList<Directo
dir_check.background?.applyColorFilter(primaryColor) dir_check.background?.applyColorFilter(primaryColor)
} }
if (isListViewType) {
dir_holder.isSelected = isSelected
}
if (scrollHorizontally && !isListViewType && folderStyle == FOLDER_STYLE_ROUNDED_CORNERS) { if (scrollHorizontally && !isListViewType && folderStyle == FOLDER_STYLE_ROUNDED_CORNERS) {
(dir_thumbnail.layoutParams as RelativeLayout.LayoutParams).addRule(RelativeLayout.ABOVE, dir_name.id) (dir_thumbnail.layoutParams as RelativeLayout.LayoutParams).addRule(RelativeLayout.ABOVE, dir_name.id)

View file

@ -534,6 +534,10 @@ class MediaAdapter(activity: BaseSimpleActivity, var media: ArrayList<ThumbnailI
medium_check?.background?.applyColorFilter(primaryColor) medium_check?.background?.applyColorFilter(primaryColor)
} }
if (isListViewType) {
media_item_holder.isSelected = isSelected
}
var path = medium.path var path = medium.path
if (hasOTGConnected && context.isPathOnOTG(path)) { if (hasOTGConnected && context.isPathOnOTG(path)) {
path = path.getOTGPublicPath(context) path = path.getOTGPublicPath(context)

View file

@ -1,12 +1,12 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<RelativeLayout <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/dir_holder" android:id="@+id/dir_holder"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="?attr/selectableItemBackground" android:background="?attr/selectableItemBackground"
android:clickable="true" android:clickable="true"
android:focusable="true" android:focusable="true"
android:foreground="@drawable/selector"
android:paddingStart="@dimen/medium_margin" android:paddingStart="@dimen/medium_margin"
android:paddingTop="@dimen/small_margin" android:paddingTop="@dimen/small_margin"
android:paddingBottom="@dimen/small_margin"> android:paddingBottom="@dimen/small_margin">
@ -14,7 +14,7 @@
<com.simplemobiletools.gallery.pro.views.MySquareImageView <com.simplemobiletools.gallery.pro.views.MySquareImageView
android:id="@+id/dir_thumbnail" android:id="@+id/dir_thumbnail"
android:layout_width="@dimen/list_view_folder_thumbnail_size" android:layout_width="@dimen/list_view_folder_thumbnail_size"
android:layout_height="@dimen/list_view_folder_thumbnail_size"/> android:layout_height="@dimen/list_view_folder_thumbnail_size" />
<ImageView <ImageView
android:id="@+id/dir_lock" android:id="@+id/dir_lock"
@ -29,7 +29,7 @@
android:contentDescription="@string/lock_folder" android:contentDescription="@string/lock_folder"
android:padding="@dimen/medium_margin" android:padding="@dimen/medium_margin"
android:src="@drawable/ic_lock_vector" android:src="@drawable/ic_lock_vector"
android:visibility="gone"/> android:visibility="gone" />
<ImageView <ImageView
android:id="@+id/dir_check" android:id="@+id/dir_check"
@ -43,7 +43,7 @@
android:contentDescription="@null" android:contentDescription="@null"
android:padding="@dimen/tiny_margin" android:padding="@dimen/tiny_margin"
android:src="@drawable/ic_check_vector" android:src="@drawable/ic_check_vector"
android:visibility="gone"/> android:visibility="gone" />
<TextView <TextView
android:id="@+id/dir_name" android:id="@+id/dir_name"
@ -55,7 +55,7 @@
android:paddingStart="@dimen/medium_margin" android:paddingStart="@dimen/medium_margin"
android:paddingEnd="@dimen/medium_margin" android:paddingEnd="@dimen/medium_margin"
android:textColor="@android:color/white" android:textColor="@android:color/white"
android:textSize="@dimen/bigger_text_size"/> android:textSize="@dimen/bigger_text_size" />
<TextView <TextView
android:id="@+id/dir_path" android:id="@+id/dir_path"
@ -70,7 +70,7 @@
android:paddingStart="@dimen/medium_margin" android:paddingStart="@dimen/medium_margin"
android:paddingEnd="@dimen/medium_margin" android:paddingEnd="@dimen/medium_margin"
android:textColor="@android:color/white" android:textColor="@android:color/white"
android:textSize="@dimen/smaller_text_size"/> android:textSize="@dimen/smaller_text_size" />
<TextView <TextView
android:id="@+id/photo_cnt" android:id="@+id/photo_cnt"
@ -80,7 +80,7 @@
android:layout_toEndOf="@+id/dir_name" android:layout_toEndOf="@+id/dir_name"
android:alpha="0.4" android:alpha="0.4"
android:textColor="@android:color/white" android:textColor="@android:color/white"
android:textSize="@dimen/smaller_text_size"/> android:textSize="@dimen/smaller_text_size" />
<LinearLayout <LinearLayout
android:id="@+id/dir_icon_holder" android:id="@+id/dir_icon_holder"
@ -100,7 +100,7 @@
android:contentDescription="@null" android:contentDescription="@null"
android:paddingBottom="@dimen/small_margin" android:paddingBottom="@dimen/small_margin"
android:src="@drawable/ic_sd_card_vector" android:src="@drawable/ic_sd_card_vector"
android:visibility="gone"/> android:visibility="gone" />
<ImageView <ImageView
android:id="@+id/dir_pin" android:id="@+id/dir_pin"
@ -109,7 +109,7 @@
android:contentDescription="@string/pin" android:contentDescription="@string/pin"
android:paddingBottom="@dimen/small_margin" android:paddingBottom="@dimen/small_margin"
android:src="@drawable/ic_pin" android:src="@drawable/ic_pin"
android:visibility="gone"/> android:visibility="gone" />
</LinearLayout> </LinearLayout>
</RelativeLayout> </RelativeLayout>

View file

@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<RelativeLayout <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/media_item_holder" android:id="@+id/media_item_holder"
android:layout_width="wrap_content" android:layout_width="wrap_content"
@ -8,6 +7,7 @@
android:background="?attr/selectableItemBackground" android:background="?attr/selectableItemBackground"
android:clickable="true" android:clickable="true"
android:focusable="true" android:focusable="true"
android:foreground="@drawable/selector"
android:paddingStart="@dimen/medium_margin" android:paddingStart="@dimen/medium_margin"
android:paddingTop="@dimen/small_margin" android:paddingTop="@dimen/small_margin"
android:paddingBottom="@dimen/small_margin"> android:paddingBottom="@dimen/small_margin">
@ -15,7 +15,7 @@
<com.simplemobiletools.gallery.pro.views.MySquareImageView <com.simplemobiletools.gallery.pro.views.MySquareImageView
android:id="@+id/medium_thumbnail" android:id="@+id/medium_thumbnail"
android:layout_width="@dimen/list_view_folder_thumbnail_size" android:layout_width="@dimen/list_view_folder_thumbnail_size"
android:layout_height="@dimen/list_view_folder_thumbnail_size"/> android:layout_height="@dimen/list_view_folder_thumbnail_size" />
<ImageView <ImageView
android:id="@+id/medium_check" android:id="@+id/medium_check"
@ -29,7 +29,7 @@
android:contentDescription="@null" android:contentDescription="@null"
android:padding="@dimen/tiny_margin" android:padding="@dimen/tiny_margin"
android:src="@drawable/ic_check_vector" android:src="@drawable/ic_check_vector"
android:visibility="gone"/> android:visibility="gone" />
<TextView <TextView
android:id="@+id/medium_name" android:id="@+id/medium_name"
@ -45,7 +45,7 @@
android:paddingEnd="@dimen/normal_margin" android:paddingEnd="@dimen/normal_margin"
android:textColor="@android:color/white" android:textColor="@android:color/white"
android:textSize="@dimen/bigger_text_size" android:textSize="@dimen/bigger_text_size"
tools:text="My photo"/> tools:text="My photo" />
<ImageView <ImageView
android:id="@+id/play_outline" android:id="@+id/play_outline"
@ -56,7 +56,7 @@
android:layout_marginEnd="@dimen/small_margin" android:layout_marginEnd="@dimen/small_margin"
android:paddingBottom="6dp" android:paddingBottom="6dp"
android:src="@drawable/ic_play_outline_vector" android:src="@drawable/ic_play_outline_vector"
android:visibility="gone"/> android:visibility="gone" />
<TextView <TextView
android:id="@+id/file_type" android:id="@+id/file_type"
@ -65,9 +65,9 @@
android:layout_alignParentEnd="true" android:layout_alignParentEnd="true"
android:layout_alignParentBottom="true" android:layout_alignParentBottom="true"
android:layout_marginEnd="@dimen/small_margin" android:layout_marginEnd="@dimen/small_margin"
android:paddingBottom="@dimen/medium_margin"
android:paddingEnd="@dimen/small_margin"
android:fontFamily="sans-serif-medium" android:fontFamily="sans-serif-medium"
android:paddingEnd="@dimen/small_margin"
android:paddingBottom="@dimen/medium_margin"
android:shadowColor="@color/default_background_color" android:shadowColor="@color/default_background_color"
android:shadowRadius="4" android:shadowRadius="4"
android:text="@string/gif" android:text="@string/gif"
@ -87,6 +87,6 @@
android:paddingBottom="@dimen/small_margin" android:paddingBottom="@dimen/small_margin"
android:textColor="@android:color/white" android:textColor="@android:color/white"
android:textSize="@dimen/normal_text_size" android:textSize="@dimen/normal_text_size"
tools:text="00:05"/> tools:text="00:05" />
</RelativeLayout> </RelativeLayout>