updating commons and target SDK to 31

This commit is contained in:
tibbi
2022-04-11 23:12:53 +02:00
parent 6add8ac473
commit 179c9e70f3
12 changed files with 62 additions and 67 deletions

View File

@ -9,12 +9,12 @@ if (keystorePropertiesFile.exists()) {
}
android {
compileSdkVersion 30
compileSdkVersion 31
defaultConfig {
applicationId "com.simplemobiletools.dialer"
minSdkVersion 23
targetSdkVersion 30
targetSdkVersion 31
versionCode 34
versionName "5.11.5"
setProperty("archivesBaseName", "dialer")
@ -61,6 +61,6 @@ android {
}
dependencies {
implementation 'com.github.SimpleMobileTools:Simple-Commons:b3416c828f'
implementation 'com.github.SimpleMobileTools:Simple-Commons:e3376e4f56'
implementation 'com.github.tibbi:IndicatorFastScroll:4524cd0b61'
}

View File

@ -152,12 +152,12 @@ class CallActivity : SimpleActivity() {
dialpad_asterisk_holder.setOnClickListener { dialpadPressed('*') }
dialpad_hashtag_holder.setOnClickListener { dialpadPressed('#') }
dialpad_wrapper.setBackgroundColor(config.backgroundColor)
dialpad_wrapper.setBackgroundColor(getProperBackgroundColor())
arrayOf(call_toggle_microphone, call_toggle_speaker, call_dialpad, dialpad_close, call_sim_image).forEach {
it.applyColorFilter(config.textColor)
it.applyColorFilter(getProperTextColor())
}
call_sim_id.setTextColor(config.textColor.getContrastColor())
call_sim_id.setTextColor(getProperTextColor().getContrastColor())
}
@SuppressLint("ClickableViewAccessibility")

View File

@ -26,7 +26,6 @@ import kotlinx.android.synthetic.main.activity_dialpad.*
import kotlinx.android.synthetic.main.activity_dialpad.dialpad_holder
import kotlinx.android.synthetic.main.dialpad.*
import java.util.*
import kotlin.collections.ArrayList
class DialpadActivity : SimpleActivity() {
private var allContacts = ArrayList<SimpleContact>()
@ -98,11 +97,11 @@ class DialpadActivity : SimpleActivity() {
SimpleContactsHelper(this).getAvailableContacts(false) { gotContacts(it) }
disableKeyboardPopping()
val adjustedPrimaryColor = getAdjustedPrimaryColor()
val properPrimaryColor = getProperPrimaryColor()
val callIconId = if (areMultipleSIMsAvailable()) {
val callIcon = resources.getColoredDrawableWithColor(R.drawable.ic_phone_two_vector, adjustedPrimaryColor.getContrastColor())
val callIcon = resources.getColoredDrawableWithColor(R.drawable.ic_phone_two_vector, properPrimaryColor.getContrastColor())
dialpad_call_two_button.setImageDrawable(callIcon)
dialpad_call_two_button.background.applyColorFilter(adjustedPrimaryColor)
dialpad_call_two_button.background.applyColorFilter(properPrimaryColor)
dialpad_call_two_button.beVisible()
dialpad_call_two_button.setOnClickListener {
initCall(dialpad_input.value, 1)
@ -113,21 +112,21 @@ class DialpadActivity : SimpleActivity() {
R.drawable.ic_phone_vector
}
val callIcon = resources.getColoredDrawableWithColor(callIconId, adjustedPrimaryColor.getContrastColor())
val callIcon = resources.getColoredDrawableWithColor(callIconId, properPrimaryColor.getContrastColor())
dialpad_call_button.setImageDrawable(callIcon)
dialpad_call_button.background.applyColorFilter(adjustedPrimaryColor)
dialpad_call_button.background.applyColorFilter(properPrimaryColor)
letter_fastscroller.textColor = config.textColor.getColorStateList()
letter_fastscroller.pressedTextColor = adjustedPrimaryColor
letter_fastscroller.textColor = getProperTextColor().getColorStateList()
letter_fastscroller.pressedTextColor = properPrimaryColor
letter_fastscroller_thumb.setupWithFastScroller(letter_fastscroller)
letter_fastscroller_thumb.textColor = adjustedPrimaryColor.getContrastColor()
letter_fastscroller_thumb.thumbColor = adjustedPrimaryColor.getColorStateList()
letter_fastscroller_thumb.textColor = properPrimaryColor.getContrastColor()
letter_fastscroller_thumb.thumbColor = properPrimaryColor.getColorStateList()
}
override fun onResume() {
super.onResume()
updateTextColors(dialpad_holder)
dialpad_clear_char.applyColorFilter(config.textColor)
dialpad_clear_char.applyColorFilter(getProperTextColor())
}
override fun onCreateOptionsMenu(menu: Menu): Boolean {

View File

@ -37,7 +37,6 @@ import kotlinx.android.synthetic.main.activity_main.*
import kotlinx.android.synthetic.main.fragment_contacts.*
import kotlinx.android.synthetic.main.fragment_favorites.*
import kotlinx.android.synthetic.main.fragment_recents.*
import java.util.*
class MainActivity : SimpleActivity() {
private var isSearchOpen = false
@ -60,9 +59,9 @@ class MainActivity : SimpleActivity() {
val snackbar = Snackbar.make(main_holder, R.string.allow_displaying_over_other_apps, Snackbar.LENGTH_INDEFINITE).setAction(R.string.ok) {
startActivity(Intent(Settings.ACTION_MANAGE_OVERLAY_PERMISSION))
}
snackbar.setBackgroundTint(config.backgroundColor.darkenColor())
snackbar.setTextColor(config.textColor)
snackbar.setActionTextColor(config.textColor)
snackbar.setBackgroundTint(getProperBackgroundColor().darkenColor())
snackbar.setTextColor(getProperTextColor())
snackbar.setActionTextColor(getProperTextColor())
snackbar.show()
}
} else {
@ -79,24 +78,24 @@ class MainActivity : SimpleActivity() {
override fun onResume() {
super.onResume()
val adjustedPrimaryColor = getAdjustedPrimaryColor()
val dialpadIcon = resources.getColoredDrawableWithColor(R.drawable.ic_dialpad_vector, adjustedPrimaryColor.getContrastColor())
val properPrimaryColor = getProperPrimaryColor()
val dialpadIcon = resources.getColoredDrawableWithColor(R.drawable.ic_dialpad_vector, properPrimaryColor.getContrastColor())
main_dialpad_button.apply {
setImageDrawable(dialpadIcon)
background.applyColorFilter(adjustedPrimaryColor)
background.applyColorFilter(properPrimaryColor)
}
main_tabs_holder.setBackgroundColor(config.backgroundColor)
main_tabs_holder.setSelectedTabIndicatorColor(adjustedPrimaryColor)
main_tabs_holder.setBackgroundColor(getProperBackgroundColor())
main_tabs_holder.setSelectedTabIndicatorColor(properPrimaryColor)
if (viewpager.adapter != null) {
getInactiveTabIndexes(viewpager.currentItem).forEach {
main_tabs_holder.getTabAt(it)?.icon?.applyColorFilter(config.textColor)
main_tabs_holder.getTabAt(it)?.icon?.applyColorFilter(getProperTextColor())
}
main_tabs_holder.getTabAt(viewpager.currentItem)?.icon?.applyColorFilter(adjustedPrimaryColor)
main_tabs_holder.getTabAt(viewpager.currentItem)?.icon?.applyColorFilter(properPrimaryColor)
getAllFragments().forEach {
it?.setupColors(config.textColor, config.primaryColor, getAdjustedPrimaryColor())
it?.setupColors(getProperTextColor(), getProperPrimaryColor(), getProperPrimaryColor())
}
}
@ -239,23 +238,23 @@ class MainActivity : SimpleActivity() {
private fun setupTabColors() {
val lastUsedPage = getDefaultTab()
main_tabs_holder.apply {
background = ColorDrawable(config.backgroundColor)
setSelectedTabIndicatorColor(getAdjustedPrimaryColor())
background = ColorDrawable(getProperBackgroundColor())
setSelectedTabIndicatorColor(getProperPrimaryColor())
getTabAt(lastUsedPage)?.select()
getTabAt(lastUsedPage)?.icon?.applyColorFilter(getAdjustedPrimaryColor())
getTabAt(lastUsedPage)?.icon?.applyColorFilter(getProperPrimaryColor())
getInactiveTabIndexes(lastUsedPage).forEach {
getTabAt(it)?.icon?.applyColorFilter(config.textColor)
getTabAt(it)?.icon?.applyColorFilter(getProperTextColor())
}
}
main_tabs_holder.onTabSelectionChanged(
tabUnselectedAction = {
it.icon?.applyColorFilter(config.textColor)
it.icon?.applyColorFilter(getProperTextColor())
},
tabSelectedAction = {
viewpager.currentItem = it.position
it.icon?.applyColorFilter(getAdjustedPrimaryColor())
it.icon?.applyColorFilter(getProperPrimaryColor())
}
)
}
@ -343,7 +342,7 @@ class MainActivity : SimpleActivity() {
else -> R.drawable.ic_clock_vector
}
return resources.getColoredDrawableWithColor(drawableId, config.textColor)
return resources.getColoredDrawableWithColor(drawableId, getProperTextColor())
}
private fun getTabContentDescription(position: Int): String {

View File

@ -50,7 +50,7 @@ class SettingsActivity : SimpleActivity() {
settings_startup_label,
settings_calls_label
).forEach {
it.setTextColor(getAdjustedPrimaryColor())
it.setTextColor(getProperPrimaryColor())
}
arrayOf(
@ -59,7 +59,7 @@ class SettingsActivity : SimpleActivity() {
settings_startup_holder,
settings_calls_holder
).forEach {
it.background.applyColorFilter(baseConfig.backgroundColor.getContrastColor())
it.background.applyColorFilter(getProperBackgroundColor().getContrastColor())
}
}

View File

@ -225,9 +225,9 @@ class ContactsAdapter(
text = if (textToHighlight.isEmpty()) contact.name else {
if (contact.name.contains(textToHighlight, true)) {
contact.name.highlightTextPart(textToHighlight, adjustedPrimaryColor)
contact.name.highlightTextPart(textToHighlight, properPrimaryColor)
} else {
contact.name.highlightTextFromNumbers(textToHighlight, adjustedPrimaryColor)
contact.name.highlightTextFromNumbers(textToHighlight, properPrimaryColor)
}
}

View File

@ -25,7 +25,6 @@ import com.simplemobiletools.dialer.helpers.RecentsHelper
import com.simplemobiletools.dialer.interfaces.RefreshItemsListener
import com.simplemobiletools.dialer.models.RecentCall
import kotlinx.android.synthetic.main.item_recent_call.view.*
import java.util.*
class RecentCallsAdapter(
activity: SimpleActivity, var recentCalls: ArrayList<RecentCall>, recyclerView: MyRecyclerView, val refreshItemsListener: RefreshItemsListener?,
@ -116,8 +115,8 @@ class RecentCallsAdapter(
}
fun initDrawables() {
outgoingCallIcon = resources.getColoredDrawableWithColor(R.drawable.ic_outgoing_call_vector, baseConfig.textColor)
incomingCallIcon = resources.getColoredDrawableWithColor(R.drawable.ic_incoming_call_vector, baseConfig.textColor)
outgoingCallIcon = resources.getColoredDrawableWithColor(R.drawable.ic_outgoing_call_vector, activity.getProperTextColor())
incomingCallIcon = resources.getColoredDrawableWithColor(R.drawable.ic_incoming_call_vector, activity.getProperTextColor())
incomingMissedCallIcon = resources.getColoredDrawableWithColor(R.drawable.ic_incoming_call_vector, redColor)
}
@ -260,7 +259,7 @@ class RecentCallsAdapter(
}
if (textToHighlight.isNotEmpty() && nameToShow.contains(textToHighlight, true)) {
nameToShow = SpannableString(nameToShow.toString().highlightTextPart(textToHighlight, adjustedPrimaryColor))
nameToShow = SpannableString(nameToShow.toString().highlightTextPart(textToHighlight, properPrimaryColor))
}
item_recents_name.apply {

View File

@ -2,10 +2,7 @@ package com.simplemobiletools.dialer.dialogs
import androidx.appcompat.app.AlertDialog
import com.reddit.indicatorfastscroll.FastScrollItemIndicator
import com.simplemobiletools.commons.extensions.getAdjustedPrimaryColor
import com.simplemobiletools.commons.extensions.getColorStateList
import com.simplemobiletools.commons.extensions.getContrastColor
import com.simplemobiletools.commons.extensions.setupDialogStuff
import com.simplemobiletools.commons.extensions.*
import com.simplemobiletools.commons.models.SimpleContact
import com.simplemobiletools.dialer.R
import com.simplemobiletools.dialer.activities.SimpleActivity
@ -20,10 +17,10 @@ class SelectContactDialog(val activity: SimpleActivity, contacts: ArrayList<Simp
init {
view.apply {
letter_fastscroller.textColor = context.config.textColor.getColorStateList()
letter_fastscroller.textColor = context.getProperTextColor().getColorStateList()
letter_fastscroller_thumb.setupWithFastScroller(letter_fastscroller)
letter_fastscroller_thumb.textColor = context.getAdjustedPrimaryColor().getContrastColor()
letter_fastscroller_thumb.thumbColor = context.getAdjustedPrimaryColor().getColorStateList()
letter_fastscroller_thumb.textColor = context.getProperPrimaryColor().getContrastColor()
letter_fastscroller_thumb.thumbColor = context.getProperPrimaryColor().getColorStateList()
letter_fastscroller.setupWithRecyclerView(select_contact_list, { position ->
try {

View File

@ -54,21 +54,21 @@ class ContactsFragment(context: Context, attributeSet: AttributeSet) : MyViewPag
}
}
override fun setupColors(textColor: Int, primaryColor: Int, adjustedPrimaryColor: Int) {
override fun setupColors(textColor: Int, primaryColor: Int, properPrimaryColor: Int) {
(fragment_list?.adapter as? MyRecyclerViewAdapter)?.updateTextColor(textColor)
fragment_placeholder.setTextColor(textColor)
fragment_placeholder_2.setTextColor(adjustedPrimaryColor)
fragment_placeholder_2.setTextColor(properPrimaryColor)
letter_fastscroller.textColor = textColor.getColorStateList()
letter_fastscroller.pressedTextColor = adjustedPrimaryColor
letter_fastscroller.pressedTextColor = properPrimaryColor
letter_fastscroller_thumb.setupWithFastScroller(letter_fastscroller)
letter_fastscroller_thumb.textColor = adjustedPrimaryColor.getContrastColor()
letter_fastscroller_thumb.thumbColor = adjustedPrimaryColor.getColorStateList()
letter_fastscroller_thumb.textColor = properPrimaryColor.getContrastColor()
letter_fastscroller_thumb.thumbColor = properPrimaryColor.getColorStateList()
fragment_fab.setColors(
textColor,
adjustedPrimaryColor,
adjustedPrimaryColor.getContrastColor()
properPrimaryColor,
properPrimaryColor.getContrastColor()
)
}

View File

@ -35,15 +35,15 @@ class FavoritesFragment(context: Context, attributeSet: AttributeSet) : MyViewPa
fragment_placeholder_2.beGone()
}
override fun setupColors(textColor: Int, primaryColor: Int, adjustedPrimaryColor: Int) {
override fun setupColors(textColor: Int, primaryColor: Int, properPrimaryColor: Int) {
fragment_placeholder.setTextColor(textColor)
(fragment_list?.adapter as? MyRecyclerViewAdapter)?.updateTextColor(textColor)
letter_fastscroller.textColor = textColor.getColorStateList()
letter_fastscroller.pressedTextColor = adjustedPrimaryColor
letter_fastscroller.pressedTextColor = properPrimaryColor
letter_fastscroller_thumb.setupWithFastScroller(letter_fastscroller)
letter_fastscroller_thumb.textColor = adjustedPrimaryColor.getContrastColor()
letter_fastscroller_thumb.thumbColor = adjustedPrimaryColor.getColorStateList()
letter_fastscroller_thumb.textColor = properPrimaryColor.getContrastColor()
letter_fastscroller_thumb.thumbColor = properPrimaryColor.getColorStateList()
}
override fun refreshItems() {

View File

@ -4,7 +4,8 @@ import android.content.Context
import android.util.AttributeSet
import android.widget.RelativeLayout
import com.simplemobiletools.commons.adapters.MyRecyclerViewAdapter
import com.simplemobiletools.commons.extensions.getAdjustedPrimaryColor
import com.simplemobiletools.commons.extensions.getProperPrimaryColor
import com.simplemobiletools.commons.extensions.getProperTextColor
import com.simplemobiletools.dialer.activities.SimpleActivity
import com.simplemobiletools.dialer.extensions.config
import com.simplemobiletools.dialer.helpers.Config
@ -22,7 +23,7 @@ abstract class MyViewPagerFragment(context: Context, attributeSet: AttributeSet)
this.activity = activity
setupFragment()
setupColors(config.textColor, config.primaryColor, activity.getAdjustedPrimaryColor())
setupColors(activity.getProperTextColor(), activity.getProperPrimaryColor(), activity.getProperPrimaryColor())
}
}
@ -33,7 +34,7 @@ abstract class MyViewPagerFragment(context: Context, attributeSet: AttributeSet)
abstract fun setupFragment()
abstract fun setupColors(textColor: Int, primaryColor: Int, adjustedPrimaryColor: Int)
abstract fun setupColors(textColor: Int, primaryColor: Int, properPrimaryColor: Int)
abstract fun onSearchClosed()

View File

@ -35,9 +35,9 @@ class RecentsFragment(context: Context, attributeSet: AttributeSet) : MyViewPage
}
}
override fun setupColors(textColor: Int, primaryColor: Int, adjustedPrimaryColor: Int) {
override fun setupColors(textColor: Int, primaryColor: Int, properPrimaryColor: Int) {
recents_placeholder.setTextColor(textColor)
recents_placeholder_2.setTextColor(adjustedPrimaryColor)
recents_placeholder_2.setTextColor(properPrimaryColor)
(recents_list?.adapter as? RecentCallsAdapter)?.apply {
initDrawables()