use MyScalableRecyclerView from Commons
This commit is contained in:
parent
9d17c5a568
commit
c079bbb699
|
@ -32,7 +32,7 @@ android {
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile 'com.simplemobiletools:commons:2.21.4'
|
compile 'com.simplemobiletools:commons:2.21.7'
|
||||||
compile 'com.bignerdranch.android:recyclerview-multiselect:0.2'
|
compile 'com.bignerdranch.android:recyclerview-multiselect:0.2'
|
||||||
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,7 @@ import android.content.Intent
|
||||||
import android.net.Uri
|
import android.net.Uri
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.os.Parcelable
|
import android.os.Parcelable
|
||||||
|
import android.support.v4.app.Fragment
|
||||||
import android.support.v7.widget.LinearLayoutManager
|
import android.support.v7.widget.LinearLayoutManager
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
|
@ -13,7 +14,6 @@ import android.webkit.MimeTypeMap
|
||||||
import com.simplemobiletools.commons.extensions.*
|
import com.simplemobiletools.commons.extensions.*
|
||||||
import com.simplemobiletools.commons.models.FileDirItem
|
import com.simplemobiletools.commons.models.FileDirItem
|
||||||
import com.simplemobiletools.commons.views.RecyclerViewDivider
|
import com.simplemobiletools.commons.views.RecyclerViewDivider
|
||||||
import com.simplemobiletools.filemanager.Config
|
|
||||||
import com.simplemobiletools.filemanager.PATH
|
import com.simplemobiletools.filemanager.PATH
|
||||||
import com.simplemobiletools.filemanager.R
|
import com.simplemobiletools.filemanager.R
|
||||||
import com.simplemobiletools.filemanager.SCROLL_STATE
|
import com.simplemobiletools.filemanager.SCROLL_STATE
|
||||||
|
@ -26,15 +26,14 @@ import kotlinx.android.synthetic.main.items_fragment.view.*
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
|
||||||
class ItemsFragment : android.support.v4.app.Fragment(), ItemsAdapter.ItemOperationsListener {
|
class ItemsFragment : Fragment(), ItemsAdapter.ItemOperationsListener {
|
||||||
private var mListener: ItemInteractionListener? = null
|
private var mListener: ItemInteractionListener? = null
|
||||||
private var mStoredTextColor = 0
|
private var mStoredTextColor = 0
|
||||||
|
private var mShowHidden = false
|
||||||
|
private var mItems = ArrayList<FileDirItem>()
|
||||||
|
|
||||||
lateinit var mItems: ArrayList<FileDirItem>
|
|
||||||
lateinit var mConfig: Config
|
|
||||||
lateinit var fragmentView: View
|
lateinit var fragmentView: View
|
||||||
|
|
||||||
private var mShowHidden = false
|
|
||||||
var mPath = ""
|
var mPath = ""
|
||||||
|
|
||||||
override fun onCreateView(inflater: LayoutInflater?, container: ViewGroup?, savedInstanceState: Bundle?): View {
|
override fun onCreateView(inflater: LayoutInflater?, container: ViewGroup?, savedInstanceState: Bundle?): View {
|
||||||
|
@ -44,9 +43,7 @@ class ItemsFragment : android.support.v4.app.Fragment(), ItemsAdapter.ItemOperat
|
||||||
|
|
||||||
override fun onViewCreated(view: View?, savedInstanceState: Bundle?) {
|
override fun onViewCreated(view: View?, savedInstanceState: Bundle?) {
|
||||||
super.onViewCreated(view, savedInstanceState)
|
super.onViewCreated(view, savedInstanceState)
|
||||||
mConfig = context.config
|
mShowHidden = context.config.showHidden
|
||||||
mShowHidden = mConfig.showHidden
|
|
||||||
mItems = ArrayList<FileDirItem>()
|
|
||||||
fillItems()
|
fillItems()
|
||||||
|
|
||||||
items_swipe_refresh.setOnRefreshListener({ fillItems() })
|
items_swipe_refresh.setOnRefreshListener({ fillItems() })
|
||||||
|
@ -55,15 +52,16 @@ class ItemsFragment : android.support.v4.app.Fragment(), ItemsAdapter.ItemOperat
|
||||||
|
|
||||||
override fun onResume() {
|
override fun onResume() {
|
||||||
super.onResume()
|
super.onResume()
|
||||||
if (mShowHidden != mConfig.showHidden) {
|
val config = context.config
|
||||||
|
if (mShowHidden != config.showHidden) {
|
||||||
mShowHidden = !mShowHidden
|
mShowHidden = !mShowHidden
|
||||||
fillItems()
|
fillItems()
|
||||||
}
|
}
|
||||||
context.updateTextColors(items_holder)
|
context.updateTextColors(items_holder)
|
||||||
if (mStoredTextColor != context.config.textColor) {
|
if (mStoredTextColor != config.textColor) {
|
||||||
mItems = ArrayList<FileDirItem>()
|
mItems = ArrayList<FileDirItem>()
|
||||||
fillItems()
|
fillItems()
|
||||||
mStoredTextColor = context.config.textColor
|
mStoredTextColor = config.textColor
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -76,7 +74,7 @@ class ItemsFragment : android.support.v4.app.Fragment(), ItemsAdapter.ItemOperat
|
||||||
mPath = arguments.getString(PATH)
|
mPath = arguments.getString(PATH)
|
||||||
getItems(mPath) {
|
getItems(mPath) {
|
||||||
val newItems = it
|
val newItems = it
|
||||||
FileDirItem.sorting = mConfig.getFolderSorting(mPath)
|
FileDirItem.sorting = context.config.getFolderSorting(mPath)
|
||||||
newItems.sort()
|
newItems.sort()
|
||||||
|
|
||||||
fragmentView.apply {
|
fragmentView.apply {
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content">
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
<android.support.v7.widget.RecyclerView
|
<com.simplemobiletools.commons.views.MyScalableRecyclerView
|
||||||
android:id="@+id/items_list"
|
android:id="@+id/items_list"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
|
Loading…
Reference in New Issue