mirror of
https://github.com/M66B/FairEmail.git
synced 2026-03-31 14:17:03 +02:00
Optionally load emoji
This commit is contained in:
@@ -39,6 +39,9 @@ import android.webkit.CookieManager;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.emoji2.text.DefaultEmojiCompatConfig;
|
||||
import androidx.emoji2.text.EmojiCompat;
|
||||
import androidx.emoji2.text.FontRequestEmojiCompatConfig;
|
||||
import androidx.preference.PreferenceManager;
|
||||
import androidx.work.WorkManager;
|
||||
|
||||
@@ -147,6 +150,7 @@ public class ApplicationEx extends Application
|
||||
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
|
||||
final boolean crash_reports = prefs.getBoolean("crash_reports", false);
|
||||
final boolean load_emoji = prefs.getBoolean("load_emoji", BuildConfig.PLAY_STORE_RELEASE);
|
||||
|
||||
prev = Thread.getDefaultUncaughtExceptionHandler();
|
||||
|
||||
@@ -190,6 +194,18 @@ public class ApplicationEx extends Application
|
||||
if (Helper.hasWebView(this))
|
||||
CookieManager.getInstance().setAcceptCookie(false);
|
||||
|
||||
Log.i("Load emoji=" + load_emoji);
|
||||
if (!load_emoji)
|
||||
try {
|
||||
FontRequestEmojiCompatConfig crying = DefaultEmojiCompatConfig.create(this);
|
||||
if (crying != null) {
|
||||
crying.setMetadataLoadStrategy(EmojiCompat.LOAD_STRATEGY_MANUAL);
|
||||
EmojiCompat.init(crying);
|
||||
}
|
||||
} catch (Throwable ex) {
|
||||
Log.e(ex);
|
||||
}
|
||||
|
||||
EncryptionHelper.init(this);
|
||||
MessageHelper.setSystemProperties(this);
|
||||
|
||||
@@ -244,6 +260,7 @@ public class ApplicationEx extends Application
|
||||
ServiceSynchronize.scheduleWatchdog(this);
|
||||
break;
|
||||
case "secure": // privacy
|
||||
case "load_emoji": // privacy
|
||||
case "shortcuts": // misc
|
||||
case "language": // misc
|
||||
case "wal": // misc
|
||||
|
||||
@@ -83,6 +83,7 @@ public class FragmentOptionsPrivacy extends FragmentBase implements SharedPrefer
|
||||
private TextView tvGenericUserAgent;
|
||||
private SwitchCompat swSafeBrowsing;
|
||||
private ImageButton ibSafeBrowsing;
|
||||
private SwitchCompat swLoadEmoji;
|
||||
private ImageButton ibDisconnectBlacklist;
|
||||
private Button btnDisconnectBlacklist;
|
||||
private TextView tvDisconnectBlacklistTime;
|
||||
@@ -98,7 +99,7 @@ public class FragmentOptionsPrivacy extends FragmentBase implements SharedPrefer
|
||||
"disable_tracking", "hide_timezone",
|
||||
"pin", "biometrics", "biometrics_timeout", "autolock",
|
||||
"client_id", "display_hidden", "incognito_keyboard", "secure",
|
||||
"generic_ua", "safe_browsing",
|
||||
"generic_ua", "safe_browsing", "load_emoji",
|
||||
"disconnect_auto_update", "disconnect_links", "disconnect_images"
|
||||
};
|
||||
|
||||
@@ -136,6 +137,7 @@ public class FragmentOptionsPrivacy extends FragmentBase implements SharedPrefer
|
||||
tvGenericUserAgent = view.findViewById(R.id.tvGenericUserAgent);
|
||||
swSafeBrowsing = view.findViewById(R.id.swSafeBrowsing);
|
||||
ibSafeBrowsing = view.findViewById(R.id.ibSafeBrowsing);
|
||||
swLoadEmoji = view.findViewById(R.id.swLoadEmoji);
|
||||
ibDisconnectBlacklist = view.findViewById(R.id.ibDisconnectBlacklist);
|
||||
btnDisconnectBlacklist = view.findViewById(R.id.btnDisconnectBlacklist);
|
||||
tvDisconnectBlacklistTime = view.findViewById(R.id.tvDisconnectBlacklistTime);
|
||||
@@ -344,6 +346,13 @@ public class FragmentOptionsPrivacy extends FragmentBase implements SharedPrefer
|
||||
|
||||
grpSafeBrowsing.setEnabled(WebViewEx.isFeatureSupported(WebViewFeature.SAFE_BROWSING_ENABLE));
|
||||
|
||||
swLoadEmoji.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
||||
prefs.edit().putBoolean("load_emoji", checked).commit(); // apply won't work here
|
||||
}
|
||||
});
|
||||
|
||||
ibDisconnectBlacklist.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
@@ -488,6 +497,7 @@ public class FragmentOptionsPrivacy extends FragmentBase implements SharedPrefer
|
||||
tvGenericUserAgent.setText(WebViewEx.getUserAgent(getContext()));
|
||||
swGenericUserAgent.setChecked(prefs.getBoolean("generic_ua", true));
|
||||
swSafeBrowsing.setChecked(prefs.getBoolean("safe_browsing", false));
|
||||
swLoadEmoji.setChecked(prefs.getBoolean("load_emoji", BuildConfig.PLAY_STORE_RELEASE));
|
||||
|
||||
long time = prefs.getLong("disconnect_last", -1);
|
||||
DateFormat DF = SimpleDateFormat.getDateTimeInstance();
|
||||
|
||||
Reference in New Issue
Block a user