mirror of
https://github.com/Helium314/HeliBoard.git
synced 2025-05-17 15:32:48 +00:00
set custom typeface also in clipboard suggestion view
and rename read method to get
This commit is contained in:
parent
c1bbf51fa1
commit
789b533358
6 changed files with 6 additions and 8 deletions
|
@ -145,7 +145,7 @@ public class KeyboardView extends View {
|
||||||
keyAttr.recycle();
|
keyAttr.recycle();
|
||||||
|
|
||||||
mPaint.setAntiAlias(true);
|
mPaint.setAntiAlias(true);
|
||||||
mTypeface = Settings.getInstance().readCustomTypeface();
|
mTypeface = Settings.getInstance().getCustomTypeface();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
|
|
|
@ -156,7 +156,7 @@ class ClipboardHistoryView @JvmOverloads constructor(
|
||||||
|
|
||||||
val params = KeyDrawParams()
|
val params = KeyDrawParams()
|
||||||
params.updateParams(clipboardLayoutParams.bottomRowKeyboardHeight, keyVisualAttr)
|
params.updateParams(clipboardLayoutParams.bottomRowKeyboardHeight, keyVisualAttr)
|
||||||
Settings.getInstance().readCustomTypeface()?.let { params.mTypeface = it }
|
Settings.getInstance().getCustomTypeface()?.let { params.mTypeface = it }
|
||||||
setupClipKey(params)
|
setupClipKey(params)
|
||||||
setupBottomRowKeyboard(editorInfo, keyboardActionListener)
|
setupBottomRowKeyboard(editorInfo, keyboardActionListener)
|
||||||
|
|
||||||
|
|
|
@ -44,7 +44,7 @@ public class KeyPreviewView extends AppCompatTextView {
|
||||||
public KeyPreviewView(final Context context, final AttributeSet attrs, final int defStyleAttr) {
|
public KeyPreviewView(final Context context, final AttributeSet attrs, final int defStyleAttr) {
|
||||||
super(context, attrs, defStyleAttr);
|
super(context, attrs, defStyleAttr);
|
||||||
setGravity(Gravity.CENTER);
|
setGravity(Gravity.CENTER);
|
||||||
mTypeface = Settings.getInstance().readCustomTypeface();
|
mTypeface = Settings.getInstance().getCustomTypeface();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPreviewVisual(final Key key, final KeyboardIconsSet iconsSet, final KeyDrawParams drawParams) {
|
public void setPreviewVisual(final Key key, final KeyboardIconsSet iconsSet, final KeyDrawParams drawParams) {
|
||||||
|
|
|
@ -198,6 +198,7 @@ class ClipboardHistoryManager(
|
||||||
// create the view
|
// create the view
|
||||||
val binding = ClipboardSuggestionBinding.inflate(LayoutInflater.from(latinIME), parent, false)
|
val binding = ClipboardSuggestionBinding.inflate(LayoutInflater.from(latinIME), parent, false)
|
||||||
val textView = binding.clipboardSuggestionText
|
val textView = binding.clipboardSuggestionText
|
||||||
|
latinIME.mSettings.getCustomTypeface()?.let { textView.typeface = it }
|
||||||
textView.text = (if (isClipSensitive(inputType)) "*".repeat(content.length) else content)
|
textView.text = (if (isClipSensitive(inputType)) "*".repeat(content.length) else content)
|
||||||
.take(200) // truncate displayed text for performance reasons
|
.take(200) // truncate displayed text for performance reasons
|
||||||
val clipIcon = latinIME.mKeyboardSwitcher.keyboard.mIconsSet.getIconDrawable(ToolbarKey.PASTE.name.lowercase())
|
val clipIcon = latinIME.mKeyboardSwitcher.keyboard.mIconsSet.getIconDrawable(ToolbarKey.PASTE.name.lowercase())
|
||||||
|
|
|
@ -737,10 +737,7 @@ public final class Settings implements SharedPreferences.OnSharedPreferenceChang
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
public Typeface readCustomTypeface() {
|
public Typeface getCustomTypeface() {
|
||||||
// dammit, dann würde wenns keins gibt bei jedem zugriff gesucht -> 2 variablen nehmen? custom und hasCustom?
|
|
||||||
// ein clear brauchen wir sowieso on theme changed (und auch triggern wenn man ne font setzt/löscht)
|
|
||||||
// try/catch!
|
|
||||||
if (sCachedTypeface == null) {
|
if (sCachedTypeface == null) {
|
||||||
try {
|
try {
|
||||||
sCachedTypeface = Typeface.createFromFile(getCustomFontFile(mContext));
|
sCachedTypeface = Typeface.createFromFile(getCustomFontFile(mContext));
|
||||||
|
|
|
@ -156,7 +156,7 @@ public final class SuggestionStripView extends RelativeLayout implements OnClick
|
||||||
mToolbar = findViewById(R.id.toolbar);
|
mToolbar = findViewById(R.id.toolbar);
|
||||||
mToolbarContainer = findViewById(R.id.toolbar_container);
|
mToolbarContainer = findViewById(R.id.toolbar_container);
|
||||||
|
|
||||||
final Typeface customTypeface = Settings.getInstance().readCustomTypeface();
|
final Typeface customTypeface = Settings.getInstance().getCustomTypeface();
|
||||||
for (int pos = 0; pos < SuggestedWords.MAX_SUGGESTIONS; pos++) {
|
for (int pos = 0; pos < SuggestedWords.MAX_SUGGESTIONS; pos++) {
|
||||||
final TextView word = new TextView(context, null, R.attr.suggestionWordStyle);
|
final TextView word = new TextView(context, null, R.attr.suggestionWordStyle);
|
||||||
word.setContentDescription(getResources().getString(R.string.spoken_empty_suggestion));
|
word.setContentDescription(getResources().getString(R.string.spoken_empty_suggestion));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue