diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt index 47eff4f7c..66a4eb984 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt @@ -212,6 +212,8 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener { findItem(R.id.increase_column_count).isVisible = config.viewTypeFiles == VIEW_TYPE_GRID && config.mediaColumnCnt < 10 findItem(R.id.reduce_column_count).isVisible = config.viewTypeFiles == VIEW_TYPE_GRID && config.mediaColumnCnt > 1 + + findItem(R.id.toggle_filename).isVisible = config.viewTypeFiles == VIEW_TYPE_GRID } return true @@ -272,6 +274,9 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener { RadioGroupDialog(this, items, config.viewTypeFiles) { config.viewTypeFiles = it as Int invalidateOptionsMenu() + setupLayoutManager() + media_grid.adapter = null + setupAdapter() } } @@ -365,6 +370,13 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener { private fun getRecyclerAdapter() = (media_grid.adapter as MediaAdapter) private fun setupLayoutManager() { + if (config.viewTypeFiles == VIEW_TYPE_GRID) + setupGridLayoutManager() + else + setupListLayoutManager() + } + + private fun setupGridLayoutManager() { val layoutManager = media_grid.layoutManager as GridLayoutManager if (config.scrollHorizontally) { layoutManager.orientation = GridLayoutManager.HORIZONTAL @@ -402,6 +414,14 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener { } } + private fun setupListLayoutManager() { + media_grid.isDragSelectionEnabled = true + media_grid.isZoomingEnabled = false + + val layoutManager = media_grid.layoutManager as GridLayoutManager + layoutManager.spanCount = 1 + } + private fun increaseColumnCount() { config.mediaColumnCnt = ++(media_grid.layoutManager as GridLayoutManager).spanCount invalidateOptionsMenu() diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/MediaAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/MediaAdapter.kt index 3c71c7f6c..e89d3b8c4 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/MediaAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/MediaAdapter.kt @@ -250,7 +250,7 @@ class MediaAdapter(val activity: SimpleActivity, var media: MutableList, } override fun onBindViewHolder(holder: ViewHolder, position: Int) { - itemViews.put(position, holder.bindView(media[position], displayFilenames, scrollVertically)) + itemViews.put(position, holder.bindView(media[position], displayFilenames || isListViewType, scrollVertically)) toggleItemSelection(selectedPositions.contains(position), position) holder.itemView.tag = holder } diff --git a/app/src/main/res/layout/directory_item_list.xml b/app/src/main/res/layout/directory_item_list.xml index 3ecc8152d..5d5b4c21f 100644 --- a/app/src/main/res/layout/directory_item_list.xml +++ b/app/src/main/res/layout/directory_item_list.xml @@ -69,7 +69,8 @@ android:layout_alignParentRight="true" android:layout_marginRight="@dimen/small_margin" android:gravity="end" - android:orientation="horizontal"> + android:orientation="horizontal" + android:paddingBottom="@dimen/tiny_margin"> + android:paddingLeft="@dimen/small_margin" + android:paddingTop="@dimen/small_margin"> + android:layout_width="@dimen/list_view_folder_thumbnail_size" + android:layout_height="@dimen/list_view_folder_thumbnail_size"/> + + + android:layout_height="1dp" + android:layout_alignBottom="@+id/medium_thumbnail" + android:layout_marginTop="2dp" + android:layout_toRightOf="@+id/medium_thumbnail" + android:background="@drawable/divider"/> diff --git a/app/src/main/res/values/dimens.xml b/app/src/main/res/values/dimens.xml index 0c8d41eea..58e7e8c8e 100644 --- a/app/src/main/res/values/dimens.xml +++ b/app/src/main/res/values/dimens.xml @@ -3,6 +3,7 @@ 150dp 100dp 20dp + 22dp 26dp 150dp 24dp