diff --git a/app/src/main/java/app/fedilab/android/mastodon/ui/fragment/media/FragmentMedia.java b/app/src/main/java/app/fedilab/android/mastodon/ui/fragment/media/FragmentMedia.java index 498f6aea0..68971097a 100644 --- a/app/src/main/java/app/fedilab/android/mastodon/ui/fragment/media/FragmentMedia.java +++ b/app/src/main/java/app/fedilab/android/mastodon/ui/fragment/media/FragmentMedia.java @@ -96,7 +96,7 @@ public class FragmentMedia extends Fragment { return; } canSwipe = (binding.mediaPicture.getScale() == 1); - if (!canSwipe && !requireActivity().isFinishing() && isAdded()) { + if (!canSwipe && isAdded() && !requireActivity().isFinishing()) { if (!((MediaActivity) requireActivity()).getFullScreen()) { ((MediaActivity) requireActivity()).setFullscreen(true); } diff --git a/app/src/main/java/app/fedilab/android/mastodon/ui/fragment/media/FragmentMediaProfile.java b/app/src/main/java/app/fedilab/android/mastodon/ui/fragment/media/FragmentMediaProfile.java index ccf6a1153..6e9a14669 100644 --- a/app/src/main/java/app/fedilab/android/mastodon/ui/fragment/media/FragmentMediaProfile.java +++ b/app/src/main/java/app/fedilab/android/mastodon/ui/fragment/media/FragmentMediaProfile.java @@ -91,7 +91,7 @@ public class FragmentMediaProfile extends Fragment { @Override public void federatedAccount(Account account) { - if (account != null && !requireActivity().isFinishing() && isAdded()) { + if (account != null && isAdded() && !requireActivity().isFinishing()) { accountId = account.id; accountsVM.getAccountStatuses(tempInstance, null, accountId, null, null, null, null, null, true, false, MastodonHelper.statusesPerCall(requireActivity())) .observe(getViewLifecycleOwner(), statuses -> initializeStatusesCommonView(statuses)); diff --git a/app/src/main/java/app/fedilab/android/mastodon/ui/fragment/timeline/FragmentMastodonTimeline.java b/app/src/main/java/app/fedilab/android/mastodon/ui/fragment/timeline/FragmentMastodonTimeline.java index 5202d4c3b..5b39387e7 100644 --- a/app/src/main/java/app/fedilab/android/mastodon/ui/fragment/timeline/FragmentMastodonTimeline.java +++ b/app/src/main/java/app/fedilab/android/mastodon/ui/fragment/timeline/FragmentMastodonTimeline.java @@ -1067,7 +1067,7 @@ public class FragmentMastodonTimeline extends Fragment implements StatusAdapter. @Override public void federatedAccount(Account account) { - if (account != null && !requireActivity().isFinishing() && isAdded()) { + if (account != null && isAdded() && !requireActivity().isFinishing()) { accountIDInRemoteInstance = account.id; accountsVM.getAccountStatuses(tempInstance, null, accountIDInRemoteInstance, null, null, null, null, null, false, true, MastodonHelper.statusesPerCall(requireActivity())) .observe(getViewLifecycleOwner(), pinnedStatuses -> accountsVM.getAccountStatuses(tempInstance, null, accountIDInRemoteInstance, null, null, null, exclude_replies, exclude_reblogs, media_only, false, MastodonHelper.statusesPerCall(requireActivity())) diff --git a/mathjaxandroid/src/main/java/de/timfreiheit/mathjax/android/MathJaxView.java b/mathjaxandroid/src/main/java/de/timfreiheit/mathjax/android/MathJaxView.java index a918cfa1f..8754c5d28 100644 --- a/mathjaxandroid/src/main/java/de/timfreiheit/mathjax/android/MathJaxView.java +++ b/mathjaxandroid/src/main/java/de/timfreiheit/mathjax/android/MathJaxView.java @@ -2,6 +2,7 @@ package de.timfreiheit.mathjax.android; import android.annotation.SuppressLint; +import android.app.ActivityManager; import android.content.Context; import android.content.res.TypedArray; import android.os.Build; @@ -90,6 +91,17 @@ public class MathJaxView extends FrameLayout { } } + public static String getProcessName(Context context) { + ActivityManager manager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE); + for (ActivityManager.RunningAppProcessInfo processInfo : manager.getRunningAppProcesses()) { + if (processInfo.pid == android.os.Process.myPid()) { + return processInfo.processName; + } + } + + return null; + } + @SuppressLint({"SetJavaScriptEnabled", "AddJavascriptInterface"}) private void init(Context context, AttributeSet attrSet, MathJaxConfig config) { mWebView = new WebView(context); @@ -155,6 +167,12 @@ public class MathJaxView extends FrameLayout { mWebView.setHorizontalScrollBarEnabled(horizontalScrollbarsEnabled); mWebView.setBackgroundColor(0); mWebView.getSettings().setLoadWithOverviewMode(true); + + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) { + String process = getProcessName(context); + if (!context.getPackageName().equals(process)) + WebView.setDataDirectorySuffix(process); + } } /**