mirror of
https://github.com/SimpleMobileTools/Simple-File-Manager.git
synced 2025-06-05 22:09:15 +02:00
mark selected grid items with a check
This commit is contained in:
@@ -40,7 +40,11 @@ import com.simplemobiletools.filemanager.pro.helpers.*
|
|||||||
import com.simplemobiletools.filemanager.pro.interfaces.ItemOperationsListener
|
import com.simplemobiletools.filemanager.pro.interfaces.ItemOperationsListener
|
||||||
import com.simplemobiletools.filemanager.pro.models.ListItem
|
import com.simplemobiletools.filemanager.pro.models.ListItem
|
||||||
import com.stericson.RootTools.RootTools
|
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.*
|
||||||
|
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 kotlinx.android.synthetic.main.item_section.view.*
|
||||||
import java.io.Closeable
|
import java.io.Closeable
|
||||||
import java.io.File
|
import java.io.File
|
||||||
@@ -714,6 +718,11 @@ class ItemsAdapter(activity: SimpleActivity, var listItems: MutableList<ListItem
|
|||||||
item_date?.setTextColor(textColor)
|
item_date?.setTextColor(textColor)
|
||||||
item_date?.setTextSize(TypedValue.COMPLEX_UNIT_PX, smallerFontSize)
|
item_date?.setTextSize(TypedValue.COMPLEX_UNIT_PX, smallerFontSize)
|
||||||
|
|
||||||
|
item_check?.beVisibleIf(isSelected)
|
||||||
|
if (isSelected) {
|
||||||
|
item_check?.background?.applyColorFilter(primaryColor)
|
||||||
|
}
|
||||||
|
|
||||||
if (listItem.isDirectory) {
|
if (listItem.isDirectory) {
|
||||||
item_icon.setImageDrawable(folderDrawable)
|
item_icon.setImageDrawable(folderDrawable)
|
||||||
item_details?.text = getChildrenCnt(listItem)
|
item_details?.text = getChildrenCnt(listItem)
|
||||||
|
@@ -421,7 +421,7 @@ class ItemsFragment : Fragment(), ItemOperationsListener, Breadcrumbs.Breadcrumb
|
|||||||
|
|
||||||
private fun setupGridLayoutManager() {
|
private fun setupGridLayoutManager() {
|
||||||
val layoutManager = mView.items_list.layoutManager as MyGridLayoutManager
|
val layoutManager = mView.items_list.layoutManager as MyGridLayoutManager
|
||||||
layoutManager.spanCount = 3
|
layoutManager.spanCount = 4
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setupListLayoutManager() {
|
private fun setupListLayoutManager() {
|
||||||
|
@@ -8,14 +8,16 @@
|
|||||||
android:clickable="true"
|
android:clickable="true"
|
||||||
android:focusable="true"
|
android:focusable="true"
|
||||||
android:foreground="@drawable/selector"
|
android:foreground="@drawable/selector"
|
||||||
|
android:paddingStart="@dimen/small_margin"
|
||||||
android:paddingTop="@dimen/tiny_margin"
|
android:paddingTop="@dimen/tiny_margin"
|
||||||
|
android:paddingEnd="@dimen/small_margin"
|
||||||
android:paddingBottom="@dimen/tiny_margin">
|
android:paddingBottom="@dimen/tiny_margin">
|
||||||
|
|
||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
android:id="@+id/item_holder"
|
android:id="@+id/item_holder"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginBottom="@dimen/normal_margin">
|
android:layout_marginBottom="@dimen/activity_margin">
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/item_icon"
|
android:id="@+id/item_icon"
|
||||||
@@ -29,12 +31,25 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_below="@+id/item_icon"
|
android:layout_below="@+id/item_icon"
|
||||||
android:ellipsize="end"
|
android:ellipsize="middle"
|
||||||
android:gravity="center_horizontal"
|
android:gravity="center_horizontal"
|
||||||
android:maxLines="1"
|
android:paddingStart="@dimen/small_margin"
|
||||||
android:paddingStart="@dimen/medium_margin"
|
android:paddingEnd="@dimen/small_margin"
|
||||||
android:paddingEnd="@dimen/medium_margin"
|
android:singleLine="true"
|
||||||
tools:text="Directory" />
|
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>
|
</RelativeLayout>
|
||||||
</FrameLayout>
|
</FrameLayout>
|
||||||
|
Reference in New Issue
Block a user