Skip to content
Snippets Groups Projects
Commit e3dbb5dd authored by Dani Mahardhika's avatar Dani Mahardhika
Browse files

Save currentPath state

parent 62c0e1bd
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -37,6 +37,8 @@ class FilesFragment : ButterKnifeFragment() {
 
companion object {
 
private const val CURRENT_PATH = "current_path"
fun newInstance(): FilesFragment {
return FilesFragment()
}
Loading
Loading
@@ -102,10 +104,15 @@ class FilesFragment : ButterKnifeFragment() {
 
swipeRefreshLayout.setOnRefreshListener { loadData() }
 
var path = ""
if (savedInstanceState != null) {
path = savedInstanceState.getString(CURRENT_PATH)
}
if (activity is ProjectActivity) {
project = (activity as ProjectActivity).project
ref = (activity as ProjectActivity).getRefRef()
loadData("")
loadData(path)
} else {
throw IllegalStateException("Incorrect parent activity")
}
Loading
Loading
@@ -113,6 +120,11 @@ class FilesFragment : ButterKnifeFragment() {
App.bus().register(this)
}
 
override fun onSaveInstanceState(outState: Bundle) {
outState.putString(CURRENT_PATH, currentPath)
super.onSaveInstanceState(outState)
}
override fun onBackPressed(): Boolean {
if (adapterBreadcrumb.itemCount > 1) {
val breadcrumb = adapterBreadcrumb.getValueAt(adapterBreadcrumb.itemCount - 2)
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment