mark selected grid items with a check

This commit is contained in:
tibbi 2020-10-29 21:41:57 +01:00
parent c5f38a93f3
commit 07ba82f4ee
3 changed files with 30 additions and 6 deletions

View File

@ -40,7 +40,11 @@ import com.simplemobiletools.filemanager.pro.helpers.*
import com.simplemobiletools.filemanager.pro.interfaces.ItemOperationsListener
import com.simplemobiletools.filemanager.pro.models.ListItem
import com.stericson.RootTools.RootTools
import kotlinx.android.synthetic.main.item_file_dir_grid.view.*
import kotlinx.android.synthetic.main.item_file_dir_list.view.*
import kotlinx.android.synthetic.main.item_file_dir_list.view.item_frame
import kotlinx.android.synthetic.main.item_file_dir_list.view.item_icon
import kotlinx.android.synthetic.main.item_file_dir_list.view.item_name
import kotlinx.android.synthetic.main.item_section.view.*
import java.io.Closeable
import java.io.File
@ -714,6 +718,11 @@ class ItemsAdapter(activity: SimpleActivity, var listItems: MutableList<ListItem
item_date?.setTextColor(textColor)
item_date?.setTextSize(TypedValue.COMPLEX_UNIT_PX, smallerFontSize)
item_check?.beVisibleIf(isSelected)
if (isSelected) {
item_check?.background?.applyColorFilter(primaryColor)
}
if (listItem.isDirectory) {
item_icon.setImageDrawable(folderDrawable)
item_details?.text = getChildrenCnt(listItem)

View File

@ -421,7 +421,7 @@ class ItemsFragment : Fragment(), ItemOperationsListener, Breadcrumbs.Breadcrumb
private fun setupGridLayoutManager() {
val layoutManager = mView.items_list.layoutManager as MyGridLayoutManager
layoutManager.spanCount = 3
layoutManager.spanCount = 4
}
private fun setupListLayoutManager() {

View File

@ -8,14 +8,16 @@
android:clickable="true"
android:focusable="true"
android:foreground="@drawable/selector"
android:paddingStart="@dimen/small_margin"
android:paddingTop="@dimen/tiny_margin"
android:paddingEnd="@dimen/small_margin"
android:paddingBottom="@dimen/tiny_margin">
<RelativeLayout
android:id="@+id/item_holder"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/normal_margin">
android:layout_marginBottom="@dimen/activity_margin">
<ImageView
android:id="@+id/item_icon"
@ -29,12 +31,25 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/item_icon"
android:ellipsize="end"
android:ellipsize="middle"
android:gravity="center_horizontal"
android:maxLines="1"
android:paddingStart="@dimen/medium_margin"
android:paddingEnd="@dimen/medium_margin"
android:paddingStart="@dimen/small_margin"
android:paddingEnd="@dimen/small_margin"
android:singleLine="true"
tools:text="Directory" />
<ImageView
android:id="@+id/item_check"
android:layout_width="@dimen/selection_check_size"
android:layout_height="@dimen/selection_check_size"
android:layout_alignEnd="@+id/item_icon"
android:layout_alignParentTop="true"
android:layout_margin="@dimen/small_margin"
android:background="@drawable/circle_background"
android:contentDescription="@null"
android:padding="@dimen/tiny_margin"
android:src="@drawable/ic_check_vector"
android:visibility="gone" />
</RelativeLayout>
</FrameLayout>