mirror of
https://github.com/Kunzisoft/KeePassDX.git
synced 2025-12-04 15:49:33 +01:00
fix: R attribute
This commit is contained in:
@@ -159,9 +159,9 @@ class EntryActivity : DatabaseLockActivity() {
|
||||
toolbar?.title = " "
|
||||
|
||||
// Retrieve the textColor to tint the toolbar
|
||||
val taColorSecondary = theme.obtainStyledAttributes(intArrayOf(com.google.android.material.R.attr.colorSecondary))
|
||||
val taColorSurface = theme.obtainStyledAttributes(intArrayOf(com.google.android.material.R.attr.colorSurface))
|
||||
val taColorOnSurface = theme.obtainStyledAttributes(intArrayOf(com.google.android.material.R.attr.colorOnSurface))
|
||||
val taColorSecondary = theme.obtainStyledAttributes(intArrayOf(R.attr.colorSecondary))
|
||||
val taColorSurface = theme.obtainStyledAttributes(intArrayOf(R.attr.colorSurface))
|
||||
val taColorOnSurface = theme.obtainStyledAttributes(intArrayOf(R.attr.colorOnSurface))
|
||||
val taColorBackground = theme.obtainStyledAttributes(intArrayOf(android.R.attr.windowBackground))
|
||||
mColorSecondary = taColorSecondary.getColor(0, Color.BLACK)
|
||||
mColorSurface = taColorSurface.getColor(0, Color.BLACK)
|
||||
|
||||
@@ -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(com.google.android.material.R.attr.colorSecondary))
|
||||
val ta = activity.theme.obtainStyledAttributes(intArrayOf(R.attr.colorSecondary))
|
||||
mIconColor = ta.getColor(0, Color.WHITE)
|
||||
ta.recycle()
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ class BreadcrumbAdapter(val context: Context, val database: Database?)
|
||||
mShowUUID = PreferencesUtil.showUUID(context)
|
||||
|
||||
// Retrieve the color to tint the icon
|
||||
val taIconColor = context.theme.obtainStyledAttributes(intArrayOf(com.google.android.material.R.attr.colorOnSurface))
|
||||
val taIconColor = context.theme.obtainStyledAttributes(intArrayOf(R.attr.colorOnSurface))
|
||||
mIconColor = taIconColor.getColor(0, Color.WHITE)
|
||||
taIconColor.recycle()
|
||||
}
|
||||
|
||||
@@ -22,7 +22,6 @@ package com.kunzisoft.keepass.adapters
|
||||
import android.content.Context
|
||||
import android.content.res.ColorStateList
|
||||
import android.graphics.Color
|
||||
import android.os.Build
|
||||
import android.util.Log
|
||||
import android.util.TypedValue
|
||||
import android.view.LayoutInflater
|
||||
@@ -120,7 +119,7 @@ class NodesAdapter (
|
||||
this.mNodeSortedListCallback = NodeSortedListCallback()
|
||||
this.mNodeSortedList = SortedList(Node::class.java, mNodeSortedListCallback)
|
||||
|
||||
val taColorSurfaceContainer = context.obtainStyledAttributes(intArrayOf(com.google.android.material.R.attr.colorSurfaceContainer))
|
||||
val taColorSurfaceContainer = context.obtainStyledAttributes(intArrayOf(R.attr.colorSurfaceContainer))
|
||||
this.mColorSurfaceContainer = taColorSurfaceContainer.getColor(0, Color.BLACK)
|
||||
taColorSurfaceContainer.recycle()
|
||||
// Retrieve the color to tint the icon
|
||||
@@ -136,11 +135,11 @@ class NodesAdapter (
|
||||
this.mTextColorSecondary = taTextColorSecondary.getColor(0, Color.BLACK)
|
||||
taTextColorSecondary.recycle()
|
||||
// To get background color for selection
|
||||
val taColorSecondary = context.obtainStyledAttributes(intArrayOf(com.google.android.material.R.attr.colorSecondary))
|
||||
val taColorSecondary = context.obtainStyledAttributes(intArrayOf(R.attr.colorSecondary))
|
||||
this.mColorSecondary = taColorSecondary.getColor(0, Color.GRAY)
|
||||
taColorSecondary.recycle()
|
||||
// To get text color for selection
|
||||
val taColorOnSecondary = context.obtainStyledAttributes(intArrayOf(com.google.android.material.R.attr.colorOnSecondary))
|
||||
val taColorOnSecondary = context.obtainStyledAttributes(intArrayOf(R.attr.colorOnSecondary))
|
||||
this.mColorOnSecondary = taColorOnSecondary.getColor(0, Color.WHITE)
|
||||
taColorOnSecondary.recycle()
|
||||
}
|
||||
|
||||
@@ -98,7 +98,7 @@ open class Education(val activity: Activity) {
|
||||
}
|
||||
|
||||
protected fun getCircleColor(): Int {
|
||||
val typedArray = activity.obtainStyledAttributes(intArrayOf(com.google.android.material.R.attr.colorPrimaryContainer))
|
||||
val typedArray = activity.obtainStyledAttributes(intArrayOf(R.attr.colorPrimaryContainer))
|
||||
val colorControl = typedArray.getColor(0, Color.GREEN)
|
||||
typedArray.recycle()
|
||||
return colorControl
|
||||
@@ -109,7 +109,7 @@ open class Education(val activity: Activity) {
|
||||
}
|
||||
|
||||
protected fun getTextColor(): Int {
|
||||
val typedArray = activity.obtainStyledAttributes(intArrayOf(com.google.android.material.R.attr.colorOnPrimaryContainer))
|
||||
val typedArray = activity.obtainStyledAttributes(intArrayOf(R.attr.colorOnPrimaryContainer))
|
||||
val colorControl = typedArray.getColor(0, Color.WHITE)
|
||||
typedArray.recycle()
|
||||
return colorControl
|
||||
|
||||
@@ -72,7 +72,7 @@ abstract class NotificationService : Service() {
|
||||
setTheme(Stylish.getThemeId(this))
|
||||
val typedValue = TypedValue()
|
||||
val theme = theme
|
||||
theme.resolveAttribute(com.google.android.material.R.attr.colorPrimary, typedValue, true)
|
||||
theme.resolveAttribute(R.attr.colorPrimary, typedValue, true)
|
||||
colorNotificationAccent = typedValue.data
|
||||
}
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ import com.kunzisoft.keepass.R
|
||||
|
||||
class SectionView @JvmOverloads constructor(context: Context,
|
||||
attrs: AttributeSet? = null,
|
||||
defStyle: Int = com.google.android.material.R.attr.cardViewStyle)
|
||||
defStyle: Int = R.attr.cardViewStyle)
|
||||
: CardView(context, attrs, defStyle) {
|
||||
|
||||
private var containerSectionView = LinearLayout(context).apply {
|
||||
|
||||
@@ -154,7 +154,7 @@ abstract class TemplateAbstractView<
|
||||
// Build each section
|
||||
template.sections.forEach { templateSection ->
|
||||
|
||||
val sectionView = SectionView(context, null, com.google.android.material.R.attr.cardViewStyle)
|
||||
val sectionView = SectionView(context, null, R.attr.cardViewStyle)
|
||||
|
||||
// Build each attribute
|
||||
templateSection.attributes.forEach { templateAttribute ->
|
||||
|
||||
@@ -47,7 +47,7 @@ class ToolbarAction @JvmOverloads constructor(context: Context,
|
||||
init {
|
||||
ContextCompat.getDrawable(context, R.drawable.ic_close_white_24dp)?.let { closeDrawable ->
|
||||
val typedValue = TypedValue()
|
||||
context.theme.resolveAttribute(com.google.android.material.R.attr.colorOnSurface, typedValue, true)
|
||||
context.theme.resolveAttribute(R.attr.colorOnSurface, typedValue, true)
|
||||
@ColorInt val colorControl = typedValue.data
|
||||
closeDrawable.colorFilter = PorterDuffColorFilter(colorControl, PorterDuff.Mode.SRC_ATOP)
|
||||
navigationIcon = closeDrawable
|
||||
|
||||
@@ -38,7 +38,7 @@ class ToolbarSpecial @JvmOverloads constructor(context: Context,
|
||||
init {
|
||||
ContextCompat.getDrawable(context, R.drawable.ic_arrow_back_white_24dp)?.let { closeDrawable ->
|
||||
val typedValue = TypedValue()
|
||||
context.theme.resolveAttribute(com.google.android.material.R.attr.colorOnSurface, typedValue, true)
|
||||
context.theme.resolveAttribute(R.attr.colorOnSurface, typedValue, true)
|
||||
@ColorInt val colorOnSurface = typedValue.data
|
||||
closeDrawable.colorFilter = PorterDuffColorFilter(colorOnSurface, PorterDuff.Mode.SRC_ATOP)
|
||||
navigationIcon = closeDrawable
|
||||
|
||||
@@ -58,7 +58,6 @@ import androidx.core.view.WindowInsetsCompat
|
||||
import androidx.core.view.forEach
|
||||
import androidx.core.view.isVisible
|
||||
import androidx.core.view.updateLayoutParams
|
||||
import androidx.core.view.updatePadding
|
||||
import androidx.core.view.updatePaddingRelative
|
||||
import com.google.android.material.appbar.CollapsingToolbarLayout
|
||||
import com.google.android.material.snackbar.Snackbar
|
||||
@@ -118,7 +117,7 @@ fun TextView.customLink(listener: (View) -> Unit) {
|
||||
fun Snackbar.asError(): Snackbar {
|
||||
this.view.apply {
|
||||
setBackgroundColor(Color.RED)
|
||||
findViewById<TextView>(com.google.android.material.R.id.snackbar_text).setTextColor(Color.WHITE)
|
||||
findViewById<TextView>(R.id.snackbar_text).setTextColor(Color.WHITE)
|
||||
}
|
||||
return this
|
||||
}
|
||||
@@ -311,7 +310,7 @@ fun Activity.setTransparentNavigationBar(applyToStatusBar: Boolean = false, appl
|
||||
WindowCompat.setDecorFitsSystemWindows(window, false)
|
||||
window.navigationBarColor = ContextCompat.getColor(this, R.color.surface_selector)
|
||||
if (applyToStatusBar) {
|
||||
obtainStyledAttributes(intArrayOf(com.google.android.material.R.attr.colorSurface)).apply {
|
||||
obtainStyledAttributes(intArrayOf(R.attr.colorSurface)).apply {
|
||||
window.statusBarColor = getColor(0, Color.GRAY)
|
||||
recycle()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user