From fe20625a1550bbec9b1276f39b7330617de91eff Mon Sep 17 00:00:00 2001 From: Harshad Vedartham Date: Sat, 13 Apr 2024 22:59:00 -0700 Subject: [PATCH] Reverting to old blink logic - looks much better --- .../opoc/frontend/filebrowser/GsFileBrowserListAdapter.java | 3 +-- .../main/java/net/gsantner/opoc/util/GsContextUtils.java | 6 +++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/net/gsantner/opoc/frontend/filebrowser/GsFileBrowserListAdapter.java b/app/src/main/java/net/gsantner/opoc/frontend/filebrowser/GsFileBrowserListAdapter.java index d25383f6a0..3ee141e8ac 100644 --- a/app/src/main/java/net/gsantner/opoc/frontend/filebrowser/GsFileBrowserListAdapter.java +++ b/app/src/main/java/net/gsantner/opoc/frontend/filebrowser/GsFileBrowserListAdapter.java @@ -15,7 +15,6 @@ import android.graphics.drawable.ColorDrawable; import android.graphics.drawable.Drawable; import android.os.Bundle; -import android.os.Handler; import android.text.Spannable; import android.text.Spanned; import android.text.TextUtils; @@ -587,7 +586,7 @@ private void showAndFlash(final File file) { _recyclerView.postDelayed(() -> { final RecyclerView.ViewHolder holder = _recyclerView.findViewHolderForLayoutPosition(pos); if (holder != null) { - GsContextUtils.flashView(holder.itemView); + GsContextUtils.blinkView(holder.itemView); } }, 250); } diff --git a/app/src/main/java/net/gsantner/opoc/util/GsContextUtils.java b/app/src/main/java/net/gsantner/opoc/util/GsContextUtils.java index b272b25f47..9fa9970806 100644 --- a/app/src/main/java/net/gsantner/opoc/util/GsContextUtils.java +++ b/app/src/main/java/net/gsantner/opoc/util/GsContextUtils.java @@ -2878,10 +2878,10 @@ public boolean isDarkModeEnabled(final Context context) { return false; } - public static void flashView(final View view) { + public static void blinkView(final View view) { if (view != null) { - view.setBackgroundColor(Color.LTGRAY); // Highlight - view.postDelayed(() -> view.setBackgroundColor(Color.TRANSPARENT), 300); + final float init = view.getAlpha(); + ObjectAnimator.ofFloat(view, View.ALPHA, init, 0.1f, 1.0f, 0.1f, 1.0f, init).setDuration(1000).start(); } } }