diff options
Diffstat (limited to 'app/src')
| -rw-r--r-- | app/src/main/java/invalid/lena/rsend/FolderPickerActivity.kt | 15 | ||||
| -rw-r--r-- | app/src/main/java/invalid/lena/rsend/RemoteActivity.kt | 1 |
2 files changed, 11 insertions, 5 deletions
diff --git a/app/src/main/java/invalid/lena/rsend/FolderPickerActivity.kt b/app/src/main/java/invalid/lena/rsend/FolderPickerActivity.kt index 0e403e0..b81ce22 100644 --- a/app/src/main/java/invalid/lena/rsend/FolderPickerActivity.kt +++ b/app/src/main/java/invalid/lena/rsend/FolderPickerActivity.kt @@ -40,10 +40,12 @@ class FolderPickerActivity : AppCompatActivity() { root = (getSystemService(StorageManager::class.java).primaryStorageVolume.directory ?: Environment.getExternalStorageDirectory()).canonicalFile - // Start where the field already points, if that is a directory under the - // root; otherwise at the root itself. - val start = intent.getStringExtra("start")?.let { safeDirectory(File(it)) } - current = start ?: root + // Start where the field already points, or where browsing had reached + // before a configuration change, if that is a directory under the root; + // otherwise at the root itself. Restored paths go through the same check + // as typed ones. + val start = savedInstanceState?.getString("current") ?: intent.getStringExtra("start") + current = start?.let { safeDirectory(File(it)) } ?: root use = findViewById(R.id.use) use.setOnClickListener { @@ -66,6 +68,11 @@ class FolderPickerActivity : AppCompatActivity() { render() } + override fun onSaveInstanceState(outState: Bundle) { + outState.putString("current", current.absolutePath) + super.onSaveInstanceState(outState) + } + private fun render() { pathView.text = current.absolutePath list.removeAllViews() diff --git a/app/src/main/java/invalid/lena/rsend/RemoteActivity.kt b/app/src/main/java/invalid/lena/rsend/RemoteActivity.kt index 83f499d..b0a94a0 100644 --- a/app/src/main/java/invalid/lena/rsend/RemoteActivity.kt +++ b/app/src/main/java/invalid/lena/rsend/RemoteActivity.kt @@ -235,7 +235,6 @@ class RemoteActivity : AppCompatActivity() { val at = save(r.copy(hostKey = line)) if (at < 0) return index = at - intent.putExtra("index", at) status.text = "Host key pinned. Connection OK." } |