forked from hardcoresushi/DroidFS
Toast on file operation success & handle usf_keep_open on CameraActivity
This commit is contained in:
parent
966e78b66f
commit
e783e02398
@ -4,7 +4,7 @@ apply plugin: 'kotlin-android-extensions'
|
|||||||
|
|
||||||
android {
|
android {
|
||||||
compileSdkVersion 29
|
compileSdkVersion 29
|
||||||
buildToolsVersion "30.0.2"
|
buildToolsVersion "30.0.3"
|
||||||
ndkVersion '21.3.6528147'
|
ndkVersion '21.3.6528147'
|
||||||
|
|
||||||
compileOptions {
|
compileOptions {
|
||||||
@ -15,8 +15,8 @@ android {
|
|||||||
applicationId "sushi.hardcore.droidfs"
|
applicationId "sushi.hardcore.droidfs"
|
||||||
minSdkVersion 21
|
minSdkVersion 21
|
||||||
targetSdkVersion 29
|
targetSdkVersion 29
|
||||||
versionCode 7
|
versionCode 8
|
||||||
versionName "1.3.0"
|
versionName "1.4.0"
|
||||||
|
|
||||||
ndk {
|
ndk {
|
||||||
abiFilters 'x86_64', 'armeabi-v7a', 'arm64-v8a'
|
abiFilters 'x86_64', 'armeabi-v7a', 'arm64-v8a'
|
||||||
|
@ -9,6 +9,7 @@ import android.os.Build
|
|||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.text.InputType
|
import android.text.InputType
|
||||||
import android.util.DisplayMetrics
|
import android.util.DisplayMetrics
|
||||||
|
import android.util.Log
|
||||||
import android.util.Size
|
import android.util.Size
|
||||||
import android.view.MotionEvent
|
import android.view.MotionEvent
|
||||||
import android.view.ScaleGestureDetector
|
import android.view.ScaleGestureDetector
|
||||||
@ -55,6 +56,7 @@ class CameraActivity : BaseActivity(), SensorOrientationListener.Listener {
|
|||||||
image_timer.setImageResource(R.drawable.icon_timer_off)
|
image_timer.setImageResource(R.drawable.icon_timer_off)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
private var usf_keep_open = false
|
||||||
private lateinit var sensorOrientationListener: SensorOrientationListener
|
private lateinit var sensorOrientationListener: SensorOrientationListener
|
||||||
private var previousOrientation: Float = 0f
|
private var previousOrientation: Float = 0f
|
||||||
private lateinit var orientedIcons: List<ImageView>
|
private lateinit var orientedIcons: List<ImageView>
|
||||||
@ -69,6 +71,7 @@ class CameraActivity : BaseActivity(), SensorOrientationListener.Listener {
|
|||||||
private var isBackCamera = true
|
private var isBackCamera = true
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
|
usf_keep_open = sharedPrefs.getBoolean("usf_keep_open", false)
|
||||||
setContentView(R.layout.activity_camera)
|
setContentView(R.layout.activity_camera)
|
||||||
gocryptfsVolume = GocryptfsVolume(intent.getIntExtra("sessionID", -1))
|
gocryptfsVolume = GocryptfsVolume(intent.getIntExtra("sessionID", -1))
|
||||||
outputDirectory = intent.getStringExtra("path")!!
|
outputDirectory = intent.getStringExtra("path")!!
|
||||||
@ -319,7 +322,7 @@ class CameraActivity : BaseActivity(), SensorOrientationListener.Listener {
|
|||||||
|
|
||||||
override fun onStop() {
|
override fun onStop() {
|
||||||
super.onStop()
|
super.onStop()
|
||||||
if (!isFinishing){
|
if (!isFinishing && !usf_keep_open){
|
||||||
finish()
|
finish()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -327,7 +330,10 @@ class CameraActivity : BaseActivity(), SensorOrientationListener.Listener {
|
|||||||
override fun onPause() {
|
override fun onPause() {
|
||||||
super.onPause()
|
super.onPause()
|
||||||
sensorOrientationListener.remove(this)
|
sensorOrientationListener.remove(this)
|
||||||
if (ContextCompat.checkSelfPermission(this, Manifest.permission.CAMERA) == PackageManager.PERMISSION_GRANTED){ //if not asking for permission
|
if (
|
||||||
|
(ContextCompat.checkSelfPermission(this, Manifest.permission.CAMERA) == PackageManager.PERMISSION_GRANTED) //not asking for permission
|
||||||
|
&& !usf_keep_open
|
||||||
|
){
|
||||||
finish()
|
finish()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -65,7 +65,6 @@ open class BaseExplorerActivity : BaseActivity() {
|
|||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
usf_open = sharedPrefs.getBoolean("usf_open", false)
|
usf_open = sharedPrefs.getBoolean("usf_open", false)
|
||||||
usf_keep_open = sharedPrefs.getBoolean("usf_keep_open", false)
|
usf_keep_open = sharedPrefs.getBoolean("usf_keep_open", false)
|
||||||
val intent = intent
|
|
||||||
volumeName = intent.getStringExtra("volume_name") ?: ""
|
volumeName = intent.getStringExtra("volume_name") ?: ""
|
||||||
val sessionID = intent.getIntExtra("sessionID", -1)
|
val sessionID = intent.getIntExtra("sessionID", -1)
|
||||||
gocryptfsVolume = GocryptfsVolume(sessionID)
|
gocryptfsVolume = GocryptfsVolume(sessionID)
|
||||||
|
@ -160,11 +160,7 @@ class ExplorerActivity : BaseExplorerActivity() {
|
|||||||
fileOperationService.wipeUris(uris) { errorMsg ->
|
fileOperationService.wipeUris(uris) { errorMsg ->
|
||||||
runOnUiThread {
|
runOnUiThread {
|
||||||
if (errorMsg == null){
|
if (errorMsg == null){
|
||||||
ColoredAlertDialogBuilder(this)
|
Toast.makeText(this, R.string.wipe_successful, Toast.LENGTH_SHORT).show()
|
||||||
.setTitle(R.string.wipe_successful)
|
|
||||||
.setMessage(R.string.wipe_success_msg)
|
|
||||||
.setPositiveButton(R.string.ok, null)
|
|
||||||
.show()
|
|
||||||
} else {
|
} else {
|
||||||
ColoredAlertDialogBuilder(this)
|
ColoredAlertDialogBuilder(this)
|
||||||
.setTitle(R.string.error)
|
.setTitle(R.string.error)
|
||||||
@ -194,11 +190,7 @@ class ExplorerActivity : BaseExplorerActivity() {
|
|||||||
fileOperationService.exportFiles(uri, explorerAdapter.selectedItems.map { i -> explorerElements[i] }){ failedItem ->
|
fileOperationService.exportFiles(uri, explorerAdapter.selectedItems.map { i -> explorerElements[i] }){ failedItem ->
|
||||||
runOnUiThread {
|
runOnUiThread {
|
||||||
if (failedItem == null){
|
if (failedItem == null){
|
||||||
ColoredAlertDialogBuilder(this)
|
Toast.makeText(this, R.string.success_export, Toast.LENGTH_SHORT).show()
|
||||||
.setTitle(R.string.success_export)
|
|
||||||
.setMessage(R.string.success_export_msg)
|
|
||||||
.setPositiveButton(R.string.ok, null)
|
|
||||||
.show()
|
|
||||||
} else {
|
} else {
|
||||||
ColoredAlertDialogBuilder(this)
|
ColoredAlertDialogBuilder(this)
|
||||||
.setTitle(R.string.error)
|
.setTitle(R.string.error)
|
||||||
@ -249,11 +241,7 @@ class ExplorerActivity : BaseExplorerActivity() {
|
|||||||
fileOperationService.copyElements(items, remoteGocryptfsVolume){ failedItem ->
|
fileOperationService.copyElements(items, remoteGocryptfsVolume){ failedItem ->
|
||||||
runOnUiThread {
|
runOnUiThread {
|
||||||
if (failedItem == null){
|
if (failedItem == null){
|
||||||
ColoredAlertDialogBuilder(this)
|
Toast.makeText(this, R.string.success_import, Toast.LENGTH_SHORT).show()
|
||||||
.setTitle(R.string.success_import)
|
|
||||||
.setMessage(R.string.success_import_msg)
|
|
||||||
.setPositiveButton(R.string.ok, null)
|
|
||||||
.show()
|
|
||||||
} else {
|
} else {
|
||||||
ColoredAlertDialogBuilder(this)
|
ColoredAlertDialogBuilder(this)
|
||||||
.setTitle(R.string.error)
|
.setTitle(R.string.error)
|
||||||
@ -344,14 +332,14 @@ class ExplorerActivity : BaseExplorerActivity() {
|
|||||||
items?.let {
|
items?.let {
|
||||||
fileOperationService.copyElements(it.toMutableList() as ArrayList<OperationFile>){ failedItem ->
|
fileOperationService.copyElements(it.toMutableList() as ArrayList<OperationFile>){ failedItem ->
|
||||||
runOnUiThread {
|
runOnUiThread {
|
||||||
if (failedItem != null){
|
if (failedItem == null){
|
||||||
|
Toast.makeText(this, R.string.copy_success, Toast.LENGTH_SHORT).show()
|
||||||
|
} else {
|
||||||
ColoredAlertDialogBuilder(this)
|
ColoredAlertDialogBuilder(this)
|
||||||
.setTitle(R.string.error)
|
.setTitle(R.string.error)
|
||||||
.setMessage(getString(R.string.copy_failed, failedItem))
|
.setMessage(getString(R.string.copy_failed, failedItem))
|
||||||
.setPositiveButton(R.string.ok, null)
|
.setPositiveButton(R.string.ok, null)
|
||||||
.show()
|
.show()
|
||||||
} else {
|
|
||||||
Toast.makeText(this, R.string.copy_success, Toast.LENGTH_SHORT).show()
|
|
||||||
}
|
}
|
||||||
setCurrentPath(currentDirectoryPath)
|
setCurrentPath(currentDirectoryPath)
|
||||||
}
|
}
|
||||||
@ -366,14 +354,14 @@ class ExplorerActivity : BaseExplorerActivity() {
|
|||||||
items?.let {
|
items?.let {
|
||||||
fileOperationService.moveElements(it.toMutableList() as ArrayList<OperationFile>){ failedItem ->
|
fileOperationService.moveElements(it.toMutableList() as ArrayList<OperationFile>){ failedItem ->
|
||||||
runOnUiThread {
|
runOnUiThread {
|
||||||
if (failedItem != null){
|
if (failedItem == null){
|
||||||
|
Toast.makeText(this, R.string.move_success, Toast.LENGTH_SHORT).show()
|
||||||
|
} else {
|
||||||
ColoredAlertDialogBuilder(this)
|
ColoredAlertDialogBuilder(this)
|
||||||
.setTitle(R.string.error)
|
.setTitle(R.string.error)
|
||||||
.setMessage(getString(R.string.move_failed, failedItem))
|
.setMessage(getString(R.string.move_failed, failedItem))
|
||||||
.setPositiveButton(R.string.ok, null)
|
.setPositiveButton(R.string.ok, null)
|
||||||
.show()
|
.show()
|
||||||
} else {
|
|
||||||
Toast.makeText(this, R.string.move_success, Toast.LENGTH_SHORT).show()
|
|
||||||
}
|
}
|
||||||
setCurrentPath(currentDirectoryPath)
|
setCurrentPath(currentDirectoryPath)
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,7 @@ abstract class FileViewerActivity: BaseActivity() {
|
|||||||
lateinit var gocryptfsVolume: GocryptfsVolume
|
lateinit var gocryptfsVolume: GocryptfsVolume
|
||||||
lateinit var filePath: String
|
lateinit var filePath: String
|
||||||
private var isFinishingIntentionally = false
|
private var isFinishingIntentionally = false
|
||||||
protected var usf_keep_open = false
|
private var usf_keep_open = false
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
filePath = intent.getStringExtra("path")!!
|
filePath = intent.getStringExtra("path")!!
|
||||||
|
@ -26,7 +26,6 @@
|
|||||||
<string name="import_failed">Import of %s failed.</string>
|
<string name="import_failed">Import of %s failed.</string>
|
||||||
<string name="export_failed">Export of %s failed.</string>
|
<string name="export_failed">Export of %s failed.</string>
|
||||||
<string name="success_export">Export successful !</string>
|
<string name="success_export">Export successful !</string>
|
||||||
<string name="success_export_msg">The selected files have been successfully exported.</string>
|
|
||||||
<string name="remove_failed">Deletion of %s failed.</string>
|
<string name="remove_failed">Deletion of %s failed.</string>
|
||||||
<string name="passwords_mismatch">Passwords don\'t match</string>
|
<string name="passwords_mismatch">Passwords don\'t match</string>
|
||||||
<string name="dir_not_empty">The selected directory isn\'t empty</string>
|
<string name="dir_not_empty">The selected directory isn\'t empty</string>
|
||||||
@ -57,7 +56,6 @@
|
|||||||
<string name="ask_for_wipe">Do you want to wipe the original files ?</string>
|
<string name="ask_for_wipe">Do you want to wipe the original files ?</string>
|
||||||
<string name="wipe_failed">Wiping failed: %s</string>
|
<string name="wipe_failed">Wiping failed: %s</string>
|
||||||
<string name="wipe_successful">Files successfully wiped !</string>
|
<string name="wipe_successful">Files successfully wiped !</string>
|
||||||
<string name="wipe_success_msg">The imported files have been successfully wiped from their original locations.</string>
|
|
||||||
<string name="create_password_warning">Warning !\nThis password will be the only way to decrypt the volume and access the files inside.\nChoose a very strong password (not \"123456\" or \"password\"), do not lose it and keep it secure (preferably only in your mind).\n\nDroidFS cannot protect you from screen recording apps, keyloggers, apk backdooring, compromised root accesses, memory dumps etc.\nDo not type passwords in insecure environments.</string>
|
<string name="create_password_warning">Warning !\nThis password will be the only way to decrypt the volume and access the files inside.\nChoose a very strong password (not \"123456\" or \"password\"), do not lose it and keep it secure (preferably only in your mind).\n\nDroidFS cannot protect you from screen recording apps, keyloggers, apk backdooring, compromised root accesses, memory dumps etc.\nDo not type passwords in insecure environments.</string>
|
||||||
<string name="open_activity_warning">Warning !\nOpening volumes in insecure environments can lead to data leaks.\nDroidFS cannot protect you from screen recording apps, keyloggers, apk backdooring, compromised root accesses, memory dumps etc.\nDo not open volumes containing sensitive data unless you know exactly what you are doing.</string>
|
<string name="open_activity_warning">Warning !\nOpening volumes in insecure environments can lead to data leaks.\nDroidFS cannot protect you from screen recording apps, keyloggers, apk backdooring, compromised root accesses, memory dumps etc.\nDo not open volumes containing sensitive data unless you know exactly what you are doing.</string>
|
||||||
<string name="rename">Rename</string>
|
<string name="rename">Rename</string>
|
||||||
|
Loading…
Reference in New Issue
Block a user