Skip to content
Snippets Groups Projects
Commit 58ee51ad authored by John's avatar John
Browse files

Merge branch 'master' into 'master'

Save currentPath state

Closes #159

See merge request Commit451/LabCoat!34
parents 62c0e1bd e3dbb5dd
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