Merge pull request #525 from SimpleMobileTools/KryptKode-feat/scoped-storage
Krypt kode feat/scoped storage
This commit is contained in:
commit
6684235930
|
@ -57,7 +57,7 @@ android {
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation 'com.github.SimpleMobileTools:Simple-Commons:4e6eeb901f'
|
implementation 'com.github.SimpleMobileTools:Simple-Commons:51f1996098'
|
||||||
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'
|
||||||
|
|
|
@ -61,6 +61,9 @@ class MimeTypesActivity : SimpleActivity(), ItemOperationsListener {
|
||||||
ensureBackgroundThread {
|
ensureBackgroundThread {
|
||||||
reFetchItems()
|
reFetchItems()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val adjustedPrimaryColor = getAdjustedPrimaryColor()
|
||||||
|
mimetypes_fastscroller.updateColors(adjustedPrimaryColor, adjustedPrimaryColor.getContrastColor())
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onCreateOptionsMenu(menu: Menu): Boolean {
|
override fun onCreateOptionsMenu(menu: Menu): Boolean {
|
||||||
|
@ -130,13 +133,13 @@ class MimeTypesActivity : SimpleActivity(), ItemOperationsListener {
|
||||||
lastSearchedText = searchText
|
lastSearchedText = searchText
|
||||||
when {
|
when {
|
||||||
searchText.isEmpty() -> {
|
searchText.isEmpty() -> {
|
||||||
mimetypes_list.beVisible()
|
mimetypes_fastscroller.beVisible()
|
||||||
getRecyclerAdapter()?.updateItems(storedItems)
|
getRecyclerAdapter()?.updateItems(storedItems)
|
||||||
mimetypes_placeholder.beGoneIf(storedItems.isNotEmpty())
|
mimetypes_placeholder.beGoneIf(storedItems.isNotEmpty())
|
||||||
mimetypes_placeholder_2.beGone()
|
mimetypes_placeholder_2.beGone()
|
||||||
}
|
}
|
||||||
searchText.length == 1 -> {
|
searchText.length == 1 -> {
|
||||||
mimetypes_list.beGone()
|
mimetypes_fastscroller.beGone()
|
||||||
mimetypes_placeholder.beVisible()
|
mimetypes_placeholder.beVisible()
|
||||||
mimetypes_placeholder_2.beVisible()
|
mimetypes_placeholder_2.beVisible()
|
||||||
}
|
}
|
||||||
|
@ -150,14 +153,9 @@ class MimeTypesActivity : SimpleActivity(), ItemOperationsListener {
|
||||||
|
|
||||||
runOnUiThread {
|
runOnUiThread {
|
||||||
getRecyclerAdapter()?.updateItems(listItems, text)
|
getRecyclerAdapter()?.updateItems(listItems, text)
|
||||||
mimetypes_list.beVisibleIf(listItems.isNotEmpty())
|
mimetypes_fastscroller.beVisibleIf(listItems.isNotEmpty())
|
||||||
mimetypes_placeholder.beVisibleIf(listItems.isEmpty())
|
mimetypes_placeholder.beVisibleIf(listItems.isEmpty())
|
||||||
mimetypes_placeholder_2.beGone()
|
mimetypes_placeholder_2.beGone()
|
||||||
|
|
||||||
mimetypes_list.onGlobalLayout {
|
|
||||||
items_fastscroller.setScrollToY(mimetypes_list.computeVerticalScrollOffset())
|
|
||||||
calculateContentHeight(listItems)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -232,7 +230,7 @@ class MimeTypesActivity : SimpleActivity(), ItemOperationsListener {
|
||||||
isSearchOpen = false
|
isSearchOpen = false
|
||||||
lastSearchedText = ""
|
lastSearchedText = ""
|
||||||
|
|
||||||
mimetypes_list.beVisible()
|
mimetypes_fastscroller.beVisible()
|
||||||
mimetypes_placeholder.beGoneIf(storedItems.isNotEmpty())
|
mimetypes_placeholder.beGoneIf(storedItems.isNotEmpty())
|
||||||
mimetypes_placeholder_2.beGone()
|
mimetypes_placeholder_2.beGone()
|
||||||
}
|
}
|
||||||
|
@ -321,7 +319,7 @@ class MimeTypesActivity : SimpleActivity(), ItemOperationsListener {
|
||||||
}
|
}
|
||||||
|
|
||||||
storedItems = items
|
storedItems = items
|
||||||
ItemsAdapter(this as SimpleActivity, storedItems, this, mimetypes_list, false, items_fastscroller, null) {
|
ItemsAdapter(this as SimpleActivity, storedItems, this, mimetypes_list, false, null) {
|
||||||
tryOpenPathIntent((it as ListItem).path, false)
|
tryOpenPathIntent((it as ListItem).path, false)
|
||||||
}.apply {
|
}.apply {
|
||||||
setupZoomListener(zoomListener)
|
setupZoomListener(zoomListener)
|
||||||
|
@ -332,13 +330,6 @@ class MimeTypesActivity : SimpleActivity(), ItemOperationsListener {
|
||||||
mimetypes_list.scheduleLayoutAnimation()
|
mimetypes_list.scheduleLayoutAnimation()
|
||||||
}
|
}
|
||||||
|
|
||||||
val dateFormat = config.dateFormat
|
|
||||||
val timeFormat = getTimeFormat()
|
|
||||||
items_fastscroller.setViews(mimetypes_list) {
|
|
||||||
val listItem = getRecyclerAdapter()?.listItems?.getOrNull(it)
|
|
||||||
items_fastscroller.updateBubbleText(listItem?.getBubbleText(this, dateFormat, timeFormat) ?: "")
|
|
||||||
}
|
|
||||||
|
|
||||||
mimetypes_placeholder.beVisibleIf(items.isEmpty())
|
mimetypes_placeholder.beVisibleIf(items.isEmpty())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -390,18 +381,9 @@ class MimeTypesActivity : SimpleActivity(), ItemOperationsListener {
|
||||||
invalidateOptionsMenu()
|
invalidateOptionsMenu()
|
||||||
getRecyclerAdapter()?.apply {
|
getRecyclerAdapter()?.apply {
|
||||||
notifyItemRangeChanged(0, listItems.size)
|
notifyItemRangeChanged(0, listItems.size)
|
||||||
calculateContentHeight(listItems)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun calculateContentHeight(items: MutableList<ListItem>) {
|
|
||||||
val layoutManager = mimetypes_list.layoutManager as MyGridLayoutManager
|
|
||||||
val thumbnailHeight = layoutManager.getChildAt(0)?.height ?: 0
|
|
||||||
val fullHeight = ((items.size - 1) / layoutManager.spanCount + 1) * thumbnailHeight
|
|
||||||
items_fastscroller.setContentHeight(fullHeight)
|
|
||||||
items_fastscroller.setScrollToY(mimetypes_list.computeVerticalScrollOffset())
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun setupLayoutManager() {
|
private fun setupLayoutManager() {
|
||||||
if (config.getFolderViewType(currentMimeType) == VIEW_TYPE_GRID) {
|
if (config.getFolderViewType(currentMimeType) == VIEW_TYPE_GRID) {
|
||||||
currentViewType = VIEW_TYPE_GRID
|
currentViewType = VIEW_TYPE_GRID
|
||||||
|
|
|
@ -12,7 +12,6 @@ import com.bumptech.glide.load.resource.drawable.DrawableTransitionOptions
|
||||||
import com.bumptech.glide.request.RequestOptions
|
import com.bumptech.glide.request.RequestOptions
|
||||||
import com.simplemobiletools.commons.adapters.MyRecyclerViewAdapter
|
import com.simplemobiletools.commons.adapters.MyRecyclerViewAdapter
|
||||||
import com.simplemobiletools.commons.extensions.getColoredDrawableWithColor
|
import com.simplemobiletools.commons.extensions.getColoredDrawableWithColor
|
||||||
import com.simplemobiletools.commons.extensions.getFileSignature
|
|
||||||
import com.simplemobiletools.commons.extensions.getTextSize
|
import com.simplemobiletools.commons.extensions.getTextSize
|
||||||
import com.simplemobiletools.commons.extensions.getTimeFormat
|
import com.simplemobiletools.commons.extensions.getTimeFormat
|
||||||
import com.simplemobiletools.commons.helpers.getFilePlaceholderDrawables
|
import com.simplemobiletools.commons.helpers.getFilePlaceholderDrawables
|
||||||
|
@ -25,7 +24,7 @@ import kotlinx.android.synthetic.main.item_file_dir_list.view.*
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
|
||||||
class DecompressItemsAdapter(activity: SimpleActivity, var listItems: MutableList<ListItem>, recyclerView: MyRecyclerView, itemClick: (Any) -> Unit) :
|
class DecompressItemsAdapter(activity: SimpleActivity, var listItems: MutableList<ListItem>, recyclerView: MyRecyclerView, itemClick: (Any) -> Unit) :
|
||||||
MyRecyclerViewAdapter(activity, recyclerView, null, itemClick) {
|
MyRecyclerViewAdapter(activity, recyclerView, itemClick) {
|
||||||
|
|
||||||
private lateinit var fileDrawable: Drawable
|
private lateinit var fileDrawable: Drawable
|
||||||
private lateinit var folderDrawable: Drawable
|
private lateinit var folderDrawable: Drawable
|
||||||
|
|
|
@ -24,13 +24,13 @@ import com.bumptech.glide.load.resource.bitmap.CenterCrop
|
||||||
import com.bumptech.glide.load.resource.bitmap.RoundedCorners
|
import com.bumptech.glide.load.resource.bitmap.RoundedCorners
|
||||||
import com.bumptech.glide.load.resource.drawable.DrawableTransitionOptions
|
import com.bumptech.glide.load.resource.drawable.DrawableTransitionOptions
|
||||||
import com.bumptech.glide.request.RequestOptions
|
import com.bumptech.glide.request.RequestOptions
|
||||||
|
import com.qtalk.recyclerviewfastscroller.RecyclerViewFastScroller
|
||||||
import com.simplemobiletools.commons.adapters.MyRecyclerViewAdapter
|
import com.simplemobiletools.commons.adapters.MyRecyclerViewAdapter
|
||||||
import com.simplemobiletools.commons.dialogs.*
|
import com.simplemobiletools.commons.dialogs.*
|
||||||
import com.simplemobiletools.commons.extensions.*
|
import com.simplemobiletools.commons.extensions.*
|
||||||
import com.simplemobiletools.commons.helpers.*
|
import com.simplemobiletools.commons.helpers.*
|
||||||
import com.simplemobiletools.commons.models.FileDirItem
|
import com.simplemobiletools.commons.models.FileDirItem
|
||||||
import com.simplemobiletools.commons.models.RadioItem
|
import com.simplemobiletools.commons.models.RadioItem
|
||||||
import com.simplemobiletools.commons.views.FastScroller
|
|
||||||
import com.simplemobiletools.commons.views.MyRecyclerView
|
import com.simplemobiletools.commons.views.MyRecyclerView
|
||||||
import com.simplemobiletools.filemanager.pro.R
|
import com.simplemobiletools.filemanager.pro.R
|
||||||
import com.simplemobiletools.filemanager.pro.activities.SimpleActivity
|
import com.simplemobiletools.filemanager.pro.activities.SimpleActivity
|
||||||
|
@ -41,13 +41,13 @@ 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 java.io.BufferedInputStream
|
|
||||||
import kotlinx.android.synthetic.main.item_file_dir_grid.view.*
|
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_frame
|
||||||
import kotlinx.android.synthetic.main.item_file_dir_list.view.item_icon
|
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_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.BufferedInputStream
|
||||||
import java.io.Closeable
|
import java.io.Closeable
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
@ -57,9 +57,9 @@ import java.util.zip.ZipOutputStream
|
||||||
|
|
||||||
class ItemsAdapter(
|
class ItemsAdapter(
|
||||||
activity: SimpleActivity, var listItems: MutableList<ListItem>, val listener: ItemOperationsListener?, recyclerView: MyRecyclerView,
|
activity: SimpleActivity, var listItems: MutableList<ListItem>, val listener: ItemOperationsListener?, recyclerView: MyRecyclerView,
|
||||||
val isPickMultipleIntent: Boolean, fastScroller: FastScroller?, val swipeRefreshLayout: SwipeRefreshLayout?, itemClick: (Any) -> Unit
|
val isPickMultipleIntent: Boolean, val swipeRefreshLayout: SwipeRefreshLayout?, itemClick: (Any) -> Unit
|
||||||
) :
|
) :
|
||||||
MyRecyclerViewAdapter(activity, recyclerView, fastScroller, itemClick) {
|
MyRecyclerViewAdapter(activity, recyclerView, itemClick), RecyclerViewFastScroller.OnPopupTextUpdate {
|
||||||
|
|
||||||
private val TYPE_FILE_DIR = 1
|
private val TYPE_FILE_DIR = 1
|
||||||
private val TYPE_SECTION = 2
|
private val TYPE_SECTION = 2
|
||||||
|
@ -326,6 +326,7 @@ class ItemsAdapter(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressLint("NewApi")
|
||||||
private fun addFileUris(path: String, paths: ArrayList<String>) {
|
private fun addFileUris(path: String, paths: ArrayList<String>) {
|
||||||
if (activity.getIsPathDirectory(path)) {
|
if (activity.getIsPathDirectory(path)) {
|
||||||
val shouldShowHidden = activity.config.shouldShowHidden
|
val shouldShowHidden = activity.config.shouldShowHidden
|
||||||
|
@ -621,6 +622,7 @@ class ItemsAdapter(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressLint("NewApi")
|
||||||
private fun compressPaths(sourcePaths: List<String>, targetPath: String): Boolean {
|
private fun compressPaths(sourcePaths: List<String>, targetPath: String): Boolean {
|
||||||
val queue = LinkedList<String>()
|
val queue = LinkedList<String>()
|
||||||
val fos = activity.getFileOutputStreamSync(targetPath, "application/zip") ?: return false
|
val fos = activity.getFileOutputStreamSync(targetPath, "application/zip") ?: return false
|
||||||
|
@ -759,7 +761,6 @@ class ItemsAdapter(
|
||||||
textToHighlight = highlightText
|
textToHighlight = highlightText
|
||||||
notifyDataSetChanged()
|
notifyDataSetChanged()
|
||||||
}
|
}
|
||||||
fastScroller?.measureRecyclerView()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fun updateFontSizes() {
|
fun updateFontSizes() {
|
||||||
|
@ -899,4 +900,6 @@ class ItemsAdapter(
|
||||||
fileDrawable = resources.getDrawable(R.drawable.ic_file_generic)
|
fileDrawable = resources.getDrawable(R.drawable.ic_file_generic)
|
||||||
fileDrawables = getFilePlaceholderDrawables(activity)
|
fileDrawables = getFilePlaceholderDrawables(activity)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun onChange(position: Int) = listItems.getOrNull(position)?.getBubbleText(activity, dateFormat, timeFormat) ?: ""
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,8 +12,10 @@ import com.simplemobiletools.filemanager.pro.extensions.config
|
||||||
import kotlinx.android.synthetic.main.item_manage_favorite.view.*
|
import kotlinx.android.synthetic.main.item_manage_favorite.view.*
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
|
||||||
class ManageFavoritesAdapter(activity: BaseSimpleActivity, var favorites: ArrayList<String>, val listener: RefreshRecyclerViewListener?,
|
class ManageFavoritesAdapter(
|
||||||
recyclerView: MyRecyclerView, itemClick: (Any) -> Unit) : MyRecyclerViewAdapter(activity, recyclerView, null, itemClick) {
|
activity: BaseSimpleActivity, var favorites: ArrayList<String>, val listener: RefreshRecyclerViewListener?,
|
||||||
|
recyclerView: MyRecyclerView, itemClick: (Any) -> Unit
|
||||||
|
) : MyRecyclerViewAdapter(activity, recyclerView, itemClick) {
|
||||||
|
|
||||||
private val config = activity.config
|
private val config = activity.config
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package com.simplemobiletools.filemanager.pro.fragments
|
package com.simplemobiletools.filemanager.pro.fragments
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.os.Parcelable
|
import android.os.Parcelable
|
||||||
import android.util.AttributeSet
|
import android.util.AttributeSet
|
||||||
|
@ -50,7 +51,6 @@ class ItemsFragment(context: Context, attributeSet: AttributeSet) : MyViewPagerF
|
||||||
|
|
||||||
override fun onResume(textColor: Int, primaryColor: Int) {
|
override fun onResume(textColor: Int, primaryColor: Int) {
|
||||||
context!!.updateTextColors(this)
|
context!!.updateTextColors(this)
|
||||||
items_fastscroller.updatePrimaryColor()
|
|
||||||
storedItems = ArrayList()
|
storedItems = ArrayList()
|
||||||
getRecyclerAdapter()?.apply {
|
getRecyclerAdapter()?.apply {
|
||||||
updatePrimaryColor(primaryColor)
|
updatePrimaryColor(primaryColor)
|
||||||
|
@ -58,7 +58,7 @@ class ItemsFragment(context: Context, attributeSet: AttributeSet) : MyViewPagerF
|
||||||
initDrawables()
|
initDrawables()
|
||||||
}
|
}
|
||||||
|
|
||||||
items_fastscroller.updateBubbleColors()
|
items_fastscroller.updateColors(primaryColor, primaryColor.getContrastColor())
|
||||||
|
|
||||||
if (currentPath != "") {
|
if (currentPath != "") {
|
||||||
breadcrumbs.updateColor(textColor)
|
breadcrumbs.updateColor(textColor)
|
||||||
|
@ -124,10 +124,7 @@ class ItemsFragment(context: Context, attributeSet: AttributeSet) : MyViewPagerF
|
||||||
breadcrumbs.updateFontSize(context!!.getTextSize())
|
breadcrumbs.updateFontSize(context!!.getTextSize())
|
||||||
}
|
}
|
||||||
|
|
||||||
ItemsAdapter(
|
ItemsAdapter(activity as SimpleActivity, storedItems, this, items_list, isPickMultipleIntent, items_swipe_refresh) {
|
||||||
activity as SimpleActivity, storedItems, this, items_list, isPickMultipleIntent, items_fastscroller,
|
|
||||||
items_swipe_refresh
|
|
||||||
) {
|
|
||||||
if ((it as? ListItem)?.isSectionTitle == true) {
|
if ((it as? ListItem)?.isSectionTitle == true) {
|
||||||
openDirectory(it.mPath)
|
openDirectory(it.mPath)
|
||||||
searchClosed()
|
searchClosed()
|
||||||
|
@ -143,18 +140,7 @@ class ItemsFragment(context: Context, attributeSet: AttributeSet) : MyViewPagerF
|
||||||
items_list.scheduleLayoutAnimation()
|
items_list.scheduleLayoutAnimation()
|
||||||
}
|
}
|
||||||
|
|
||||||
val dateFormat = context!!.config.dateFormat
|
|
||||||
val timeFormat = context!!.getTimeFormat()
|
|
||||||
items_fastscroller.setViews(items_list, items_swipe_refresh) {
|
|
||||||
val listItem = getRecyclerAdapter()?.listItems?.getOrNull(it)
|
|
||||||
items_fastscroller.updateBubbleText(listItem?.getBubbleText(context, dateFormat, timeFormat) ?: "")
|
|
||||||
}
|
|
||||||
|
|
||||||
getRecyclerLayoutManager().onRestoreInstanceState(scrollStates[currentPath])
|
getRecyclerLayoutManager().onRestoreInstanceState(scrollStates[currentPath])
|
||||||
items_list.onGlobalLayout {
|
|
||||||
items_fastscroller.setScrollToY(items_list.computeVerticalScrollOffset())
|
|
||||||
calculateContentHeight(storedItems)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -162,6 +148,7 @@ class ItemsFragment(context: Context, attributeSet: AttributeSet) : MyViewPagerF
|
||||||
|
|
||||||
private fun getRecyclerLayoutManager() = (items_list.layoutManager as MyGridLayoutManager)
|
private fun getRecyclerLayoutManager() = (items_list.layoutManager as MyGridLayoutManager)
|
||||||
|
|
||||||
|
@SuppressLint("NewApi")
|
||||||
private fun getItems(path: String, callback: (originalPath: String, items: ArrayList<ListItem>) -> Unit) {
|
private fun getItems(path: String, callback: (originalPath: String, items: ArrayList<ListItem>) -> Unit) {
|
||||||
skipItemUpdating = false
|
skipItemUpdating = false
|
||||||
ensureBackgroundThread {
|
ensureBackgroundThread {
|
||||||
|
@ -289,13 +276,13 @@ class ItemsFragment(context: Context, attributeSet: AttributeSet) : MyViewPagerF
|
||||||
|
|
||||||
when {
|
when {
|
||||||
searchText.isEmpty() -> {
|
searchText.isEmpty() -> {
|
||||||
items_list.beVisible()
|
items_fastscroller.beVisible()
|
||||||
getRecyclerAdapter()?.updateItems(storedItems)
|
getRecyclerAdapter()?.updateItems(storedItems)
|
||||||
items_placeholder.beGone()
|
items_placeholder.beGone()
|
||||||
items_placeholder_2.beGone()
|
items_placeholder_2.beGone()
|
||||||
}
|
}
|
||||||
searchText.length == 1 -> {
|
searchText.length == 1 -> {
|
||||||
items_list.beGone()
|
items_fastscroller.beGone()
|
||||||
items_placeholder.beVisible()
|
items_placeholder.beVisible()
|
||||||
items_placeholder_2.beVisible()
|
items_placeholder_2.beVisible()
|
||||||
}
|
}
|
||||||
|
@ -332,14 +319,9 @@ class ItemsFragment(context: Context, attributeSet: AttributeSet) : MyViewPagerF
|
||||||
|
|
||||||
activity?.runOnUiThread {
|
activity?.runOnUiThread {
|
||||||
getRecyclerAdapter()?.updateItems(listItems, text)
|
getRecyclerAdapter()?.updateItems(listItems, text)
|
||||||
items_list.beVisibleIf(listItems.isNotEmpty())
|
items_fastscroller.beVisibleIf(listItems.isNotEmpty())
|
||||||
items_placeholder.beVisibleIf(listItems.isEmpty())
|
items_placeholder.beVisibleIf(listItems.isEmpty())
|
||||||
items_placeholder_2.beGone()
|
items_placeholder_2.beGone()
|
||||||
|
|
||||||
items_list.onGlobalLayout {
|
|
||||||
items_fastscroller.setScrollToY(items_list.computeVerticalScrollOffset())
|
|
||||||
calculateContentHeight(listItems)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -391,13 +373,13 @@ class ItemsFragment(context: Context, attributeSet: AttributeSet) : MyViewPagerF
|
||||||
isSearchOpen = false
|
isSearchOpen = false
|
||||||
if (!skipItemUpdating) {
|
if (!skipItemUpdating) {
|
||||||
getRecyclerAdapter()?.updateItems(storedItems)
|
getRecyclerAdapter()?.updateItems(storedItems)
|
||||||
calculateContentHeight(storedItems)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
skipItemUpdating = false
|
skipItemUpdating = false
|
||||||
lastSearchedText = ""
|
lastSearchedText = ""
|
||||||
|
|
||||||
items_swipe_refresh.isEnabled = true
|
items_swipe_refresh.isEnabled = true
|
||||||
items_list.beVisible()
|
items_fastscroller.beVisible()
|
||||||
items_placeholder.beGone()
|
items_placeholder.beGone()
|
||||||
items_placeholder_2.beGone()
|
items_placeholder_2.beGone()
|
||||||
}
|
}
|
||||||
|
@ -472,14 +454,6 @@ class ItemsFragment(context: Context, attributeSet: AttributeSet) : MyViewPagerF
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun calculateContentHeight(items: MutableList<ListItem>) {
|
|
||||||
val layoutManager = items_list.layoutManager as MyGridLayoutManager
|
|
||||||
val thumbnailHeight = layoutManager.getChildAt(0)?.height ?: 0
|
|
||||||
val fullHeight = ((items.size - 1) / layoutManager.spanCount + 1) * thumbnailHeight
|
|
||||||
items_fastscroller.setContentHeight(fullHeight)
|
|
||||||
items_fastscroller.setScrollToY(items_list.computeVerticalScrollOffset())
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun increaseColumnCount() {
|
override fun increaseColumnCount() {
|
||||||
if (currentViewType == VIEW_TYPE_GRID) {
|
if (currentViewType == VIEW_TYPE_GRID) {
|
||||||
context?.config?.fileColumnCnt = ++(items_list.layoutManager as MyGridLayoutManager).spanCount
|
context?.config?.fileColumnCnt = ++(items_list.layoutManager as MyGridLayoutManager).spanCount
|
||||||
|
@ -498,7 +472,6 @@ class ItemsFragment(context: Context, attributeSet: AttributeSet) : MyViewPagerF
|
||||||
activity?.invalidateOptionsMenu()
|
activity?.invalidateOptionsMenu()
|
||||||
getRecyclerAdapter()?.apply {
|
getRecyclerAdapter()?.apply {
|
||||||
notifyItemRangeChanged(0, listItems.size)
|
notifyItemRangeChanged(0, listItems.size)
|
||||||
calculateContentHeight(listItems)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -55,7 +55,7 @@ class RecentsFragment(context: Context, attributeSet: AttributeSet) : MyViewPage
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
ItemsAdapter(activity as SimpleActivity, recents, this, recents_list, isPickMultipleIntent, null, recents_swipe_refresh) {
|
ItemsAdapter(activity as SimpleActivity, recents, this, recents_list, isPickMultipleIntent, recents_swipe_refresh) {
|
||||||
clickedPath((it as FileDirItem).path)
|
clickedPath((it as FileDirItem).path)
|
||||||
}.apply {
|
}.apply {
|
||||||
recents_list.adapter = this
|
recents_list.adapter = this
|
||||||
|
|
|
@ -35,6 +35,11 @@
|
||||||
android:textStyle="italic"
|
android:textStyle="italic"
|
||||||
android:visibility="gone" />
|
android:visibility="gone" />
|
||||||
|
|
||||||
|
<com.qtalk.recyclerviewfastscroller.RecyclerViewFastScroller
|
||||||
|
android:id="@+id/mimetypes_fastscroller"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
<com.simplemobiletools.commons.views.MyRecyclerView
|
<com.simplemobiletools.commons.views.MyRecyclerView
|
||||||
android:id="@+id/mimetypes_list"
|
android:id="@+id/mimetypes_list"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
@ -45,14 +50,5 @@
|
||||||
android:scrollbars="none"
|
android:scrollbars="none"
|
||||||
app:layoutManager="com.simplemobiletools.commons.views.MyGridLayoutManager" />
|
app:layoutManager="com.simplemobiletools.commons.views.MyGridLayoutManager" />
|
||||||
|
|
||||||
<com.simplemobiletools.commons.views.FastScroller
|
</com.qtalk.recyclerviewfastscroller.RecyclerViewFastScroller>
|
||||||
android:id="@+id/items_fastscroller"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:layout_alignParentEnd="true"
|
|
||||||
android:paddingStart="@dimen/normal_margin">
|
|
||||||
|
|
||||||
<include layout="@layout/fastscroller_handle_vertical" />
|
|
||||||
|
|
||||||
</com.simplemobiletools.commons.views.FastScroller>
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|
|
@ -60,27 +60,22 @@
|
||||||
android:textStyle="italic"
|
android:textStyle="italic"
|
||||||
android:visibility="gone" />
|
android:visibility="gone" />
|
||||||
|
|
||||||
|
<com.qtalk.recyclerviewfastscroller.RecyclerViewFastScroller
|
||||||
|
android:id="@+id/items_fastscroller"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_below="@+id/breadcrumbs">
|
||||||
|
|
||||||
<com.simplemobiletools.commons.views.MyRecyclerView
|
<com.simplemobiletools.commons.views.MyRecyclerView
|
||||||
android:id="@+id/items_list"
|
android:id="@+id/items_list"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_below="@+id/breadcrumbs"
|
|
||||||
android:clipToPadding="false"
|
android:clipToPadding="false"
|
||||||
android:layoutAnimation="@anim/layout_animation"
|
android:layoutAnimation="@anim/layout_animation"
|
||||||
android:scrollbars="none"
|
android:scrollbars="none"
|
||||||
app:layoutManager="com.simplemobiletools.commons.views.MyGridLayoutManager" />
|
app:layoutManager="com.simplemobiletools.commons.views.MyGridLayoutManager" />
|
||||||
|
|
||||||
<com.simplemobiletools.commons.views.FastScroller
|
</com.qtalk.recyclerviewfastscroller.RecyclerViewFastScroller>
|
||||||
android:id="@+id/items_fastscroller"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:layout_below="@+id/breadcrumbs"
|
|
||||||
android:layout_alignParentEnd="true"
|
|
||||||
android:paddingStart="@dimen/normal_margin">
|
|
||||||
|
|
||||||
<include layout="@layout/fastscroller_handle_vertical" />
|
|
||||||
|
|
||||||
</com.simplemobiletools.commons.views.FastScroller>
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
|
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue