mirror of
https://github.com/SimpleMobileTools/Simple-File-Manager.git
synced 2025-06-05 22:09:15 +02:00
use a quicker way of formatting date and time at scrolling
This commit is contained in:
@ -58,7 +58,7 @@ android {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation 'com.simplemobiletools:commons:5.26.21'
|
implementation 'com.simplemobiletools:commons:5.26.23'
|
||||||
implementation 'com.github.Stericson:RootTools:df729dcb13'
|
implementation 'com.github.Stericson:RootTools:df729dcb13'
|
||||||
implementation 'com.github.Stericson:RootShell:1.6'
|
implementation 'com.github.Stericson:RootShell:1.6'
|
||||||
implementation 'com.alexvasilkov:gesture-views:2.5.2'
|
implementation 'com.alexvasilkov:gesture-views:2.5.2'
|
||||||
|
@ -62,6 +62,8 @@ class ItemsAdapter(activity: SimpleActivity, var listItems: MutableList<ListItem
|
|||||||
private val hasOTGConnected = activity.hasOTGConnected()
|
private val hasOTGConnected = activity.hasOTGConnected()
|
||||||
private var fontSize = 0f
|
private var fontSize = 0f
|
||||||
private var smallerFontSize = 0f
|
private var smallerFontSize = 0f
|
||||||
|
private var dateFormat = ""
|
||||||
|
private var timeFormat = ""
|
||||||
|
|
||||||
var adjustedPrimaryColor = activity.getAdjustedPrimaryColor()
|
var adjustedPrimaryColor = activity.getAdjustedPrimaryColor()
|
||||||
|
|
||||||
@ -69,6 +71,8 @@ class ItemsAdapter(activity: SimpleActivity, var listItems: MutableList<ListItem
|
|||||||
setupDragListener(true)
|
setupDragListener(true)
|
||||||
initDrawables()
|
initDrawables()
|
||||||
updateFontSizes()
|
updateFontSizes()
|
||||||
|
dateFormat = activity.config.dateFormat
|
||||||
|
timeFormat = activity.getTimeFormat()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getActionMenuId() = R.menu.cab
|
override fun getActionMenuId() = R.menu.cab
|
||||||
@ -662,6 +666,12 @@ class ItemsAdapter(activity: SimpleActivity, var listItems: MutableList<ListItem
|
|||||||
notifyDataSetChanged()
|
notifyDataSetChanged()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun updateDateTimeFormat() {
|
||||||
|
dateFormat = activity.config.dateFormat
|
||||||
|
timeFormat = activity.getTimeFormat()
|
||||||
|
notifyDataSetChanged()
|
||||||
|
}
|
||||||
|
|
||||||
override fun onViewRecycled(holder: ViewHolder) {
|
override fun onViewRecycled(holder: ViewHolder) {
|
||||||
super.onViewRecycled(holder)
|
super.onViewRecycled(holder)
|
||||||
if (!activity.isDestroyed && !activity.isFinishing) {
|
if (!activity.isDestroyed && !activity.isFinishing) {
|
||||||
@ -699,7 +709,7 @@ class ItemsAdapter(activity: SimpleActivity, var listItems: MutableList<ListItem
|
|||||||
} else {
|
} else {
|
||||||
item_details.text = listItem.size.formatSize()
|
item_details.text = listItem.size.formatSize()
|
||||||
item_date.beVisible()
|
item_date.beVisible()
|
||||||
item_date.text = listItem.modified.formatDate(activity)
|
item_date.text = listItem.modified.formatDate(activity, dateFormat, timeFormat)
|
||||||
|
|
||||||
val drawable = fileDrawables.getOrElse(fileName.substringAfterLast(".").toLowerCase(), { fileDrawable })
|
val drawable = fileDrawables.getOrElse(fileName.substringAfterLast(".").toLowerCase(), { fileDrawable })
|
||||||
val options = RequestOptions()
|
val options = RequestOptions()
|
||||||
|
@ -47,6 +47,8 @@ class ItemsFragment : Fragment(), ItemOperationsListener, Breadcrumbs.Breadcrumb
|
|||||||
private var storedItems = ArrayList<ListItem>()
|
private var storedItems = ArrayList<ListItem>()
|
||||||
private var storedTextColor = 0
|
private var storedTextColor = 0
|
||||||
private var storedFontSize = 0
|
private var storedFontSize = 0
|
||||||
|
private var storedDateFormat = ""
|
||||||
|
private var storedTimeFormat = ""
|
||||||
|
|
||||||
lateinit var mView: View
|
lateinit var mView: View
|
||||||
|
|
||||||
@ -101,6 +103,10 @@ class ItemsFragment : Fragment(), ItemOperationsListener, Breadcrumbs.Breadcrumb
|
|||||||
mView.breadcrumbs.updateFontSize(context!!.getTextSize())
|
mView.breadcrumbs.updateFontSize(context!!.getTextSize())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (storedDateFormat != context!!.config.dateFormat || storedTimeFormat != context!!.getTimeFormat()) {
|
||||||
|
getRecyclerAdapter()?.updateDateTimeFormat()
|
||||||
|
}
|
||||||
|
|
||||||
mView.items_fastscroller.updateBubbleColors()
|
mView.items_fastscroller.updateBubbleColors()
|
||||||
mView.items_fastscroller.allowBubbleDisplay = true
|
mView.items_fastscroller.allowBubbleDisplay = true
|
||||||
if (!isFirstResume) {
|
if (!isFirstResume) {
|
||||||
@ -119,6 +125,8 @@ class ItemsFragment : Fragment(), ItemOperationsListener, Breadcrumbs.Breadcrumb
|
|||||||
context!!.config.apply {
|
context!!.config.apply {
|
||||||
storedTextColor = textColor
|
storedTextColor = textColor
|
||||||
storedFontSize = fontSize
|
storedFontSize = fontSize
|
||||||
|
storedDateFormat = dateFormat
|
||||||
|
storedTimeFormat = context.getTimeFormat()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user