mirror of
https://codeberg.org/tom79/Fedilab.git
synced 2025-09-15 08:20:18 +03:00
Disable quote button when approval is denied
This commit is contained in:
parent
8274556404
commit
4bcbd3679d
2 changed files with 19 additions and 0 deletions
|
@ -62,6 +62,8 @@ public class Status implements Serializable, Cloneable {
|
|||
public String visibility;
|
||||
@SerializedName("quote_approval_policy")
|
||||
public String quote_approval_policy;
|
||||
@SerializedName("quote_approval")
|
||||
public QuoteApproval quote_approval;
|
||||
@SerializedName("language")
|
||||
public String language;
|
||||
@SerializedName("uri")
|
||||
|
@ -119,6 +121,15 @@ public class Status implements Serializable, Cloneable {
|
|||
@SerializedName("reactions")
|
||||
public List<Reaction> reactions;
|
||||
|
||||
public static class QuoteApproval implements Serializable {
|
||||
@SerializedName("automatic")
|
||||
public String[] automatic;
|
||||
@SerializedName("current_user")
|
||||
public String current_user;
|
||||
@SerializedName("manual")
|
||||
public Status[] manual;
|
||||
}
|
||||
|
||||
public Status getQuote() {
|
||||
Status quote = null;
|
||||
ObjectWriter ow = new ObjectMapper().writer().withDefaultPrettyPrinter();
|
||||
|
@ -245,4 +256,6 @@ public class Status implements Serializable, Cloneable {
|
|||
@SerializedName("quoted_status")
|
||||
Status quoted_status;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -60,6 +60,7 @@ import android.text.Html;
|
|||
import android.text.Spannable;
|
||||
import android.text.SpannableString;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.util.TypedValue;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.MenuItem;
|
||||
|
@ -1206,6 +1207,11 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
|
|||
if(displayQuote) {
|
||||
PopupMenu popupMenu = new PopupMenu(context, v);
|
||||
popupMenu.getMenuInflater().inflate(R.menu.menu_boost_or_quote, popupMenu.getMenu());
|
||||
if(statusToDeal.quote_approval != null && statusToDeal.quote_approval.current_user != null && statusToDeal.quote_approval.current_user.equalsIgnoreCase("denied") ) {
|
||||
popupMenu.getMenu().findItem(R.id.action_quote).setEnabled(false);
|
||||
} else {
|
||||
popupMenu.getMenu().findItem(R.id.action_quote).setEnabled(true);
|
||||
}
|
||||
popupMenu.setOnMenuItemClickListener(item -> {
|
||||
int itemId = item.getItemId();
|
||||
if (itemId == R.id.action_reblog) {
|
||||
|
|
Loading…
Reference in a new issue