Skip to content

Commit

Permalink
fix #116 disabled color in app sheet (app type), use ColorXXX instead…
Browse files Browse the repository at this point in the history
… of XXX
  • Loading branch information
hg42 committed Sep 6, 2022
1 parent c56c3c4 commit d9dbba9
Show file tree
Hide file tree
Showing 9 changed files with 117 additions and 108 deletions.
19 changes: 12 additions & 7 deletions app/src/main/java/com/machiav3lli/backup/fragments/AppSheet.kt
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,13 @@ import com.machiav3lli.backup.ui.compose.item.RoundButton
import com.machiav3lli.backup.ui.compose.item.TagsBlock
import com.machiav3lli.backup.ui.compose.item.TitleText
import com.machiav3lli.backup.ui.compose.theme.AppTheme
import com.machiav3lli.backup.ui.compose.theme.ColorDisabled
import com.machiav3lli.backup.ui.compose.theme.LocalShapes
import com.machiav3lli.backup.ui.compose.theme.Updated
import com.machiav3lli.backup.ui.compose.theme.ColorNotInstalled
import com.machiav3lli.backup.ui.compose.theme.ColorSpecial
import com.machiav3lli.backup.ui.compose.theme.ColorSystem
import com.machiav3lli.backup.ui.compose.theme.ColorUpdated
import com.machiav3lli.backup.ui.compose.theme.ColorUser
import com.machiav3lli.backup.utils.show
import com.machiav3lli.backup.utils.showError
import com.machiav3lli.backup.viewmodels.AppSheetViewModel
Expand Down Expand Up @@ -389,11 +394,11 @@ class AppSheet(val appInfo: Package) : BaseSheet(), ActionListener {
textAlign = TextAlign.End,
text = stringResource(id = if (packageInfo.isSpecial) R.string.apptype_special else if (packageInfo.isSystem) R.string.apptype_system else R.string.apptype_user),
color = when {
!packageInfo.isInstalled -> MaterialTheme.colorScheme.onSurfaceVariant
packageInfo.isDisabled -> MaterialTheme.colorScheme.surfaceVariant
packageInfo.isSpecial -> colorResource(R.color.ic_special)
packageInfo.isSystem -> colorResource(R.color.ic_system)
else -> colorResource(R.color.ic_user)
!packageInfo.isInstalled -> ColorNotInstalled
packageInfo.isDisabled -> ColorDisabled
packageInfo.isSpecial -> ColorSpecial
packageInfo.isSystem -> ColorSystem
else -> ColorUser
}
)
}
Expand All @@ -404,7 +409,7 @@ class AppSheet(val appInfo: Package) : BaseSheet(), ActionListener {
textAlign = TextAlign.End,
text = if (packageInfo.isUpdated) "${packageInfo.latestBackup?.versionName.orEmpty()} (${packageInfo.versionName})"
else packageInfo.versionName.orEmpty(),
color = if (packageInfo.isUpdated) Updated else MaterialTheme.colorScheme.onBackground
color = if (packageInfo.isUpdated) ColorUpdated else MaterialTheme.colorScheme.onBackground
)
}
AnimatedVisibility(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,9 @@ import com.machiav3lli.backup.ui.compose.item.ExpandableSearchAction
import com.machiav3lli.backup.ui.compose.item.StateChip
import com.machiav3lli.backup.ui.compose.item.TopBar
import com.machiav3lli.backup.ui.compose.recycler.BatchPackageRecycler
import com.machiav3lli.backup.ui.compose.theme.APK
import com.machiav3lli.backup.ui.compose.theme.AppTheme
import com.machiav3lli.backup.ui.compose.theme.Data
import com.machiav3lli.backup.ui.compose.theme.ColorAPK
import com.machiav3lli.backup.ui.compose.theme.ColorData
import com.machiav3lli.backup.utils.FileUtils
import com.machiav3lli.backup.utils.StorageLocationNotConfiguredException
import com.machiav3lli.backup.utils.applyFilter
Expand Down Expand Up @@ -324,7 +324,7 @@ open class BatchFragment(private val backupBoolean: Boolean) : NavigationFragmen
icon = painterResource(id = R.drawable.ic_apk),
text = stringResource(id = R.string.all_apk),
checked = allApkChecked,
color = APK
color = ColorAPK
) {
val checkBoolean = !allApkChecked
allApkChecked = checkBoolean
Expand All @@ -341,7 +341,7 @@ open class BatchFragment(private val backupBoolean: Boolean) : NavigationFragmen
icon = painterResource(id = R.drawable.ic_data),
text = stringResource(id = R.string.all_data),
checked = allDataChecked,
color = Data
color = ColorData
) {
val checkBoolean = !allDataChecked
allDataChecked = checkBoolean
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@ import com.machiav3lli.backup.ui.compose.item.PreferencesGroupHeader
import com.machiav3lli.backup.ui.compose.item.SeekBarPreference
import com.machiav3lli.backup.ui.compose.item.SwitchPreference
import com.machiav3lli.backup.ui.compose.theme.AppTheme
import com.machiav3lli.backup.ui.compose.theme.DeData
import com.machiav3lli.backup.ui.compose.theme.Special
import com.machiav3lli.backup.ui.compose.theme.Updated
import com.machiav3lli.backup.ui.compose.theme.ColorDeData
import com.machiav3lli.backup.ui.compose.theme.ColorSpecial
import com.machiav3lli.backup.ui.compose.theme.ColorUpdated
import com.machiav3lli.backup.ui.item.Pref
import com.machiav3lli.backup.utils.sortFilterModel

Expand Down Expand Up @@ -141,7 +141,7 @@ val EnableSpecialsPref = Pref.BooleanPref(
titleId = R.string.prefs_enablespecial,
summaryId = R.string.prefs_enablespecial_summary,
iconId = R.drawable.ic_special,
iconTint = Special,
iconTint = ColorSpecial,
defaultValue = false
)

Expand All @@ -150,7 +150,7 @@ val DisableVerificationPref = Pref.BooleanPref(
titleId = R.string.prefs_disableverification,
summaryId = R.string.prefs_disableverification_summary,
iconId = R.drawable.ic_andy,
iconTint = Updated,
iconTint = ColorUpdated,
defaultValue = true
)

Expand All @@ -159,7 +159,7 @@ val RestoreAllPermissionsPref = Pref.BooleanPref(
titleId = R.string.prefs_restoreallpermissions,
summaryId = R.string.prefs_restoreallpermissions_summary,
iconId = R.drawable.ic_de_data,
iconTint = DeData,
iconTint = ColorDeData,
defaultValue = false
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,15 @@ import com.machiav3lli.backup.ui.compose.item.EnumPreference
import com.machiav3lli.backup.ui.compose.item.LaunchPreference
import com.machiav3lli.backup.ui.compose.item.SeekBarPreference
import com.machiav3lli.backup.ui.compose.item.SwitchPreference
import com.machiav3lli.backup.ui.compose.theme.APK
import com.machiav3lli.backup.ui.compose.theme.ColorAPK
import com.machiav3lli.backup.ui.compose.theme.AppTheme
import com.machiav3lli.backup.ui.compose.theme.DeData
import com.machiav3lli.backup.ui.compose.theme.Exodus
import com.machiav3lli.backup.ui.compose.theme.ExtDATA
import com.machiav3lli.backup.ui.compose.theme.Media
import com.machiav3lli.backup.ui.compose.theme.OBB
import com.machiav3lli.backup.ui.compose.theme.Special
import com.machiav3lli.backup.ui.compose.theme.Updated
import com.machiav3lli.backup.ui.compose.theme.ColorDeData
import com.machiav3lli.backup.ui.compose.theme.ColorExodus
import com.machiav3lli.backup.ui.compose.theme.ColorExtDATA
import com.machiav3lli.backup.ui.compose.theme.ColorMedia
import com.machiav3lli.backup.ui.compose.theme.ColorOBB
import com.machiav3lli.backup.ui.compose.theme.ColorSpecial
import com.machiav3lli.backup.ui.compose.theme.ColorUpdated
import com.machiav3lli.backup.ui.item.Pref

@Composable
Expand Down Expand Up @@ -122,7 +122,7 @@ val EncryptionPref = Pref.BooleanPref(
titleId = R.string.prefs_encryption,
summaryId = R.string.prefs_encryption_summary,
iconId = R.drawable.ic_encryption,
iconTint = Updated,
iconTint = ColorUpdated,
defaultValue = false
)

Expand All @@ -131,7 +131,7 @@ val EncryptionPasswordPref = Pref.StringPref(
titleId = R.string.prefs_password,
summaryId = R.string.prefs_password_summary,
iconId = R.drawable.ic_password,
iconTint = Updated,
iconTint = ColorUpdated,
defaultValue = ""
)

Expand All @@ -147,7 +147,7 @@ val DeDataPref = Pref.BooleanPref(
titleId = R.string.prefs_deviceprotecteddata,
summaryId = R.string.prefs_deviceprotecteddata_summary,
iconId = R.drawable.ic_de_data,
iconTint = DeData,
iconTint = ColorDeData,
defaultValue = true
)

Expand All @@ -156,7 +156,7 @@ val ExtDataPref = Pref.BooleanPref(
titleId = R.string.prefs_externaldata,
summaryId = R.string.prefs_externaldata_summary,
iconId = R.drawable.ic_external_data,
iconTint = ExtDATA,
iconTint = ColorExtDATA,
defaultValue = true
)

Expand All @@ -165,7 +165,7 @@ val ObbPref = Pref.BooleanPref(
titleId = R.string.prefs_obbdata,
summaryId = R.string.prefs_obbdata_summary,
iconId = R.drawable.ic_obb_data,
iconTint = OBB,
iconTint = ColorOBB,
defaultValue = true
)

Expand All @@ -174,7 +174,7 @@ val MediaPref = Pref.BooleanPref(
titleId = R.string.prefs_mediadata,
summaryId = R.string.prefs_mediadata_summary,
iconId = R.drawable.ic_media_data,
iconTint = Media,
iconTint = ColorMedia,
defaultValue = true
)

Expand All @@ -183,7 +183,7 @@ val RestorePermissionsPref = Pref.BooleanPref(
titleId = R.string.prefs_restorepermissions,
summaryId = R.string.prefs_restorepermissions_summary,
iconId = R.drawable.ic_sizes,
iconTint = APK,
iconTint = ColorAPK,
defaultValue = true
)

Expand All @@ -192,7 +192,7 @@ val NumBackupsPref = Pref.IntPref(
titleId = R.string.prefs_numBackupRevisions,
summaryId = R.string.prefs_numBackupRevisions_summary,
iconId = R.drawable.ic_revisions,
iconTint = Special,
iconTint = ColorSpecial,
entries = ((0..9) + (10..20 step 2) + (50..200 step 50)).toList(),
defaultValue = 2
)
Expand All @@ -202,7 +202,7 @@ val CompressionLevelPref = Pref.IntPref(
titleId = R.string.prefs_compression_level,
summaryId = R.string.prefs_compression_level_summary,
iconId = R.drawable.ic_compression_level,
iconTint = Exodus,
iconTint = ColorExodus,
entries = (0..9).toList(),
defaultValue = 2
)
Expand All @@ -219,7 +219,7 @@ val InstallerPackagePref = Pref.StringPref(
key = PREFS_INSTALLER_PACKAGENAME,
titleId = R.string.prefs_installerpackagename,
iconId = R.drawable.ic_launchable,
iconTint = OBB,
iconTint = ColorOBB,
defaultValue = BuildConfig.APPLICATION_ID
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ import com.machiav3lli.backup.items.Package
import com.machiav3lli.backup.ui.compose.item.LaunchPreference
import com.machiav3lli.backup.ui.compose.navigation.NavItem
import com.machiav3lli.backup.ui.compose.theme.AppTheme
import com.machiav3lli.backup.ui.compose.theme.DeData
import com.machiav3lli.backup.ui.compose.theme.Exodus
import com.machiav3lli.backup.ui.compose.theme.ExtDATA
import com.machiav3lli.backup.ui.compose.theme.ColorDeData
import com.machiav3lli.backup.ui.compose.theme.ColorExodus
import com.machiav3lli.backup.ui.compose.theme.ColorExtDATA
import com.machiav3lli.backup.ui.item.Pref
import com.machiav3lli.backup.utils.FileUtils.invalidateBackupLocation
import com.machiav3lli.backup.utils.applyFilter
Expand Down Expand Up @@ -238,15 +238,15 @@ val ExportImportSchedulesPref = Pref.LinkPref(
titleId = R.string.prefs_schedulesexportimport,
summaryId = R.string.prefs_schedulesexportimport_summary,
iconId = R.drawable.ic_scheduler,
iconTint = ExtDATA
iconTint = ColorExtDATA
)

val SaveAppsListPref = Pref.LinkPref(
key = PREFS_SAVEAPPSLIST,
titleId = R.string.prefs_saveappslist,
summaryId = R.string.prefs_saveappslist_summary,
iconId = R.drawable.ic_list_ordered,
iconTint = Exodus
iconTint = ColorExodus
)


Expand Down Expand Up @@ -306,5 +306,5 @@ val LogViewerPref = Pref.LinkPref(
key = PREFS_LOGVIEWER,
titleId = R.string.prefs_logviewer,
iconId = R.drawable.ic_log,
iconTint = DeData
iconTint = ColorDeData
)
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,12 @@ import com.machiav3lli.backup.ui.compose.item.ListPreference
import com.machiav3lli.backup.ui.compose.item.SeekBarPreference
import com.machiav3lli.backup.ui.compose.item.SwitchPreference
import com.machiav3lli.backup.ui.compose.theme.AppTheme
import com.machiav3lli.backup.ui.compose.theme.DeData
import com.machiav3lli.backup.ui.compose.theme.Exodus
import com.machiav3lli.backup.ui.compose.theme.ExtDATA
import com.machiav3lli.backup.ui.compose.theme.OBB
import com.machiav3lli.backup.ui.compose.theme.Special
import com.machiav3lli.backup.ui.compose.theme.Updated
import com.machiav3lli.backup.ui.compose.theme.ColorDeData
import com.machiav3lli.backup.ui.compose.theme.ColorExodus
import com.machiav3lli.backup.ui.compose.theme.ColorExtDATA
import com.machiav3lli.backup.ui.compose.theme.ColorOBB
import com.machiav3lli.backup.ui.compose.theme.ColorSpecial
import com.machiav3lli.backup.ui.compose.theme.ColorUpdated
import com.machiav3lli.backup.ui.item.Pref
import com.machiav3lli.backup.utils.StorageLocationNotConfiguredException
import com.machiav3lli.backup.utils.backupDirConfigured
Expand Down Expand Up @@ -167,7 +167,7 @@ val Context.LanguagePref: Pref.ListPref
key = PREFS_LANGUAGES,
titleId = R.string.prefs_languages,
iconId = R.drawable.ic_languages,
iconTint = OBB,
iconTint = ColorOBB,
entries = getLanguageList(),
defaultValue = "system"
)
Expand All @@ -176,7 +176,7 @@ val ThemePref = Pref.EnumPref(
key = PREFS_THEME_X,
titleId = R.string.prefs_theme,
iconId = R.drawable.ic_theme,
iconTint = Special,
iconTint = ColorSpecial,
entries = themeItems,
defaultValue = 0
)
Expand All @@ -203,7 +203,7 @@ val BackupFolderPref = Pref.StringPref(
key = PREFS_PATH_BACKUP_DIRECTORY,
titleId = R.string.prefs_pathbackupfolder,
iconId = R.drawable.ic_folder,
iconTint = ExtDATA,
iconTint = ColorExtDATA,
defaultValue = ""
)

Expand All @@ -220,7 +220,7 @@ val DeviceLockPref = Pref.BooleanPref(
titleId = R.string.prefs_devicelock,
summaryId = R.string.prefs_devicelock_summary,
iconId = R.drawable.ic_encryption,
iconTint = Updated,
iconTint = ColorUpdated,
defaultValue = false
)

Expand All @@ -229,7 +229,7 @@ val BiometricLockPref = Pref.BooleanPref(
titleId = R.string.prefs_biometriclock,
summaryId = R.string.prefs_biometriclock_summary,
iconId = R.drawable.ic_biometric,
iconTint = DeData,
iconTint = ColorDeData,
defaultValue = false
)

Expand All @@ -238,7 +238,7 @@ val DaysOldPref = Pref.IntPref(
titleId = R.string.prefs_oldbackups,
summaryId = R.string.prefs_oldbackups_summary,
iconId = R.drawable.ic_old,
iconTint = Exodus,
iconTint = ColorExodus,
entries = (1..30).toList(),
defaultValue = 2
)
Expand Down
Loading

0 comments on commit d9dbba9

Please sign in to comment.