Switch from Cyanea to Themes

cryfs
Hardcore Sushi 2021-11-09 11:12:09 +01:00
parent d572a8d2dc
commit d3f0d059f8
Signed by: hardcoresushi
GPG Key ID: 007F84120107191E
89 changed files with 437 additions and 560 deletions

View File

@ -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"

View File

@ -25,13 +25,12 @@
tools:node="remove" /> <!--removing this permission automatically added by exoplayer-->
<application
android:name=".ColoredApplication"
android:allowBackup="false"
android:icon="@mipmap/icon_launcher"
android:label="@string/app_name"
android:requestLegacyExternalStorage="true"
android:supportsRtl="true"
android:theme="@style/AppTheme">
android:theme="@style/BaseTheme">
<activity
android:name=".CameraActivity"
android:screenOrientation="nosensor" />

View File

@ -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()
}
}
}

View File

@ -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<EditText>(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)

View File

@ -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)

View File

@ -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)
}
}

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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<ColorPreferenceCompat>("themeColor")?.let { colorPicker ->
colorPicker.onPreferenceChangeListener = Preference.OnPreferenceChangeListener{ _, _ ->
(activity as SettingsActivity).changeThemeColor()
true
}
findPreference<SimpleActionPreference>("resetThemeColor")?.onClick = {
originalThemeColor?.let {
colorPicker.saveValue(it)
val settingsActivity = (activity as SettingsActivity)
Thread {
settingsActivity.sharedPrefs.edit().commit()
settingsActivity.runOnUiThread { settingsActivity.changeThemeColor() }
}.start()
}
}
findPreference<ListPreference>("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()))
}
}
}

View File

@ -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<ColoredImageButton>(R.id.button_pick_directory).setOnClickListener {
findViewById<ImageButton>(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)) {

View File

@ -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<String>): 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
}

View File

@ -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<ExplorerElement>()
private val inflater: LayoutInflater = LayoutInflater.from(context)
val selectedItems: MutableList<Int> = 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<ImageView>(R.id.icon_element)
val icon = ContextCompat.getDrawable(context, drawableId)
icon?.colorFilter = PorterDuffColorFilter(themeColor, PorterDuff.Mode.SRC_IN)
elementIcon.setImageDrawable(icon)
view.findViewById<ImageView>(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))
}

View File

@ -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<TextView>(R.id.text)
text.text = context.getString(items[position][1] as Int)
val icon = view.findViewById<ColoredImageView>(R.id.icon)
icon.setImageDrawable(context.getDrawable(items[position][2] as Int))
val icon = view.findViewById<ImageView>(R.id.icon)
icon.setImageDrawable(AppCompatResources.getDrawable(context, items[position][2] as Int))
return view
}

View File

@ -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<ImageView>(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) {

View File

@ -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<Uri> = 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<String>) {
object : LoadingTask(activity, R.string.loading_msg_export){
fun share(activity: AppCompatActivity, themeValue: String, gocryptfsVolume: GocryptfsVolume, file_paths: List<String>) {
object : LoadingTask(activity, themeValue, R.string.loading_msg_export) {
override fun doTask(activity: AppCompatActivity) {
var contentType: String? = null
val uris = ArrayList<Uri>()
@ -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)

View File

@ -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<String>
@ -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<EditText>(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<EditText>(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<EditText>(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) { _, _ ->

View File

@ -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<Uri>, 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<EditText>(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)

View File

@ -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)

View File

@ -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)

View File

@ -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