fetch proper Material colors in a couple more places
This commit is contained in:
parent
b8b0db7534
commit
8dcbc4914e
13 changed files with 29 additions and 36 deletions
|
@ -8,9 +8,7 @@ import androidx.recyclerview.widget.DividerItemDecoration
|
|||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.simplemobiletools.commons.R
|
||||
import com.simplemobiletools.commons.activities.BaseSimpleActivity
|
||||
import com.simplemobiletools.commons.extensions.baseConfig
|
||||
import com.simplemobiletools.commons.extensions.getContrastColor
|
||||
import com.simplemobiletools.commons.extensions.getProperPrimaryColor
|
||||
import com.simplemobiletools.commons.extensions.*
|
||||
import com.simplemobiletools.commons.interfaces.MyActionModeCallback
|
||||
import com.simplemobiletools.commons.views.MyRecyclerView
|
||||
|
||||
|
@ -19,11 +17,11 @@ abstract class MyRecyclerViewAdapter(val activity: BaseSimpleActivity, val recyc
|
|||
protected val baseConfig = activity.baseConfig
|
||||
protected val resources = activity.resources!!
|
||||
protected val layoutInflater = activity.layoutInflater
|
||||
protected var primaryColor = baseConfig.primaryColor
|
||||
protected var textColor = activity.getProperTextColor()
|
||||
protected var backgroundColor = activity.getProperBackgroundColor()
|
||||
protected var rawPrimaryColor = baseConfig.primaryColor
|
||||
protected var properPrimaryColor = activity.getProperPrimaryColor()
|
||||
protected var contrastColor = properPrimaryColor.getContrastColor()
|
||||
protected var textColor = baseConfig.textColor
|
||||
protected var backgroundColor = baseConfig.backgroundColor
|
||||
protected var actModeCallback: MyActionModeCallback
|
||||
protected var selectedKeys = LinkedHashSet<Int>()
|
||||
protected var positionOffset = 0
|
||||
|
@ -271,7 +269,7 @@ abstract class MyRecyclerViewAdapter(val activity: BaseSimpleActivity, val recyc
|
|||
}
|
||||
|
||||
fun updatePrimaryColor(primaryColor: Int) {
|
||||
this.primaryColor = primaryColor
|
||||
this.rawPrimaryColor = primaryColor
|
||||
properPrimaryColor = activity.getProperPrimaryColor()
|
||||
contrastColor = properPrimaryColor.getContrastColor()
|
||||
}
|
||||
|
|
|
@ -9,9 +9,7 @@ import androidx.recyclerview.widget.ListAdapter
|
|||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.simplemobiletools.commons.R
|
||||
import com.simplemobiletools.commons.activities.BaseSimpleActivity
|
||||
import com.simplemobiletools.commons.extensions.baseConfig
|
||||
import com.simplemobiletools.commons.extensions.getContrastColor
|
||||
import com.simplemobiletools.commons.extensions.getProperPrimaryColor
|
||||
import com.simplemobiletools.commons.extensions.*
|
||||
import com.simplemobiletools.commons.interfaces.MyActionModeCallback
|
||||
import com.simplemobiletools.commons.views.MyRecyclerView
|
||||
|
||||
|
@ -25,11 +23,11 @@ abstract class MyRecyclerViewListAdapter<T>(
|
|||
protected val baseConfig = activity.baseConfig
|
||||
protected val resources = activity.resources!!
|
||||
protected val layoutInflater = activity.layoutInflater
|
||||
protected var primaryColor = baseConfig.primaryColor
|
||||
protected var primaryPrimaryColor = activity.getProperPrimaryColor()
|
||||
protected var contrastColor = primaryPrimaryColor.getContrastColor()
|
||||
protected var textColor = baseConfig.textColor
|
||||
protected var backgroundColor = baseConfig.backgroundColor
|
||||
protected var textColor = activity.getProperTextColor()
|
||||
protected var backgroundColor = activity.getProperBackgroundColor()
|
||||
protected var rawPrimaryColor = baseConfig.primaryColor
|
||||
protected var properPrimaryColor = activity.getProperPrimaryColor()
|
||||
protected var contrastColor = properPrimaryColor.getContrastColor()
|
||||
protected var actModeCallback: MyActionModeCallback
|
||||
protected var selectedKeys = LinkedHashSet<Int>()
|
||||
protected var positionOffset = 0
|
||||
|
@ -276,9 +274,9 @@ abstract class MyRecyclerViewListAdapter<T>(
|
|||
}
|
||||
|
||||
fun updatePrimaryColor(primaryColor: Int) {
|
||||
this.primaryColor = primaryColor
|
||||
primaryPrimaryColor = activity.getProperPrimaryColor()
|
||||
contrastColor = primaryPrimaryColor.getContrastColor()
|
||||
this.rawPrimaryColor = primaryColor
|
||||
properPrimaryColor = activity.getProperPrimaryColor()
|
||||
contrastColor = properPrimaryColor.getContrastColor()
|
||||
}
|
||||
|
||||
fun updateBackgroundColor(backgroundColor: Int) {
|
||||
|
|
|
@ -5,7 +5,7 @@ import androidx.appcompat.app.AlertDialog
|
|||
import com.simplemobiletools.commons.R
|
||||
import com.simplemobiletools.commons.activities.BaseSimpleActivity
|
||||
import com.simplemobiletools.commons.extensions.applyColorFilter
|
||||
import com.simplemobiletools.commons.extensions.baseConfig
|
||||
import com.simplemobiletools.commons.extensions.getProperTextColor
|
||||
import com.simplemobiletools.commons.extensions.setupDialogStuff
|
||||
import kotlinx.android.synthetic.main.dialog_call_confirmation.view.*
|
||||
|
||||
|
@ -13,7 +13,7 @@ class CallConfirmationDialog(val activity: BaseSimpleActivity, val callee: Strin
|
|||
private var view = activity.layoutInflater.inflate(R.layout.dialog_call_confirmation, null)
|
||||
|
||||
init {
|
||||
view.call_confirm_phone.applyColorFilter(activity.baseConfig.textColor)
|
||||
view.call_confirm_phone.applyColorFilter(activity.getProperTextColor())
|
||||
AlertDialog.Builder(activity)
|
||||
.setNegativeButton(R.string.cancel, null)
|
||||
.create().apply {
|
||||
|
|
|
@ -140,7 +140,7 @@ class ColorPickerDialog(
|
|||
}
|
||||
}
|
||||
|
||||
val textColor = baseConfig.textColor
|
||||
val textColor = activity.getProperTextColor()
|
||||
val builder = AlertDialog.Builder(activity)
|
||||
.setPositiveButton(R.string.ok) { dialog, which -> confirmNewColor() }
|
||||
.setNegativeButton(R.string.cancel) { dialog, which -> dialogDismissed() }
|
||||
|
|
|
@ -100,7 +100,7 @@ class FilePickerDialog(
|
|||
(layoutParams as CoordinatorLayout.LayoutParams).bottomMargin = secondaryFabBottomMargin
|
||||
}
|
||||
|
||||
mDialogView.filepicker_placeholder.setTextColor(activity.baseConfig.textColor)
|
||||
mDialogView.filepicker_placeholder.setTextColor(activity.getProperTextColor())
|
||||
mDialogView.filepicker_fastscroller.updateColors(activity.getProperPrimaryColor())
|
||||
mDialogView.filepicker_fab_show_hidden.apply {
|
||||
beVisibleIf(!showHidden && canAddShowHiddenButton)
|
||||
|
|
|
@ -341,8 +341,8 @@ class PropertiesDialog() {
|
|||
}
|
||||
|
||||
mInflater.inflate(R.layout.item_property, mPropertyView, false).apply {
|
||||
property_value.setTextColor(mActivity.baseConfig.textColor)
|
||||
property_label.setTextColor(mActivity.baseConfig.textColor)
|
||||
property_value.setTextColor(mActivity.getProperTextColor())
|
||||
property_label.setTextColor(mActivity.getProperTextColor())
|
||||
|
||||
property_label.text = mResources.getString(labelId)
|
||||
property_value.text = value
|
||||
|
|
|
@ -28,7 +28,7 @@ class RenameDialog(val activity: BaseSimpleActivity, val paths: ArrayList<String
|
|||
}
|
||||
viewPager.currentItem = activity.baseConfig.lastRenameUsed
|
||||
|
||||
val textColor = context.baseConfig.textColor
|
||||
val textColor = context.getProperTextColor()
|
||||
dialog_tab_layout.setTabTextColors(textColor, textColor)
|
||||
dialog_tab_layout.setSelectedTabIndicatorColor(context.getProperPrimaryColor())
|
||||
|
||||
|
|
|
@ -50,7 +50,7 @@ class SecurityDialog(
|
|||
}
|
||||
|
||||
if (showTabIndex == SHOW_ALL_TABS) {
|
||||
val textColor = context.baseConfig.textColor
|
||||
val textColor = context.getProperTextColor()
|
||||
|
||||
if (shouldShowBiometricIdTab()) {
|
||||
val tabTitle = if (context.isTargetSdkVersion30Plus()) R.string.biometrics else R.string.fingerprint
|
||||
|
|
|
@ -74,7 +74,7 @@ class SelectAlarmSoundDialog(
|
|||
text = alarmSound.title
|
||||
isChecked = alarmSound.uri == currentUri
|
||||
id = alarmSound.id
|
||||
setColors(config.textColor, activity.getProperPrimaryColor(), config.backgroundColor)
|
||||
setColors(activity.getProperTextColor(), activity.getProperPrimaryColor(), activity.getProperBackgroundColor())
|
||||
setOnClickListener {
|
||||
alarmClicked(alarmSound)
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ import kotlinx.android.synthetic.main.item_breadcrumb.view.*
|
|||
class Breadcrumbs(context: Context, attrs: AttributeSet) : HorizontalScrollView(context, attrs) {
|
||||
private val inflater = context.getSystemService(Context.LAYOUT_INFLATER_SERVICE) as LayoutInflater
|
||||
private val itemsLayout: LinearLayout
|
||||
private var textColor = context.baseConfig.textColor
|
||||
private var textColor = context.getProperTextColor()
|
||||
private var fontSize = resources.getDimension(R.dimen.bigger_text_size)
|
||||
private var lastPath = ""
|
||||
private var isLayoutDirty = true
|
||||
|
@ -184,7 +184,7 @@ class Breadcrumbs(context: Context, attrs: AttributeSet) : HorizontalScrollView(
|
|||
breadcrumb_text.background = ContextCompat.getDrawable(context, R.drawable.button_background)
|
||||
breadcrumb_text.background.applyColorFilter(textColor)
|
||||
elevation = 1f
|
||||
background = ColorDrawable(context.baseConfig.backgroundColor)
|
||||
background = ColorDrawable(context.getProperBackgroundColor())
|
||||
val medium = getDimension(R.dimen.medium_margin).toInt()
|
||||
breadcrumb_text.setPadding(medium, medium, medium, medium)
|
||||
setPadding(rootStartPadding, 0, 0, 0)
|
||||
|
|
|
@ -25,7 +25,7 @@ class FingerprintTab(context: Context, attrs: AttributeSet) : RelativeLayout(con
|
|||
|
||||
override fun onFinishInflate() {
|
||||
super.onFinishInflate()
|
||||
val textColor = context.baseConfig.textColor
|
||||
val textColor = context.getProperTextColor()
|
||||
context.updateTextColors(fingerprint_lock_holder)
|
||||
fingerprint_image.applyColorFilter(textColor)
|
||||
|
||||
|
|
|
@ -10,10 +10,7 @@ import com.andrognito.patternlockview.PatternLockView
|
|||
import com.andrognito.patternlockview.listener.PatternLockViewListener
|
||||
import com.andrognito.patternlockview.utils.PatternLockUtils
|
||||
import com.simplemobiletools.commons.R
|
||||
import com.simplemobiletools.commons.extensions.baseConfig
|
||||
import com.simplemobiletools.commons.extensions.getProperPrimaryColor
|
||||
import com.simplemobiletools.commons.extensions.toast
|
||||
import com.simplemobiletools.commons.extensions.updateTextColors
|
||||
import com.simplemobiletools.commons.extensions.*
|
||||
import com.simplemobiletools.commons.helpers.PROTECTION_PATTERN
|
||||
import com.simplemobiletools.commons.interfaces.HashListener
|
||||
import com.simplemobiletools.commons.interfaces.SecurityTab
|
||||
|
@ -27,7 +24,7 @@ class PatternTab(context: Context, attrs: AttributeSet) : RelativeLayout(context
|
|||
|
||||
override fun onFinishInflate() {
|
||||
super.onFinishInflate()
|
||||
val textColor = context.baseConfig.textColor
|
||||
val textColor = context.getProperTextColor()
|
||||
context.updateTextColors(pattern_lock_holder)
|
||||
|
||||
pattern_lock_view.setOnTouchListener { v, event ->
|
||||
|
|
|
@ -36,7 +36,7 @@ class PinTab(context: Context, attrs: AttributeSet) : RelativeLayout(context, at
|
|||
pin_9.setOnClickListener { addNumber("9") }
|
||||
pin_c.setOnClickListener { clear() }
|
||||
pin_ok.setOnClickListener { confirmPIN() }
|
||||
pin_ok.applyColorFilter(context.baseConfig.textColor)
|
||||
pin_ok.applyColorFilter(context.getProperTextColor())
|
||||
}
|
||||
|
||||
override fun initTab(
|
||||
|
|
Loading…
Reference in a new issue