Fix reblog confirm (#1723)
* Fix reblog confirmation default value * Fix triggering reblog before confirming it * Fix accidents caused by reblog confirmation
This commit is contained in:
parent
c80fa68dbe
commit
d44eada140
5 changed files with 14 additions and 15 deletions
|
@ -611,10 +611,10 @@ public abstract class StatusBaseViewHolder extends RecyclerView.ViewHolder {
|
|||
sensitiveMediaShow.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
protected void setupButtons(final StatusActionListener listener, final String accountId,
|
||||
protected void setupButtons(final StatusActionListener listener,
|
||||
final String accountId,
|
||||
final String statusContent,
|
||||
StatusDisplayOptions statusDisplayOptions) {
|
||||
|
||||
avatar.setOnClickListener(v -> listener.onViewAccount(accountId));
|
||||
replyButton.setOnClickListener(v -> {
|
||||
int position = getAdapterPosition();
|
||||
|
@ -624,15 +624,18 @@ public abstract class StatusBaseViewHolder extends RecyclerView.ViewHolder {
|
|||
});
|
||||
if (reblogButton != null) {
|
||||
reblogButton.setEventListener((button, buttonState) -> {
|
||||
// return true to play animaion
|
||||
int position = getAdapterPosition();
|
||||
if (position != RecyclerView.NO_POSITION) {
|
||||
listener.onReblog(!buttonState, position);
|
||||
}
|
||||
if (statusDisplayOptions.confirmReblogs()) {
|
||||
showConfirmReblogDialog(listener, statusContent, buttonState, position);
|
||||
return false;
|
||||
if (statusDisplayOptions.confirmReblogs()) {
|
||||
showConfirmReblogDialog(listener, statusContent, buttonState, position);
|
||||
return false;
|
||||
} else {
|
||||
listener.onReblog(!buttonState, position);
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -67,7 +67,7 @@ class ConversationsFragment : SFragment(), StatusActionListener, Injectable, Res
|
|||
showBotOverlay = preferences.getBoolean("showBotOverlay", true),
|
||||
useBlurhash = preferences.getBoolean("useBlurhash", true),
|
||||
cardViewMode = CardViewMode.NONE,
|
||||
confirmReblogs = preferences.getBoolean("confirmReblogs", true)
|
||||
confirmReblogs = preferences.getBoolean("confirmReblogs", false)
|
||||
)
|
||||
|
||||
|
||||
|
|
|
@ -118,7 +118,7 @@ class ReportStatusesFragment : Fragment(), Injectable, AdapterHandler {
|
|||
showBotOverlay = false,
|
||||
useBlurhash = preferences.getBoolean("useBlurhash", true),
|
||||
cardViewMode = CardViewMode.NONE,
|
||||
confirmReblogs = preferences.getBoolean("confirmReblogs", true)
|
||||
confirmReblogs = preferences.getBoolean("confirmReblogs", false)
|
||||
)
|
||||
|
||||
adapter = StatusesAdapter(statusDisplayOptions,
|
||||
|
|
|
@ -83,7 +83,7 @@ class SearchStatusesFragment : SearchFragment<Pair<Status, StatusViewData.Concre
|
|||
showBotOverlay = preferences.getBoolean("showBotOverlay", true),
|
||||
useBlurhash = preferences.getBoolean("useBlurhash", true),
|
||||
cardViewMode = CardViewMode.NONE,
|
||||
confirmReblogs = preferences.getBoolean("confirmReblogs", true)
|
||||
confirmReblogs = preferences.getBoolean("confirmReblogs", false)
|
||||
)
|
||||
|
||||
searchRecyclerView.addItemDecoration(DividerItemDecoration(searchRecyclerView.context, DividerItemDecoration.VERTICAL))
|
||||
|
|
|
@ -585,10 +585,6 @@ public class TimelineFragment extends SFragment implements
|
|||
@Override
|
||||
public void onReblog(final boolean reblog, final int position) {
|
||||
final Status status = statuses.get(position).asRight();
|
||||
doReblog(reblog, position, status);
|
||||
}
|
||||
|
||||
private void doReblog(boolean reblog, int position, Status status) {
|
||||
timelineCases.reblog(status, reblog)
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.as(autoDisposable(from(this, Lifecycle.Event.ON_DESTROY)))
|
||||
|
|
Loading…
Reference in a new issue