From 60b9a9c40b843e115067ab406a15bf9c72f6a660 Mon Sep 17 00:00:00 2001 From: Konrad Pozniak Date: Fri, 20 Dec 2019 19:52:36 +0100 Subject: [PATCH] upgrade SparkButton to 3.0.0 (#1594) --- app/build.gradle | 2 +- .../tusky/adapter/StatusBaseViewHolder.java | 59 ++++--------------- 2 files changed, 13 insertions(+), 48 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index d4fff4f3..65a384a1 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -151,7 +151,7 @@ dependencies { implementation "com.google.dagger:dagger-android-support:$daggerVersion" kapt "com.google.dagger:dagger-android-processor:$daggerVersion" - implementation "com.github.connyduck:sparkbutton:2.0.1" + implementation "com.github.connyduck:sparkbutton:3.0.0" implementation "com.github.chrisbanes:PhotoView:2.3.0" diff --git a/app/src/main/java/com/keylesspalace/tusky/adapter/StatusBaseViewHolder.java b/app/src/main/java/com/keylesspalace/tusky/adapter/StatusBaseViewHolder.java index 5b74ca08..3bb83dfd 100644 --- a/app/src/main/java/com/keylesspalace/tusky/adapter/StatusBaseViewHolder.java +++ b/app/src/main/java/com/keylesspalace/tusky/adapter/StatusBaseViewHolder.java @@ -565,60 +565,25 @@ public abstract class StatusBaseViewHolder extends RecyclerView.ViewHolder { } }); if (reblogButton != null) { - reblogButton.setEventListener(new SparkEventListener() { - @Override - public void onEvent(ImageView button, boolean buttonState) { - int position = getAdapterPosition(); - if (position != RecyclerView.NO_POSITION) { - listener.onReblog(buttonState, position); - } - } - - @Override - public void onEventAnimationEnd(ImageView button, boolean buttonState) { - } - - @Override - public void onEventAnimationStart(ImageView button, boolean buttonState) { + reblogButton.setEventListener((button, buttonState) -> { + int position = getAdapterPosition(); + if (position != RecyclerView.NO_POSITION) { + listener.onReblog(buttonState, position); } }); } - favouriteButton.setEventListener(new SparkEventListener() { - @Override - public void onEvent(ImageView button, boolean buttonState) { - int position = getAdapterPosition(); - if (position != RecyclerView.NO_POSITION) { - listener.onFavourite(buttonState, position); - } - } - - @Override - public void onEventAnimationEnd(ImageView button, boolean buttonState) { - } - - @Override - public void onEventAnimationStart(ImageView button, boolean buttonState) { + favouriteButton.setEventListener((button, buttonState) -> { + int position = getAdapterPosition(); + if (position != RecyclerView.NO_POSITION) { + listener.onFavourite(buttonState, position); } }); - bookmarkButton.setEventListener(new SparkEventListener() { - @Override - public void onEvent(ImageView button, boolean buttonState) { - int position = getAdapterPosition(); - if (position != RecyclerView.NO_POSITION) { - listener.onBookmark(buttonState, position); - } - } - - @Override - public void onEventAnimationEnd(ImageView button, boolean buttonState) { - - } - - @Override - public void onEventAnimationStart(ImageView button, boolean buttonState) { - + bookmarkButton.setEventListener((button, buttonState) -> { + int position = getAdapterPosition(); + if (position != RecyclerView.NO_POSITION) { + listener.onBookmark(buttonState, position); } });