lets replace Adjusted primary color with Proper primary color
This commit is contained in:
parent
3d75d21bdf
commit
b8b0db7534
13 changed files with 35 additions and 44 deletions
|
@ -26,7 +26,7 @@ class FAQActivity : BaseSimpleActivity() {
|
|||
setContentView(R.layout.activity_faq)
|
||||
|
||||
val dividerMargin = resources.getDimension(R.dimen.medium_margin).toInt()
|
||||
val titleColor = getAdjustedPrimaryColor()
|
||||
val titleColor = getProperPrimaryColor()
|
||||
val backgroundColor = getProperBackgroundColor()
|
||||
val textColor = getProperTextColor()
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ class ManageBlockedNumbersActivity : BaseSimpleActivity(), RefreshRecyclerViewLi
|
|||
|
||||
manage_blocked_numbers_placeholder_2.apply {
|
||||
underlineText()
|
||||
setTextColor(getAdjustedPrimaryColor())
|
||||
setTextColor(getProperPrimaryColor())
|
||||
setOnClickListener {
|
||||
if (isDefaultDialer()) {
|
||||
addOrEditBlockedNumber()
|
||||
|
|
|
@ -9,11 +9,10 @@ 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.getAdjustedPrimaryColor
|
||||
import com.simplemobiletools.commons.extensions.getContrastColor
|
||||
import com.simplemobiletools.commons.extensions.getProperPrimaryColor
|
||||
import com.simplemobiletools.commons.interfaces.MyActionModeCallback
|
||||
import com.simplemobiletools.commons.views.MyRecyclerView
|
||||
import java.util.*
|
||||
|
||||
abstract class MyRecyclerViewAdapter(val activity: BaseSimpleActivity, val recyclerView: MyRecyclerView, val itemClick: (Any) -> Unit) :
|
||||
RecyclerView.Adapter<MyRecyclerViewAdapter.ViewHolder>() {
|
||||
|
@ -21,8 +20,8 @@ abstract class MyRecyclerViewAdapter(val activity: BaseSimpleActivity, val recyc
|
|||
protected val resources = activity.resources!!
|
||||
protected val layoutInflater = activity.layoutInflater
|
||||
protected var primaryColor = baseConfig.primaryColor
|
||||
protected var adjustedPrimaryColor = activity.getAdjustedPrimaryColor()
|
||||
protected var contrastColor = adjustedPrimaryColor.getContrastColor()
|
||||
protected var properPrimaryColor = activity.getProperPrimaryColor()
|
||||
protected var contrastColor = properPrimaryColor.getContrastColor()
|
||||
protected var textColor = baseConfig.textColor
|
||||
protected var backgroundColor = baseConfig.backgroundColor
|
||||
protected var actModeCallback: MyActionModeCallback
|
||||
|
@ -273,8 +272,8 @@ abstract class MyRecyclerViewAdapter(val activity: BaseSimpleActivity, val recyc
|
|||
|
||||
fun updatePrimaryColor(primaryColor: Int) {
|
||||
this.primaryColor = primaryColor
|
||||
adjustedPrimaryColor = activity.getAdjustedPrimaryColor()
|
||||
contrastColor = adjustedPrimaryColor.getContrastColor()
|
||||
properPrimaryColor = activity.getProperPrimaryColor()
|
||||
contrastColor = properPrimaryColor.getContrastColor()
|
||||
}
|
||||
|
||||
fun updateBackgroundColor(backgroundColor: Int) {
|
||||
|
|
|
@ -10,11 +10,10 @@ 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.getAdjustedPrimaryColor
|
||||
import com.simplemobiletools.commons.extensions.getContrastColor
|
||||
import com.simplemobiletools.commons.extensions.getProperPrimaryColor
|
||||
import com.simplemobiletools.commons.interfaces.MyActionModeCallback
|
||||
import com.simplemobiletools.commons.views.MyRecyclerView
|
||||
import java.util.*
|
||||
|
||||
abstract class MyRecyclerViewListAdapter<T>(
|
||||
val activity: BaseSimpleActivity,
|
||||
|
@ -27,8 +26,8 @@ abstract class MyRecyclerViewListAdapter<T>(
|
|||
protected val resources = activity.resources!!
|
||||
protected val layoutInflater = activity.layoutInflater
|
||||
protected var primaryColor = baseConfig.primaryColor
|
||||
protected var adjustedPrimaryColor = activity.getAdjustedPrimaryColor()
|
||||
protected var contrastColor = adjustedPrimaryColor.getContrastColor()
|
||||
protected var primaryPrimaryColor = activity.getProperPrimaryColor()
|
||||
protected var contrastColor = primaryPrimaryColor.getContrastColor()
|
||||
protected var textColor = baseConfig.textColor
|
||||
protected var backgroundColor = baseConfig.backgroundColor
|
||||
protected var actModeCallback: MyActionModeCallback
|
||||
|
@ -278,8 +277,8 @@ abstract class MyRecyclerViewListAdapter<T>(
|
|||
|
||||
fun updatePrimaryColor(primaryColor: Int) {
|
||||
this.primaryColor = primaryColor
|
||||
adjustedPrimaryColor = activity.getAdjustedPrimaryColor()
|
||||
contrastColor = adjustedPrimaryColor.getContrastColor()
|
||||
primaryPrimaryColor = activity.getProperPrimaryColor()
|
||||
contrastColor = primaryPrimaryColor.getContrastColor()
|
||||
}
|
||||
|
||||
fun updateBackgroundColor(backgroundColor: Int) {
|
||||
|
|
|
@ -16,7 +16,6 @@ import com.simplemobiletools.commons.models.FileDirItem
|
|||
import com.simplemobiletools.commons.views.Breadcrumbs
|
||||
import kotlinx.android.synthetic.main.dialog_filepicker.view.*
|
||||
import java.io.File
|
||||
import java.util.*
|
||||
|
||||
/**
|
||||
* The only filepicker constructor with a couple optional parameters
|
||||
|
@ -102,7 +101,7 @@ class FilePickerDialog(
|
|||
}
|
||||
|
||||
mDialogView.filepicker_placeholder.setTextColor(activity.baseConfig.textColor)
|
||||
mDialogView.filepicker_fastscroller.updateColors(activity.getAdjustedPrimaryColor())
|
||||
mDialogView.filepicker_fastscroller.updateColors(activity.getProperPrimaryColor())
|
||||
mDialogView.filepicker_fab_show_hidden.apply {
|
||||
beVisibleIf(!showHidden && canAddShowHiddenButton)
|
||||
setOnClickListener {
|
||||
|
@ -295,7 +294,7 @@ class FilePickerDialog(
|
|||
mDialogView.apply {
|
||||
filepicker_favorites_holder.beVisible()
|
||||
filepicker_files_holder.beGone()
|
||||
val drawable = activity.resources.getColoredDrawableWithColor(R.drawable.ic_folder_vector, activity.getAdjustedPrimaryColor().getContrastColor())
|
||||
val drawable = activity.resources.getColoredDrawableWithColor(R.drawable.ic_folder_vector, activity.getProperPrimaryColor().getContrastColor())
|
||||
filepicker_fab_show_favorites.setImageDrawable(drawable)
|
||||
}
|
||||
}
|
||||
|
@ -304,7 +303,7 @@ class FilePickerDialog(
|
|||
mDialogView.apply {
|
||||
filepicker_favorites_holder.beGone()
|
||||
filepicker_files_holder.beVisible()
|
||||
val drawable = activity.resources.getColoredDrawableWithColor(R.drawable.ic_star_vector, activity.getAdjustedPrimaryColor().getContrastColor())
|
||||
val drawable = activity.resources.getColoredDrawableWithColor(R.drawable.ic_star_vector, activity.getProperPrimaryColor().getContrastColor())
|
||||
filepicker_fab_show_favorites.setImageDrawable(drawable)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,9 +11,9 @@ class RateStarsDialog(val activity: Activity) {
|
|||
|
||||
init {
|
||||
val view = activity.layoutInflater.inflate(R.layout.dialog_rate_stars, null).apply {
|
||||
val textColor = activity.baseConfig.textColor
|
||||
val primaryColor = activity.getProperPrimaryColor()
|
||||
arrayOf(rate_star_1, rate_star_2, rate_star_3, rate_star_4, rate_star_5).forEach {
|
||||
it.applyColorFilter(textColor)
|
||||
it.applyColorFilter(primaryColor)
|
||||
}
|
||||
|
||||
rate_star_1.setOnClickListener { dialogCancelled(true) }
|
||||
|
|
|
@ -11,7 +11,6 @@ import com.simplemobiletools.commons.helpers.RENAME_PATTERN
|
|||
import com.simplemobiletools.commons.helpers.RENAME_SIMPLE
|
||||
import com.simplemobiletools.commons.views.MyViewPager
|
||||
import kotlinx.android.synthetic.main.dialog_rename.view.*
|
||||
import java.util.*
|
||||
|
||||
class RenameDialog(val activity: BaseSimpleActivity, val paths: ArrayList<String>, val useMediaFileExtension: Boolean, val callback: () -> Unit) {
|
||||
var dialog: AlertDialog? = null
|
||||
|
@ -31,7 +30,7 @@ class RenameDialog(val activity: BaseSimpleActivity, val paths: ArrayList<String
|
|||
|
||||
val textColor = context.baseConfig.textColor
|
||||
dialog_tab_layout.setTabTextColors(textColor, textColor)
|
||||
dialog_tab_layout.setSelectedTabIndicatorColor(context.getAdjustedPrimaryColor())
|
||||
dialog_tab_layout.setSelectedTabIndicatorColor(context.getProperPrimaryColor())
|
||||
|
||||
dialog_tab_layout.onTabSelectionChanged(tabSelectedAction = {
|
||||
viewPager.currentItem = when {
|
||||
|
|
|
@ -58,7 +58,7 @@ class SecurityDialog(
|
|||
}
|
||||
|
||||
dialog_tab_layout.setTabTextColors(textColor, textColor)
|
||||
dialog_tab_layout.setSelectedTabIndicatorColor(context.getAdjustedPrimaryColor())
|
||||
dialog_tab_layout.setSelectedTabIndicatorColor(context.getProperPrimaryColor())
|
||||
dialog_tab_layout.onTabSelectionChanged(tabSelectedAction = {
|
||||
viewPager.currentItem = when {
|
||||
it.text.toString().equals(resources.getString(R.string.pattern), true) -> PROTECTION_PATTERN
|
||||
|
|
|
@ -17,7 +17,6 @@ import com.simplemobiletools.commons.models.AlarmSound
|
|||
import com.simplemobiletools.commons.models.RadioItem
|
||||
import com.simplemobiletools.commons.views.MyCompatRadioButton
|
||||
import kotlinx.android.synthetic.main.dialog_select_alarm_sound.view.*
|
||||
import java.util.*
|
||||
|
||||
class SelectAlarmSoundDialog(
|
||||
val activity: BaseSimpleActivity, val currentUri: String, val audioStream: Int, val pickAudioIntentId: Int,
|
||||
|
@ -39,8 +38,8 @@ class SelectAlarmSoundDialog(
|
|||
gotSystemAlarms()
|
||||
}
|
||||
|
||||
view.dialog_select_alarm_your_label.setTextColor(activity.getAdjustedPrimaryColor())
|
||||
view.dialog_select_alarm_system_label.setTextColor(activity.getAdjustedPrimaryColor())
|
||||
view.dialog_select_alarm_your_label.setTextColor(activity.getProperPrimaryColor())
|
||||
view.dialog_select_alarm_system_label.setTextColor(activity.getProperPrimaryColor())
|
||||
|
||||
addYourAlarms()
|
||||
|
||||
|
@ -75,7 +74,7 @@ class SelectAlarmSoundDialog(
|
|||
text = alarmSound.title
|
||||
isChecked = alarmSound.uri == currentUri
|
||||
id = alarmSound.id
|
||||
setColors(config.textColor, activity.getAdjustedPrimaryColor(), config.backgroundColor)
|
||||
setColors(config.textColor, activity.getProperPrimaryColor(), config.backgroundColor)
|
||||
setOnClickListener {
|
||||
alarmClicked(alarmSound)
|
||||
|
||||
|
|
|
@ -1357,11 +1357,11 @@ fun Activity.setupDialogStuff(
|
|||
|
||||
val textColor = getProperTextColor()
|
||||
val backgroundColor = getProperBackgroundColor()
|
||||
val adjustedPrimaryColor = getAdjustedPrimaryColor()
|
||||
val primaryColor = getProperPrimaryColor()
|
||||
if (view is ViewGroup) {
|
||||
updateTextColors(view)
|
||||
} else if (view is MyTextView) {
|
||||
view.setColors(textColor, adjustedPrimaryColor, backgroundColor)
|
||||
view.setColors(textColor, primaryColor, backgroundColor)
|
||||
}
|
||||
|
||||
var title: TextView? = null
|
||||
|
@ -1378,10 +1378,10 @@ fun Activity.setupDialogStuff(
|
|||
}
|
||||
|
||||
// if we use the same primary and background color, use the text color for dialog confirmation buttons
|
||||
val dialogButtonColor = if (adjustedPrimaryColor == baseConfig.backgroundColor) {
|
||||
val dialogButtonColor = if (primaryColor == baseConfig.backgroundColor) {
|
||||
textColor
|
||||
} else {
|
||||
adjustedPrimaryColor
|
||||
primaryColor
|
||||
}
|
||||
|
||||
dialog.apply {
|
||||
|
|
|
@ -12,6 +12,7 @@ import com.simplemobiletools.commons.helpers.*
|
|||
import com.simplemobiletools.commons.models.SharedTheme
|
||||
import com.simplemobiletools.commons.views.*
|
||||
|
||||
// handle system default theme (Material You) specially as the color is taken from the system, not hardcoded by us
|
||||
fun Context.getProperTextColor() = if (baseConfig.isUsingSystemTheme) {
|
||||
resources.getColor(R.color.you_neutral_text_color)
|
||||
} else {
|
||||
|
@ -24,10 +25,10 @@ fun Context.getProperBackgroundColor() = if (baseConfig.isUsingSystemTheme) {
|
|||
baseConfig.backgroundColor
|
||||
}
|
||||
|
||||
fun Context.getProperPrimaryColor() = if (baseConfig.isUsingSystemTheme) {
|
||||
resources.getColor(R.color.you_primary_color)
|
||||
} else {
|
||||
baseConfig.primaryColor
|
||||
fun Context.getProperPrimaryColor() = when {
|
||||
baseConfig.isUsingSystemTheme -> resources.getColor(R.color.you_primary_color)
|
||||
isWhiteTheme() || isBlackAndWhiteTheme() -> baseConfig.accentColor
|
||||
else -> baseConfig.primaryColor
|
||||
}
|
||||
|
||||
fun Context.updateTextColors(viewGroup: ViewGroup) {
|
||||
|
@ -76,11 +77,6 @@ fun Context.isWhiteTheme() = baseConfig.textColor == DARK_GREY && baseConfig.pri
|
|||
|
||||
fun Context.isUsingSystemDarkTheme() = resources.configuration.uiMode and Configuration.UI_MODE_NIGHT_YES != 0
|
||||
|
||||
fun Context.getAdjustedPrimaryColor() = when {
|
||||
isWhiteTheme() || isBlackAndWhiteTheme() -> baseConfig.accentColor
|
||||
else -> getProperPrimaryColor()
|
||||
}
|
||||
|
||||
fun Context.getDialogTheme() = if (baseConfig.backgroundColor.getContrastColor() == Color.WHITE) R.style.MyDialogTheme_Dark else R.style.MyDialogTheme
|
||||
|
||||
fun Context.getSharedTheme(callback: (sharedTheme: SharedTheme?) -> Unit) {
|
||||
|
|
|
@ -262,14 +262,14 @@ fun String.getNameLetter() = normalizeString().toCharArray().getOrNull(0)?.toStr
|
|||
|
||||
fun String.normalizePhoneNumber() = PhoneNumberUtils.normalizeNumber(this)
|
||||
|
||||
fun String.highlightTextFromNumbers(textToHighlight: String, adjustedPrimaryColor: Int): SpannableString {
|
||||
fun String.highlightTextFromNumbers(textToHighlight: String, primaryColor: Int): SpannableString {
|
||||
val spannableString = SpannableString(this)
|
||||
val digits = PhoneNumberUtils.convertKeypadLettersToDigits(this)
|
||||
if (digits.contains(textToHighlight)) {
|
||||
val startIndex = digits.indexOf(textToHighlight, 0, true)
|
||||
val endIndex = Math.min(startIndex + textToHighlight.length, length)
|
||||
try {
|
||||
spannableString.setSpan(ForegroundColorSpan(adjustedPrimaryColor), startIndex, endIndex, Spannable.SPAN_EXCLUSIVE_INCLUSIVE)
|
||||
spannableString.setSpan(ForegroundColorSpan(primaryColor), startIndex, endIndex, Spannable.SPAN_EXCLUSIVE_INCLUSIVE)
|
||||
} catch (ignored: IndexOutOfBoundsException) {
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@ 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.getAdjustedPrimaryColor
|
||||
import com.simplemobiletools.commons.extensions.getProperPrimaryColor
|
||||
import com.simplemobiletools.commons.extensions.toast
|
||||
import com.simplemobiletools.commons.extensions.updateTextColors
|
||||
import com.simplemobiletools.commons.helpers.PROTECTION_PATTERN
|
||||
|
@ -38,7 +38,7 @@ class PatternTab(context: Context, attrs: AttributeSet) : RelativeLayout(context
|
|||
false
|
||||
}
|
||||
|
||||
pattern_lock_view.correctStateColor = context.getAdjustedPrimaryColor()
|
||||
pattern_lock_view.correctStateColor = context.getProperPrimaryColor()
|
||||
pattern_lock_view.normalStateColor = textColor
|
||||
pattern_lock_view.addPatternLockListener(object : PatternLockViewListener {
|
||||
override fun onComplete(pattern: MutableList<PatternLockView.Dot>?) {
|
||||
|
|
Loading…
Reference in a new issue