disable emoji fonts on Android 5 (#698)

This commit is contained in:
Konrad Pozniak 2018-07-01 10:18:00 +02:00 committed by GitHub
parent 1c5df27f91
commit 030a201da6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 16 additions and 3 deletions

View File

@ -77,7 +77,7 @@ dependencies {
// EmojiCompat // EmojiCompat
implementation "com.android.support:support-emoji:$supportLibraryVersion" implementation "com.android.support:support-emoji:$supportLibraryVersion"
implementation "com.android.support:support-emoji-appcompat:$supportLibraryVersion" implementation "com.android.support:support-emoji-appcompat:$supportLibraryVersion"
implementation "de.c1710:filemojicompat:1.0.5" implementation "de.c1710:filemojicompat:1.0.9"
// architecture components // architecture components
implementation 'android.arch.lifecycle:extensions:1.1.1' implementation 'android.arch.lifecycle:extensions:1.1.1'
//room //room

View File

@ -299,7 +299,12 @@ class AccountActivity : BottomSheetActivity(), ActionButtonActivity, HasSupportF
accountUsernameTextView.text = usernameFormatted accountUsernameTextView.text = usernameFormatted
accountDisplayNameTextView.text = CustomEmojiHelper.emojifyString(account.name, account.emojis, accountDisplayNameTextView) accountDisplayNameTextView.text = CustomEmojiHelper.emojifyString(account.name, account.emojis, accountDisplayNameTextView)
if (supportActionBar != null) { if (supportActionBar != null) {
try {
supportActionBar?.title = EmojiCompat.get().process(account.name) supportActionBar?.title = EmojiCompat.get().process(account.name)
} catch (e: IllegalStateException) {
// some Android versions seem to have problems with custom emoji fonts
supportActionBar?.title = account.name
}
val subtitle = String.format(getString(R.string.status_username_format), val subtitle = String.format(getString(R.string.status_username_format),
account.username) account.username)

View File

@ -23,6 +23,7 @@ import android.os.Bundle;
import android.preference.CheckBoxPreference; import android.preference.CheckBoxPreference;
import android.preference.EditTextPreference; import android.preference.EditTextPreference;
import android.preference.Preference; import android.preference.Preference;
import android.preference.PreferenceCategory;
import android.preference.PreferenceFragment; import android.preference.PreferenceFragment;
import android.support.annotation.XmlRes; import android.support.annotation.XmlRes;
import android.text.Editable; import android.text.Editable;
@ -67,6 +68,12 @@ public class PreferencesFragment extends PreferenceFragment implements SharedPre
addPreferencesFromResource(preference); addPreferencesFromResource(preference);
Preference emojiPreference = findPreference("emojiCompat");
if(emojiPreference != null && Build.VERSION.SDK_INT <= Build.VERSION_CODES.M) {
//disable emoji fonts on Android 5 because they cause problems
((PreferenceCategory)findPreference("categoryAppearance")).removePreference(emojiPreference);
}
Preference regexPref = findPreference("tabFilterRegex"); Preference regexPref = findPreference("tabFilterRegex");
if (regexPref != null) regexPref.setOnPreferenceClickListener(pref -> { if (regexPref != null) regexPref.setOnPreferenceClickListener(pref -> {
// Reset the error dialog when shown; if the dialog was closed with the cancel button // Reset the error dialog when shown; if the dialog was closed with the cancel button

View File

@ -2,7 +2,8 @@
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
android:key="@string/preferences_file_key"> android:key="@string/preferences_file_key">
<PreferenceCategory android:title="@string/pref_title_appearance_settings"> <PreferenceCategory android:title="@string/pref_title_appearance_settings"
android:key="categoryAppearance">
<ListPreference <ListPreference
android:defaultValue="night" android:defaultValue="night"