show the file last modified at the right side

This commit is contained in:
tibbi 2019-06-13 23:01:18 +02:00
parent 07c054fa52
commit 12f0d5c193
6 changed files with 27 additions and 8 deletions

View file

@ -51,7 +51,7 @@ android {
}
dependencies {
implementation 'com.simplemobiletools:commons:5.13.10'
implementation 'com.simplemobiletools:commons:5.13.11'
implementation 'com.github.Stericson:RootTools:df729dcb13'
implementation 'com.github.Stericson:RootShell:1.6'
implementation 'com.alexvasilkov:gesture-views:2.5.2'

View file

@ -656,12 +656,17 @@ class ItemsAdapter(activity: SimpleActivity, var listItems: MutableList<ListItem
item_name.text = if (textToHighlight.isEmpty()) fileName else fileName.highlightTextPart(textToHighlight, adjustedPrimaryColor)
item_name.setTextColor(textColor)
item_details.setTextColor(textColor)
item_date.setTextColor(textColor)
if (listItem.isDirectory) {
item_icon.setImageDrawable(folderDrawable)
item_details.text = getChildrenCnt(listItem)
item_date.beGone()
} else {
item_details.text = listItem.size.formatSize()
item_date.beVisible()
item_date.text = listItem.modified.formatDate(activity)
val options = RequestOptions()
.diskCacheStrategy(DiskCacheStrategy.RESOURCE)
.error(fileDrawable)

View file

@ -229,13 +229,13 @@ class ItemsFragment : Fragment(), ItemOperationsListener, Breadcrumbs.Breadcrumb
file.length()
}
return ListItem(curPath, curName, isDirectory, children, size, false)
return ListItem(curPath, curName, isDirectory, children, size, file.lastModified(), false)
}
private fun getListItemsFromFileDirItems(fileDirItems: ArrayList<FileDirItem>): ArrayList<ListItem> {
val listItems = ArrayList<ListItem>()
fileDirItems.forEach {
val listItem = ListItem(it.path, it.name, it.isDirectory, it.children, it.size, false)
val listItem = ListItem(it.path, it.name, it.isDirectory, it.children, it.size, it.modified, false)
listItems.add(listItem)
}
return listItems
@ -295,7 +295,7 @@ class ItemsFragment : Fragment(), ItemOperationsListener, Breadcrumbs.Breadcrumb
files.forEach {
val parent = it.mPath.getParentPath()
if (parent != previousParent) {
listItems.add(ListItem("", context!!.humanizePath(parent), false, 0, 0, true))
listItems.add(ListItem("", context!!.humanizePath(parent), false, 0, 0, 0, true))
previousParent = parent
}
listItems.add(it)

View file

@ -44,7 +44,7 @@ class RootHelpers(val activity: Activity) {
val file = File(path, line)
val fullLine = fullLines.firstOrNull { it.endsWith(" $line") }
val isDirectory = fullLine?.startsWith('d') ?: file.isDirectory
val fileDirItem = ListItem(file.absolutePath, line, isDirectory, 0, 0, false)
val fileDirItem = ListItem(file.absolutePath, line, isDirectory, 0, 0, 0, false)
files.add(fileDirItem)
super.commandOutput(id, line)
}

View file

@ -2,5 +2,6 @@ package com.simplemobiletools.filemanager.pro.models
import com.simplemobiletools.commons.models.FileDirItem
data class ListItem(val mPath: String, val mName: String = "", var mIsDirectory: Boolean = false, var mChildren: Int = 0, var mSize: Long = 0L, var isSectionTitle: Boolean)
: FileDirItem(mPath, mName, mIsDirectory, mChildren, mSize)
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,
var isSectionTitle: Boolean)
: FileDirItem(mPath, mName, mIsDirectory, mChildren, mSize, mModified)

View file

@ -37,13 +37,26 @@
<TextView
android:id="@+id/item_details"
android:layout_width="match_parent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/item_name"
android:layout_toEndOf="@+id/item_icon"
android:alpha="0.6"
android:paddingStart="@dimen/small_margin"
android:textSize="@dimen/smaller_text_size"
tools:text="1 KB"/>
<TextView
android:id="@+id/item_date"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignTop="@+id/item_details"
android:layout_alignBottom="@+id/item_details"
android:layout_toEndOf="@+id/item_details"
android:alpha="0.6"
android:gravity="end"
android:textSize="@dimen/smaller_text_size"
tools:text="1.1.1970"/>
</RelativeLayout>
</FrameLayout>