From 9d4a576bc1d7cfd9d3165bfe67c3aedb7cfe1b93 Mon Sep 17 00:00:00 2001 From: Thomas Date: Tue, 22 Nov 2022 16:42:05 +0100 Subject: [PATCH] Fix automatically hide after x seconds --- .../java/app/fedilab/android/ui/drawer/StatusAdapter.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/app/fedilab/android/ui/drawer/StatusAdapter.java b/app/src/main/java/app/fedilab/android/ui/drawer/StatusAdapter.java index bc36b5ef..acfd5c03 100644 --- a/app/src/main/java/app/fedilab/android/ui/drawer/StatusAdapter.java +++ b/app/src/main/java/app/fedilab/android/ui/drawer/StatusAdapter.java @@ -1240,8 +1240,10 @@ public class StatusAdapter extends RecyclerView.Adapter layoutMediaBinding.media.setOnClickListener(v -> { if (statusToDeal.isMediaObfuscated && mediaObfuscated(statusToDeal) && !expand_media) { statusToDeal.isMediaObfuscated = false; - adapter.notifyItemChanged(holder.getBindingAdapterPosition()); + int position = holder.getBindingAdapterPosition(); + adapter.notifyItemChanged(position); final int timeout = sharedpreferences.getInt(context.getString(R.string.SET_NSFW_TIMEOUT), 5); + if (timeout > 0) { new CountDownTimer((timeout * 1000L), 1000) { public void onTick(long millisUntilFinished) { @@ -1249,7 +1251,7 @@ public class StatusAdapter extends RecyclerView.Adapter public void onFinish() { status.isMediaObfuscated = true; - adapter.notifyItemChanged(holder.getBindingAdapterPosition()); + adapter.notifyItemChanged(position); } }.start(); }