From 0769082a8cbc3c519ce33847c115b6ace495cf49 Mon Sep 17 00:00:00 2001 From: Thomas Date: Wed, 4 May 2022 12:01:43 +0200 Subject: [PATCH] Fix issue #16 --- .../app/fedilab/android/helper/MastodonHelper.java | 11 ++++++++++- .../app/fedilab/android/ui/drawer/ComposeAdapter.java | 4 +++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/app/fedilab/android/helper/MastodonHelper.java b/app/src/main/java/app/fedilab/android/helper/MastodonHelper.java index bddb62e9a..a57f223e4 100644 --- a/app/src/main/java/app/fedilab/android/helper/MastodonHelper.java +++ b/app/src/main/java/app/fedilab/android/helper/MastodonHelper.java @@ -199,8 +199,17 @@ public class MastodonHelper { Context context = view.getContext(); SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(context); boolean disableGif = sharedpreferences.getBoolean(context.getString(R.string.SET_DISABLE_GIF), false); - String targetedUrl = disableGif ? (type == MediaAccountType.AVATAR ? account.avatar_static : account.header_static) : (type == MediaAccountType.AVATAR ? account.avatar : account.header); @DrawableRes int placeholder = type == MediaAccountType.AVATAR ? R.drawable.ic_person : R.drawable.default_banner; + if (account == null) { + Glide.with(view.getContext()) + .asDrawable() + .load(placeholder) + .thumbnail(0.1f) + .placeholder(placeholder) + .into(view); + return; + } + String targetedUrl = disableGif ? (type == MediaAccountType.AVATAR ? account.avatar_static : account.header_static) : (type == MediaAccountType.AVATAR ? account.avatar : account.header); if (disableGif || (!targetedUrl.endsWith(".gif"))) { Glide.with(view.getContext()) .asDrawable() diff --git a/app/src/main/java/app/fedilab/android/ui/drawer/ComposeAdapter.java b/app/src/main/java/app/fedilab/android/ui/drawer/ComposeAdapter.java index 71aa81ab9..2c7bf4f36 100644 --- a/app/src/main/java/app/fedilab/android/ui/drawer/ComposeAdapter.java +++ b/app/src/main/java/app/fedilab/android/ui/drawer/ComposeAdapter.java @@ -1052,8 +1052,10 @@ public class ComposeAdapter extends RecyclerView.Adapter 0) { statusDraft.visibility = statusList.get(position - 1).visibility; - } else { + } else if (BaseMainActivity.accountWeakReference.get().mastodon_account != null) { statusDraft.visibility = BaseMainActivity.accountWeakReference.get().mastodon_account.source.privacy; + } else { + statusDraft.visibility = "public"; } }