forked from hardcoresushi/DroidFS
Don't close volume just after creating it
This commit is contained in:
parent
d570d9b0ef
commit
e92804ae34
@ -198,7 +198,7 @@ class CameraActivity : BaseActivity(), SensorOrientationListener.Listener {
|
|||||||
if (gocryptfsVolume.importFile(ByteArrayInputStream(outputBuff.toByteArray()), PathUtils.pathJoin(outputDirectory, fileName))){
|
if (gocryptfsVolume.importFile(ByteArrayInputStream(outputBuff.toByteArray()), PathUtils.pathJoin(outputDirectory, fileName))){
|
||||||
Toast.makeText(applicationContext, getString(R.string.picture_save_success, fileName), Toast.LENGTH_SHORT).show()
|
Toast.makeText(applicationContext, getString(R.string.picture_save_success, fileName), Toast.LENGTH_SHORT).show()
|
||||||
} else {
|
} else {
|
||||||
ColoredAlertDialogBuilder(applicationContext)
|
ColoredAlertDialogBuilder(this@CameraActivity)
|
||||||
.setTitle(R.string.error)
|
.setTitle(R.string.error)
|
||||||
.setMessage(R.string.picture_save_failed)
|
.setMessage(R.string.picture_save_failed)
|
||||||
.setCancelable(false)
|
.setCancelable(false)
|
||||||
|
@ -21,6 +21,7 @@ class CreateActivity : VolumeActionActivity() {
|
|||||||
private const val PICK_DIRECTORY_REQUEST_CODE = 1
|
private const val PICK_DIRECTORY_REQUEST_CODE = 1
|
||||||
}
|
}
|
||||||
private var sessionID = -1
|
private var sessionID = -1
|
||||||
|
private var isStartingExplorer = false
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
setContentView(R.layout.activity_create)
|
setContentView(R.layout.activity_create)
|
||||||
@ -129,7 +130,7 @@ class CreateActivity : VolumeActionActivity() {
|
|||||||
sessionID = GocryptfsVolume.init(currentVolumePath, password, null, returnedHash)
|
sessionID = GocryptfsVolume.init(currentVolumePath, password, null, returnedHash)
|
||||||
if (sessionID != -1) {
|
if (sessionID != -1) {
|
||||||
if (checkbox_remember_path.isChecked) {
|
if (checkbox_remember_path.isChecked) {
|
||||||
if (volumeDatabase.isVolumeSaved(currentVolumeName)) {
|
if (volumeDatabase.isVolumeSaved(currentVolumeName)) { //cleaning old saved path
|
||||||
volumeDatabase.removeVolume(Volume(currentVolumeName))
|
volumeDatabase.removeVolume(Volume(currentVolumeName))
|
||||||
}
|
}
|
||||||
volumeDatabase.saveVolume(Volume(currentVolumeName, switch_hidden_volume.isChecked))
|
volumeDatabase.saveVolume(Volume(currentVolumeName, switch_hidden_volume.isChecked))
|
||||||
@ -172,17 +173,18 @@ class CreateActivity : VolumeActionActivity() {
|
|||||||
.setMessage(R.string.success_volume_create_msg)
|
.setMessage(R.string.success_volume_create_msg)
|
||||||
.setCancelable(false)
|
.setCancelable(false)
|
||||||
.setPositiveButton(R.string.ok) { _, _ ->
|
.setPositiveButton(R.string.ok) { _, _ ->
|
||||||
val intent = Intent(applicationContext, ExplorerActivity::class.java)
|
val intent = Intent(this, ExplorerActivity::class.java)
|
||||||
intent.putExtra("sessionID", sessionID)
|
intent.putExtra("sessionID", sessionID)
|
||||||
intent.putExtra("volume_name", File(currentVolumeName).name)
|
intent.putExtra("volume_name", File(currentVolumeName).name)
|
||||||
startActivity(intent)
|
startActivity(intent)
|
||||||
|
isStartingExplorer = true
|
||||||
finish()
|
finish()
|
||||||
}
|
}
|
||||||
.show()
|
.show()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun onClickRememberPath(view: View) {
|
fun onClickRememberPath(view: View) {
|
||||||
if (!checkbox_remember_path.isChecked){
|
if (!checkbox_remember_path.isChecked) {
|
||||||
checkbox_save_password.isChecked = false
|
checkbox_save_password.isChecked = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -190,7 +192,7 @@ class CreateActivity : VolumeActionActivity() {
|
|||||||
override fun onPause() {
|
override fun onPause() {
|
||||||
super.onPause()
|
super.onPause()
|
||||||
//Closing volume if leaving activity while showing dialog
|
//Closing volume if leaving activity while showing dialog
|
||||||
if (sessionID != -1){
|
if (sessionID != -1 && !isStartingExplorer) {
|
||||||
GocryptfsVolume(sessionID).close()
|
GocryptfsVolume(sessionID).close()
|
||||||
finish()
|
finish()
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user