Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]
### Added
- Added support for custom fonts

### Fixed
- Fixed an issue where sound/vibration preferences were ignored after reboot ([#372])

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ import org.fossify.commons.extensions.isDynamicTheme
import org.fossify.commons.extensions.lightenColor
import org.fossify.commons.extensions.removeUnderlines
import org.fossify.commons.extensions.toast
import org.fossify.commons.helpers.FontHelper
import org.fossify.commons.helpers.HIGHER_ALPHA
import org.fossify.commons.helpers.ensureBackgroundThread
import org.fossify.commons.helpers.isPiePlus
Expand Down Expand Up @@ -670,11 +671,12 @@ class MyKeyboardView @JvmOverloads constructor(
val paint = mPaint
val keys = mKeys
paint.color = mTextColor
val customTypeface = FontHelper.getTypeface(context)
val smallLetterPaint = Paint().apply {
set(paint)
color = paint.color.adjustAlpha(0.8f)
textSize = mTopSmallNumberSize
typeface = Typeface.DEFAULT
typeface = customTypeface
}

canvas.drawColor(Color.TRANSPARENT, PorterDuff.Mode.CLEAR)
Expand All @@ -699,13 +701,13 @@ class MyKeyboardView @JvmOverloads constructor(
if (code == KEYCODE_SPACE && key.label.length > 1) {
// Use smaller font size for current language label on space bar
paint.textSize = mSpaceBarTextSize.toFloat()
paint.typeface = Typeface.DEFAULT
paint.typeface = customTypeface
} else if (label.length > 1) {
paint.textSize = mLabelTextSize.toFloat()
paint.typeface = Typeface.DEFAULT_BOLD
paint.typeface = Typeface.create(customTypeface, Typeface.BOLD)
} else {
paint.textSize = mKeyTextSize.toFloat()
paint.typeface = Typeface.DEFAULT
paint.typeface = customTypeface
}

paint.color = textColor
Expand Down Expand Up @@ -1042,15 +1044,16 @@ class MyKeyboardView @JvmOverloads constructor(
if (key.icon != null) {
mPreviewText!!.setCompoundDrawables(null, null, null, key.icon)
} else {
val customTypeface = FontHelper.getTypeface(context)
if (key.label.length > 1) {
mPreviewText!!.setTextSize(TypedValue.COMPLEX_UNIT_PX, mKeyTextSize.toFloat())
mPreviewText!!.typeface = Typeface.DEFAULT_BOLD
mPreviewText!!.typeface = Typeface.create(customTypeface, Typeface.BOLD)
} else {
mPreviewText!!.setTextSize(
TypedValue.COMPLEX_UNIT_PX,
mPreviewTextSizeLarge.toFloat()
)
mPreviewText!!.typeface = Typeface.DEFAULT
mPreviewText!!.typeface = customTypeface
}

mPreviewText!!.setCompoundDrawables(null, null, null, null)
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
android:layout_height="wrap_content"
android:layout_margin="@dimen/normal_margin">

<android.widget.TextView
<org.fossify.commons.views.MyTextView
android:id="@+id/change_keyboard"
style="@style/ColoredButtonStyle"
android:layout_width="wrap_content"
Expand Down
6 changes: 3 additions & 3 deletions app/src/main/res/layout/keyboard_view_keyboard.xml
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@
android:padding="@dimen/small_margin"
android:src="@drawable/ic_arrow_left_vector" />

<TextView
<org.fossify.commons.views.MyTextView
android:id="@+id/clipboard_manager_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
Expand Down Expand Up @@ -303,7 +303,7 @@
android:layout_height="match_parent"
android:layout_below="@+id/clipboard_manager_top_bar">

<TextView
<org.fossify.commons.views.MyTextView
android:id="@+id/clipboard_content_placeholder_1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
Expand All @@ -316,7 +316,7 @@
android:textSize="@dimen/bigger_text_size"
android:visibility="gone" />

<TextView
<org.fossify.commons.views.MyTextView
android:id="@+id/clipboard_content_placeholder_2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
Expand Down
Loading