Skip to content

Commit 12f0d5c

Browse files
committed
show the file last modified at the right side
1 parent 07c054f commit 12f0d5c

File tree

6 files changed

+27
-8
lines changed

6 files changed

+27
-8
lines changed

app/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ android {
5151
}
5252

5353
dependencies {
54-
implementation 'com.simplemobiletools:commons:5.13.10'
54+
implementation 'com.simplemobiletools:commons:5.13.11'
5555
implementation 'com.github.Stericson:RootTools:df729dcb13'
5656
implementation 'com.github.Stericson:RootShell:1.6'
5757
implementation 'com.alexvasilkov:gesture-views:2.5.2'

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -656,12 +656,17 @@ class ItemsAdapter(activity: SimpleActivity, var listItems: MutableList<ListItem
656656
item_name.text = if (textToHighlight.isEmpty()) fileName else fileName.highlightTextPart(textToHighlight, adjustedPrimaryColor)
657657
item_name.setTextColor(textColor)
658658
item_details.setTextColor(textColor)
659+
item_date.setTextColor(textColor)
659660

660661
if (listItem.isDirectory) {
661662
item_icon.setImageDrawable(folderDrawable)
662663
item_details.text = getChildrenCnt(listItem)
664+
item_date.beGone()
663665
} else {
664666
item_details.text = listItem.size.formatSize()
667+
item_date.beVisible()
668+
item_date.text = listItem.modified.formatDate(activity)
669+
665670
val options = RequestOptions()
666671
.diskCacheStrategy(DiskCacheStrategy.RESOURCE)
667672
.error(fileDrawable)

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -229,13 +229,13 @@ class ItemsFragment : Fragment(), ItemOperationsListener, Breadcrumbs.Breadcrumb
229229
file.length()
230230
}
231231

232-
return ListItem(curPath, curName, isDirectory, children, size, false)
232+
return ListItem(curPath, curName, isDirectory, children, size, file.lastModified(), false)
233233
}
234234

235235
private fun getListItemsFromFileDirItems(fileDirItems: ArrayList<FileDirItem>): ArrayList<ListItem> {
236236
val listItems = ArrayList<ListItem>()
237237
fileDirItems.forEach {
238-
val listItem = ListItem(it.path, it.name, it.isDirectory, it.children, it.size, false)
238+
val listItem = ListItem(it.path, it.name, it.isDirectory, it.children, it.size, it.modified, false)
239239
listItems.add(listItem)
240240
}
241241
return listItems
@@ -295,7 +295,7 @@ class ItemsFragment : Fragment(), ItemOperationsListener, Breadcrumbs.Breadcrumb
295295
files.forEach {
296296
val parent = it.mPath.getParentPath()
297297
if (parent != previousParent) {
298-
listItems.add(ListItem("", context!!.humanizePath(parent), false, 0, 0, true))
298+
listItems.add(ListItem("", context!!.humanizePath(parent), false, 0, 0, 0, true))
299299
previousParent = parent
300300
}
301301
listItems.add(it)

app/src/main/kotlin/com/simplemobiletools/filemanager/pro/helpers/RootHelpers.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ class RootHelpers(val activity: Activity) {
4444
val file = File(path, line)
4545
val fullLine = fullLines.firstOrNull { it.endsWith(" $line") }
4646
val isDirectory = fullLine?.startsWith('d') ?: file.isDirectory
47-
val fileDirItem = ListItem(file.absolutePath, line, isDirectory, 0, 0, false)
47+
val fileDirItem = ListItem(file.absolutePath, line, isDirectory, 0, 0, 0, false)
4848
files.add(fileDirItem)
4949
super.commandOutput(id, line)
5050
}

app/src/main/kotlin/com/simplemobiletools/filemanager/pro/models/ListItem.kt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@ package com.simplemobiletools.filemanager.pro.models
22

33
import com.simplemobiletools.commons.models.FileDirItem
44

5-
data class ListItem(val mPath: String, val mName: String = "", var mIsDirectory: Boolean = false, var mChildren: Int = 0, var mSize: Long = 0L, var isSectionTitle: Boolean)
6-
: FileDirItem(mPath, mName, mIsDirectory, mChildren, mSize)
5+
data class ListItem(val mPath: String, val mName: String = "", var mIsDirectory: Boolean = false, var mChildren: Int = 0, var mSize: Long = 0L, var mModified: Long = 0L,
6+
var isSectionTitle: Boolean)
7+
: FileDirItem(mPath, mName, mIsDirectory, mChildren, mSize, mModified)

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

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,26 @@
3737

3838
<TextView
3939
android:id="@+id/item_details"
40-
android:layout_width="match_parent"
40+
android:layout_width="wrap_content"
4141
android:layout_height="wrap_content"
4242
android:layout_below="@+id/item_name"
4343
android:layout_toEndOf="@+id/item_icon"
44+
android:alpha="0.6"
4445
android:paddingStart="@dimen/small_margin"
4546
android:textSize="@dimen/smaller_text_size"
4647
tools:text="1 KB"/>
4748

49+
<TextView
50+
android:id="@+id/item_date"
51+
android:layout_width="match_parent"
52+
android:layout_height="wrap_content"
53+
android:layout_alignTop="@+id/item_details"
54+
android:layout_alignBottom="@+id/item_details"
55+
android:layout_toEndOf="@+id/item_details"
56+
android:alpha="0.6"
57+
android:gravity="end"
58+
android:textSize="@dimen/smaller_text_size"
59+
tools:text="1.1.1970"/>
60+
4861
</RelativeLayout>
4962
</FrameLayout>

0 commit comments

Comments
 (0)