apply the selected font size on a few places

This commit is contained in:
tibbi 2020-02-05 12:03:45 +01:00
parent 1e7b8f7340
commit fe4e6767aa
4 changed files with 17 additions and 15 deletions

View file

@ -1,6 +1,7 @@
package com.simplemobiletools.contacts.pro.adapters
import android.graphics.drawable.Drawable
import android.util.TypedValue
import android.view.Menu
import android.view.View
import android.view.ViewGroup
@ -12,10 +13,7 @@ import com.bumptech.glide.signature.ObjectKey
import com.simplemobiletools.commons.adapters.MyRecyclerViewAdapter
import com.simplemobiletools.commons.dialogs.ConfirmationDialog
import com.simplemobiletools.commons.dialogs.RadioGroupDialog
import com.simplemobiletools.commons.extensions.beVisibleIf
import com.simplemobiletools.commons.extensions.getAdjustedPrimaryColor
import com.simplemobiletools.commons.extensions.getColoredDrawableWithColor
import com.simplemobiletools.commons.extensions.highlightTextPart
import com.simplemobiletools.commons.extensions.*
import com.simplemobiletools.commons.helpers.ensureBackgroundThread
import com.simplemobiletools.commons.models.RadioItem
import com.simplemobiletools.commons.views.FastScroller
@ -46,6 +44,7 @@ class ContactsAdapter(activity: SimpleActivity, var contactItems: ArrayList<Cont
var startNameWithSurname = config.startNameWithSurname
var showContactThumbnails = config.showContactThumbnails
var showPhoneNumbers = config.showPhoneNumbers
var fontSize = activity.getTextSize()
private val itemLayout = if (showPhoneNumbers) R.layout.item_contact_with_number else R.layout.item_contact_without_number
@ -110,7 +109,7 @@ class ContactsAdapter(activity: SimpleActivity, var contactItems: ArrayList<Cont
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int) = createViewHolder(itemLayout, parent)
override fun onBindViewHolder(holder: MyRecyclerViewAdapter.ViewHolder, position: Int) {
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
val contact = contactItems[position]
val allowLongClick = location != LOCATION_INSERT_OR_EDIT
holder.bindView(contact, true, allowLongClick) { itemView, layoutPosition ->
@ -286,6 +285,7 @@ class ContactsAdapter(activity: SimpleActivity, var contactItems: ArrayList<Cont
}
contact_name.setTextColor(textColor)
contact_name.setTextSize(TypedValue.COMPLEX_UNIT_PX, fontSize)
if (!showContactThumbnails && !showPhoneNumbers) {
contact_name.setPadding(bigPadding, bigPadding, bigPadding, bigPadding)
} else {
@ -303,6 +303,7 @@ class ContactsAdapter(activity: SimpleActivity, var contactItems: ArrayList<Cont
contact_number.text = if (textToHighlight.isEmpty()) numberText else numberText.highlightTextPart(textToHighlight, adjustedPrimaryColor, false, true)
contact_number.setTextColor(textColor)
contact_number.setPadding(if (showContactThumbnails) smallPadding else bigPadding, 0, smallPadding, 0)
contact_number.setTextSize(TypedValue.COMPLEX_UNIT_PX, fontSize)
}
contact_tmb.beVisibleIf(showContactThumbnails)

View file

@ -1,14 +1,12 @@
package com.simplemobiletools.contacts.pro.adapters
import android.util.TypedValue
import android.view.Menu
import android.view.View
import android.view.ViewGroup
import com.simplemobiletools.commons.adapters.MyRecyclerViewAdapter
import com.simplemobiletools.commons.dialogs.ConfirmationDialog
import com.simplemobiletools.commons.extensions.applyColorFilter
import com.simplemobiletools.commons.extensions.beVisibleIf
import com.simplemobiletools.commons.extensions.getAdjustedPrimaryColor
import com.simplemobiletools.commons.extensions.highlightTextPart
import com.simplemobiletools.commons.extensions.*
import com.simplemobiletools.commons.helpers.ensureBackgroundThread
import com.simplemobiletools.commons.views.FastScroller
import com.simplemobiletools.commons.views.MyRecyclerView
@ -33,6 +31,7 @@ class GroupsAdapter(activity: SimpleActivity, var groups: ArrayList<Group>, val
var adjustedPrimaryColor = activity.getAdjustedPrimaryColor()
var showContactThumbnails = activity.config.showContactThumbnails
var fontSize = activity.getTextSize()
init {
setupDragListener(true)
@ -72,7 +71,7 @@ class GroupsAdapter(activity: SimpleActivity, var groups: ArrayList<Group>, val
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int) = createViewHolder(R.layout.item_group, parent)
override fun onBindViewHolder(holder: MyRecyclerViewAdapter.ViewHolder, position: Int) {
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
val group = groups[position]
holder.bindView(group, true, true) { itemView, layoutPosition ->
setupView(itemView, group)
@ -164,6 +163,7 @@ class GroupsAdapter(activity: SimpleActivity, var groups: ArrayList<Group>, val
group_name.apply {
setTextColor(textColor)
setTextSize(TypedValue.COMPLEX_UNIT_PX, fontSize)
text = groupTitle
if (showContactThumbnails) {

View file

@ -1,6 +1,7 @@
package com.simplemobiletools.contacts.pro.adapters
import android.util.SparseArray
import android.util.TypedValue
import android.view.View
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
@ -9,10 +10,7 @@ import com.bumptech.glide.load.engine.DiskCacheStrategy
import com.bumptech.glide.load.resource.drawable.DrawableTransitionOptions
import com.bumptech.glide.request.RequestOptions
import com.bumptech.glide.signature.ObjectKey
import com.simplemobiletools.commons.extensions.beVisibleIf
import com.simplemobiletools.commons.extensions.getAdjustedPrimaryColor
import com.simplemobiletools.commons.extensions.getColoredDrawableWithColor
import com.simplemobiletools.commons.extensions.highlightTextPart
import com.simplemobiletools.commons.extensions.*
import com.simplemobiletools.commons.views.FastScroller
import com.simplemobiletools.commons.views.MyRecyclerView
import com.simplemobiletools.contacts.pro.R
@ -31,6 +29,7 @@ class SelectContactsAdapter(val activity: SimpleActivity, var contacts: ArrayLis
private val config = activity.config
private val textColor = config.textColor
private val adjustedPrimaryColor = activity.getAdjustedPrimaryColor()
private val fontSize = activity.getTextSize()
private val contactDrawable = activity.resources.getColoredDrawableWithColor(R.drawable.ic_person_vector, textColor)
private val showContactThumbnails = config.showContactThumbnails
@ -121,6 +120,7 @@ class SelectContactsAdapter(val activity: SimpleActivity, var contacts: ArrayLis
}
contact_name.setTextColor(textColor)
contact_name.setTextSize(TypedValue.COMPLEX_UNIT_PX, fontSize)
if (!showContactThumbnails && !showPhoneNumbers) {
contact_name.setPadding(bigPadding, bigPadding, bigPadding, bigPadding)
} else {
@ -138,6 +138,7 @@ class SelectContactsAdapter(val activity: SimpleActivity, var contacts: ArrayLis
contact_number.text = if (textToHighlight.isEmpty()) numberText else numberText.highlightTextPart(textToHighlight, adjustedPrimaryColor, false, true)
contact_number.setTextColor(textColor)
contact_number.setPadding(if (showContactThumbnails) smallPadding else bigPadding, 0, smallPadding, 0)
contact_number.setTextSize(TypedValue.COMPLEX_UNIT_PX, fontSize)
}
contact_frame.setOnClickListener {

View file

@ -45,7 +45,7 @@
android:layout_toEndOf="@+id/contact_tmb"
android:alpha="0.6"
android:maxLines="1"
android:textSize="@dimen/bigger_text_size"
android:textSize="@dimen/big_text_size"
tools:text="0123 456 789" />
</RelativeLayout>