diff --git a/app/build.gradle b/app/build.gradle
index 159cfb30..d09fbb60 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -32,5 +32,6 @@ dependencies {
compile 'com.android.support:design:25.1.0'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.pkmmte.view:circularimageview:1.1'
+ compile 'com.github.peter9870:sparkbutton:master'
testCompile 'junit:junit:4.12'
}
diff --git a/app/src/main/java/com/keylesspalace/tusky/StatusViewHolder.java b/app/src/main/java/com/keylesspalace/tusky/StatusViewHolder.java
index 3f30299b..12eee0ab 100644
--- a/app/src/main/java/com/keylesspalace/tusky/StatusViewHolder.java
+++ b/app/src/main/java/com/keylesspalace/tusky/StatusViewHolder.java
@@ -34,6 +34,9 @@ import android.widget.ToggleButton;
import com.android.volley.toolbox.ImageLoader;
import com.android.volley.toolbox.NetworkImageView;
import com.squareup.picasso.Picasso;
+import com.varunest.sparkbutton.SparkButton;
+import com.varunest.sparkbutton.SparkButtonBuilder;
+import com.varunest.sparkbutton.SparkEventListener;
import java.util.Date;
@@ -47,8 +50,8 @@ class StatusViewHolder extends RecyclerView.ViewHolder {
private View rebloggedBar;
private TextView rebloggedByDisplayName;
private ImageButton replyButton;
- private ImageButton reblogButton;
- private ImageButton favouriteButton;
+ private SparkButton reblogButton;
+ private SparkButton favouriteButton;
private ImageButton moreButton;
private boolean favourited;
private boolean reblogged;
@@ -72,8 +75,8 @@ class StatusViewHolder extends RecyclerView.ViewHolder {
rebloggedBar = itemView.findViewById(R.id.status_reblogged_bar);
rebloggedByDisplayName = (TextView) itemView.findViewById(R.id.status_reblogged);
replyButton = (ImageButton) itemView.findViewById(R.id.status_reply);
- reblogButton = (ImageButton) itemView.findViewById(R.id.status_reblog);
- favouriteButton = (ImageButton) itemView.findViewById(R.id.status_favourite);
+ reblogButton = (SparkButton) itemView.findViewById(R.id.status_reblog);
+ favouriteButton = (SparkButton) itemView.findViewById(R.id.status_favourite);
moreButton = (ImageButton) itemView.findViewById(R.id.status_more);
reblogged = false;
favourited = false;
@@ -187,35 +190,25 @@ class StatusViewHolder extends RecyclerView.ViewHolder {
private void setReblogged(boolean reblogged) {
this.reblogged = reblogged;
- int attribute;
- if (reblogged) {
- attribute = R.attr.status_reblog_button_marked_tint;
- } else {
- attribute = R.attr.status_reblog_button_tint;
- }
- ThemeUtils.setImageViewTint(reblogButton, attribute);
+ reblogButton.setChecked(reblogged);
}
/** This should only be called after setReblogged, in order to override the tint correctly. */
private void setRebloggingEnabled(boolean enabled) {
reblogButton.setEnabled(enabled);
+
if (enabled) {
- reblogButton.setImageResource(R.drawable.ic_repeat_24dp);
+ reblogButton.setInactiveImage(R.drawable.reblog_inactive);
+ reblogButton.setActiveImage(R.drawable.reblog_active);
} else {
- ThemeUtils.setImageViewTint(reblogButton, R.attr.status_reblog_button_disabled_tint);
- reblogButton.setImageResource(R.drawable.ic_lock_24dp);
+ reblogButton.setInactiveImage(R.drawable.reblog_disabled);
+ reblogButton.setActiveImage(R.drawable.reblog_disabled);
}
}
private void setFavourited(boolean favourited) {
this.favourited = favourited;
- int attribute;
- if (favourited) {
- attribute = R.attr.status_favourite_button_marked_tint;
- } else {
- attribute = R.attr.status_favourite_button_tint;
- }
- ThemeUtils.setImageViewTint(favouriteButton, attribute);
+ favouriteButton.setChecked(favourited);
}
private void setMediaPreviews(final Status.MediaAttachment[] attachments,
@@ -313,15 +306,15 @@ class StatusViewHolder extends RecyclerView.ViewHolder {
listener.onReply(getAdapterPosition());
}
});
- reblogButton.setOnClickListener(new View.OnClickListener() {
+ reblogButton.setEventListener(new SparkEventListener() {
@Override
- public void onClick(View v) {
+ public void onEvent(ImageView button, boolean buttonState) {
listener.onReblog(!reblogged, getAdapterPosition());
}
});
- favouriteButton.setOnClickListener(new View.OnClickListener() {
+ favouriteButton.setEventListener(new SparkEventListener() {
@Override
- public void onClick(View v) {
+ public void onEvent(ImageView button, boolean buttonState) {
listener.onFavourite(!favourited, getAdapterPosition());
}
});
diff --git a/app/src/main/res/drawable/favourite_active.xml b/app/src/main/res/drawable/favourite_active.xml
new file mode 100644
index 00000000..2d53859f
--- /dev/null
+++ b/app/src/main/res/drawable/favourite_active.xml
@@ -0,0 +1,9 @@
+
+
+
diff --git a/app/src/main/res/drawable/favourite_inactive.xml b/app/src/main/res/drawable/favourite_inactive.xml
new file mode 100644
index 00000000..24b69ac3
--- /dev/null
+++ b/app/src/main/res/drawable/favourite_inactive.xml
@@ -0,0 +1,9 @@
+
+
+
diff --git a/app/src/main/res/drawable/reblog_active.xml b/app/src/main/res/drawable/reblog_active.xml
new file mode 100644
index 00000000..c23ed9a9
--- /dev/null
+++ b/app/src/main/res/drawable/reblog_active.xml
@@ -0,0 +1,9 @@
+
+
+
diff --git a/app/src/main/res/drawable/reblog_disabled.xml b/app/src/main/res/drawable/reblog_disabled.xml
new file mode 100644
index 00000000..59db1759
--- /dev/null
+++ b/app/src/main/res/drawable/reblog_disabled.xml
@@ -0,0 +1,9 @@
+
+
+
diff --git a/app/src/main/res/drawable/reblog_inactive.xml b/app/src/main/res/drawable/reblog_inactive.xml
new file mode 100644
index 00000000..74d6b8fe
--- /dev/null
+++ b/app/src/main/res/drawable/reblog_inactive.xml
@@ -0,0 +1,9 @@
+
+
+
diff --git a/app/src/main/res/layout/item_status.xml b/app/src/main/res/layout/item_status.xml
index be611581..53b6b93f 100644
--- a/app/src/main/res/layout/item_status.xml
+++ b/app/src/main/res/layout/item_status.xml
@@ -227,6 +227,8 @@
android:layout_height="wrap_content"
android:layout_below="@id/status_media_preview_container"
android:layout_toRightOf="@+id/status_avatar"
+ android:clipChildren="false"
+ android:clipToPadding="false"
android:paddingBottom="8dp"
android:paddingTop="6dp">
@@ -242,10 +244,14 @@
android:layout_height="match_parent"
android:layout_weight="1" />
-
@@ -254,11 +260,15 @@
android:layout_height="match_parent"
android:layout_weight="1" />
-
#000000
#2F2F2F
#4F4F4F
- #009F6F
+ #56a7e1
#BFBFBF
#4F4F4F
- #ffec21
+ #fab207
#B0B0B0
#CFCFCF
#34444C
diff --git a/build.gradle b/build.gradle
index 1ea4bd05..83a6ca5a 100644
--- a/build.gradle
+++ b/build.gradle
@@ -15,6 +15,7 @@ buildscript {
allprojects {
repositories {
jcenter()
+ maven { url "https://jitpack.io" }
}
}