diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index f5ebeb9..a7ad0da 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -16,7 +16,6 @@
android:theme="@style/AppTheme">
@@ -24,7 +23,6 @@
@@ -36,11 +34,9 @@
= Build.VERSION_CODES.M) {
diff --git a/app/src/main/java/sushi/hardcore/droidfs/OpenActivity.kt b/app/src/main/java/sushi/hardcore/droidfs/OpenActivity.kt
index a06bc6c..51c2bff 100644
--- a/app/src/main/java/sushi/hardcore/droidfs/OpenActivity.kt
+++ b/app/src/main/java/sushi/hardcore/droidfs/OpenActivity.kt
@@ -8,8 +8,6 @@ import android.view.View
import android.view.WindowManager
import android.widget.AdapterView.OnItemClickListener
import android.widget.Toast
-import kotlinx.android.synthetic.main.activity_change_password.*
-import kotlinx.android.synthetic.main.activity_open.*
import kotlinx.android.synthetic.main.activity_open.checkbox_remember_path
import kotlinx.android.synthetic.main.activity_open.checkbox_save_password
import kotlinx.android.synthetic.main.activity_open.edit_password
@@ -29,7 +27,7 @@ import sushi.hardcore.droidfs.widgets.ColoredAlertDialog
import java.io.File
import java.util.*
-class OpenActivity : ColoredActivity() {
+class OpenActivity : BaseActivity() {
companion object {
private const val PICK_DIRECTORY_REQUEST_CODE = 1
}
@@ -40,12 +38,8 @@ class OpenActivity : ColoredActivity() {
private var usf_fingerprint = false
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
- if (!sharedPrefs.getBoolean("usf_screenshot", false)){
- window.setFlags(WindowManager.LayoutParams.FLAG_SECURE, WindowManager.LayoutParams.FLAG_SECURE)
- }
setContentView(R.layout.activity_open)
setSupportActionBar(toolbar)
- //val sharedPrefs = PreferenceManager.getDefaultSharedPreferences(this)
usf_fingerprint = sharedPrefs.getBoolean("usf_fingerprint", false)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && usf_fingerprint) {
fingerprintPasswordHashSaver = FingerprintPasswordHashSaver(this, sharedPrefs)
@@ -72,7 +66,7 @@ class OpenActivity : ColoredActivity() {
}
}
- fun pick_directory(view: View?) {
+ fun pickDirectory(view: View?) {
val i = Intent(Intent.ACTION_OPEN_DOCUMENT_TREE)
startActivityForResult(i, PICK_DIRECTORY_REQUEST_CODE)
}
diff --git a/app/src/main/java/sushi/hardcore/droidfs/SettingsActivity.kt b/app/src/main/java/sushi/hardcore/droidfs/SettingsActivity.kt
index a1afe71..dd308d6 100644
--- a/app/src/main/java/sushi/hardcore/droidfs/SettingsActivity.kt
+++ b/app/src/main/java/sushi/hardcore/droidfs/SettingsActivity.kt
@@ -1,19 +1,17 @@
package sushi.hardcore.droidfs
import android.os.Bundle
-import android.view.WindowManager
import androidx.fragment.app.Fragment
import androidx.preference.Preference
import androidx.preference.PreferenceFragmentCompat
import kotlinx.android.synthetic.main.toolbar.*
+import sushi.hardcore.droidfs.widgets.ThemeColor
-class SettingsActivity : ColoredActivity(), PreferenceFragmentCompat.OnPreferenceStartFragmentCallback {
+
+class SettingsActivity : BaseActivity(), PreferenceFragmentCompat.OnPreferenceStartFragmentCallback {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
- if (!sharedPrefs.getBoolean("usf_screenshot", false)){
- window.setFlags(WindowManager.LayoutParams.FLAG_SECURE, WindowManager.LayoutParams.FLAG_SECURE)
- }
setContentView(R.layout.activity_settings)
setSupportActionBar(toolbar)
supportActionBar?.setDisplayHomeAsUpEnabled(true)
@@ -33,12 +31,14 @@ class SettingsActivity : ColoredActivity(), PreferenceFragmentCompat.OnPreferenc
class SettingsFragment : PreferenceFragmentCompat() {
override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
setPreferencesFromResource(R.xml.root_preferences, rootKey)
+ ThemeColor.tintPreferenceIcons(preferenceScreen, ThemeColor.getThemeColor(requireContext()))
}
}
class UnsafeFeaturesSettingsFragment : PreferenceFragmentCompat() {
override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
setPreferencesFromResource(R.xml.unsafe_features_preferences, rootKey)
+ ThemeColor.tintPreferenceIcons(preferenceScreen, ThemeColor.getThemeColor(requireContext()))
}
}
diff --git a/app/src/main/java/sushi/hardcore/droidfs/explorers/BaseExplorerActivity.kt b/app/src/main/java/sushi/hardcore/droidfs/explorers/BaseExplorerActivity.kt
index 85b61a8..0cfe35e 100644
--- a/app/src/main/java/sushi/hardcore/droidfs/explorers/BaseExplorerActivity.kt
+++ b/app/src/main/java/sushi/hardcore/droidfs/explorers/BaseExplorerActivity.kt
@@ -16,7 +16,7 @@ import com.github.clans.fab.FloatingActionMenu
import kotlinx.android.synthetic.main.activity_explorer_base.*
import kotlinx.android.synthetic.main.explorer_info_bar.*
import kotlinx.android.synthetic.main.toolbar.*
-import sushi.hardcore.droidfs.ColoredActivity
+import sushi.hardcore.droidfs.BaseActivity
import sushi.hardcore.droidfs.ConstValues
import sushi.hardcore.droidfs.ConstValues.Companion.isAudio
import sushi.hardcore.droidfs.ConstValues.Companion.isImage
@@ -36,7 +36,7 @@ import sushi.hardcore.droidfs.util.GocryptfsVolume
import sushi.hardcore.droidfs.widgets.ColoredAlertDialog
import java.util.*
-open class BaseExplorerActivity : ColoredActivity() {
+open class BaseExplorerActivity : BaseActivity() {
private lateinit var shared_prefs_editor: SharedPreferences.Editor
private lateinit var sort_modes_entries: Array
private lateinit var sort_modes_values: Array
@@ -49,9 +49,6 @@ open class BaseExplorerActivity : ColoredActivity() {
private var usf_open = false
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
- if (!sharedPrefs.getBoolean("usf_screenshot", false)){
- window.setFlags(WindowManager.LayoutParams.FLAG_SECURE, WindowManager.LayoutParams.FLAG_SECURE)
- }
usf_open = sharedPrefs.getBoolean("usf_open", false)
val intent = intent
volume_name = intent.getStringExtra("volume_name") ?: ""
diff --git a/app/src/main/java/sushi/hardcore/droidfs/explorers/ExplorerActivity.kt b/app/src/main/java/sushi/hardcore/droidfs/explorers/ExplorerActivity.kt
index 0df9ca1..cad7990 100644
--- a/app/src/main/java/sushi/hardcore/droidfs/explorers/ExplorerActivity.kt
+++ b/app/src/main/java/sushi/hardcore/droidfs/explorers/ExplorerActivity.kt
@@ -77,7 +77,7 @@ class ExplorerActivity : BaseExplorerActivity() {
fun onClickAddFile(view: View?) {
fam_explorer.close(true)
- val i = Intent(Intent.ACTION_OPEN_DOCUMENT)
+ val i = Intent(Intent.ACTION_GET_CONTENT)
i.type = "*/*"
i.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, true)
i.addCategory(Intent.CATEGORY_OPENABLE)
@@ -96,24 +96,23 @@ class ExplorerActivity : BaseExplorerActivity() {
if (requestCode == PICK_FILES_REQUEST_CODE) {
if (resultCode == Activity.RESULT_OK && data != null) {
val uris: MutableList = ArrayList()
- val single_uri = data.data
- if (single_uri == null) { //multiples choices
- val clipdata = data.clipData
- if (clipdata != null){
- for (i in 0 until clipdata.itemCount) {
- uris.add(clipdata.getItemAt(i).uri)
+ val singleUri = data.data
+ if (singleUri == null) { //multiples choices
+ val clipData = data.clipData
+ if (clipData != null){
+ for (i in 0 until clipData.itemCount) {
+ uris.add(clipData.getItemAt(i).uri)
}
}
} else {
- uris.add(single_uri)
+ uris.add(singleUri)
}
if (uris.isNotEmpty()){
var success = true
for (uri in uris) {
- val dst_path = FilesUtils.path_join(current_path, FilesUtils.getFilenameFromURI(this, uri))
- var `is` = contentResolver.openInputStream(uri)
- if (`is` != null) {
- success = gocryptfsVolume.import_file(`is`, dst_path)
+ val dstPath = FilesUtils.path_join(current_path, FilesUtils.getFilenameFromURI(this, uri))
+ contentResolver.openInputStream(uri)?.let {
+ success = gocryptfsVolume.import_file(it, dstPath)
}
if (!success) {
ColoredAlertDialog(this)
diff --git a/app/src/main/java/sushi/hardcore/droidfs/file_viewers/FileViewerActivity.kt b/app/src/main/java/sushi/hardcore/droidfs/file_viewers/FileViewerActivity.kt
index 39428c9..c5876d8 100644
--- a/app/src/main/java/sushi/hardcore/droidfs/file_viewers/FileViewerActivity.kt
+++ b/app/src/main/java/sushi/hardcore/droidfs/file_viewers/FileViewerActivity.kt
@@ -5,7 +5,7 @@ import android.os.Bundle
import android.view.View
import android.view.WindowManager
import androidx.preference.PreferenceManager
-import sushi.hardcore.droidfs.ColoredActivity
+import sushi.hardcore.droidfs.BaseActivity
import sushi.hardcore.droidfs.R
import sushi.hardcore.droidfs.provider.TemporaryFileProvider
import sushi.hardcore.droidfs.util.GocryptfsVolume
@@ -14,16 +14,12 @@ import sushi.hardcore.droidfs.widgets.ColoredAlertDialog
import java.io.File
import java.util.ArrayList
-abstract class FileViewerActivity: ColoredActivity() {
+abstract class FileViewerActivity: BaseActivity() {
private var cachedFiles: MutableList = ArrayList()
lateinit var gocryptfsVolume: GocryptfsVolume
lateinit var filePath: String
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
- val sharedPrefs = PreferenceManager.getDefaultSharedPreferences(this)
- if (!sharedPrefs.getBoolean("usf_screenshot", false)){
- window.setFlags(WindowManager.LayoutParams.FLAG_SECURE, WindowManager.LayoutParams.FLAG_SECURE)
- }
filePath = intent.getStringExtra("path")!!
val sessionID = intent.getIntExtra("sessionID", -1)
gocryptfsVolume = GocryptfsVolume(sessionID)
diff --git a/app/src/main/java/sushi/hardcore/droidfs/util/GocryptfsVolume.kt b/app/src/main/java/sushi/hardcore/droidfs/util/GocryptfsVolume.kt
index a1a8026..d8e6271 100644
--- a/app/src/main/java/sushi/hardcore/droidfs/util/GocryptfsVolume.kt
+++ b/app/src/main/java/sushi/hardcore/droidfs/util/GocryptfsVolume.kt
@@ -126,38 +126,38 @@ class GocryptfsVolume(var sessionID: Int) {
return false
}
- fun import_file(`is`: InputStream, handleID: Int): Boolean {
+ fun import_file(inputStream: InputStream, handleID: Int): Boolean {
var offset: Long = 0
val io_buffer = ByteArray(DefaultBS)
var length: Int
- while (`is`.read(io_buffer).also { length = it } > 0) {
+ while (inputStream.read(io_buffer).also { length = it } > 0) {
val written = native_write_file(sessionID, handleID, offset, io_buffer, length).toLong()
if (written == length.toLong()) {
offset += written
} else {
- `is`.close()
+ inputStream.close()
return false
}
}
native_close_file(sessionID, handleID)
- `is`.close()
+ inputStream.close()
return true
}
- fun import_file(`is`: InputStream, dst_path: String): Boolean {
+ fun import_file(inputStream: InputStream, dst_path: String): Boolean {
var success = false
val dst_handleID = open_write_mode(dst_path)
if (dst_handleID != -1) {
- success = import_file(`is`, dst_handleID)
+ success = import_file(inputStream, dst_handleID)
close_file(dst_handleID)
}
return success
}
fun import_file(context: Context, src_uri: Uri, dst_path: String): Boolean {
- val `is` = context.contentResolver.openInputStream(src_uri)
- if (`is` != null){
- return import_file(`is`, dst_path)
+ val inputStream = context.contentResolver.openInputStream(src_uri)
+ if (inputStream != null){
+ return import_file(inputStream, dst_path)
}
return false
}
diff --git a/app/src/main/java/sushi/hardcore/droidfs/widgets/ThemeColor.kt b/app/src/main/java/sushi/hardcore/droidfs/widgets/ThemeColor.kt
index 35dbf12..8418c79 100644
--- a/app/src/main/java/sushi/hardcore/droidfs/widgets/ThemeColor.kt
+++ b/app/src/main/java/sushi/hardcore/droidfs/widgets/ThemeColor.kt
@@ -2,7 +2,11 @@ package sushi.hardcore.droidfs.widgets
import android.content.Context
import android.graphics.Color
+import android.graphics.drawable.Drawable
import androidx.core.content.ContextCompat
+import androidx.core.graphics.drawable.DrawableCompat
+import androidx.preference.Preference
+import androidx.preference.PreferenceGroup
import androidx.preference.PreferenceManager
import sushi.hardcore.droidfs.R
@@ -11,4 +15,14 @@ object ThemeColor {
val sharedPrefs = PreferenceManager.getDefaultSharedPreferences(context)
return sharedPrefs.getInt("themeColor", ContextCompat.getColor(context, R.color.themeColor))
}
+ fun tintPreferenceIcons(preference: Preference, color: Int){
+ if (preference is PreferenceGroup) {
+ for (i in 0 until preference.preferenceCount) {
+ tintPreferenceIcons(preference.getPreference(i), color)
+ }
+ } else {
+ val icon: Drawable = preference.icon
+ DrawableCompat.setTint(icon, color)
+ }
+ }
}
diff --git a/app/src/main/res/drawable/icon_decrypt.xml b/app/src/main/res/drawable/icon_decrypt.xml
index e74ed50..f48247a 100644
--- a/app/src/main/res/drawable/icon_decrypt.xml
+++ b/app/src/main/res/drawable/icon_decrypt.xml
@@ -4,9 +4,9 @@
android:height="24dp"
android:viewportWidth="1024"
android:viewportHeight="1024"
- android:tint="@color/cyanea_accent">
+ android:tint="#FFFFFF">
\ No newline at end of file
diff --git a/app/src/main/res/drawable/icon_delete.xml b/app/src/main/res/drawable/icon_delete.xml
index 282594c..2e5ece8 100644
--- a/app/src/main/res/drawable/icon_delete.xml
+++ b/app/src/main/res/drawable/icon_delete.xml
@@ -1,5 +1,5 @@
-
+
diff --git a/app/src/main/res/drawable/icon_file_audio.xml b/app/src/main/res/drawable/icon_file_audio.xml
index bef7c9b..bf4bba1 100644
--- a/app/src/main/res/drawable/icon_file_audio.xml
+++ b/app/src/main/res/drawable/icon_file_audio.xml
@@ -5,6 +5,6 @@
android:width="24dp"
android:height="24dp">
diff --git a/app/src/main/res/drawable/icon_file_image.xml b/app/src/main/res/drawable/icon_file_image.xml
index 40f5c9f..849c2db 100644
--- a/app/src/main/res/drawable/icon_file_image.xml
+++ b/app/src/main/res/drawable/icon_file_image.xml
@@ -6,6 +6,6 @@
android:viewportHeight="24">
\ No newline at end of file
diff --git a/app/src/main/res/drawable/icon_file_text.xml b/app/src/main/res/drawable/icon_file_text.xml
index 44cf122..530021b 100644
--- a/app/src/main/res/drawable/icon_file_text.xml
+++ b/app/src/main/res/drawable/icon_file_text.xml
@@ -6,6 +6,6 @@
android:viewportHeight="24">
diff --git a/app/src/main/res/drawable/icon_file_unknown.xml b/app/src/main/res/drawable/icon_file_unknown.xml
index 9dc00ec..106117f 100644
--- a/app/src/main/res/drawable/icon_file_unknown.xml
+++ b/app/src/main/res/drawable/icon_file_unknown.xml
@@ -2,6 +2,6 @@
android:viewportHeight="24" android:viewportWidth="24"
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
diff --git a/app/src/main/res/drawable/icon_file_video.xml b/app/src/main/res/drawable/icon_file_video.xml
index 9d73ad1..13c239b 100644
--- a/app/src/main/res/drawable/icon_file_video.xml
+++ b/app/src/main/res/drawable/icon_file_video.xml
@@ -6,6 +6,6 @@
android:viewportHeight="24">
\ No newline at end of file
diff --git a/app/src/main/res/drawable/icon_fingerprint.xml b/app/src/main/res/drawable/icon_fingerprint.xml
index 318b95d..3930214 100644
--- a/app/src/main/res/drawable/icon_fingerprint.xml
+++ b/app/src/main/res/drawable/icon_fingerprint.xml
@@ -1,5 +1,5 @@
-
-
+
diff --git a/app/src/main/res/drawable/icon_folder.xml b/app/src/main/res/drawable/icon_folder.xml
index ea5c7b2..f4397fa 100644
--- a/app/src/main/res/drawable/icon_folder.xml
+++ b/app/src/main/res/drawable/icon_folder.xml
@@ -1,5 +1,5 @@
-
+
diff --git a/app/src/main/res/drawable/icon_open_in_new.xml b/app/src/main/res/drawable/icon_open_in_new.xml
index b6686a7..a73d244 100644
--- a/app/src/main/res/drawable/icon_open_in_new.xml
+++ b/app/src/main/res/drawable/icon_open_in_new.xml
@@ -1,4 +1,4 @@
-
diff --git a/app/src/main/res/drawable/icon_palette.xml b/app/src/main/res/drawable/icon_palette.xml
index d4df12d..b87ca00 100644
--- a/app/src/main/res/drawable/icon_palette.xml
+++ b/app/src/main/res/drawable/icon_palette.xml
@@ -1,4 +1,4 @@
-
diff --git a/app/src/main/res/drawable/icon_screenshot.xml b/app/src/main/res/drawable/icon_screenshot.xml
index b9b35a7..e8555d4 100644
--- a/app/src/main/res/drawable/icon_screenshot.xml
+++ b/app/src/main/res/drawable/icon_screenshot.xml
@@ -4,7 +4,7 @@
android:viewportHeight="512"
android:width="24dp"
android:height="24dp"
- android:tint="@color/cyanea_accent">
+ android:tint="#FFFFFF">
diff --git a/app/src/main/res/drawable/icon_sort.xml b/app/src/main/res/drawable/icon_sort.xml
index c800740..55c6338 100644
--- a/app/src/main/res/drawable/icon_sort.xml
+++ b/app/src/main/res/drawable/icon_sort.xml
@@ -1,5 +1,5 @@
-
+
diff --git a/app/src/main/res/drawable/icon_stop.xml b/app/src/main/res/drawable/icon_stop.xml
index c3963cf..513de7c 100644
--- a/app/src/main/res/drawable/icon_stop.xml
+++ b/app/src/main/res/drawable/icon_stop.xml
@@ -1,5 +1,5 @@
-
+
diff --git a/app/src/main/res/drawable/icon_warning.xml b/app/src/main/res/drawable/icon_warning.xml
index d589146..037eb63 100644
--- a/app/src/main/res/drawable/icon_warning.xml
+++ b/app/src/main/res/drawable/icon_warning.xml
@@ -1,5 +1,5 @@
-
-
+
diff --git a/app/src/main/res/layout/activity_change_password.xml b/app/src/main/res/layout/activity_change_password.xml
index 416e3f3..1766a1c 100644
--- a/app/src/main/res/layout/activity_change_password.xml
+++ b/app/src/main/res/layout/activity_change_password.xml
@@ -39,7 +39,7 @@
diff --git a/app/src/main/res/layout/activity_create.xml b/app/src/main/res/layout/activity_create.xml
index dc78e2f..9241623 100644
--- a/app/src/main/res/layout/activity_create.xml
+++ b/app/src/main/res/layout/activity_create.xml
@@ -38,7 +38,7 @@
diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml
index 5b97228..e2d04fc 100644
--- a/app/src/main/res/layout/activity_main.xml
+++ b/app/src/main/res/layout/activity_main.xml
@@ -34,7 +34,8 @@
android:layout_marginHorizontal="@dimen/main_activity_button_hor_margin"
android:layout_marginVertical="@dimen/main_activity_button_ver_margin"
android:onClick="onClickOpen"
- android:text="@string/open_volume" />
+ android:text="@string/open_volume"
+ style="@style/button"/>
+ android:text="@string/create_volume"
+ style="@style/button"/>
+ android:text="@string/change_volume_password"
+ style="@style/button"/>
diff --git a/app/src/main/res/layout/activity_open.xml b/app/src/main/res/layout/activity_open.xml
index 01fb4ac..0daa579 100644
--- a/app/src/main/res/layout/activity_open.xml
+++ b/app/src/main/res/layout/activity_open.xml
@@ -39,7 +39,7 @@
diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml
index 5ac0994..8d7955d 100644
--- a/app/src/main/res/values/colors.xml
+++ b/app/src/main/res/values/colors.xml
@@ -9,12 +9,12 @@
@color/themeColor
#333333
#000000
- #ffffff
+ #FFFFFF
#5B5A5C
#66666666
- #ffffff
+ #FFFFFF
#111111
- #ffffff
+ #FFFFFF
#6CC341
#ff0000
\ No newline at end of file
diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml
index 557ec50..4230a74 100644
--- a/app/src/main/res/values/styles.xml
+++ b/app/src/main/res/values/styles.xml
@@ -1,12 +1,12 @@
-