fix: Add tertiary color, change color accent to color secondary

This commit is contained in:
J-Jamet committed 2023-07-09 11:40:58 +02:00
1 parent 3891bb1c8f
commit eb4e45cb69
51 files changed
+238 -304

No files matched your search

@@ -112,7 +112,7 @@ class EntryActivity : DatabaseLockActivity() {
}
private var mIcon: IconImage? = null
private var mColorAccent: Int = 0
private var mColorSecondary: Int = 0
private var mControlColor: Int = 0
private var mColorPrimary: Int = 0
private var mColorBackground: Int = 0
@@ -146,15 +146,15 @@ class EntryActivity : DatabaseLockActivity() {
toolbar?.title = " "
// Retrieve the textColor to tint the toolbar
val taColorAccent = theme.obtainStyledAttributes(intArrayOf(R.attr.colorAccent))
val taColorSecondary = theme.obtainStyledAttributes(intArrayOf(R.attr.colorSecondary))
val taControlColor = theme.obtainStyledAttributes(intArrayOf(R.attr.toolbarColorControl))
val taColorPrimary = theme.obtainStyledAttributes(intArrayOf(R.attr.colorPrimary))
val taColorBackground = theme.obtainStyledAttributes(intArrayOf(android.R.attr.windowBackground))
mColorAccent = taColorAccent.getColor(0, Color.BLACK)
mColorSecondary = taColorSecondary.getColor(0, Color.BLACK)
mControlColor = taControlColor.getColor(0, Color.BLACK)
mColorPrimary = taColorPrimary.getColor(0, Color.BLACK)
mColorBackground = taColorBackground.getColor(0, Color.BLACK)
taColorAccent.recycle()
taColorSecondary.recycle()
taControlColor.recycle()
taColorPrimary.recycle()
taColorBackground.recycle()
@@ -227,7 +227,7 @@ class EntryActivity : DatabaseLockActivity() {
historyView?.visibility = if (entryIsHistory) View.VISIBLE else View.GONE
if (entryIsHistory) {
collapsingToolbarLayout?.contentScrim =
ColorDrawable(mColorAccent)
ColorDrawable(mColorSecondary)
}
val entryInfo = entryInfoHistory.entryInfo
@@ -380,7 +380,7 @@ class EntryActivity : DatabaseLockActivity() {
mDatabase?.iconDrawableFactory?.assignDatabaseIcon(
iconView,
icon,
mForegroundColor ?: mColorAccent
mForegroundColor ?: mColorSecondary
)
}
}
@@ -108,7 +108,7 @@ class GroupDialogFragment : DatabaseDialogFragment() {
uuidReferenceView = root.findViewById(R.id.group_UUID_reference)
// Retrieve the textColor to tint the icon
val ta = activity.theme.obtainStyledAttributes(intArrayOf(R.attr.colorAccent))
val ta = activity.theme.obtainStyledAttributes(intArrayOf(R.attr.colorSecondary))
mIconColor = ta.getColor(0, Color.WHITE)
ta.recycle()
@@ -40,7 +40,7 @@ class BreadcrumbAdapter(val context: Context)
mShowUUID = PreferencesUtil.showUUID(context)
// Retrieve the textColor to tint the icon
val taTextColor = context.theme.obtainStyledAttributes(intArrayOf(R.attr.textColorInverse))
val taTextColor = context.theme.obtainStyledAttributes(intArrayOf(R.attr.colorOnPrimary))
mIconColor = taTextColor.getColor(0, Color.WHITE)
taTextColor.recycle()
}
@@ -92,7 +92,7 @@ class FileDatabaseHistoryAdapter(context: Context)
init {
val typedValue = TypedValue()
val theme = context.theme
theme.resolveAttribute(R.attr.colorAccent, typedValue, true)
theme.resolveAttribute(R.attr.colorSecondary, typedValue, true)
warningColor = typedValue.data
theme.resolveAttribute(android.R.attr.textColorHintInverse, typedValue, true)
defaultColor = typedValue.data
@@ -95,9 +95,9 @@ class NodesAdapter (
@ColorInt
private val mTextColorSecondary: Int
@ColorInt
private val mColorAccentLight: Int
private val mColorSecondary: Int
@ColorInt
private val mColorOnAccentColor: Int
private val mColorOnSecondary: Int
/**
* Determine if the adapter contains or not any element
@@ -127,13 +127,13 @@ class NodesAdapter (
this.mTextColorSecondary = taTextColorSecondary.getColor(0, Color.BLACK)
taTextColorSecondary.recycle()
// To get background color for selection
val taColorAccentLight = context.theme.obtainStyledAttributes(intArrayOf(R.attr.colorAccentLight))
this.mColorAccentLight = taColorAccentLight.getColor(0, Color.GRAY)
taColorAccentLight.recycle()
val taColorSecondary = context.theme.obtainStyledAttributes(intArrayOf(R.attr.colorSecondary))
this.mColorSecondary = taColorSecondary.getColor(0, Color.GRAY)
taColorSecondary.recycle()
// To get text color for selection
val taColorOnAccentColor = context.theme.obtainStyledAttributes(intArrayOf(R.attr.colorOnAccentColor))
this.mColorOnAccentColor = taColorOnAccentColor.getColor(0, Color.WHITE)
taColorOnAccentColor.recycle()
val taColorOnSecondary = context.theme.obtainStyledAttributes(intArrayOf(R.attr.colorOnSecondary))
this.mColorOnSecondary = taColorOnSecondary.getColor(0, Color.WHITE)
taColorOnSecondary.recycle()
}
private fun assignPreferences() {
@@ -380,7 +380,7 @@ class NodesAdapter (
// Assign icon colors
var iconColor = if (holder.container.isSelected)
mColorOnAccentColor
mColorOnSecondary
else when (subNode.type) {
Type.GROUP -> mTextColorPrimary
Type.ENTRY -> mTextColor
@@ -436,7 +436,7 @@ class NodesAdapter (
holder.container.setBackgroundColor(Color.TRANSPARENT)
}
} else {
holder.container.setBackgroundColor(mColorAccentLight)
holder.container.setBackgroundColor(mColorSecondary)
}
val foregroundColor = if (mShowEntryColors) entry.foregroundColor else null
if (!holder.container.isSelected) {
@@ -457,12 +457,12 @@ class NodesAdapter (
holder.meta.setTextColor(mTextColor)
}
} else {
holder.text.setTextColor(mColorOnAccentColor)
holder.subText?.setTextColor(mColorOnAccentColor)
holder.otpToken?.setTextColor(mColorOnAccentColor)
holder.otpProgress?.setIndicatorColor(mColorOnAccentColor)
holder.attachmentIcon?.setColorFilter(mColorOnAccentColor)
holder.meta.setTextColor(mColorOnAccentColor)
holder.text.setTextColor(mColorOnSecondary)
holder.subText?.setTextColor(mColorOnSecondary)
holder.otpToken?.setTextColor(mColorOnSecondary)
holder.otpProgress?.setIndicatorColor(mColorOnSecondary)
holder.attachmentIcon?.setColorFilter(mColorOnSecondary)
holder.meta.setTextColor(mColorOnSecondary)
}
database.stopManageEntry(entry)