feat: add font customization (#676)
* fix: use AndroidX AppCompat PopupMenu * feat: add font customization
This commit is contained in:
parent
d5a6ef09b1
commit
e904efa6ed
9 changed files with 22 additions and 18 deletions
|
|
@ -6,6 +6,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
### Added
|
### Added
|
||||||
|
- Added support for custom fonts
|
||||||
- Added "Copy number to clipboard" option inside chat overflow menu ([#651])
|
- Added "Copy number to clipboard" option inside chat overflow menu ([#651])
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,7 @@ import org.fossify.commons.extensions.formatDateOrTime
|
||||||
import org.fossify.commons.extensions.getContrastColor
|
import org.fossify.commons.extensions.getContrastColor
|
||||||
import org.fossify.commons.extensions.getTextSize
|
import org.fossify.commons.extensions.getTextSize
|
||||||
import org.fossify.commons.extensions.setupViewBackground
|
import org.fossify.commons.extensions.setupViewBackground
|
||||||
|
import org.fossify.commons.helpers.FontHelper
|
||||||
import org.fossify.commons.helpers.SimpleContactsHelper
|
import org.fossify.commons.helpers.SimpleContactsHelper
|
||||||
import org.fossify.commons.helpers.ensureBackgroundThread
|
import org.fossify.commons.helpers.ensureBackgroundThread
|
||||||
import org.fossify.commons.views.MyRecyclerView
|
import org.fossify.commons.views.MyRecyclerView
|
||||||
|
|
@ -181,9 +182,10 @@ abstract class BaseConversationsAdapter(
|
||||||
conversationBodyShort.alpha = 0.7f
|
conversationBodyShort.alpha = 0.7f
|
||||||
if (conversation.isScheduled) Typeface.ITALIC else Typeface.NORMAL
|
if (conversation.isScheduled) Typeface.ITALIC else Typeface.NORMAL
|
||||||
}
|
}
|
||||||
conversationAddress.setTypeface(null, style)
|
val customTypeface = FontHelper.getTypeface(activity)
|
||||||
conversationBodyShort.setTypeface(null, style)
|
conversationAddress.setTypeface(customTypeface, style)
|
||||||
conversationDate.setTypeface(null, style)
|
conversationBodyShort.setTypeface(customTypeface, style)
|
||||||
|
conversationDate.setTypeface(customTypeface, style)
|
||||||
|
|
||||||
arrayListOf(conversationAddress, conversationBodyShort, conversationDate).forEach {
|
arrayListOf(conversationAddress, conversationBodyShort, conversationDate).forEach {
|
||||||
it.setTextColor(textColor)
|
it.setTextColor(textColor)
|
||||||
|
|
|
||||||
|
|
@ -42,6 +42,7 @@ import org.fossify.commons.extensions.getTimeFormat
|
||||||
import org.fossify.commons.extensions.shareTextIntent
|
import org.fossify.commons.extensions.shareTextIntent
|
||||||
import org.fossify.commons.extensions.showErrorToast
|
import org.fossify.commons.extensions.showErrorToast
|
||||||
import org.fossify.commons.extensions.usableScreenSize
|
import org.fossify.commons.extensions.usableScreenSize
|
||||||
|
import org.fossify.commons.helpers.FontHelper
|
||||||
import org.fossify.commons.helpers.SimpleContactsHelper
|
import org.fossify.commons.helpers.SimpleContactsHelper
|
||||||
import org.fossify.commons.helpers.ensureBackgroundThread
|
import org.fossify.commons.helpers.ensureBackgroundThread
|
||||||
import org.fossify.commons.views.MyRecyclerView
|
import org.fossify.commons.views.MyRecyclerView
|
||||||
|
|
@ -473,7 +474,7 @@ class ThreadAdapter(
|
||||||
setLinkTextColor(contrastColor)
|
setLinkTextColor(contrastColor)
|
||||||
|
|
||||||
if (message.isScheduled) {
|
if (message.isScheduled) {
|
||||||
typeface = Typeface.create(Typeface.DEFAULT, Typeface.ITALIC)
|
typeface = Typeface.create(FontHelper.getTypeface(activity), Typeface.ITALIC)
|
||||||
val scheduledDrawable = AppCompatResources.getDrawable(activity, org.fossify.commons.R.drawable.ic_clock_vector)?.apply {
|
val scheduledDrawable = AppCompatResources.getDrawable(activity, org.fossify.commons.R.drawable.ic_clock_vector)?.apply {
|
||||||
applyColorFilter(contrastColor)
|
applyColorFilter(contrastColor)
|
||||||
val size = lineHeight
|
val size = lineHeight
|
||||||
|
|
@ -482,7 +483,7 @@ class ThreadAdapter(
|
||||||
|
|
||||||
setCompoundDrawables(null, null, scheduledDrawable, null)
|
setCompoundDrawables(null, null, scheduledDrawable, null)
|
||||||
} else {
|
} else {
|
||||||
typeface = Typeface.DEFAULT
|
typeface = FontHelper.getTypeface(activity)
|
||||||
setCompoundDrawables(null, null, null, null)
|
setCompoundDrawables(null, null, null, null)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
package org.fossify.messages.dialogs
|
package org.fossify.messages.dialogs
|
||||||
|
|
||||||
import android.view.*
|
import android.view.*
|
||||||
import android.widget.PopupMenu
|
import androidx.appcompat.widget.PopupMenu
|
||||||
import org.fossify.commons.activities.BaseSimpleActivity
|
import org.fossify.commons.activities.BaseSimpleActivity
|
||||||
import org.fossify.commons.adapters.MyRecyclerViewAdapter
|
import org.fossify.commons.adapters.MyRecyclerViewAdapter
|
||||||
import org.fossify.commons.extensions.copyToClipboard
|
import org.fossify.commons.extensions.copyToClipboard
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@
|
||||||
android:layout_marginStart="@dimen/medium_margin"
|
android:layout_marginStart="@dimen/medium_margin"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<androidx.appcompat.widget.AppCompatTextView
|
<org.fossify.commons.views.MyTextView
|
||||||
android:id="@+id/filename"
|
android:id="@+id/filename"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
|
@ -44,7 +44,7 @@
|
||||||
android:textStyle="bold"
|
android:textStyle="bold"
|
||||||
tools:text="Event_16_02_2022.ics" />
|
tools:text="Event_16_02_2022.ics" />
|
||||||
|
|
||||||
<androidx.appcompat.widget.AppCompatTextView
|
<org.fossify.commons.views.MyTextView
|
||||||
android:id="@+id/file_size"
|
android:id="@+id/file_size"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@
|
||||||
android:layout_marginStart="@dimen/medium_margin"
|
android:layout_marginStart="@dimen/medium_margin"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<androidx.appcompat.widget.AppCompatTextView
|
<org.fossify.commons.views.MyTextView
|
||||||
android:id="@+id/vcard_title"
|
android:id="@+id/vcard_title"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
|
@ -39,7 +39,7 @@
|
||||||
tools:text="Elon Reeve Musk"
|
tools:text="Elon Reeve Musk"
|
||||||
tools:visibility="visible" />
|
tools:visibility="visible" />
|
||||||
|
|
||||||
<androidx.appcompat.widget.AppCompatTextView
|
<org.fossify.commons.views.MyTextView
|
||||||
android:id="@+id/vcard_subtitle"
|
android:id="@+id/vcard_subtitle"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
|
@ -48,7 +48,7 @@
|
||||||
tools:text="and 6 others"
|
tools:text="and 6 others"
|
||||||
tools:visibility="visible" />
|
tools:visibility="visible" />
|
||||||
|
|
||||||
<androidx.appcompat.widget.AppCompatTextView
|
<org.fossify.commons.views.MyTextView
|
||||||
android:id="@+id/view_contact_details"
|
android:id="@+id/view_contact_details"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@
|
||||||
app:layout_constraintTop_toTopOf="@id/conversation_address"
|
app:layout_constraintTop_toTopOf="@id/conversation_address"
|
||||||
tools:src="@mipmap/ic_launcher" />
|
tools:src="@mipmap/ic_launcher" />
|
||||||
|
|
||||||
<TextView
|
<org.fossify.commons.views.MyTextView
|
||||||
android:id="@+id/conversation_address"
|
android:id="@+id/conversation_address"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
|
@ -39,7 +39,7 @@
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
tools:text="John" />
|
tools:text="John" />
|
||||||
|
|
||||||
<TextView
|
<org.fossify.commons.views.MyTextView
|
||||||
android:id="@+id/draft_indicator"
|
android:id="@+id/draft_indicator"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
|
@ -57,7 +57,7 @@
|
||||||
app:layout_constraintStart_toStartOf="@id/conversation_address"
|
app:layout_constraintStart_toStartOf="@id/conversation_address"
|
||||||
app:layout_constraintTop_toTopOf="@id/conversation_body_short" />
|
app:layout_constraintTop_toTopOf="@id/conversation_body_short" />
|
||||||
|
|
||||||
<TextView
|
<org.fossify.commons.views.MyTextView
|
||||||
android:id="@+id/conversation_body_short"
|
android:id="@+id/conversation_body_short"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
|
@ -73,7 +73,7 @@
|
||||||
app:layout_constraintTop_toBottomOf="@id/conversation_address"
|
app:layout_constraintTop_toBottomOf="@id/conversation_address"
|
||||||
tools:text="Hey buddy!" />
|
tools:text="Hey buddy!" />
|
||||||
|
|
||||||
<TextView
|
<org.fossify.commons.views.MyTextView
|
||||||
android:id="@+id/conversation_date"
|
android:id="@+id/conversation_date"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
|
@ -99,7 +99,7 @@
|
||||||
app:layout_constraintTop_toTopOf="@id/conversation_body_short"
|
app:layout_constraintTop_toTopOf="@id/conversation_body_short"
|
||||||
tools:visibility="visible" />
|
tools:visibility="visible" />
|
||||||
|
|
||||||
<TextView
|
<org.fossify.commons.views.MyTextView
|
||||||
android:id="@+id/unread_count_badge"
|
android:id="@+id/unread_count_badge"
|
||||||
android:layout_width="@dimen/small_icon_size"
|
android:layout_width="@dimen/small_icon_size"
|
||||||
android:layout_height="@dimen/small_icon_size"
|
android:layout_height="@dimen/small_icon_size"
|
||||||
|
|
|
||||||
|
|
@ -51,7 +51,7 @@
|
||||||
android:visibility="gone"
|
android:visibility="gone"
|
||||||
tools:ignore="ContentDescription" />
|
tools:ignore="ContentDescription" />
|
||||||
|
|
||||||
<androidx.appcompat.widget.AppCompatTextView
|
<org.fossify.commons.views.MyTextView
|
||||||
android:id="@+id/thread_message_body"
|
android:id="@+id/thread_message_body"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content">
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
<androidx.appcompat.widget.AppCompatTextView
|
<org.fossify.commons.views.MyTextView
|
||||||
android:id="@+id/reply_disabled_text"
|
android:id="@+id/reply_disabled_text"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue