From d3f0d059f8f4bfa7a7185357990b7006fca02685 Mon Sep 17 00:00:00 2001 From: Hardcore Sushi Date: Tue, 9 Nov 2021 11:12:09 +0100 Subject: [PATCH] Switch from Cyanea to Themes --- app/build.gradle | 2 +- app/src/main/AndroidManifest.xml | 3 +- .../sushi/hardcore/droidfs/BaseActivity.kt | 57 ++++++++++++------- .../sushi/hardcore/droidfs/CameraActivity.kt | 12 ++-- .../droidfs/ChangePasswordActivity.kt | 12 ++-- .../hardcore/droidfs/ColoredApplication.kt | 11 ---- .../sushi/hardcore/droidfs/CreateActivity.kt | 12 ++-- .../sushi/hardcore/droidfs/LoadingTask.kt | 6 +- .../sushi/hardcore/droidfs/MainActivity.kt | 30 +++++----- .../sushi/hardcore/droidfs/OpenActivity.kt | 18 +++--- .../hardcore/droidfs/SettingsActivity.kt | 30 ++-------- .../hardcore/droidfs/VolumeActionActivity.kt | 19 +++---- .../adapters/DialogSingleChoiceAdapter.kt | 2 - .../adapters/ExplorerElementAdapter.kt | 11 +--- .../droidfs/adapters/IconTextDialogAdapter.kt | 7 ++- .../droidfs/adapters/SavedVolumesAdapter.kt | 6 +- .../content_providers/ExternalProvider.kt | 16 +++--- .../droidfs/explorers/BaseExplorerActivity.kt | 38 +++++++++---- .../droidfs/explorers/ExplorerActivity.kt | 28 ++++----- .../droidfs/explorers/ExplorerActivityDrop.kt | 8 +-- .../file_viewers/FileViewerActivity.kt | 8 +-- .../droidfs/file_viewers/ImageViewer.kt | 12 ++-- .../droidfs/file_viewers/MediaPlayer.kt | 4 +- .../droidfs/file_viewers/TextEditor.kt | 6 +- .../droidfs/widgets/ColoredBorderListView.kt | 28 --------- .../droidfs/widgets/ColoredCheckBox.kt | 15 ----- .../droidfs/widgets/ColoredEditText.kt | 15 ----- .../hardcore/droidfs/widgets/ColoredFAB.kt | 18 ------ .../droidfs/widgets/ColoredImageButton.kt | 14 ----- .../droidfs/widgets/ColoredImageView.kt | 14 ----- .../droidfs/widgets/ColoredListPreference.kt | 30 ---------- ...Builder.kt => CustomAlertDialogBuilder.kt} | 39 ++++++++----- .../NonScrollableColoredBorderListView.kt | 21 +++++-- .../droidfs/widgets/SimpleActionPreference.kt | 16 ------ .../hardcore/droidfs/widgets/ThemeColor.kt | 25 -------- .../main/res/drawable/button_background.xml | 2 +- app/src/main/res/drawable/icon_camera.xml | 6 +- .../res/drawable/icon_create_new_folder.xml | 4 +- app/src/main/res/drawable/icon_decrypt.xml | 2 +- app/src/main/res/drawable/icon_delete.xml | 4 +- app/src/main/res/drawable/icon_encrypt.xml | 5 +- app/src/main/res/drawable/icon_file_audio.xml | 2 +- app/src/main/res/drawable/icon_file_image.xml | 2 +- app/src/main/res/drawable/icon_file_text.xml | 2 +- .../main/res/drawable/icon_file_unknown.xml | 2 +- app/src/main/res/drawable/icon_file_video.xml | 2 +- .../main/res/drawable/icon_fingerprint.xml | 4 +- app/src/main/res/drawable/icon_folder.xml | 2 +- .../main/res/drawable/icon_folder_search.xml | 2 +- app/src/main/res/drawable/icon_gitea.xml | 2 +- app/src/main/res/drawable/icon_github.xml | 2 +- .../main/res/drawable/icon_import_folder.xml | 4 +- app/src/main/res/drawable/icon_info.xml | 4 +- app/src/main/res/drawable/icon_notes.xml | 4 +- .../main/res/drawable/icon_open_in_new.xml | 4 +- app/src/main/res/drawable/icon_palette.xml | 4 +- app/src/main/res/drawable/icon_restore.xml | 5 -- .../res/drawable/icon_screen_rotation.xml | 4 +- app/src/main/res/drawable/icon_screenshot.xml | 2 +- app/src/main/res/drawable/icon_share.xml | 4 +- app/src/main/res/drawable/icon_sort.xml | 2 +- app/src/main/res/drawable/icon_transfert.xml | 4 +- app/src/main/res/drawable/icon_warning.xml | 4 +- app/src/main/res/drawable/listview_border.xml | 2 +- .../res/layout/activity_change_password.xml | 9 ++- app/src/main/res/layout/activity_create.xml | 7 +-- app/src/main/res/layout/activity_explorer.xml | 2 +- .../res/layout/activity_explorer_drop.xml | 2 +- .../main/res/layout/activity_image_viewer.xml | 2 + app/src/main/res/layout/activity_main.xml | 12 ++-- app/src/main/res/layout/activity_open.xml | 5 +- app/src/main/res/layout/activity_settings.xml | 1 - .../res/layout/adapter_dialog_icon_text.xml | 2 +- .../main/res/layout/adapter_saved_volume.xml | 2 +- .../main/res/layout/checkboxes_section.xml | 4 +- app/src/main/res/layout/dialog_edit_text.xml | 4 +- app/src/main/res/layout/explorer_info_bar.xml | 2 +- .../main/res/layout/fragment_fingerprint.xml | 43 -------------- app/src/main/res/layout/toolbar.xml | 2 +- .../main/res/layout/volume_path_section.xml | 6 +- app/src/main/res/values-pt-rBR/strings.xml | 7 --- app/src/main/res/values-ru/strings.xml | 7 --- app/src/main/res/values/arrays.xml | 30 ++++++++++ app/src/main/res/values/attrs.xml | 5 ++ app/src/main/res/values/colors.xml | 28 +++++---- app/src/main/res/values/dialog_styles.xml | 44 ++++++++++++++ app/src/main/res/values/strings.xml | 9 +-- app/src/main/res/values/styles.xml | 57 ++++++++++++++++--- app/src/main/res/xml/root_preferences.xml | 20 +++---- 89 files changed, 437 insertions(+), 560 deletions(-) delete mode 100644 app/src/main/java/sushi/hardcore/droidfs/ColoredApplication.kt delete mode 100644 app/src/main/java/sushi/hardcore/droidfs/widgets/ColoredBorderListView.kt delete mode 100644 app/src/main/java/sushi/hardcore/droidfs/widgets/ColoredCheckBox.kt delete mode 100644 app/src/main/java/sushi/hardcore/droidfs/widgets/ColoredEditText.kt delete mode 100644 app/src/main/java/sushi/hardcore/droidfs/widgets/ColoredFAB.kt delete mode 100644 app/src/main/java/sushi/hardcore/droidfs/widgets/ColoredImageButton.kt delete mode 100644 app/src/main/java/sushi/hardcore/droidfs/widgets/ColoredImageView.kt delete mode 100644 app/src/main/java/sushi/hardcore/droidfs/widgets/ColoredListPreference.kt rename app/src/main/java/sushi/hardcore/droidfs/widgets/{ColoredAlertDialogBuilder.kt => CustomAlertDialogBuilder.kt} (52%) delete mode 100644 app/src/main/java/sushi/hardcore/droidfs/widgets/SimpleActionPreference.kt delete mode 100644 app/src/main/java/sushi/hardcore/droidfs/widgets/ThemeColor.kt delete mode 100644 app/src/main/res/drawable/icon_restore.xml delete mode 100644 app/src/main/res/layout/fragment_fingerprint.xml create mode 100644 app/src/main/res/values/attrs.xml create mode 100644 app/src/main/res/values/dialog_styles.xml diff --git a/app/build.gradle b/app/build.gradle index 576e152..0c14cc7 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -64,7 +64,7 @@ dependencies { implementation "androidx.sqlite:sqlite-ktx:2.1.0" implementation "androidx.preference:preference-ktx:1.1.1" implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.1.0" - implementation "com.jaredrummler:cyanea:1.0.2" + implementation 'com.google.android.material:material:1.4.0' implementation "com.github.bumptech.glide:glide:4.12.0" implementation "androidx.biometric:biometric:1.1.0" diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index cd95198..e4588bf 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -25,13 +25,12 @@ tools:node="remove" /> + android:theme="@style/BaseTheme"> diff --git a/app/src/main/java/sushi/hardcore/droidfs/BaseActivity.kt b/app/src/main/java/sushi/hardcore/droidfs/BaseActivity.kt index 09a5c4e..082014f 100644 --- a/app/src/main/java/sushi/hardcore/droidfs/BaseActivity.kt +++ b/app/src/main/java/sushi/hardcore/droidfs/BaseActivity.kt @@ -3,36 +3,51 @@ package sushi.hardcore.droidfs import android.content.SharedPreferences import android.os.Bundle import android.view.WindowManager -import androidx.core.content.ContextCompat +import androidx.appcompat.app.AppCompatActivity import androidx.preference.PreferenceManager -import com.jaredrummler.cyanea.app.CyaneaAppCompatActivity -import sushi.hardcore.droidfs.widgets.ThemeColor -open class BaseActivity: CyaneaAppCompatActivity() { +open class BaseActivity: AppCompatActivity() { protected lateinit var sharedPrefs: SharedPreferences - protected var isRecreating = false + protected lateinit var themeValue: String + protected var shouldCheckTheme = true + override fun onCreate(savedInstanceState: Bundle?) { - val themeColor = ThemeColor.getThemeColor(this) - if (cyanea.accent != themeColor){ - changeThemeColor(themeColor) + sharedPrefs = PreferenceManager.getDefaultSharedPreferences(this) + if (shouldCheckTheme) { + themeValue = sharedPrefs.getString("theme", "dark_green")!! + when (themeValue) { + "black_green" -> setTheme(R.style.BlackGreen) + "dark_red" -> setTheme(R.style.DarkRed) + "black_red" -> setTheme(R.style.BlackRed) + "dark_blue" -> setTheme(R.style.DarkBlue) + "black_blue" -> setTheme(R.style.BlackBlue) + "dark_yellow" -> setTheme(R.style.DarkYellow) + "black_yellow" -> setTheme(R.style.BlackYellow) + "dark_orange" -> setTheme(R.style.DarkOrange) + "black_orange" -> setTheme(R.style.BlackOrange) + "dark_purple" -> setTheme(R.style.DarkPurple) + "black_purple" -> setTheme(R.style.BlackPurple) + } + } else { + shouldCheckTheme = true } super.onCreate(savedInstanceState) - sharedPrefs = PreferenceManager.getDefaultSharedPreferences(this) if (!sharedPrefs.getBoolean("usf_screenshot", false)){ window.setFlags(WindowManager.LayoutParams.FLAG_SECURE, WindowManager.LayoutParams.FLAG_SECURE) } } - fun changeThemeColor(themeColor: Int? = null){ - val accentColor = themeColor ?: ThemeColor.getThemeColor(this) - val backgroundColor = ContextCompat.getColor(this, R.color.backgroundColor) - isRecreating = true - cyanea.edit{ - accent(accentColor) - //accentDark(themeColor) - //accentLight(themeColor) - background(backgroundColor) - //backgroundDark(backgroundColor) - //backgroundLight(backgroundColor) - }.recreate(this) + + override fun onStart() { + super.onStart() + val newThemeValue = sharedPrefs.getString("theme", "dark_green")!! + onThemeChanged(newThemeValue) + } + + fun onThemeChanged(newThemeValue: String) { + if (newThemeValue != themeValue) { + themeValue = newThemeValue + shouldCheckTheme = false + recreate() + } } } \ No newline at end of file diff --git a/app/src/main/java/sushi/hardcore/droidfs/CameraActivity.kt b/app/src/main/java/sushi/hardcore/droidfs/CameraActivity.kt index e2407d1..dc38516 100644 --- a/app/src/main/java/sushi/hardcore/droidfs/CameraActivity.kt +++ b/app/src/main/java/sushi/hardcore/droidfs/CameraActivity.kt @@ -36,7 +36,7 @@ import sushi.hardcore.droidfs.databinding.ActivityCameraBinding import sushi.hardcore.droidfs.util.PathUtils import sushi.hardcore.droidfs.video_recording.SeekableWriter import sushi.hardcore.droidfs.video_recording.VideoCapture -import sushi.hardcore.droidfs.widgets.ColoredAlertDialogBuilder +import sushi.hardcore.droidfs.widgets.CustomAlertDialogBuilder import java.io.* import java.text.SimpleDateFormat import java.util.* @@ -126,7 +126,7 @@ class CameraActivity : BaseActivity(), SensorOrientationListener.Listener { } else { 1 } - ColoredAlertDialogBuilder(this) + CustomAlertDialogBuilder(this, themeValue) .setTitle(R.string.camera_optimization) .setSingleChoiceItems(DialogSingleChoiceAdapter(this, arrayOf(R.string.maximize_quality, R.string.minimize_latency).map { getString(it) }), currentIndex) { dialog, which -> val resId: Int @@ -149,7 +149,7 @@ class CameraActivity : BaseActivity(), SensorOrientationListener.Listener { } binding.imageRatio.setOnClickListener { resolutions?.let { - ColoredAlertDialogBuilder(this) + CustomAlertDialogBuilder(this, themeValue) .setTitle(R.string.choose_resolution) .setSingleChoiceItems(DialogSingleChoiceAdapter(this, it.map { size -> size.toString() }), currentResolutionIndex) { dialog, which -> setupCamera(resolutions!![which]) @@ -164,7 +164,7 @@ class CameraActivity : BaseActivity(), SensorOrientationListener.Listener { val dialogEditTextView = layoutInflater.inflate(R.layout.dialog_edit_text, null) val dialogEditText = dialogEditTextView.findViewById(R.id.dialog_edit_text) dialogEditText.inputType = InputType.TYPE_CLASS_NUMBER - val dialog = ColoredAlertDialogBuilder(this) + val dialog = CustomAlertDialogBuilder(this, themeValue) .setView(dialogEditTextView) .setTitle(getString(R.string.enter_timer_duration)) .setPositiveButton(R.string.ok) { _, _ -> @@ -266,7 +266,7 @@ class CameraActivity : BaseActivity(), SensorOrientationListener.Listener { permissionsGranted = true setupCamera() } else { - ColoredAlertDialogBuilder(this) + CustomAlertDialogBuilder(this, themeValue) .setTitle(R.string.error) .setMessage(R.string.camera_perm_needed) .setCancelable(false) @@ -348,7 +348,7 @@ class CameraActivity : BaseActivity(), SensorOrientationListener.Listener { if (gocryptfsVolume.importFile(ByteArrayInputStream(outputBuff.toByteArray()), outputPath)){ Toast.makeText(applicationContext, getString(R.string.picture_save_success, outputPath), Toast.LENGTH_SHORT).show() } else { - ColoredAlertDialogBuilder(this@CameraActivity) + CustomAlertDialogBuilder(this@CameraActivity, themeValue) .setTitle(R.string.error) .setMessage(R.string.picture_save_failed) .setCancelable(false) diff --git a/app/src/main/java/sushi/hardcore/droidfs/ChangePasswordActivity.kt b/app/src/main/java/sushi/hardcore/droidfs/ChangePasswordActivity.kt index d9dca82..407f624 100644 --- a/app/src/main/java/sushi/hardcore/droidfs/ChangePasswordActivity.kt +++ b/app/src/main/java/sushi/hardcore/droidfs/ChangePasswordActivity.kt @@ -12,7 +12,7 @@ import sushi.hardcore.droidfs.databinding.ActivityChangePasswordBinding import sushi.hardcore.droidfs.util.PathUtils import sushi.hardcore.droidfs.util.WidgetUtil import sushi.hardcore.droidfs.util.Wiper -import sushi.hardcore.droidfs.widgets.ColoredAlertDialogBuilder +import sushi.hardcore.droidfs.widgets.CustomAlertDialogBuilder import java.io.File import java.util.* @@ -26,7 +26,7 @@ class ChangePasswordActivity : VolumeActionActivity() { setContentView(binding.root) setupLayout() setupFingerprintStuff() - savedVolumesAdapter = SavedVolumesAdapter(this, volumeDatabase) + savedVolumesAdapter = SavedVolumesAdapter(this, themeValue, volumeDatabase) if (savedVolumesAdapter.count > 0){ binding.savedPathListview.adapter = savedVolumesAdapter binding.savedPathListview.onItemClickListener = OnItemClickListener { _, _, position, _ -> @@ -87,7 +87,7 @@ class ChangePasswordActivity : VolumeActionActivity() { loadVolumePath { val volumeFile = File(currentVolumePath) if (!GocryptfsVolume.isGocryptfsVolume(volumeFile)){ - ColoredAlertDialogBuilder(this) + CustomAlertDialogBuilder(this, themeValue) .setTitle(R.string.error) .setMessage(R.string.error_not_a_volume) .setPositiveButton(R.string.ok, null) @@ -106,7 +106,7 @@ class ChangePasswordActivity : VolumeActionActivity() { if (!newPassword.contentEquals(newPasswordConfirm)) { Toast.makeText(this, R.string.passwords_mismatch, Toast.LENGTH_SHORT).show() } else { - object : LoadingTask(this, R.string.loading_msg_change_password) { + object : LoadingTask(this, themeValue, R.string.loading_msg_change_password) { override fun doTask(activity: AppCompatActivity) { val oldPassword = binding.editOldPassword.text.toString().toCharArray() var returnedHash: ByteArray? = null @@ -159,7 +159,7 @@ class ChangePasswordActivity : VolumeActionActivity() { } } else { stopTask { - ColoredAlertDialogBuilder(activity) + CustomAlertDialogBuilder(activity, themeValue) .setTitle(R.string.error) .setMessage(R.string.change_password_failed) .setPositiveButton(R.string.ok, null) @@ -178,7 +178,7 @@ class ChangePasswordActivity : VolumeActionActivity() { } private fun onPasswordChanged(){ - ColoredAlertDialogBuilder(this) + CustomAlertDialogBuilder(this, themeValue) .setTitle(R.string.success_change_password) .setMessage(R.string.success_change_password_msg) .setCancelable(false) diff --git a/app/src/main/java/sushi/hardcore/droidfs/ColoredApplication.kt b/app/src/main/java/sushi/hardcore/droidfs/ColoredApplication.kt deleted file mode 100644 index 7a8ee7b..0000000 --- a/app/src/main/java/sushi/hardcore/droidfs/ColoredApplication.kt +++ /dev/null @@ -1,11 +0,0 @@ -package sushi.hardcore.droidfs - -import android.app.Application -import com.jaredrummler.cyanea.Cyanea - -class ColoredApplication: Application() { - override fun onCreate() { - super.onCreate() - Cyanea.init(this, resources) - } -} \ No newline at end of file diff --git a/app/src/main/java/sushi/hardcore/droidfs/CreateActivity.kt b/app/src/main/java/sushi/hardcore/droidfs/CreateActivity.kt index c57dbfb..9b8a154 100644 --- a/app/src/main/java/sushi/hardcore/droidfs/CreateActivity.kt +++ b/app/src/main/java/sushi/hardcore/droidfs/CreateActivity.kt @@ -9,7 +9,7 @@ import androidx.appcompat.app.AppCompatActivity import sushi.hardcore.droidfs.databinding.ActivityCreateBinding import sushi.hardcore.droidfs.explorers.ExplorerActivity import sushi.hardcore.droidfs.util.Wiper -import sushi.hardcore.droidfs.widgets.ColoredAlertDialogBuilder +import sushi.hardcore.droidfs.widgets.CustomAlertDialogBuilder import java.io.File import java.util.* @@ -38,7 +38,7 @@ class CreateActivity : VolumeActionActivity() { binding.spinnerXchacha.onItemSelectedListener = object : AdapterView.OnItemSelectedListener { override fun onItemSelected(parent: AdapterView<*>?, view: View?, position: Int, id: Long) { if (position == 1) { - ColoredAlertDialogBuilder(this@CreateActivity) + CustomAlertDialogBuilder(this@CreateActivity, themeValue) .setTitle(R.string.warning) .setMessage(R.string.xchacha_warning) .setPositiveButton(R.string.ok, null) @@ -55,7 +55,7 @@ class CreateActivity : VolumeActionActivity() { override fun onClickSwitchHiddenVolume() { super.onClickSwitchHiddenVolume() if (switchHiddenVolume.isChecked){ - ColoredAlertDialogBuilder(this) + CustomAlertDialogBuilder(this, themeValue) .setTitle(R.string.warning) .setMessage(R.string.hidden_volume_warning) .setPositiveButton(R.string.ok, null) @@ -95,7 +95,7 @@ class CreateActivity : VolumeActionActivity() { } } if (goodDirectory) { - object: LoadingTask(this, R.string.loading_msg_create){ + object: LoadingTask(this, themeValue, R.string.loading_msg_create) { override fun doTask(activity: AppCompatActivity) { val xchacha = when (binding.spinnerXchacha.selectedItemPosition) { 0 -> 0 @@ -129,7 +129,7 @@ class CreateActivity : VolumeActionActivity() { } } else { stopTask { - ColoredAlertDialogBuilder(activity) + CustomAlertDialogBuilder(activity, themeValue) .setTitle(R.string.error) .setMessage(R.string.create_volume_failed) .setPositiveButton(R.string.ok, null) @@ -148,7 +148,7 @@ class CreateActivity : VolumeActionActivity() { } private fun startExplorer(){ - ColoredAlertDialogBuilder(this) + CustomAlertDialogBuilder(this, themeValue) .setTitle(R.string.success_volume_create) .setMessage(R.string.success_volume_create_msg) .setCancelable(false) diff --git a/app/src/main/java/sushi/hardcore/droidfs/LoadingTask.kt b/app/src/main/java/sushi/hardcore/droidfs/LoadingTask.kt index 6eacc43..a8ca8da 100644 --- a/app/src/main/java/sushi/hardcore/droidfs/LoadingTask.kt +++ b/app/src/main/java/sushi/hardcore/droidfs/LoadingTask.kt @@ -4,11 +4,11 @@ import android.widget.TextView import android.widget.Toast import androidx.appcompat.app.AlertDialog import androidx.appcompat.app.AppCompatActivity -import sushi.hardcore.droidfs.widgets.ColoredAlertDialogBuilder +import sushi.hardcore.droidfs.widgets.CustomAlertDialogBuilder -abstract class LoadingTask(val activity: AppCompatActivity, loadingMessageResId: Int) { +abstract class LoadingTask(val activity: AppCompatActivity, themeValue: String, loadingMessageResId: Int) { private val dialogLoadingView = activity.layoutInflater.inflate(R.layout.dialog_loading, null) - private val dialogLoading: AlertDialog = ColoredAlertDialogBuilder(activity) + private val dialogLoading: AlertDialog = CustomAlertDialogBuilder(activity, themeValue) .setView(dialogLoadingView) .setTitle(R.string.loading) .setCancelable(false) diff --git a/app/src/main/java/sushi/hardcore/droidfs/MainActivity.kt b/app/src/main/java/sushi/hardcore/droidfs/MainActivity.kt index d7ccd26..5ce7025 100644 --- a/app/src/main/java/sushi/hardcore/droidfs/MainActivity.kt +++ b/app/src/main/java/sushi/hardcore/droidfs/MainActivity.kt @@ -5,7 +5,7 @@ import android.os.Bundle import android.view.Menu import android.view.MenuItem import sushi.hardcore.droidfs.databinding.ActivityMainBinding -import sushi.hardcore.droidfs.widgets.ColoredAlertDialogBuilder +import sushi.hardcore.droidfs.widgets.CustomAlertDialogBuilder class MainActivity : BaseActivity() { @@ -14,21 +14,19 @@ class MainActivity : BaseActivity() { val binding = ActivityMainBinding.inflate(layoutInflater) setContentView(binding.root) setSupportActionBar(binding.toolbar.toolbar) - if (!isRecreating) { - if (sharedPrefs.getBoolean("applicationFirstOpening", true)){ - ColoredAlertDialogBuilder(this) - .setTitle(R.string.warning) - .setMessage(R.string.usf_home_warning_msg) - .setCancelable(false) - .setPositiveButton(R.string.see_unsafe_features){ _, _ -> - val intent = Intent(this, SettingsActivity::class.java) - intent.putExtra("screen", "UnsafeFeaturesSettingsFragment") - startActivity(intent) - } - .setNegativeButton(R.string.ok, null) - .setOnDismissListener { sharedPrefs.edit().putBoolean("applicationFirstOpening", false).apply() } - .show() - } + if (sharedPrefs.getBoolean("applicationFirstOpening", true)) { + CustomAlertDialogBuilder(this, themeValue) + .setTitle(R.string.warning) + .setMessage(R.string.usf_home_warning_msg) + .setCancelable(false) + .setPositiveButton(R.string.see_unsafe_features) { _, _ -> + val intent = Intent(this, SettingsActivity::class.java) + intent.putExtra("screen", "UnsafeFeaturesSettingsFragment") + startActivity(intent) + } + .setNegativeButton(R.string.ok, null) + .setOnDismissListener { sharedPrefs.edit().putBoolean("applicationFirstOpening", false).apply() } + .show() } binding.buttonOpen.setOnClickListener { startActivity(OpenActivity::class.java) diff --git a/app/src/main/java/sushi/hardcore/droidfs/OpenActivity.kt b/app/src/main/java/sushi/hardcore/droidfs/OpenActivity.kt index 19c6337..c205441 100644 --- a/app/src/main/java/sushi/hardcore/droidfs/OpenActivity.kt +++ b/app/src/main/java/sushi/hardcore/droidfs/OpenActivity.kt @@ -18,7 +18,7 @@ import sushi.hardcore.droidfs.explorers.ExplorerActivityPick import sushi.hardcore.droidfs.util.PathUtils import sushi.hardcore.droidfs.util.WidgetUtil import sushi.hardcore.droidfs.util.Wiper -import sushi.hardcore.droidfs.widgets.ColoredAlertDialogBuilder +import sushi.hardcore.droidfs.widgets.CustomAlertDialogBuilder import java.io.File import java.util.* @@ -35,7 +35,7 @@ class OpenActivity : VolumeActionActivity() { setContentView(binding.root) setupLayout() setupFingerprintStuff() - savedVolumesAdapter = SavedVolumesAdapter(this, volumeDatabase) + savedVolumesAdapter = SavedVolumesAdapter(this, themeValue, volumeDatabase) if (savedVolumesAdapter.count > 0){ binding.savedPathListview.adapter = savedVolumesAdapter binding.savedPathListview.onItemClickListener = OnItemClickListener { _, _, position, _ -> @@ -116,20 +116,20 @@ class OpenActivity : VolumeActionActivity() { loadVolumePath { val volumeFile = File(currentVolumePath) if (!GocryptfsVolume.isGocryptfsVolume(volumeFile)){ - ColoredAlertDialogBuilder(this) + CustomAlertDialogBuilder(this, themeValue) .setTitle(R.string.error) .setMessage(R.string.error_not_a_volume) .setPositiveButton(R.string.ok, null) .show() } else if (!volumeFile.canWrite()) { if ((intent.action == Intent.ACTION_SEND || intent.action == Intent.ACTION_SEND_MULTIPLE) && intent.extras != null) { //import via android share menu - ColoredAlertDialogBuilder(this) + CustomAlertDialogBuilder(this, themeValue) .setTitle(R.string.error) .setMessage(R.string.open_cant_write_error_msg) .setPositiveButton(R.string.ok, null) .show() } else { - val dialog = ColoredAlertDialogBuilder(this) + val dialog = CustomAlertDialogBuilder(this, themeValue) .setTitle(R.string.warning) .setCancelable(false) .setPositiveButton(R.string.ok) { _, _ -> openVolume() } @@ -152,7 +152,7 @@ class OpenActivity : VolumeActionActivity() { } private fun openVolume(){ - object : LoadingTask(this, R.string.loading_msg_open){ + object : LoadingTask(this, themeValue, R.string.loading_msg_open) { override fun doTask(activity: AppCompatActivity) { val password = binding.editPassword.text.toString().toCharArray() var returnedHash: ByteArray? = null @@ -179,7 +179,7 @@ class OpenActivity : VolumeActionActivity() { } } else { stopTask { - ColoredAlertDialogBuilder(activity) + CustomAlertDialogBuilder(activity, themeValue) .setTitle(R.string.open_volume_failed) .setMessage(R.string.open_volume_failed_msg) .setPositiveButton(R.string.ok, null) @@ -192,14 +192,14 @@ class OpenActivity : VolumeActionActivity() { } private fun openUsingPasswordHash(passwordHash: ByteArray){ - object : LoadingTask(this, R.string.loading_msg_open){ + object : LoadingTask(this, themeValue, R.string.loading_msg_open) { override fun doTask(activity: AppCompatActivity) { sessionID = GocryptfsVolume.init(currentVolumePath, null, passwordHash, null) if (sessionID != -1){ stopTask { startExplorer() } } else { stopTask { - ColoredAlertDialogBuilder(activity) + CustomAlertDialogBuilder(activity, themeValue) .setTitle(R.string.open_volume_failed) .setMessage(R.string.open_failed_hash_msg) .setPositiveButton(R.string.ok, null) diff --git a/app/src/main/java/sushi/hardcore/droidfs/SettingsActivity.kt b/app/src/main/java/sushi/hardcore/droidfs/SettingsActivity.kt index 55655ee..4a8cbf8 100644 --- a/app/src/main/java/sushi/hardcore/droidfs/SettingsActivity.kt +++ b/app/src/main/java/sushi/hardcore/droidfs/SettingsActivity.kt @@ -2,13 +2,9 @@ package sushi.hardcore.droidfs import android.os.Bundle import android.view.MenuItem -import androidx.core.content.ContextCompat -import androidx.preference.Preference +import androidx.preference.ListPreference import androidx.preference.PreferenceFragmentCompat -import com.jaredrummler.android.colorpicker.ColorPreferenceCompat import sushi.hardcore.droidfs.databinding.ActivitySettingsBinding -import sushi.hardcore.droidfs.widgets.SimpleActionPreference -import sushi.hardcore.droidfs.widgets.ThemeColor class SettingsActivity : BaseActivity() { @@ -43,26 +39,9 @@ class SettingsActivity : BaseActivity() { class MainSettingsFragment : PreferenceFragmentCompat() { override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) { setPreferencesFromResource(R.xml.root_preferences, rootKey) - ThemeColor.tintPreferenceIcons(preferenceScreen, ThemeColor.getThemeColor(requireContext())) - var originalThemeColor: Int? = null - context?.let { - originalThemeColor = ContextCompat.getColor(it, R.color.themeColor) - } - findPreference("themeColor")?.let { colorPicker -> - colorPicker.onPreferenceChangeListener = Preference.OnPreferenceChangeListener{ _, _ -> - (activity as SettingsActivity).changeThemeColor() - true - } - findPreference("resetThemeColor")?.onClick = { - originalThemeColor?.let { - colorPicker.saveValue(it) - val settingsActivity = (activity as SettingsActivity) - Thread { - settingsActivity.sharedPrefs.edit().commit() - settingsActivity.runOnUiThread { settingsActivity.changeThemeColor() } - }.start() - } - } + findPreference("theme")?.setOnPreferenceChangeListener { _, newValue -> + (activity as BaseActivity).onThemeChanged(newValue as String) + true } } } @@ -70,7 +49,6 @@ class SettingsActivity : BaseActivity() { class UnsafeFeaturesSettingsFragment : PreferenceFragmentCompat() { override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) { setPreferencesFromResource(R.xml.unsafe_features_preferences, rootKey) - ThemeColor.tintPreferenceIcons(preferenceScreen, ThemeColor.getThemeColor(requireContext())) } } } \ No newline at end of file diff --git a/app/src/main/java/sushi/hardcore/droidfs/VolumeActionActivity.kt b/app/src/main/java/sushi/hardcore/droidfs/VolumeActionActivity.kt index d187218..54c792c 100644 --- a/app/src/main/java/sushi/hardcore/droidfs/VolumeActionActivity.kt +++ b/app/src/main/java/sushi/hardcore/droidfs/VolumeActionActivity.kt @@ -19,8 +19,7 @@ import androidx.biometric.BiometricPrompt import androidx.core.content.ContextCompat import sushi.hardcore.droidfs.util.PathUtils import sushi.hardcore.droidfs.util.WidgetUtil -import sushi.hardcore.droidfs.widgets.ColoredAlertDialogBuilder -import sushi.hardcore.droidfs.widgets.ColoredImageButton +import sushi.hardcore.droidfs.widgets.CustomAlertDialogBuilder import java.security.KeyStore import javax.crypto.* import javax.crypto.spec.GCMParameterSpec @@ -68,7 +67,7 @@ abstract class VolumeActionActivity : BaseActivity() { protected fun setupLayout() { setSupportActionBar(findViewById(R.id.toolbar)) supportActionBar?.setDisplayHomeAsUpEnabled(true) - findViewById(R.id.button_pick_directory).setOnClickListener { + findViewById(R.id.button_pick_directory).setOnClickListener { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { if (ContextCompat.checkSelfPermission(this, Manifest.permission.READ_EXTERNAL_STORAGE) + ContextCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) { @@ -123,7 +122,7 @@ abstract class VolumeActionActivity : BaseActivity() { if (path != null) { editVolumePath.setText(path) } else { - ColoredAlertDialogBuilder(this) + CustomAlertDialogBuilder(this, themeValue) .setTitle(R.string.error) .setMessage(R.string.path_from_uri_null_error_msg) .setPositiveButton(R.string.ok, null) @@ -136,7 +135,7 @@ abstract class VolumeActionActivity : BaseActivity() { onPickingDirectory() pickDirectory.launch(null) } catch (e: ActivityNotFoundException) { - ColoredAlertDialogBuilder(this) + CustomAlertDialogBuilder(this, themeValue) .setTitle(R.string.error) .setMessage(R.string.open_tree_failed) .setPositiveButton(R.string.ok, null) @@ -149,7 +148,7 @@ abstract class VolumeActionActivity : BaseActivity() { when (requestCode) { STORAGE_PERMISSIONS_REQUEST -> if (grantResults.size == 2) { if (grantResults[0] != PackageManager.PERMISSION_GRANTED || grantResults[1] != PackageManager.PERMISSION_GRANTED) { - ColoredAlertDialogBuilder(this) + CustomAlertDialogBuilder(this, themeValue) .setTitle(R.string.storage_perm_denied) .setMessage(R.string.storage_perm_denied_msg) .setCancelable(false) @@ -209,7 +208,7 @@ abstract class VolumeActionActivity : BaseActivity() { val plainText = cipherObject.doFinal(dataToProcess) onPasswordDecrypted(plainText) } catch (e: AEADBadTagException){ - ColoredAlertDialogBuilder(activityContext) + CustomAlertDialogBuilder(activityContext, themeValue) .setTitle(R.string.error) .setMessage(R.string.MAC_verification_failed) .setPositiveButton(R.string.reset_hash_storage) { _, _ -> @@ -221,7 +220,7 @@ abstract class VolumeActionActivity : BaseActivity() { } } } catch (e: IllegalBlockSizeException){ - ColoredAlertDialogBuilder(activityContext) + CustomAlertDialogBuilder(activityContext, themeValue) .setTitle(R.string.illegal_block_size_exception) .setMessage(R.string.illegal_block_size_exception_msg) .setPositiveButton(R.string.reset_hash_storage) { _, _ -> @@ -292,7 +291,7 @@ abstract class VolumeActionActivity : BaseActivity() { } private fun alertKeyPermanentlyInvalidatedException(){ - ColoredAlertDialogBuilder(this) + CustomAlertDialogBuilder(this, themeValue) .setTitle(R.string.key_permanently_invalidated_exception) .setMessage(R.string.key_permanently_invalidated_exception_msg) .setPositiveButton(R.string.reset_hash_storage) { _, _ -> @@ -381,7 +380,7 @@ abstract class VolumeActionActivity : BaseActivity() { } fun errorDirectoryNotWritable(errorMsg: Int) { - val dialog = ColoredAlertDialogBuilder(this) + val dialog = CustomAlertDialogBuilder(this, themeValue) .setTitle(R.string.error) .setPositiveButton(R.string.ok, null) if (PathUtils.isPathOnExternalStorage(currentVolumePath, this)) { diff --git a/app/src/main/java/sushi/hardcore/droidfs/adapters/DialogSingleChoiceAdapter.kt b/app/src/main/java/sushi/hardcore/droidfs/adapters/DialogSingleChoiceAdapter.kt index 76e5cdb..bdf9703 100644 --- a/app/src/main/java/sushi/hardcore/droidfs/adapters/DialogSingleChoiceAdapter.kt +++ b/app/src/main/java/sushi/hardcore/droidfs/adapters/DialogSingleChoiceAdapter.kt @@ -7,7 +7,6 @@ import android.view.ViewGroup import android.widget.BaseAdapter import android.widget.CheckedTextView import sushi.hardcore.droidfs.R -import sushi.hardcore.droidfs.widgets.ThemeColor class DialogSingleChoiceAdapter(private val context: Context, private val entries: List): BaseAdapter() { private val inflater: LayoutInflater = LayoutInflater.from(context) @@ -18,7 +17,6 @@ class DialogSingleChoiceAdapter(private val context: Context, private val entrie val typedArray = context.theme.obtainStyledAttributes(arrayOf(android.R.attr.listChoiceIndicatorSingle).toIntArray()) val drawable = typedArray.getDrawable(0) typedArray.recycle() - drawable?.setTint(ThemeColor.getThemeColor(context)) checkedTextView.setCompoundDrawablesWithIntrinsicBounds(drawable, null, null, null) return view } diff --git a/app/src/main/java/sushi/hardcore/droidfs/adapters/ExplorerElementAdapter.kt b/app/src/main/java/sushi/hardcore/droidfs/adapters/ExplorerElementAdapter.kt index e2c046a..9133a6e 100644 --- a/app/src/main/java/sushi/hardcore/droidfs/adapters/ExplorerElementAdapter.kt +++ b/app/src/main/java/sushi/hardcore/droidfs/adapters/ExplorerElementAdapter.kt @@ -2,8 +2,6 @@ package sushi.hardcore.droidfs.adapters import android.content.Context import android.graphics.Color -import android.graphics.PorterDuff -import android.graphics.PorterDuffColorFilter import android.view.LayoutInflater import android.view.View import android.view.ViewGroup @@ -15,7 +13,6 @@ import sushi.hardcore.droidfs.ConstValues.Companion.getAssociatedDrawable import sushi.hardcore.droidfs.R import sushi.hardcore.droidfs.explorers.ExplorerElement import sushi.hardcore.droidfs.util.PathUtils -import sushi.hardcore.droidfs.widgets.ThemeColor import java.text.DateFormat import java.util.* @@ -24,7 +21,6 @@ class ExplorerElementAdapter(private val context: Context) : BaseAdapter() { private var explorerElements = listOf() private val inflater: LayoutInflater = LayoutInflater.from(context) val selectedItems: MutableList = ArrayList() - private val themeColor = ThemeColor.getThemeColor(context) override fun getCount(): Int { return explorerElements.size } @@ -62,12 +58,9 @@ class ExplorerElementAdapter(private val context: Context) : BaseAdapter() { drawableId = getAssociatedDrawable(currentElement.name) } } - val elementIcon = view.findViewById(R.id.icon_element) - val icon = ContextCompat.getDrawable(context, drawableId) - icon?.colorFilter = PorterDuffColorFilter(themeColor, PorterDuff.Mode.SRC_IN) - elementIcon.setImageDrawable(icon) + view.findViewById(R.id.icon_element).setImageResource(drawableId) if (selectedItems.contains(position)) { - view.setBackgroundColor(ContextCompat.getColor(context, R.color.item_selected)) + view.setBackgroundColor(ContextCompat.getColor(context, R.color.itemSelected)) } else { view.setBackgroundColor(Color.alpha(0)) } diff --git a/app/src/main/java/sushi/hardcore/droidfs/adapters/IconTextDialogAdapter.kt b/app/src/main/java/sushi/hardcore/droidfs/adapters/IconTextDialogAdapter.kt index 1f60a17..87ff73f 100644 --- a/app/src/main/java/sushi/hardcore/droidfs/adapters/IconTextDialogAdapter.kt +++ b/app/src/main/java/sushi/hardcore/droidfs/adapters/IconTextDialogAdapter.kt @@ -5,9 +5,10 @@ import android.view.LayoutInflater import android.view.View import android.view.ViewGroup import android.widget.BaseAdapter +import android.widget.ImageView import android.widget.TextView +import androidx.appcompat.content.res.AppCompatResources import sushi.hardcore.droidfs.R -import sushi.hardcore.droidfs.widgets.ColoredImageView open class IconTextDialogAdapter(private val context: Context): BaseAdapter() { private val inflater: LayoutInflater = LayoutInflater.from(context) @@ -17,8 +18,8 @@ open class IconTextDialogAdapter(private val context: Context): BaseAdapter() { val view: View = convertView ?: inflater.inflate(R.layout.adapter_dialog_icon_text, parent, false) val text = view.findViewById(R.id.text) text.text = context.getString(items[position][1] as Int) - val icon = view.findViewById(R.id.icon) - icon.setImageDrawable(context.getDrawable(items[position][2] as Int)) + val icon = view.findViewById(R.id.icon) + icon.setImageDrawable(AppCompatResources.getDrawable(context, items[position][2] as Int)) return view } diff --git a/app/src/main/java/sushi/hardcore/droidfs/adapters/SavedVolumesAdapter.kt b/app/src/main/java/sushi/hardcore/droidfs/adapters/SavedVolumesAdapter.kt index cf65a48..469bb8c 100644 --- a/app/src/main/java/sushi/hardcore/droidfs/adapters/SavedVolumesAdapter.kt +++ b/app/src/main/java/sushi/hardcore/droidfs/adapters/SavedVolumesAdapter.kt @@ -12,11 +12,11 @@ import sushi.hardcore.droidfs.util.PathUtils import sushi.hardcore.droidfs.Volume import sushi.hardcore.droidfs.VolumeDatabase import sushi.hardcore.droidfs.util.WidgetUtil -import sushi.hardcore.droidfs.widgets.ColoredAlertDialogBuilder +import sushi.hardcore.droidfs.widgets.CustomAlertDialogBuilder import sushi.hardcore.droidfs.widgets.NonScrollableColoredBorderListView import java.io.File -class SavedVolumesAdapter(private val context: Context, private val volumeDatabase: VolumeDatabase) : BaseAdapter() { +class SavedVolumesAdapter(private val context: Context, private val themeValue: String, private val volumeDatabase: VolumeDatabase) : BaseAdapter() { private val inflater: LayoutInflater = LayoutInflater.from(context) private lateinit var nonScrollableColoredBorderListView: NonScrollableColoredBorderListView @@ -53,7 +53,7 @@ class SavedVolumesAdapter(private val context: Context, private val volumeDataba volumeNameTextView.text = currentVolume.name val deleteImageView = view.findViewById(R.id.delete_imageview) deleteImageView.setOnClickListener { - val dialog = ColoredAlertDialogBuilder(context) + val dialog = CustomAlertDialogBuilder(context, themeValue) dialog.setTitle(R.string.warning) if (currentVolume.isHidden){ if (currentVolume.hash != null) { diff --git a/app/src/main/java/sushi/hardcore/droidfs/content_providers/ExternalProvider.kt b/app/src/main/java/sushi/hardcore/droidfs/content_providers/ExternalProvider.kt index b87c896..b11381a 100644 --- a/app/src/main/java/sushi/hardcore/droidfs/content_providers/ExternalProvider.kt +++ b/app/src/main/java/sushi/hardcore/droidfs/content_providers/ExternalProvider.kt @@ -8,13 +8,13 @@ import androidx.appcompat.app.AppCompatActivity import sushi.hardcore.droidfs.GocryptfsVolume import sushi.hardcore.droidfs.LoadingTask import sushi.hardcore.droidfs.R -import sushi.hardcore.droidfs.widgets.ColoredAlertDialogBuilder +import sushi.hardcore.droidfs.widgets.CustomAlertDialogBuilder import java.io.File object ExternalProvider { private const val content_type_all = "*/*" private var storedFiles: MutableList = ArrayList() - private fun getContentType(filename: String, previous_content_type: String?): String? { + private fun getContentType(filename: String, previous_content_type: String?): String { if (content_type_all != previous_content_type) { var contentType = MimeTypeMap.getSingleton().getMimeTypeFromExtension(File(filename).extension) if (contentType == null) { @@ -41,8 +41,8 @@ object ExternalProvider { return Pair(null, null) } - fun share(activity: AppCompatActivity, gocryptfsVolume: GocryptfsVolume, file_paths: List) { - object : LoadingTask(activity, R.string.loading_msg_export){ + fun share(activity: AppCompatActivity, themeValue: String, gocryptfsVolume: GocryptfsVolume, file_paths: List) { + object : LoadingTask(activity, themeValue, R.string.loading_msg_export) { override fun doTask(activity: AppCompatActivity) { var contentType: String? = null val uris = ArrayList() @@ -53,7 +53,7 @@ object ExternalProvider { result.second } else { stopTask { - ColoredAlertDialogBuilder(activity) + CustomAlertDialogBuilder(activity, themeValue) .setTitle(R.string.error) .setMessage(activity.getString(R.string.export_failed, path)) .setPositiveButton(R.string.ok, null) @@ -78,8 +78,8 @@ object ExternalProvider { } } - fun open(activity: AppCompatActivity, gocryptfsVolume: GocryptfsVolume, file_path: String) { - object : LoadingTask(activity, R.string.loading_msg_export) { + fun open(activity: AppCompatActivity, themeValue: String, gocryptfsVolume: GocryptfsVolume, file_path: String) { + object : LoadingTask(activity, themeValue, R.string.loading_msg_export) { override fun doTask(activity: AppCompatActivity) { val result = exportFile(activity, gocryptfsVolume, file_path, null) if (result.first != null) { @@ -88,7 +88,7 @@ object ExternalProvider { stopTask { activity.startActivity(openIntent) } } else { stopTask { - ColoredAlertDialogBuilder(activity) + CustomAlertDialogBuilder(activity, themeValue) .setTitle(R.string.error) .setMessage(activity.getString(R.string.export_failed, file_path)) .setPositiveButton(R.string.ok, null) 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 b666227..c06cc7a 100644 --- a/app/src/main/java/sushi/hardcore/droidfs/explorers/BaseExplorerActivity.kt +++ b/app/src/main/java/sushi/hardcore/droidfs/explorers/BaseExplorerActivity.kt @@ -17,6 +17,7 @@ import android.widget.EditText import android.widget.ListView import android.widget.TextView import android.widget.Toast +import androidx.core.content.ContextCompat import androidx.documentfile.provider.DocumentFile import androidx.lifecycle.ViewModel import androidx.lifecycle.ViewModelProvider @@ -41,7 +42,7 @@ import sushi.hardcore.droidfs.file_viewers.ImageViewer import sushi.hardcore.droidfs.file_viewers.TextEditor import sushi.hardcore.droidfs.file_viewers.VideoPlayer import sushi.hardcore.droidfs.util.PathUtils -import sushi.hardcore.droidfs.widgets.ColoredAlertDialogBuilder +import sushi.hardcore.droidfs.widgets.CustomAlertDialogBuilder open class BaseExplorerActivity : BaseActivity() { private lateinit var sortOrderEntries: Array @@ -146,12 +147,12 @@ open class BaseExplorerActivity : BaseActivity() { private fun openWithExternalApp(fullPath: String){ isStartingActivity = true - ExternalProvider.open(this, gocryptfsVolume, fullPath) + ExternalProvider.open(this, themeValue, gocryptfsVolume, fullPath) } private fun showOpenAsDialog(path: String) { val adapter = OpenAsDialogAdapter(this, usf_open) - ColoredAlertDialogBuilder(this) + CustomAlertDialogBuilder(this, themeValue) .setSingleChoiceItems(adapter, -1) { dialog, which -> when (adapter.getItem(which)) { "image" -> startFileViewer(ImageViewer::class.java, path) @@ -267,7 +268,7 @@ open class BaseExplorerActivity : BaseActivity() { } private fun askCloseVolume() { - ColoredAlertDialogBuilder(this) + CustomAlertDialogBuilder(this, themeValue) .setTitle(R.string.warning) .setMessage(R.string.ask_close_volume) .setPositiveButton(R.string.ok) { _, _ -> closeVolumeOnUserExit() } @@ -293,7 +294,7 @@ open class BaseExplorerActivity : BaseActivity() { Toast.makeText(this, R.string.error_filename_empty, Toast.LENGTH_SHORT).show() } else { if (!gocryptfsVolume.mkdir(PathUtils.pathJoin(currentDirectoryPath, folderName))) { - ColoredAlertDialogBuilder(this) + CustomAlertDialogBuilder(this, themeValue) .setTitle(R.string.error) .setMessage(R.string.error_mkdir) .setPositiveButton(R.string.ok, null) @@ -308,7 +309,7 @@ open class BaseExplorerActivity : BaseActivity() { protected fun openDialogCreateFolder() { val dialogEditTextView = layoutInflater.inflate(R.layout.dialog_edit_text, null) val dialogEditText = dialogEditTextView.findViewById(R.id.dialog_edit_text) - val dialog = ColoredAlertDialogBuilder(this) + val dialog = CustomAlertDialogBuilder(this, themeValue) .setView(dialogEditTextView) .setTitle(R.string.enter_folder_name) .setPositiveButton(R.string.ok) { _, _ -> @@ -346,7 +347,7 @@ open class BaseExplorerActivity : BaseActivity() { } } if (!ready){ - ColoredAlertDialogBuilder(this) + CustomAlertDialogBuilder(this, themeValue) .setTitle(R.string.warning) .setMessage(getString(if (items[i].explorerElement.isDirectory){R.string.dir_overwrite_question} else {R.string.file_overwrite_question}, testDstPath)) .setPositiveButton(R.string.yes) {_, _ -> @@ -359,7 +360,7 @@ open class BaseExplorerActivity : BaseActivity() { val dialogEditText = dialogEditTextView.findViewById(R.id.dialog_edit_text) dialogEditText.setText(items[i].explorerElement.name) dialogEditText.selectAll() - val dialog = ColoredAlertDialogBuilder(this) + val dialog = CustomAlertDialogBuilder(this, themeValue) .setView(dialogEditTextView) .setTitle(R.string.enter_new_name) .setPositiveButton(R.string.ok) { _, _ -> @@ -403,7 +404,7 @@ open class BaseExplorerActivity : BaseActivity() { for (uri in uris) { val fileName = PathUtils.getFilenameFromURI(this, uri) if (fileName == null) { - ColoredAlertDialogBuilder(this) + CustomAlertDialogBuilder(this, themeValue) .setTitle(R.string.error) .setMessage(getString(R.string.error_retrieving_filename, uri)) .setPositiveButton(R.string.ok, null) @@ -446,7 +447,7 @@ open class BaseExplorerActivity : BaseActivity() { Toast.makeText(this, R.string.error_filename_empty, Toast.LENGTH_SHORT).show() } else { if (!gocryptfsVolume.rename(PathUtils.pathJoin(currentDirectoryPath, old_name), PathUtils.pathJoin(currentDirectoryPath, new_name))) { - ColoredAlertDialogBuilder(this) + CustomAlertDialogBuilder(this, themeValue) .setTitle(R.string.error) .setMessage(getString(R.string.rename_failed, old_name)) .setPositiveButton(R.string.ok, null) @@ -458,6 +459,14 @@ open class BaseExplorerActivity : BaseActivity() { } } + private fun setMenuIconTint(menu: Menu, iconColor: Int, menuItemId: Int, drawableId: Int) { + menu.findItem(menuItemId)?.let { + it.icon = ContextCompat.getDrawable(this, drawableId)?.apply { + setTint(iconColor) + } + } + } + protected fun handleMenuItems(menu: Menu){ menu.findItem(R.id.rename).isVisible = false menu.findItem(R.id.open_as)?.isVisible = false @@ -465,6 +474,11 @@ open class BaseExplorerActivity : BaseActivity() { menu.findItem(R.id.external_open)?.isVisible = false } val noItemSelected = explorerAdapter.selectedItems.isEmpty() + val iconColor = ContextCompat.getColor(this, R.color.menuIconTint) + setMenuIconTint(menu, iconColor, R.id.sort, R.drawable.icon_sort) + setMenuIconTint(menu, iconColor, R.id.delete, R.drawable.icon_delete) + setMenuIconTint(menu, iconColor, R.id.decrypt, R.drawable.icon_decrypt) + setMenuIconTint(menu, iconColor, R.id.share, R.drawable.icon_share) menu.findItem(R.id.sort).isVisible = noItemSelected menu.findItem(R.id.close).isVisible = noItemSelected if (noItemSelected){ @@ -490,7 +504,7 @@ open class BaseExplorerActivity : BaseActivity() { true } R.id.sort -> { - ColoredAlertDialogBuilder(this) + CustomAlertDialogBuilder(this, themeValue) .setTitle(R.string.sort_order) .setSingleChoiceItems(DialogSingleChoiceAdapter(this, sortOrderEntries.toList()), currentSortOrderIndex) { dialog, which -> currentSortOrderIndex = which @@ -507,7 +521,7 @@ open class BaseExplorerActivity : BaseActivity() { val dialogEditText = dialogEditTextView.findViewById(R.id.dialog_edit_text) dialogEditText.setText(oldName) dialogEditText.selectAll() - val dialog = ColoredAlertDialogBuilder(this) + val dialog = CustomAlertDialogBuilder(this, themeValue) .setView(dialogEditTextView) .setTitle(R.string.rename_title) .setPositiveButton(R.string.ok) { _, _ -> 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 5dc71aa..ad065a8 100644 --- a/app/src/main/java/sushi/hardcore/droidfs/explorers/ExplorerActivity.kt +++ b/app/src/main/java/sushi/hardcore/droidfs/explorers/ExplorerActivity.kt @@ -19,7 +19,7 @@ import sushi.hardcore.droidfs.content_providers.ExternalProvider import sushi.hardcore.droidfs.databinding.ActivityExplorerBinding import sushi.hardcore.droidfs.file_operations.OperationFile import sushi.hardcore.droidfs.util.PathUtils -import sushi.hardcore.droidfs.widgets.ColoredAlertDialogBuilder +import sushi.hardcore.droidfs.widgets.CustomAlertDialogBuilder import java.io.File class ExplorerActivity : BaseExplorerActivity() { @@ -73,7 +73,7 @@ class ExplorerActivity : BaseExplorerActivity() { if (failedItem == null){ Toast.makeText(this, R.string.success_import, Toast.LENGTH_SHORT).show() } else { - ColoredAlertDialogBuilder(this) + CustomAlertDialogBuilder(this, themeValue) .setTitle(R.string.error) .setMessage(getString(R.string.import_failed, failedItem)) .setPositiveButton(R.string.ok, null) @@ -105,7 +105,7 @@ class ExplorerActivity : BaseExplorerActivity() { if (failedItem == null){ Toast.makeText(this, R.string.success_export, Toast.LENGTH_SHORT).show() } else { - ColoredAlertDialogBuilder(this) + CustomAlertDialogBuilder(this, themeValue) .setTitle(R.string.error) .setMessage(getString(R.string.export_failed, failedItem)) .setPositiveButton(R.string.ok, null) @@ -124,7 +124,7 @@ class ExplorerActivity : BaseExplorerActivity() { private fun onImportComplete(failedItem: String?, urisToWipe: List, rootFile: DocumentFile? = null) { if (failedItem == null){ - ColoredAlertDialogBuilder(this) + CustomAlertDialogBuilder(this, themeValue) .setTitle(R.string.success_import) .setMessage(""" ${getString(R.string.success_import_msg)} @@ -136,7 +136,7 @@ class ExplorerActivity : BaseExplorerActivity() { if (errorMsg == null){ Toast.makeText(this, R.string.wipe_successful, Toast.LENGTH_SHORT).show() } else { - ColoredAlertDialogBuilder(this) + CustomAlertDialogBuilder(this, themeValue) .setTitle(R.string.error) .setMessage(getString(R.string.wipe_failed, errorMsg)) .setPositiveButton(R.string.ok, null) @@ -148,7 +148,7 @@ class ExplorerActivity : BaseExplorerActivity() { .setNegativeButton(R.string.no, null) .show() } else { - ColoredAlertDialogBuilder(this) + CustomAlertDialogBuilder(this, themeValue) .setTitle(R.string.error) .setMessage(getString(R.string.import_failed, failedItem)) .setPositiveButton(R.string.ok, null) @@ -173,7 +173,7 @@ class ExplorerActivity : BaseExplorerActivity() { listOf("createFolder", R.string.mkdir, R.drawable.icon_create_new_folder), listOf("camera", R.string.camera, R.drawable.icon_camera) ) - ColoredAlertDialogBuilder(this) + CustomAlertDialogBuilder(this, themeValue) .setSingleChoiceItems(adapter, -1){ thisDialog, which -> when (adapter.getItem(which)){ "importFromOtherVolumes" -> { @@ -194,7 +194,7 @@ class ExplorerActivity : BaseExplorerActivity() { "createFile" -> { val dialogEditTextView = layoutInflater.inflate(R.layout.dialog_edit_text, null) val dialogEditText = dialogEditTextView.findViewById(R.id.dialog_edit_text) - val dialog = ColoredAlertDialogBuilder(this) + val dialog = CustomAlertDialogBuilder(this, themeValue) .setView(dialogEditTextView) .setTitle(getString(R.string.enter_file_name)) .setPositiveButton(R.string.ok) { _, _ -> @@ -247,7 +247,7 @@ class ExplorerActivity : BaseExplorerActivity() { val filePath = PathUtils.pathJoin(currentDirectoryPath, fileName) val handleID = gocryptfsVolume.openWriteMode(filePath) //don't check overwrite because openWriteMode open in read-write (doesn't erase content) if (handleID == -1) { - ColoredAlertDialogBuilder(this) + CustomAlertDialogBuilder(this, themeValue) .setTitle(R.string.error) .setMessage(R.string.file_creation_failed) .setPositiveButton(R.string.ok, null) @@ -333,7 +333,7 @@ class ExplorerActivity : BaseExplorerActivity() { if (failedItem == null){ Toast.makeText(this, R.string.copy_success, Toast.LENGTH_SHORT).show() } else { - ColoredAlertDialogBuilder(this) + CustomAlertDialogBuilder(this, themeValue) .setTitle(R.string.error) .setMessage(getString(R.string.copy_failed, failedItem)) .setPositiveButton(R.string.ok, null) @@ -355,7 +355,7 @@ class ExplorerActivity : BaseExplorerActivity() { if (failedItem == null){ Toast.makeText(this, R.string.move_success, Toast.LENGTH_SHORT).show() } else { - ColoredAlertDialogBuilder(this) + CustomAlertDialogBuilder(this, themeValue) .setTitle(R.string.error) .setMessage(getString(R.string.move_failed, failedItem)) .setPositiveButton(R.string.ok, null) @@ -373,7 +373,7 @@ class ExplorerActivity : BaseExplorerActivity() { } R.id.delete -> { val size = explorerAdapter.selectedItems.size - val dialog = ColoredAlertDialogBuilder(this) + val dialog = CustomAlertDialogBuilder(this, themeValue) dialog.setTitle(R.string.warning) dialog.setPositiveButton(R.string.ok) { _, _ -> removeSelectedItems() } dialog.setNegativeButton(R.string.cancel, null) @@ -391,7 +391,7 @@ class ExplorerActivity : BaseExplorerActivity() { paths.add(explorerElements[i].fullPath) } isStartingActivity = true - ExternalProvider.share(this, gocryptfsVolume, paths) + ExternalProvider.share(this, themeValue, gocryptfsVolume, paths) unselectAll() true } @@ -452,7 +452,7 @@ class ExplorerActivity : BaseExplorerActivity() { } } if (failedItem != null) { - ColoredAlertDialogBuilder(this) + CustomAlertDialogBuilder(this, themeValue) .setTitle(R.string.error) .setMessage(getString(R.string.remove_failed, failedItem)) .setPositiveButton(R.string.ok, null) diff --git a/app/src/main/java/sushi/hardcore/droidfs/explorers/ExplorerActivityDrop.kt b/app/src/main/java/sushi/hardcore/droidfs/explorers/ExplorerActivityDrop.kt index a7fb780..d3a7927 100644 --- a/app/src/main/java/sushi/hardcore/droidfs/explorers/ExplorerActivityDrop.kt +++ b/app/src/main/java/sushi/hardcore/droidfs/explorers/ExplorerActivityDrop.kt @@ -6,7 +6,7 @@ import android.view.Menu import android.view.MenuItem import sushi.hardcore.droidfs.R import sushi.hardcore.droidfs.databinding.ActivityExplorerDropBinding -import sushi.hardcore.droidfs.widgets.ColoredAlertDialogBuilder +import sushi.hardcore.droidfs.widgets.CustomAlertDialogBuilder class ExplorerActivityDrop : BaseExplorerActivity() { private lateinit var binding: ActivityExplorerDropBinding @@ -56,7 +56,7 @@ class ExplorerActivityDrop : BaseExplorerActivity() { getString(R.string.share_intent_parsing_failed) } errorMsg?.let { - ColoredAlertDialogBuilder(this) + CustomAlertDialogBuilder(this, themeValue) .setTitle(R.string.error) .setMessage(it) .setPositiveButton(R.string.ok, null) @@ -71,7 +71,7 @@ class ExplorerActivityDrop : BaseExplorerActivity() { private fun onImported(failedItem: String?){ setCurrentPath(currentDirectoryPath) if (failedItem == null) { - ColoredAlertDialogBuilder(this) + CustomAlertDialogBuilder(this, themeValue) .setTitle(R.string.success_import) .setMessage(R.string.success_import_msg) .setCancelable(false) @@ -80,7 +80,7 @@ class ExplorerActivityDrop : BaseExplorerActivity() { } .show() } else { - ColoredAlertDialogBuilder(this) + CustomAlertDialogBuilder(this, themeValue) .setTitle(R.string.error) .setMessage(getString(R.string.import_failed, failedItem)) .setPositiveButton(R.string.ok, null) 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 c635402..7b170d6 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 @@ -10,7 +10,7 @@ import sushi.hardcore.droidfs.R import sushi.hardcore.droidfs.content_providers.RestrictedFileProvider import sushi.hardcore.droidfs.explorers.ExplorerElement import sushi.hardcore.droidfs.util.PathUtils -import sushi.hardcore.droidfs.widgets.ColoredAlertDialogBuilder +import sushi.hardcore.droidfs.widgets.CustomAlertDialogBuilder abstract class FileViewerActivity: BaseActivity() { protected lateinit var gocryptfsVolume: GocryptfsVolume @@ -76,7 +76,7 @@ abstract class FileViewerActivity: BaseActivity() { if (success){ return fileBuff } else { - ColoredAlertDialogBuilder(this) + CustomAlertDialogBuilder(this, themeValue) .setTitle(R.string.error) .setMessage(R.string.read_file_failed) .setCancelable(false) @@ -84,7 +84,7 @@ abstract class FileViewerActivity: BaseActivity() { .show() } } catch (e: OutOfMemoryError){ - ColoredAlertDialogBuilder(this) + CustomAlertDialogBuilder(this, themeValue) .setTitle(R.string.error) .setMessage(R.string.outofmemoryerror_msg) .setCancelable(false) @@ -93,7 +93,7 @@ abstract class FileViewerActivity: BaseActivity() { } } else { - ColoredAlertDialogBuilder(this) + CustomAlertDialogBuilder(this, themeValue) .setTitle(R.string.error) .setMessage(R.string.get_size_failed) .setCancelable(false) diff --git a/app/src/main/java/sushi/hardcore/droidfs/file_viewers/ImageViewer.kt b/app/src/main/java/sushi/hardcore/droidfs/file_viewers/ImageViewer.kt index cf41d15..e8f3959 100644 --- a/app/src/main/java/sushi/hardcore/droidfs/file_viewers/ImageViewer.kt +++ b/app/src/main/java/sushi/hardcore/droidfs/file_viewers/ImageViewer.kt @@ -15,7 +15,7 @@ import com.bumptech.glide.load.resource.bitmap.BitmapTransformation import sushi.hardcore.droidfs.ConstValues import sushi.hardcore.droidfs.R import sushi.hardcore.droidfs.databinding.ActivityImageViewerBinding -import sushi.hardcore.droidfs.widgets.ColoredAlertDialogBuilder +import sushi.hardcore.droidfs.widgets.CustomAlertDialogBuilder import sushi.hardcore.droidfs.widgets.ZoomableImageView import java.io.ByteArrayInputStream import java.io.ByteArrayOutputStream @@ -87,7 +87,7 @@ class ImageViewer: FileViewerActivity() { } }) binding.imageDelete.setOnClickListener { - ColoredAlertDialogBuilder(this) + CustomAlertDialogBuilder(this, themeValue) .keepFullScreen() .setTitle(R.string.warning) .setPositiveButton(R.string.ok) { _, _ -> @@ -101,7 +101,7 @@ class ImageViewer: FileViewerActivity() { loadImage() } } else { - ColoredAlertDialogBuilder(this) + CustomAlertDialogBuilder(this, themeValue) .keepFullScreen() .setTitle(R.string.error) .setMessage(getString(R.string.remove_failed, fileName)) @@ -222,7 +222,7 @@ class ImageViewer: FileViewerActivity() { private fun askSaveRotation(callback: () -> Unit){ if (rotationAngle%360 != 0f && !slideshowActive){ - ColoredAlertDialogBuilder(this) + CustomAlertDialogBuilder(this, themeValue) .keepFullScreen() .setTitle(R.string.warning) .setMessage(R.string.ask_save_img_rotated) @@ -241,7 +241,7 @@ class ImageViewer: FileViewerActivity() { Toast.makeText(this, R.string.image_saved_successfully, Toast.LENGTH_SHORT).show() callback() } else { - ColoredAlertDialogBuilder(this) + CustomAlertDialogBuilder(this, themeValue) .keepFullScreen() .setTitle(R.string.error) .setMessage(R.string.file_write_failed) @@ -249,7 +249,7 @@ class ImageViewer: FileViewerActivity() { .show() } } else { - ColoredAlertDialogBuilder(this) + CustomAlertDialogBuilder(this, themeValue) .keepFullScreen() .setTitle(R.string.error) .setMessage(R.string.bitmap_compress_failed) diff --git a/app/src/main/java/sushi/hardcore/droidfs/file_viewers/MediaPlayer.kt b/app/src/main/java/sushi/hardcore/droidfs/file_viewers/MediaPlayer.kt index 7be6f3b..ead2166 100644 --- a/app/src/main/java/sushi/hardcore/droidfs/file_viewers/MediaPlayer.kt +++ b/app/src/main/java/sushi/hardcore/droidfs/file_viewers/MediaPlayer.kt @@ -7,7 +7,7 @@ import com.google.android.exoplayer2.source.MediaSource import com.google.android.exoplayer2.source.ProgressiveMediaSource import sushi.hardcore.droidfs.ConstValues import sushi.hardcore.droidfs.R -import sushi.hardcore.droidfs.widgets.ColoredAlertDialogBuilder +import sushi.hardcore.droidfs.widgets.CustomAlertDialogBuilder abstract class MediaPlayer: FileViewerActivity() { private lateinit var player: SimpleExoPlayer @@ -43,7 +43,7 @@ abstract class MediaPlayer: FileViewerActivity() { } } override fun onPlayerError(error: PlaybackException) { - ColoredAlertDialogBuilder(this@MediaPlayer) + CustomAlertDialogBuilder(this@MediaPlayer, themeValue) .setTitle(R.string.error) .setMessage(getString(R.string.playing_failed, error.errorCodeName)) .setCancelable(false) diff --git a/app/src/main/java/sushi/hardcore/droidfs/file_viewers/TextEditor.kt b/app/src/main/java/sushi/hardcore/droidfs/file_viewers/TextEditor.kt index 58ad05f..7380d76 100644 --- a/app/src/main/java/sushi/hardcore/droidfs/file_viewers/TextEditor.kt +++ b/app/src/main/java/sushi/hardcore/droidfs/file_viewers/TextEditor.kt @@ -11,7 +11,7 @@ import android.widget.Toast import androidx.appcompat.widget.Toolbar import sushi.hardcore.droidfs.R import sushi.hardcore.droidfs.GocryptfsVolume -import sushi.hardcore.droidfs.widgets.ColoredAlertDialogBuilder +import sushi.hardcore.droidfs.widgets.CustomAlertDialogBuilder import java.io.ByteArrayInputStream import java.io.File @@ -36,7 +36,7 @@ class TextEditor: FileViewerActivity() { try { loadLayout(String(it)) } catch (e: OutOfMemoryError){ - ColoredAlertDialogBuilder(this) + CustomAlertDialogBuilder(this, themeValue) .setTitle(R.string.error) .setMessage(R.string.outofmemoryerror_msg) .setCancelable(false) @@ -105,7 +105,7 @@ class TextEditor: FileViewerActivity() { private fun checkSaveAndExit(){ if (changedSinceLastSave){ - ColoredAlertDialogBuilder(this) + CustomAlertDialogBuilder(this, themeValue) .setTitle(R.string.warning) .setMessage(R.string.ask_save) .setPositiveButton(R.string.save) { _, _ -> diff --git a/app/src/main/java/sushi/hardcore/droidfs/widgets/ColoredBorderListView.kt b/app/src/main/java/sushi/hardcore/droidfs/widgets/ColoredBorderListView.kt deleted file mode 100644 index c9c6b33..0000000 --- a/app/src/main/java/sushi/hardcore/droidfs/widgets/ColoredBorderListView.kt +++ /dev/null @@ -1,28 +0,0 @@ -package sushi.hardcore.droidfs.widgets - -import android.content.Context -import android.graphics.drawable.ColorDrawable -import android.graphics.drawable.DrawableContainer -import android.graphics.drawable.GradientDrawable -import android.graphics.drawable.StateListDrawable -import android.util.AttributeSet -import android.widget.ListView -import androidx.core.content.ContextCompat -import sushi.hardcore.droidfs.R - -open class ColoredBorderListView: ListView { - constructor(context: Context) : super(context) { applyColor() } - constructor(context: Context, attrs: AttributeSet): super(context, attrs) { applyColor() } - constructor(context: Context, attrs: AttributeSet, defStyleAttr: Int): super(context, attrs, defStyleAttr) { applyColor() } - private fun applyColor(){ - val background = ContextCompat.getDrawable(context, R.drawable.listview_border) as StateListDrawable - val dcs = background.constantState as DrawableContainer.DrawableContainerState - val drawableItems = dcs.children - val gradientDrawable = drawableItems[0] as GradientDrawable - val themeColor = ThemeColor.getThemeColor(context) - gradientDrawable.setStroke(context.resources.displayMetrics.density.toInt()*2, themeColor) - super.setBackground(background) - super.setDivider(ColorDrawable(themeColor)) - super.setDividerHeight(context.resources.displayMetrics.density.toInt()*2) - } -} \ No newline at end of file diff --git a/app/src/main/java/sushi/hardcore/droidfs/widgets/ColoredCheckBox.kt b/app/src/main/java/sushi/hardcore/droidfs/widgets/ColoredCheckBox.kt deleted file mode 100644 index 9e26f44..0000000 --- a/app/src/main/java/sushi/hardcore/droidfs/widgets/ColoredCheckBox.kt +++ /dev/null @@ -1,15 +0,0 @@ -package sushi.hardcore.droidfs.widgets - -import android.content.Context -import android.content.res.ColorStateList -import android.util.AttributeSet -import androidx.appcompat.widget.AppCompatCheckBox - -class ColoredCheckBox: AppCompatCheckBox { - constructor(context: Context) : super(context) { applyColor() } - constructor(context: Context, attrs: AttributeSet): super(context, attrs) { applyColor() } - constructor(context: Context, attrs: AttributeSet, defStyleAttr: Int): super(context, attrs, defStyleAttr) { applyColor() } - private fun applyColor(){ - super.setButtonTintList(ColorStateList.valueOf(ThemeColor.getThemeColor(context))) - } -} \ No newline at end of file diff --git a/app/src/main/java/sushi/hardcore/droidfs/widgets/ColoredEditText.kt b/app/src/main/java/sushi/hardcore/droidfs/widgets/ColoredEditText.kt deleted file mode 100644 index 08adefa..0000000 --- a/app/src/main/java/sushi/hardcore/droidfs/widgets/ColoredEditText.kt +++ /dev/null @@ -1,15 +0,0 @@ -package sushi.hardcore.droidfs.widgets - -import android.content.Context -import android.content.res.ColorStateList -import android.util.AttributeSet -import androidx.appcompat.widget.AppCompatEditText - -class ColoredEditText: AppCompatEditText { - constructor(context: Context) : super(context) { applyColor() } - constructor(context: Context, attrs: AttributeSet): super(context, attrs) { applyColor() } - constructor(context: Context, attrs: AttributeSet, defStyleAttr: Int): super(context, attrs, defStyleAttr) { applyColor() } - private fun applyColor(){ - super.setBackgroundTintList(ColorStateList.valueOf(ThemeColor.getThemeColor(context))) - } -} diff --git a/app/src/main/java/sushi/hardcore/droidfs/widgets/ColoredFAB.kt b/app/src/main/java/sushi/hardcore/droidfs/widgets/ColoredFAB.kt deleted file mode 100644 index 0077a42..0000000 --- a/app/src/main/java/sushi/hardcore/droidfs/widgets/ColoredFAB.kt +++ /dev/null @@ -1,18 +0,0 @@ -package sushi.hardcore.droidfs.widgets - -import android.content.Context -import android.content.res.ColorStateList -import android.util.AttributeSet -import androidx.core.content.ContextCompat -import com.google.android.material.floatingactionbutton.FloatingActionButton - -class ColoredFAB: FloatingActionButton { - constructor(context: Context) : super(context) { applyColor() } - constructor(context: Context, attrs: AttributeSet): super(context, attrs) { applyColor() } - constructor(context: Context, attrs: AttributeSet, defStyleAttr: Int): super(context, attrs, defStyleAttr) { applyColor() } - private fun applyColor(){ - val themeColor = ThemeColor.getThemeColor(context) - backgroundTintList = ColorStateList.valueOf(themeColor) - setColorFilter(ContextCompat.getColor(context, android.R.color.white)) - } -} \ No newline at end of file diff --git a/app/src/main/java/sushi/hardcore/droidfs/widgets/ColoredImageButton.kt b/app/src/main/java/sushi/hardcore/droidfs/widgets/ColoredImageButton.kt deleted file mode 100644 index fe98131..0000000 --- a/app/src/main/java/sushi/hardcore/droidfs/widgets/ColoredImageButton.kt +++ /dev/null @@ -1,14 +0,0 @@ -package sushi.hardcore.droidfs.widgets - -import android.content.Context -import android.util.AttributeSet -import androidx.appcompat.widget.AppCompatImageButton - -class ColoredImageButton: AppCompatImageButton { - constructor(context: Context) : super(context) { applyColor() } - constructor(context: Context, attrs: AttributeSet): super(context, attrs) { applyColor() } - constructor(context: Context, attrs: AttributeSet, defStyleAttr: Int): super(context, attrs, defStyleAttr) { applyColor() } - private fun applyColor(){ - super.setColorFilter(ThemeColor.getThemeColor(context)) - } -} \ No newline at end of file diff --git a/app/src/main/java/sushi/hardcore/droidfs/widgets/ColoredImageView.kt b/app/src/main/java/sushi/hardcore/droidfs/widgets/ColoredImageView.kt deleted file mode 100644 index 752659b..0000000 --- a/app/src/main/java/sushi/hardcore/droidfs/widgets/ColoredImageView.kt +++ /dev/null @@ -1,14 +0,0 @@ -package sushi.hardcore.droidfs.widgets - -import android.content.Context -import android.util.AttributeSet -import androidx.appcompat.widget.AppCompatImageView - -class ColoredImageView : AppCompatImageView { - constructor(context: Context) : super(context) { applyColor() } - constructor(context: Context, attrs: AttributeSet): super(context, attrs) { applyColor() } - constructor(context: Context, attrs: AttributeSet, defStyleAttr: Int): super(context, attrs, defStyleAttr) { applyColor() } - private fun applyColor(){ - super.setColorFilter(ThemeColor.getThemeColor(context)) - } -} \ No newline at end of file diff --git a/app/src/main/java/sushi/hardcore/droidfs/widgets/ColoredListPreference.kt b/app/src/main/java/sushi/hardcore/droidfs/widgets/ColoredListPreference.kt deleted file mode 100644 index f0495fd..0000000 --- a/app/src/main/java/sushi/hardcore/droidfs/widgets/ColoredListPreference.kt +++ /dev/null @@ -1,30 +0,0 @@ -package sushi.hardcore.droidfs.widgets - -import android.content.Context -import android.util.AttributeSet -import androidx.preference.ListPreference -import sushi.hardcore.droidfs.R -import sushi.hardcore.droidfs.adapters.DialogSingleChoiceAdapter - -class ColoredListPreference: ListPreference { - constructor(context: Context): super(context) - constructor(context: Context, attrs: AttributeSet): super(context, attrs) - constructor(context: Context, attrs: AttributeSet, defStyleAttr: Int): super(context, attrs, defStyleAttr) - - override fun onAttached() { - super.onAttached() - summary = entries[entryValues.indexOf(getPersistedString(value))] - } - - override fun onClick() { - ColoredAlertDialogBuilder(context) - .setTitle(title) - .setSingleChoiceItems(DialogSingleChoiceAdapter(context, entries.map { s -> s.toString() }), entryValues.indexOf(getPersistedString(value))) { dialog, which -> - dialog.dismiss() - summary = entries[which].toString() - persistString(entryValues[which].toString()) - } - .setNegativeButton(R.string.cancel) { dialog, _ -> dialog.dismiss() } - .show() - } -} \ No newline at end of file diff --git a/app/src/main/java/sushi/hardcore/droidfs/widgets/ColoredAlertDialogBuilder.kt b/app/src/main/java/sushi/hardcore/droidfs/widgets/CustomAlertDialogBuilder.kt similarity index 52% rename from app/src/main/java/sushi/hardcore/droidfs/widgets/ColoredAlertDialogBuilder.kt rename to app/src/main/java/sushi/hardcore/droidfs/widgets/CustomAlertDialogBuilder.kt index 2816b42..6f643be 100644 --- a/app/src/main/java/sushi/hardcore/droidfs/widgets/ColoredAlertDialogBuilder.kt +++ b/app/src/main/java/sushi/hardcore/droidfs/widgets/CustomAlertDialogBuilder.kt @@ -1,15 +1,29 @@ package sushi.hardcore.droidfs.widgets import android.content.Context +import android.util.TypedValue import android.view.WindowManager import androidx.appcompat.app.AlertDialog import androidx.core.view.WindowInsetsCompat import androidx.core.view.WindowInsetsControllerCompat +import sushi.hardcore.droidfs.R -class ColoredAlertDialogBuilder: AlertDialog.Builder { - constructor(context: Context): super(context) - constructor(context: Context, themeResId: Int): super(context, themeResId) - +class CustomAlertDialogBuilder(context: Context, theme: String) : AlertDialog.Builder( + context, when (theme) { + "black_green" -> R.style.BlackGreenDialog + "dark_red" -> R.style.DarkRedDialog + "black_red" -> R.style.BlackRedDialog + "dark_blue" -> R.style.DarkBlueDialog + "black_blue" -> R.style.BlackBlueDialog + "dark_yellow" -> R.style.DarkYellowDialog + "black_yellow" -> R.style.BlackYellowDialog + "dark_orange" -> R.style.DarkOrangeDialog + "black_orange" -> R.style.BlackOrangeDialog + "dark_purple" -> R.style.DarkPurpleDialog + "black_purple" -> R.style.BlackPurpleDialog + else -> R.style.DarkGreenDialog + } +) { private var keepFullScreen = false fun keepFullScreen(): AlertDialog.Builder { @@ -17,15 +31,6 @@ class ColoredAlertDialogBuilder: AlertDialog.Builder { return this } - private fun applyColor(dialog: AlertDialog){ - dialog.setOnShowListener{ - val themeColor = ThemeColor.getThemeColor(context) - for (i in listOf(AlertDialog.BUTTON_POSITIVE, AlertDialog.BUTTON_NEGATIVE, AlertDialog.BUTTON_NEUTRAL)){ - dialog.getButton(i).setTextColor(themeColor) - } - } - } - override fun show(): AlertDialog { val dialog = create() dialog.show() @@ -41,7 +46,13 @@ class ColoredAlertDialogBuilder: AlertDialog.Builder { override fun create(): AlertDialog { val dialog = super.create() - applyColor(dialog) + dialog.setOnShowListener { + val typedValue = TypedValue() + context.theme.resolveAttribute(R.attr.colorAccent, typedValue, true) + for (i in listOf(AlertDialog.BUTTON_POSITIVE, AlertDialog.BUTTON_NEGATIVE, AlertDialog.BUTTON_NEUTRAL)) { + dialog.getButton(i).setTextColor(typedValue.data) + } + } if (keepFullScreen){ dialog.window?.setFlags(WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE, WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE) } diff --git a/app/src/main/java/sushi/hardcore/droidfs/widgets/NonScrollableColoredBorderListView.kt b/app/src/main/java/sushi/hardcore/droidfs/widgets/NonScrollableColoredBorderListView.kt index bf31c1a..72cb5a6 100644 --- a/app/src/main/java/sushi/hardcore/droidfs/widgets/NonScrollableColoredBorderListView.kt +++ b/app/src/main/java/sushi/hardcore/droidfs/widgets/NonScrollableColoredBorderListView.kt @@ -1,13 +1,26 @@ package sushi.hardcore.droidfs.widgets import android.content.Context +import android.graphics.drawable.ColorDrawable import android.util.AttributeSet +import android.util.TypedValue import android.widget.ListAdapter +import android.widget.ListView +import androidx.core.content.ContextCompat +import sushi.hardcore.droidfs.R -class NonScrollableColoredBorderListView: ColoredBorderListView { - constructor(context: Context) : super(context) - constructor(context: Context, attrs: AttributeSet): super(context, attrs) - constructor(context: Context, attrs: AttributeSet, defStyleAttr: Int): super(context, attrs, defStyleAttr) +class NonScrollableColoredBorderListView: ListView { + constructor(context: Context) : super(context) { applyColor() } + constructor(context: Context, attrs: AttributeSet): super(context, attrs) { applyColor() } + constructor(context: Context, attrs: AttributeSet, defStyleAttr: Int): super(context, attrs, defStyleAttr) { applyColor() } + + fun applyColor() { + val typedValue = TypedValue() + context.theme.resolveAttribute(R.attr.colorAccent, typedValue, true) + divider = ColorDrawable(typedValue.data) + dividerHeight = context.resources.displayMetrics.density.toInt()*2 + background = ContextCompat.getDrawable(context, R.drawable.listview_border) + } fun computeHeight(): Int { var totalHeight = 0 diff --git a/app/src/main/java/sushi/hardcore/droidfs/widgets/SimpleActionPreference.kt b/app/src/main/java/sushi/hardcore/droidfs/widgets/SimpleActionPreference.kt deleted file mode 100644 index d810994..0000000 --- a/app/src/main/java/sushi/hardcore/droidfs/widgets/SimpleActionPreference.kt +++ /dev/null @@ -1,16 +0,0 @@ -package sushi.hardcore.droidfs.widgets - -import android.content.Context -import android.util.AttributeSet -import androidx.preference.Preference - -class SimpleActionPreference: Preference { - constructor(context: Context): super(context) - constructor(context: Context, attrs: AttributeSet): super(context, attrs) - constructor(context: Context, attrs: AttributeSet, defStyleAttr: Int): super(context, attrs, defStyleAttr) - var onClick: ((SimpleActionPreference) -> Unit)? = null - - override fun onClick() { - onClick?.let { it(this) } - } -} \ No newline at end of file diff --git a/app/src/main/java/sushi/hardcore/droidfs/widgets/ThemeColor.kt b/app/src/main/java/sushi/hardcore/droidfs/widgets/ThemeColor.kt deleted file mode 100644 index 2b4abcb..0000000 --- a/app/src/main/java/sushi/hardcore/droidfs/widgets/ThemeColor.kt +++ /dev/null @@ -1,25 +0,0 @@ -package sushi.hardcore.droidfs.widgets - -import android.content.Context -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 - -object ThemeColor { - fun getThemeColor(context: Context): Int { - 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 if (preference.icon != null) { - DrawableCompat.setTint(preference.icon, color) - } - } -} diff --git a/app/src/main/res/drawable/button_background.xml b/app/src/main/res/drawable/button_background.xml index eea8b35..0333b0a 100644 --- a/app/src/main/res/drawable/button_background.xml +++ b/app/src/main/res/drawable/button_background.xml @@ -2,7 +2,7 @@ - + diff --git a/app/src/main/res/drawable/icon_camera.xml b/app/src/main/res/drawable/icon_camera.xml index 9141101..1c4afad 100644 --- a/app/src/main/res/drawable/icon_camera.xml +++ b/app/src/main/res/drawable/icon_camera.xml @@ -1,6 +1,6 @@ - - - + + diff --git a/app/src/main/res/drawable/icon_create_new_folder.xml b/app/src/main/res/drawable/icon_create_new_folder.xml index 9720363..7ddd5d7 100644 --- a/app/src/main/res/drawable/icon_create_new_folder.xml +++ b/app/src/main/res/drawable/icon_create_new_folder.xml @@ -1,5 +1,5 @@ - - + diff --git a/app/src/main/res/drawable/icon_decrypt.xml b/app/src/main/res/drawable/icon_decrypt.xml index f954e2c..af00ff0 100644 --- a/app/src/main/res/drawable/icon_decrypt.xml +++ b/app/src/main/res/drawable/icon_decrypt.xml @@ -1,4 +1,4 @@ - + diff --git a/app/src/main/res/drawable/icon_delete.xml b/app/src/main/res/drawable/icon_delete.xml index 2e5ece8..a48a72d 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_encrypt.xml b/app/src/main/res/drawable/icon_encrypt.xml index 2ca3d21..3195b9e 100644 --- a/app/src/main/res/drawable/icon_encrypt.xml +++ b/app/src/main/res/drawable/icon_encrypt.xml @@ -5,6 +5,5 @@ android:viewportHeight="500"> - + android:fillColor="?attr/colorAccent"/> + \ No newline at end of file diff --git a/app/src/main/res/drawable/icon_file_audio.xml b/app/src/main/res/drawable/icon_file_audio.xml index bf4bba1..7fb4eee 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 849c2db..d122751 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 530021b..1974a56 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 106117f..8dd054e 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 13c239b..fdbaa8c 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 3930214..01d0a73 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 f4397fa..bd6f0e2 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_folder_search.xml b/app/src/main/res/drawable/icon_folder_search.xml index 8b6ce33..e6085a2 100644 --- a/app/src/main/res/drawable/icon_folder_search.xml +++ b/app/src/main/res/drawable/icon_folder_search.xml @@ -4,6 +4,6 @@ android:viewportWidth="24" android:viewportHeight="24"> diff --git a/app/src/main/res/drawable/icon_gitea.xml b/app/src/main/res/drawable/icon_gitea.xml index c32b568..0a42a15 100644 --- a/app/src/main/res/drawable/icon_gitea.xml +++ b/app/src/main/res/drawable/icon_gitea.xml @@ -4,6 +4,6 @@ android:viewportWidth="32" android:viewportHeight="32"> diff --git a/app/src/main/res/drawable/icon_github.xml b/app/src/main/res/drawable/icon_github.xml index 0ffbbbc..f6d7f78 100644 --- a/app/src/main/res/drawable/icon_github.xml +++ b/app/src/main/res/drawable/icon_github.xml @@ -6,5 +6,5 @@ android:viewportHeight="24"> + android:fillColor="?attr/colorAccent" android:pathData="M10.9,2.1c-4.6,0.5-8.3,4.2-8.8,8.7c-0.6,5,2.5,9.3,6.9,10.7v-2.3c0,0-0.4,0.1-0.9,0.1c-1.4,0-2-1.2-2.1-1.9 c-0.1-0.4-0.3-0.7-0.6-1C5.1,16.3,5,16.3,5,16.2C5,16,5.3,16,5.4,16c0.6,0,1.1,0.7,1.3,1c0.5,0.8,1.1,1,1.4,1c0.4,0,0.7-0.1,0.9-0.2 c0.1-0.7,0.4-1.4,1-1.8c-2.3-0.5-4-1.8-4-4c0-1.1,0.5-2.2,1.2-3C7.1,8.8,7,8.3,7,7.6C7,7.2,7,6.6,7.3,6c0,0,1.4,0,2.8,1.3 C10.6,7.1,11.3,7,12,7s1.4,0.1,2,0.3C15.3,6,16.8,6,16.8,6C17,6.6,17,7.2,17,7.6c0,0.8-0.1,1.2-0.2,1.4c0.7,0.8,1.2,1.8,1.2,3 c0,2.2-1.7,3.5-4,4c0.6,0.5,1,1.4,1,2.3v3.3c4.1-1.3,7-5.1,7-9.5C22,6.1,16.9,1.4,10.9,2.1z" /> diff --git a/app/src/main/res/drawable/icon_import_folder.xml b/app/src/main/res/drawable/icon_import_folder.xml index 74484f0..eb10766 100644 --- a/app/src/main/res/drawable/icon_import_folder.xml +++ b/app/src/main/res/drawable/icon_import_folder.xml @@ -1,5 +1,5 @@ - - + diff --git a/app/src/main/res/drawable/icon_info.xml b/app/src/main/res/drawable/icon_info.xml index 654cfb3..96ad926 100644 --- a/app/src/main/res/drawable/icon_info.xml +++ b/app/src/main/res/drawable/icon_info.xml @@ -1,5 +1,5 @@ - - + diff --git a/app/src/main/res/drawable/icon_notes.xml b/app/src/main/res/drawable/icon_notes.xml index 900853e..ea8092b 100644 --- a/app/src/main/res/drawable/icon_notes.xml +++ b/app/src/main/res/drawable/icon_notes.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 a73d244..a9edead 100644 --- a/app/src/main/res/drawable/icon_open_in_new.xml +++ b/app/src/main/res/drawable/icon_open_in_new.xml @@ -1,5 +1,5 @@ - - + diff --git a/app/src/main/res/drawable/icon_palette.xml b/app/src/main/res/drawable/icon_palette.xml index b87ca00..bfc01a7 100644 --- a/app/src/main/res/drawable/icon_palette.xml +++ b/app/src/main/res/drawable/icon_palette.xml @@ -1,5 +1,5 @@ - - + diff --git a/app/src/main/res/drawable/icon_restore.xml b/app/src/main/res/drawable/icon_restore.xml deleted file mode 100644 index 98a8216..0000000 --- a/app/src/main/res/drawable/icon_restore.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - diff --git a/app/src/main/res/drawable/icon_screen_rotation.xml b/app/src/main/res/drawable/icon_screen_rotation.xml index 66eca5c..9bc0f2b 100644 --- a/app/src/main/res/drawable/icon_screen_rotation.xml +++ b/app/src/main/res/drawable/icon_screen_rotation.xml @@ -1,5 +1,5 @@ - - + diff --git a/app/src/main/res/drawable/icon_screenshot.xml b/app/src/main/res/drawable/icon_screenshot.xml index e8555d4..410a456 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="#FFFFFF"> + android:tint="?attr/colorAccent"> - + diff --git a/app/src/main/res/drawable/icon_sort.xml b/app/src/main/res/drawable/icon_sort.xml index 55c6338..eb00221 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_transfert.xml b/app/src/main/res/drawable/icon_transfert.xml index f867984..7cbe751 100644 --- a/app/src/main/res/drawable/icon_transfert.xml +++ b/app/src/main/res/drawable/icon_transfert.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 037eb63..259b7f3 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/drawable/listview_border.xml b/app/src/main/res/drawable/listview_border.xml index e54815b..b0366c6 100644 --- a/app/src/main/res/drawable/listview_border.xml +++ b/app/src/main/res/drawable/listview_border.xml @@ -4,7 +4,7 @@ - + \ No newline at end of file diff --git a/app/src/main/res/layout/activity_change_password.xml b/app/src/main/res/layout/activity_change_password.xml index cb23c8d..cd9914d 100644 --- a/app/src/main/res/layout/activity_change_password.xml +++ b/app/src/main/res/layout/activity_change_password.xml @@ -29,7 +29,7 @@ android:text="@string/old_password" android:textSize="@dimen/edit_text_label_text_size" /> - - - + android:text="@string/change_password"/> diff --git a/app/src/main/res/layout/activity_create.xml b/app/src/main/res/layout/activity_create.xml index 96ca8f5..9d0d3de 100644 --- a/app/src/main/res/layout/activity_create.xml +++ b/app/src/main/res/layout/activity_create.xml @@ -29,7 +29,7 @@ android:text="@string/password" android:textSize="@dimen/edit_text_label_text_size" /> - - + android:text="@string/create"/> diff --git a/app/src/main/res/layout/activity_explorer.xml b/app/src/main/res/layout/activity_explorer.xml index b4bbc33..22fb317 100644 --- a/app/src/main/res/layout/activity_explorer.xml +++ b/app/src/main/res/layout/activity_explorer.xml @@ -36,7 +36,7 @@ - - - + android:text="@string/open_volume"/> + android:text="@string/create_volume"/> + android:text="@string/change_volume_password"/> diff --git a/app/src/main/res/layout/activity_open.xml b/app/src/main/res/layout/activity_open.xml index 864cd2f..b5a1c22 100644 --- a/app/src/main/res/layout/activity_open.xml +++ b/app/src/main/res/layout/activity_open.xml @@ -29,7 +29,7 @@ android:text="@string/password" android:textSize="@dimen/edit_text_label_text_size" /> - + android:text="@string/open"/> diff --git a/app/src/main/res/layout/activity_settings.xml b/app/src/main/res/layout/activity_settings.xml index bf1e2df..13ad7fe 100644 --- a/app/src/main/res/layout/activity_settings.xml +++ b/app/src/main/res/layout/activity_settings.xml @@ -8,7 +8,6 @@ diff --git a/app/src/main/res/layout/adapter_dialog_icon_text.xml b/app/src/main/res/layout/adapter_dialog_icon_text.xml index 9cf8741..f3ec422 100644 --- a/app/src/main/res/layout/adapter_dialog_icon_text.xml +++ b/app/src/main/res/layout/adapter_dialog_icon_text.xml @@ -4,7 +4,7 @@ android:layout_width="match_parent" android:layout_height="match_parent"> - - - - - - + \ No newline at end of file diff --git a/app/src/main/res/layout/explorer_info_bar.xml b/app/src/main/res/layout/explorer_info_bar.xml index 57a6823..a675cd0 100644 --- a/app/src/main/res/layout/explorer_info_bar.xml +++ b/app/src/main/res/layout/explorer_info_bar.xml @@ -3,7 +3,7 @@ android:layout_width="match_parent" android:layout_height="25dp" xmlns:app="http://schemas.android.com/apk/res-auto" - android:background="@color/infoBarBackgroundColor" + android:background="?attr/infoBarBackgroundColor" android:gravity="center_vertical"> - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layout/toolbar.xml b/app/src/main/res/layout/toolbar.xml index 243bf96..1503941 100644 --- a/app/src/main/res/layout/toolbar.xml +++ b/app/src/main/res/layout/toolbar.xml @@ -4,7 +4,7 @@ android:layout_height="wrap_content" xmlns:app="http://schemas.android.com/apk/res-auto" android:id="@+id/toolbar" - android:background="@color/colorPrimaryDark" + android:background="@color/primary" app:titleTextColor="@color/textColor" android:elevation="4dp"> diff --git a/app/src/main/res/layout/volume_path_section.xml b/app/src/main/res/layout/volume_path_section.xml index 6fa87c0..5709c51 100644 --- a/app/src/main/res/layout/volume_path_section.xml +++ b/app/src/main/res/layout/volume_path_section.xml @@ -25,7 +25,7 @@ android:text="@string/volume_path" android:textSize="@dimen/edit_text_label_text_size" /> - - - Não foi possível abrir Falha ao abrir o volume. Por favor, verifique sua senha. Compartilhar arquivo - Armazenamento indisponível - DroidFS não vai funcionar sem acesso ao armazenamento. Permissão de armazenamento negada DroidFS não vai funcionar sem permissão de acesso ao armazenamento. Falha na recuperação do tamanho do arquivo. @@ -107,15 +105,12 @@ Gerenciar opções perigosas Alternar opções perigosas IU - Cor do tema - Definir uma cor personalizada do tema DroidFS tenta ser o mais seguro possível. No entanto, a segurança muitas vezes resulta em falta de conforto. Por isso o DroidFS oferece opções adicionais que você pode alternar de acordo com as suas necessidades.\n\nAviso: estas opções podem ser PERIGOSAS. Não as utilize a menos que você saiba o que está fazendo. É altamente recomendável ler a documentação antes de ativá-las. Ver opções perigosas Abrir como Imagem Vídeo Áudio - Falha ao abrir o reprodutor de mídia. Falha ao reproduzir este arquivo: %s Texto Falha ao salvar @@ -150,8 +145,6 @@ %s já existe, você quer substitui-lo ? %s já existe, você quer integrar ao conteúdo ? Digite um novo nome - Resetar a cor do tema - Resetar a cor do tema para padrão Copiar Transferência do arquivo %s falhou. Transferência bem sucedida! diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml index faf3756..50099b0 100644 --- a/app/src/main/res/values-ru/strings.xml +++ b/app/src/main/res/values-ru/strings.xml @@ -35,8 +35,6 @@ Ошибка открытия Невозможно открыть том. Проверьте пароль. Поделиться файлом - Хранилище недоступно - DroidFS не может работать без доступа к хранилищу. Доступ к хранилищу запрещён DroidFS не может работать без разрешения на доступ к хранилищу. Невозможно получить размер файла. @@ -106,15 +104,12 @@ Управление небезопасными функциями Включить/отключить небезопасные функции Интерфейс - Цвет темы - Установить собственный цвет темы DroidFS старается быть максимально безопасным, однако безопасность часто связана с появлением неудобств. Поэтому DroidFS предлагает дополнительные небезопасные функции, которые вы можете включить/отключить в соответствии со своими потребностями.\n\nПредупреждение: эти функции могут быть НЕБЕЗОПАСНЫМИ. Не используйте их, если не уверены в своих действиях. Настоятельно рекомендуется прочитать документацию перед их включением. Посмотреть небезопасные функции Открыть как Изображение Видео Аудио - Невозможно инициализировать медиапроигрыватель. Невозможно воспроизвести файл: %s Текст Невозможно сохранить. @@ -148,8 +143,6 @@ %s уже существует, переписать его? %s уже существует, объединить содержимое? Введите новое имя - Сброс цвета темы - Сбросить цвет темы на значение по умолчанию Копировать Ошибка при перемещении %s. Перемещение выполнено! diff --git a/app/src/main/res/values/arrays.xml b/app/src/main/res/values/arrays.xml index 4785015..f143993 100644 --- a/app/src/main/res/values/arrays.xml +++ b/app/src/main/res/values/arrays.xml @@ -14,6 +14,21 @@ Date (desc) + + Dark Green + Black Green + Dark Red + Black Red + Dark Blue + Black Blue + Dark Yellow + Black Yellow + Dark Orange + Black Orange + Dark Purple + Black Purple + + name @@ -23,4 +38,19 @@ size_desc date_desc + + + dark_green + black_green + dark_red + black_red + dark_blue + black_blue + dark_yellow + black_yellow + dark_orange + black_orange + dark_purple + black_purple + \ No newline at end of file diff --git a/app/src/main/res/values/attrs.xml b/app/src/main/res/values/attrs.xml new file mode 100644 index 0000000..74e7e3a --- /dev/null +++ b/app/src/main/res/values/attrs.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml index 6805488..81df520 100644 --- a/app/src/main/res/values/colors.xml +++ b/app/src/main/res/values/colors.xml @@ -1,18 +1,16 @@ - #262626 - #262626 - #6CC341 - @color/colorPrimaryDark - @color/colorPrimaryDark - @color/colorAccent - #333333 - #000000 - #FFFFFF - #5B5A5C - #66666666 - #111111 - #FFFFFF - #6CC341 - #ff0000 + #262626 + #6CC341 + #000000 + #FFFFFF + #ff0000 + #00B8D4 + #FFD600 + #FF6D00 + #AA00FF + @color/white + @color/black + @color/white + #66666666 \ No newline at end of file diff --git a/app/src/main/res/values/dialog_styles.xml b/app/src/main/res/values/dialog_styles.xml new file mode 100644 index 0000000..845912c --- /dev/null +++ b/app/src/main/res/values/dialog_styles.xml @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 6b064fe..67a6acf 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -37,8 +37,6 @@ Open failed Failed to open the volume. Please check your password. Share File - Storage unavailable - DroidFS can\'t work without storage access. Storage permission denied DroidFS can\'t work without storage permissions. Failed to retrieve file size. @@ -109,15 +107,12 @@ Manage unsafe features Enable/Disable unsafe features UI - Theme color - Set a custom theme color DroidFS try to be as secure as possible. However, security often involves lack of comfort. This is why DroidFS offer you additional unsafe features that you can enable/disable according to your needs.\n\nWarning: this features can be UNSAFE. Do not use them unless you know exactly what you are doing. It is highly recommended to read the documentation before enabling them. See unsafe features Open as Image Video Audio - Failed to initialize the media player. Failed to play this file: %s Text Save failed @@ -153,8 +148,6 @@ %s already exists, do you want to overwrite it ? %s already exists, do you want to merge its content ? Enter new name - Reset theme color - Reset theme color to the default one Copy Move of %s failed. Move successful ! @@ -209,4 +202,6 @@ Auto XChaCha20-Poly1305 is only supported since gocryptfs v2.2.0. Older versions won\'t be able to open a volume based on this cipher. Encryption cipher: + Theme + Customize app theme diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml index 1ba66ad..27d7e4a 100644 --- a/app/src/main/res/values/styles.xml +++ b/app/src/main/res/values/styles.xml @@ -1,19 +1,62 @@ - - - + + + + + + + + + + + + + + + -