|
|
@ -34,6 +34,9 @@ import android.widget.ToggleButton; |
|
|
|
import com.android.volley.toolbox.ImageLoader; |
|
|
|
import com.android.volley.toolbox.ImageLoader; |
|
|
|
import com.android.volley.toolbox.NetworkImageView; |
|
|
|
import com.android.volley.toolbox.NetworkImageView; |
|
|
|
import com.squareup.picasso.Picasso; |
|
|
|
import com.squareup.picasso.Picasso; |
|
|
|
|
|
|
|
import com.varunest.sparkbutton.SparkButton; |
|
|
|
|
|
|
|
import com.varunest.sparkbutton.SparkButtonBuilder; |
|
|
|
|
|
|
|
import com.varunest.sparkbutton.SparkEventListener; |
|
|
|
|
|
|
|
|
|
|
|
import java.util.Date; |
|
|
|
import java.util.Date; |
|
|
|
|
|
|
|
|
|
|
@ -47,8 +50,8 @@ class StatusViewHolder extends RecyclerView.ViewHolder { |
|
|
|
private View rebloggedBar; |
|
|
|
private View rebloggedBar; |
|
|
|
private TextView rebloggedByDisplayName; |
|
|
|
private TextView rebloggedByDisplayName; |
|
|
|
private ImageButton replyButton; |
|
|
|
private ImageButton replyButton; |
|
|
|
private ImageButton reblogButton; |
|
|
|
private SparkButton reblogButton; |
|
|
|
private ImageButton favouriteButton; |
|
|
|
private SparkButton favouriteButton; |
|
|
|
private ImageButton moreButton; |
|
|
|
private ImageButton moreButton; |
|
|
|
private boolean favourited; |
|
|
|
private boolean favourited; |
|
|
|
private boolean reblogged; |
|
|
|
private boolean reblogged; |
|
|
@ -72,8 +75,8 @@ class StatusViewHolder extends RecyclerView.ViewHolder { |
|
|
|
rebloggedBar = itemView.findViewById(R.id.status_reblogged_bar); |
|
|
|
rebloggedBar = itemView.findViewById(R.id.status_reblogged_bar); |
|
|
|
rebloggedByDisplayName = (TextView) itemView.findViewById(R.id.status_reblogged); |
|
|
|
rebloggedByDisplayName = (TextView) itemView.findViewById(R.id.status_reblogged); |
|
|
|
replyButton = (ImageButton) itemView.findViewById(R.id.status_reply); |
|
|
|
replyButton = (ImageButton) itemView.findViewById(R.id.status_reply); |
|
|
|
reblogButton = (ImageButton) itemView.findViewById(R.id.status_reblog); |
|
|
|
reblogButton = (SparkButton) itemView.findViewById(R.id.status_reblog); |
|
|
|
favouriteButton = (ImageButton) itemView.findViewById(R.id.status_favourite); |
|
|
|
favouriteButton = (SparkButton) itemView.findViewById(R.id.status_favourite); |
|
|
|
moreButton = (ImageButton) itemView.findViewById(R.id.status_more); |
|
|
|
moreButton = (ImageButton) itemView.findViewById(R.id.status_more); |
|
|
|
reblogged = false; |
|
|
|
reblogged = false; |
|
|
|
favourited = false; |
|
|
|
favourited = false; |
|
|
@ -187,35 +190,25 @@ class StatusViewHolder extends RecyclerView.ViewHolder { |
|
|
|
|
|
|
|
|
|
|
|
private void setReblogged(boolean reblogged) { |
|
|
|
private void setReblogged(boolean reblogged) { |
|
|
|
this.reblogged = reblogged; |
|
|
|
this.reblogged = reblogged; |
|
|
|
int attribute; |
|
|
|
reblogButton.setChecked(reblogged); |
|
|
|
if (reblogged) { |
|
|
|
|
|
|
|
attribute = R.attr.status_reblog_button_marked_tint; |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
attribute = R.attr.status_reblog_button_tint; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
ThemeUtils.setImageViewTint(reblogButton, attribute); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** This should only be called after setReblogged, in order to override the tint correctly. */ |
|
|
|
/** This should only be called after setReblogged, in order to override the tint correctly. */ |
|
|
|
private void setRebloggingEnabled(boolean enabled) { |
|
|
|
private void setRebloggingEnabled(boolean enabled) { |
|
|
|
reblogButton.setEnabled(enabled); |
|
|
|
reblogButton.setEnabled(enabled); |
|
|
|
|
|
|
|
|
|
|
|
if (enabled) { |
|
|
|
if (enabled) { |
|
|
|
reblogButton.setImageResource(R.drawable.ic_repeat_24dp); |
|
|
|
reblogButton.setInactiveImage(R.drawable.reblog_inactive); |
|
|
|
|
|
|
|
reblogButton.setActiveImage(R.drawable.reblog_active); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
ThemeUtils.setImageViewTint(reblogButton, R.attr.status_reblog_button_disabled_tint); |
|
|
|
reblogButton.setInactiveImage(R.drawable.reblog_disabled); |
|
|
|
reblogButton.setImageResource(R.drawable.ic_lock_24dp); |
|
|
|
reblogButton.setActiveImage(R.drawable.reblog_disabled); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void setFavourited(boolean favourited) { |
|
|
|
private void setFavourited(boolean favourited) { |
|
|
|
this.favourited = favourited; |
|
|
|
this.favourited = favourited; |
|
|
|
int attribute; |
|
|
|
favouriteButton.setChecked(favourited); |
|
|
|
if (favourited) { |
|
|
|
|
|
|
|
attribute = R.attr.status_favourite_button_marked_tint; |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
attribute = R.attr.status_favourite_button_tint; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
ThemeUtils.setImageViewTint(favouriteButton, attribute); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void setMediaPreviews(final Status.MediaAttachment[] attachments, |
|
|
|
private void setMediaPreviews(final Status.MediaAttachment[] attachments, |
|
|
@ -313,15 +306,15 @@ class StatusViewHolder extends RecyclerView.ViewHolder { |
|
|
|
listener.onReply(getAdapterPosition()); |
|
|
|
listener.onReply(getAdapterPosition()); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
reblogButton.setOnClickListener(new View.OnClickListener() { |
|
|
|
reblogButton.setEventListener(new SparkEventListener() { |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void onClick(View v) { |
|
|
|
public void onEvent(ImageView button, boolean buttonState) { |
|
|
|
listener.onReblog(!reblogged, getAdapterPosition()); |
|
|
|
listener.onReblog(!reblogged, getAdapterPosition()); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
favouriteButton.setOnClickListener(new View.OnClickListener() { |
|
|
|
favouriteButton.setEventListener(new SparkEventListener() { |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void onClick(View v) { |
|
|
|
public void onEvent(ImageView button, boolean buttonState) { |
|
|
|
listener.onFavourite(!favourited, getAdapterPosition()); |
|
|
|
listener.onFavourite(!favourited, getAdapterPosition()); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|