forked from hardcoresushi/DroidFS
Update libgocryptfs & Small UX fix
This commit is contained in:
parent
e2248220c4
commit
8aa2be2b05
@ -15,8 +15,8 @@ android {
|
|||||||
minSdkVersion 21
|
minSdkVersion 21
|
||||||
//noinspection ExpiredTargetSdkVersion
|
//noinspection ExpiredTargetSdkVersion
|
||||||
targetSdkVersion 29
|
targetSdkVersion 29
|
||||||
versionCode 26
|
versionCode 27
|
||||||
versionName "1.10.0"
|
versionName "1.10.1"
|
||||||
|
|
||||||
ndk {
|
ndk {
|
||||||
abiFilters "x86", "x86_64", "armeabi-v7a", "arm64-v8a"
|
abiFilters "x86", "x86_64", "armeabi-v7a", "arm64-v8a"
|
||||||
|
@ -1 +1 @@
|
|||||||
Subproject commit 985d8523434814cd9cba61b666a1f888bdcbaded
|
Subproject commit 9e98192442b08362660b45f4e2e50221ba7bc65b
|
@ -141,32 +141,28 @@ class GocryptfsVolume(val applicationContext: Context, var sessionID: Int) {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
fun importFile(inputStream: InputStream, handleID: Int): Boolean {
|
|
||||||
var offset: Long = 0
|
|
||||||
val ioBuffer = ByteArray(DefaultBS)
|
|
||||||
var length: Int
|
|
||||||
while (inputStream.read(ioBuffer).also { length = it } > 0) {
|
|
||||||
val written = writeFile(handleID, offset, ioBuffer, length).toLong()
|
|
||||||
if (written == length.toLong()) {
|
|
||||||
offset += written
|
|
||||||
} else {
|
|
||||||
inputStream.close()
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
closeFile(handleID)
|
|
||||||
inputStream.close()
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
fun importFile(inputStream: InputStream, dst_path: String): Boolean {
|
fun importFile(inputStream: InputStream, dst_path: String): Boolean {
|
||||||
var success = false
|
|
||||||
val dstHandleId = openWriteMode(dst_path)
|
val dstHandleId = openWriteMode(dst_path)
|
||||||
if (dstHandleId != -1) {
|
if (dstHandleId != -1) {
|
||||||
success = importFile(inputStream, dstHandleId)
|
var success = true
|
||||||
|
var offset: Long = 0
|
||||||
|
val ioBuffer = ByteArray(DefaultBS)
|
||||||
|
var length: Int
|
||||||
|
while (inputStream.read(ioBuffer).also { length = it } > 0) {
|
||||||
|
val written = writeFile(dstHandleId, offset, ioBuffer, length).toLong()
|
||||||
|
if (written == length.toLong()) {
|
||||||
|
offset += written
|
||||||
|
} else {
|
||||||
|
inputStream.close()
|
||||||
|
success = false
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
closeFile(dstHandleId)
|
closeFile(dstHandleId)
|
||||||
|
inputStream.close()
|
||||||
|
return success
|
||||||
}
|
}
|
||||||
return success
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
fun importFile(context: Context, src_uri: Uri, dst_path: String): Boolean {
|
fun importFile(context: Context, src_uri: Uri, dst_path: String): Boolean {
|
||||||
|
@ -594,8 +594,7 @@ class MainActivity : BaseActivity(), VolumeAdapter.Listener {
|
|||||||
CustomAlertDialogBuilder(this, themeValue)
|
CustomAlertDialogBuilder(this, themeValue)
|
||||||
.setTitle(R.string.open_volume_failed)
|
.setTitle(R.string.open_volume_failed)
|
||||||
.setMessage(R.string.open_volume_failed_msg)
|
.setMessage(R.string.open_volume_failed_msg)
|
||||||
.setPositiveButton(R.string.ok, null)
|
.setPositiveButton(R.string.ok) { _, _ ->
|
||||||
.setOnDismissListener {
|
|
||||||
askForPassword(volume, position, savePasswordHash)
|
askForPassword(volume, position, savePasswordHash)
|
||||||
}
|
}
|
||||||
.show()
|
.show()
|
||||||
|
Loading…
Reference in New Issue
Block a user