Skip to content

Commit 07ba82f

Browse files
committed
mark selected grid items with a check
1 parent c5f38a9 commit 07ba82f

File tree

3 files changed

+30
-6
lines changed

3 files changed

+30
-6
lines changed

app/src/main/kotlin/com/simplemobiletools/filemanager/pro/adapters/ItemsAdapter.kt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,11 @@ import com.simplemobiletools.filemanager.pro.helpers.*
4040
import com.simplemobiletools.filemanager.pro.interfaces.ItemOperationsListener
4141
import com.simplemobiletools.filemanager.pro.models.ListItem
4242
import com.stericson.RootTools.RootTools
43+
import kotlinx.android.synthetic.main.item_file_dir_grid.view.*
4344
import kotlinx.android.synthetic.main.item_file_dir_list.view.*
45+
import kotlinx.android.synthetic.main.item_file_dir_list.view.item_frame
46+
import kotlinx.android.synthetic.main.item_file_dir_list.view.item_icon
47+
import kotlinx.android.synthetic.main.item_file_dir_list.view.item_name
4448
import kotlinx.android.synthetic.main.item_section.view.*
4549
import java.io.Closeable
4650
import java.io.File
@@ -714,6 +718,11 @@ class ItemsAdapter(activity: SimpleActivity, var listItems: MutableList<ListItem
714718
item_date?.setTextColor(textColor)
715719
item_date?.setTextSize(TypedValue.COMPLEX_UNIT_PX, smallerFontSize)
716720

721+
item_check?.beVisibleIf(isSelected)
722+
if (isSelected) {
723+
item_check?.background?.applyColorFilter(primaryColor)
724+
}
725+
717726
if (listItem.isDirectory) {
718727
item_icon.setImageDrawable(folderDrawable)
719728
item_details?.text = getChildrenCnt(listItem)

app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments/ItemsFragment.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,7 @@ class ItemsFragment : Fragment(), ItemOperationsListener, Breadcrumbs.Breadcrumb
421421

422422
private fun setupGridLayoutManager() {
423423
val layoutManager = mView.items_list.layoutManager as MyGridLayoutManager
424-
layoutManager.spanCount = 3
424+
layoutManager.spanCount = 4
425425
}
426426

427427
private fun setupListLayoutManager() {

app/src/main/res/layout/item_file_dir_grid.xml

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,16 @@
88
android:clickable="true"
99
android:focusable="true"
1010
android:foreground="@drawable/selector"
11+
android:paddingStart="@dimen/small_margin"
1112
android:paddingTop="@dimen/tiny_margin"
13+
android:paddingEnd="@dimen/small_margin"
1214
android:paddingBottom="@dimen/tiny_margin">
1315

1416
<RelativeLayout
1517
android:id="@+id/item_holder"
1618
android:layout_width="match_parent"
1719
android:layout_height="wrap_content"
18-
android:layout_marginBottom="@dimen/normal_margin">
20+
android:layout_marginBottom="@dimen/activity_margin">
1921

2022
<ImageView
2123
android:id="@+id/item_icon"
@@ -29,12 +31,25 @@
2931
android:layout_width="match_parent"
3032
android:layout_height="wrap_content"
3133
android:layout_below="@+id/item_icon"
32-
android:ellipsize="end"
34+
android:ellipsize="middle"
3335
android:gravity="center_horizontal"
34-
android:maxLines="1"
35-
android:paddingStart="@dimen/medium_margin"
36-
android:paddingEnd="@dimen/medium_margin"
36+
android:paddingStart="@dimen/small_margin"
37+
android:paddingEnd="@dimen/small_margin"
38+
android:singleLine="true"
3739
tools:text="Directory" />
3840

41+
<ImageView
42+
android:id="@+id/item_check"
43+
android:layout_width="@dimen/selection_check_size"
44+
android:layout_height="@dimen/selection_check_size"
45+
android:layout_alignEnd="@+id/item_icon"
46+
android:layout_alignParentTop="true"
47+
android:layout_margin="@dimen/small_margin"
48+
android:background="@drawable/circle_background"
49+
android:contentDescription="@null"
50+
android:padding="@dimen/tiny_margin"
51+
android:src="@drawable/ic_check_vector"
52+
android:visibility="gone" />
53+
3954
</RelativeLayout>
4055
</FrameLayout>

0 commit comments

Comments
 (0)