fix #120, reopen the proper folder after rotating the device

This commit is contained in:
tibbi 2017-11-09 22:10:02 +01:00
parent d3b5a3b2fd
commit 0680762e3f
2 changed files with 17 additions and 1 deletions

View File

@ -44,7 +44,9 @@ class MainActivity : SimpleActivity() {
isPickMultipleIntent = intent.getBooleanExtra(Intent.EXTRA_ALLOW_MULTIPLE, false)
}
tryInitFileManager()
if (savedInstanceState == null) {
tryInitFileManager()
}
checkWhatsNewDialog()
checkIfRootAvailable()
storeStateVariables()

View File

@ -22,6 +22,7 @@ import com.simplemobiletools.filemanager.dialogs.CreateNewItemDialog
import com.simplemobiletools.filemanager.extensions.config
import com.simplemobiletools.filemanager.extensions.isPathOnRoot
import com.simplemobiletools.filemanager.extensions.openFile
import com.simplemobiletools.filemanager.helpers.PATH
import com.simplemobiletools.filemanager.helpers.RootHelpers
import com.stericson.RootTools.RootTools
import kotlinx.android.synthetic.main.items_fragment.*
@ -58,6 +59,19 @@ class ItemsFragment : Fragment(), ItemsAdapter.ItemOperationsListener, Breadcrum
}
}
override fun onSaveInstanceState(outState: Bundle) {
outState.putString(PATH, currentPath)
super.onSaveInstanceState(outState)
}
override fun onViewStateRestored(savedInstanceState: Bundle?) {
super.onViewStateRestored(savedInstanceState)
if (savedInstanceState != null) {
currentPath = savedInstanceState.getString(PATH)
storedItems.clear()
}
}
override fun onResume() {
super.onResume()
context!!.updateTextColors(mView as ViewGroup)