mirror of
https://github.com/SimpleMobileTools/Simple-Dialer.git
synced 2025-04-07 06:51:04 +02:00
Fixed font setting in Adapters
This commit is contained in:
parent
0e5d0154ad
commit
5f246d6c6e
@ -48,7 +48,8 @@ class ContactsAdapter(
|
|||||||
ItemTouchHelperContract, MyRecyclerView.MyZoomListener {
|
ItemTouchHelperContract, MyRecyclerView.MyZoomListener {
|
||||||
|
|
||||||
private var textToHighlight = highlightText
|
private var textToHighlight = highlightText
|
||||||
private var fontSize = activity.getTextSize()
|
private val fontSize: Float
|
||||||
|
get() = activity.getTextSize()
|
||||||
private var touchHelper: ItemTouchHelper? = null
|
private var touchHelper: ItemTouchHelper? = null
|
||||||
private var startReorderDragListener: StartReorderDragListener? = null
|
private var startReorderDragListener: StartReorderDragListener? = null
|
||||||
var onDragEndListener: (() -> Unit)? = null
|
var onDragEndListener: (() -> Unit)? = null
|
||||||
|
@ -38,7 +38,8 @@ class RecentCallsAdapter(
|
|||||||
private lateinit var outgoingCallIcon: Drawable
|
private lateinit var outgoingCallIcon: Drawable
|
||||||
private lateinit var incomingCallIcon: Drawable
|
private lateinit var incomingCallIcon: Drawable
|
||||||
private lateinit var incomingMissedCallIcon: Drawable
|
private lateinit var incomingMissedCallIcon: Drawable
|
||||||
private var fontSize = activity.getTextSize()
|
private val fontSize: Float
|
||||||
|
get() = activity.getTextSize()
|
||||||
private val areMultipleSIMsAvailable = activity.areMultipleSIMsAvailable()
|
private val areMultipleSIMsAvailable = activity.areMultipleSIMsAvailable()
|
||||||
private val redColor = resources.getColor(R.color.md_red_700)
|
private val redColor = resources.getColor(R.color.md_red_700)
|
||||||
private var textToHighlight = ""
|
private var textToHighlight = ""
|
||||||
@ -279,6 +280,7 @@ class RecentCallsAdapter(
|
|||||||
|
|
||||||
private fun setupView(view: View, call: RecentCall) {
|
private fun setupView(view: View, call: RecentCall) {
|
||||||
view.apply {
|
view.apply {
|
||||||
|
val currentFontSize = fontSize
|
||||||
item_recents_holder.isSelected = selectedKeys.contains(call.id)
|
item_recents_holder.isSelected = selectedKeys.contains(call.id)
|
||||||
val name = findContactByCall(call)?.getNameToDisplay() ?: call.name
|
val name = findContactByCall(call)?.getNameToDisplay() ?: call.name
|
||||||
var nameToShow = SpannableString(name)
|
var nameToShow = SpannableString(name)
|
||||||
@ -302,20 +304,20 @@ class RecentCallsAdapter(
|
|||||||
item_recents_name.apply {
|
item_recents_name.apply {
|
||||||
text = nameToShow
|
text = nameToShow
|
||||||
setTextColor(textColor)
|
setTextColor(textColor)
|
||||||
setTextSize(TypedValue.COMPLEX_UNIT_PX, fontSize)
|
setTextSize(TypedValue.COMPLEX_UNIT_PX, currentFontSize)
|
||||||
}
|
}
|
||||||
|
|
||||||
item_recents_date_time.apply {
|
item_recents_date_time.apply {
|
||||||
text = call.startTS.formatDateOrTime(context, refreshItemsListener != null, false)
|
text = call.startTS.formatDateOrTime(context, refreshItemsListener != null, false)
|
||||||
setTextColor(if (call.type == Calls.MISSED_TYPE) redColor else textColor)
|
setTextColor(if (call.type == Calls.MISSED_TYPE) redColor else textColor)
|
||||||
setTextSize(TypedValue.COMPLEX_UNIT_PX, fontSize * 0.8f)
|
setTextSize(TypedValue.COMPLEX_UNIT_PX, currentFontSize * 0.8f)
|
||||||
}
|
}
|
||||||
|
|
||||||
item_recents_duration.apply {
|
item_recents_duration.apply {
|
||||||
text = call.duration.getFormattedDuration()
|
text = call.duration.getFormattedDuration()
|
||||||
setTextColor(textColor)
|
setTextColor(textColor)
|
||||||
beVisibleIf(call.type != Calls.MISSED_TYPE && call.type != Calls.REJECTED_TYPE && call.duration > 0)
|
beVisibleIf(call.type != Calls.MISSED_TYPE && call.type != Calls.REJECTED_TYPE && call.duration > 0)
|
||||||
setTextSize(TypedValue.COMPLEX_UNIT_PX, fontSize * 0.8f)
|
setTextSize(TypedValue.COMPLEX_UNIT_PX, currentFontSize * 0.8f)
|
||||||
if (!showOverflowMenu) {
|
if (!showOverflowMenu) {
|
||||||
item_recents_duration.setPadding(0, 0, durationPadding, 0)
|
item_recents_duration.setPadding(0, 0, durationPadding, 0)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user