Allow to mute a conversation
This commit is contained in:
parent
24a0c567cb
commit
6928a16f16
|
@ -118,6 +118,8 @@ public class API {
|
||||||
MUTE,
|
MUTE,
|
||||||
MUTE_NOTIFICATIONS,
|
MUTE_NOTIFICATIONS,
|
||||||
UNMUTE,
|
UNMUTE,
|
||||||
|
MUTE_CONVERSATION,
|
||||||
|
UNMUTE_CONVERSATION,
|
||||||
BLOCK,
|
BLOCK,
|
||||||
UNBLOCK,
|
UNBLOCK,
|
||||||
FOLLOW,
|
FOLLOW,
|
||||||
|
@ -2120,6 +2122,12 @@ public class API {
|
||||||
case UNMUTE:
|
case UNMUTE:
|
||||||
action = String.format("/accounts/%s/unmute", targetedId);
|
action = String.format("/accounts/%s/unmute", targetedId);
|
||||||
break;
|
break;
|
||||||
|
case MUTE_CONVERSATION:
|
||||||
|
action = String.format("/statuses/%s/mute", targetedId);
|
||||||
|
break;
|
||||||
|
case UNMUTE_CONVERSATION:
|
||||||
|
action = String.format("/statuses/%s/unmute", targetedId);
|
||||||
|
break;
|
||||||
case PIN:
|
case PIN:
|
||||||
action = String.format("/statuses/%s/pin", targetedId);
|
action = String.format("/statuses/%s/pin", targetedId);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -2203,6 +2203,12 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
|
||||||
popup.getMenu().findItem(R.id.action_bookmark).setTitle(R.string.bookmark_remove);
|
popup.getMenu().findItem(R.id.action_bookmark).setTitle(R.string.bookmark_remove);
|
||||||
else
|
else
|
||||||
popup.getMenu().findItem(R.id.action_bookmark).setTitle(R.string.bookmark_add);
|
popup.getMenu().findItem(R.id.action_bookmark).setTitle(R.string.bookmark_add);
|
||||||
|
if (status.isMuted())
|
||||||
|
popup.getMenu().findItem(R.id.action_mute_conversation).setTitle(R.string.unmute_conversation);
|
||||||
|
else
|
||||||
|
popup.getMenu().findItem(R.id.action_mute_conversation).setTitle(R.string.mute_conversation);
|
||||||
|
|
||||||
|
|
||||||
final String[] stringArrayConf;
|
final String[] stringArrayConf;
|
||||||
if (status.getVisibility().equals("direct") || (status.getVisibility().equals("private") && !isOwner))
|
if (status.getVisibility().equals("direct") || (status.getVisibility().equals("private") && !isOwner))
|
||||||
popup.getMenu().findItem(R.id.action_schedule_boost).setVisible(false);
|
popup.getMenu().findItem(R.id.action_schedule_boost).setVisible(false);
|
||||||
|
@ -2215,10 +2221,12 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
|
||||||
stringArrayConf = context.getResources().getStringArray(R.array.more_action_owner_confirm);
|
stringArrayConf = context.getResources().getStringArray(R.array.more_action_owner_confirm);
|
||||||
} else {
|
} else {
|
||||||
popup.getMenu().findItem(R.id.action_redraft).setVisible(false);
|
popup.getMenu().findItem(R.id.action_redraft).setVisible(false);
|
||||||
if( MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.PLEROMA && (isAdmin || isModerator))
|
popup.getMenu().findItem(R.id.action_mute_conversation).setVisible(false);
|
||||||
|
if( MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.PLEROMA && (isAdmin || isModerator)) {
|
||||||
popup.getMenu().findItem(R.id.action_remove).setVisible(true);
|
popup.getMenu().findItem(R.id.action_remove).setVisible(true);
|
||||||
else
|
}else {
|
||||||
popup.getMenu().findItem(R.id.action_remove).setVisible(false);
|
popup.getMenu().findItem(R.id.action_remove).setVisible(false);
|
||||||
|
}
|
||||||
//Same instance
|
//Same instance
|
||||||
if (status.getAccount().getAcct().split("@").length < 2)
|
if (status.getAccount().getAcct().split("@").length < 2)
|
||||||
popup.getMenu().findItem(R.id.action_block_domain).setVisible(false);
|
popup.getMenu().findItem(R.id.action_block_domain).setVisible(false);
|
||||||
|
@ -2228,7 +2236,7 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
|
||||||
popup.getMenu().findItem(R.id.action_info).setVisible(false);
|
popup.getMenu().findItem(R.id.action_info).setVisible(false);
|
||||||
popup.getMenu().findItem(R.id.action_report).setVisible(false);
|
popup.getMenu().findItem(R.id.action_report).setVisible(false);
|
||||||
popup.getMenu().findItem(R.id.action_block_domain).setVisible(false);
|
popup.getMenu().findItem(R.id.action_block_domain).setVisible(false);
|
||||||
|
popup.getMenu().findItem(R.id.action_mute_conversation).setVisible(false);
|
||||||
}
|
}
|
||||||
boolean custom_sharing = sharedpreferences.getBoolean(Helper.SET_CUSTOM_SHARING, false);
|
boolean custom_sharing = sharedpreferences.getBoolean(Helper.SET_CUSTOM_SHARING, false);
|
||||||
if( custom_sharing && status.getVisibility().equals("public"))
|
if( custom_sharing && status.getVisibility().equals("public"))
|
||||||
|
@ -2374,6 +2382,14 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
|
||||||
builderInner.setMessage(status.getAccount().getAcct());
|
builderInner.setMessage(status.getAccount().getAcct());
|
||||||
doAction = API.StatusAction.MUTE;
|
doAction = API.StatusAction.MUTE;
|
||||||
break;
|
break;
|
||||||
|
case R.id.action_mute_conversation:
|
||||||
|
if( status.isMuted())
|
||||||
|
doAction = API.StatusAction.UNMUTE_CONVERSATION;
|
||||||
|
else
|
||||||
|
doAction = API.StatusAction.MUTE_CONVERSATION;
|
||||||
|
|
||||||
|
new PostActionAsyncTask(context, doAction, status.getId(), StatusListAdapter.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||||
|
return true;
|
||||||
case R.id.action_bookmark:
|
case R.id.action_bookmark:
|
||||||
if (type != RetrieveFeedsAsyncTask.Type.CACHE_BOOKMARKS) {
|
if (type != RetrieveFeedsAsyncTask.Type.CACHE_BOOKMARKS) {
|
||||||
status.setBookmarked(!status.isBookmarked());
|
status.setBookmarked(!status.isBookmarked());
|
||||||
|
@ -3182,6 +3198,22 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
|
||||||
}
|
}
|
||||||
statuses.removeAll(statusesToRemove);
|
statuses.removeAll(statusesToRemove);
|
||||||
statusListAdapter.notifyDataSetChanged();
|
statusListAdapter.notifyDataSetChanged();
|
||||||
|
}else if( statusAction == API.StatusAction.MUTE_CONVERSATION ){
|
||||||
|
for(Status status: statuses){
|
||||||
|
if( status.getId().equals(targetedId)) {
|
||||||
|
status.setMuted(true);
|
||||||
|
notifyStatusChanged(status);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}else if( statusAction == API.StatusAction.UNMUTE_CONVERSATION ){
|
||||||
|
for(Status status: statuses){
|
||||||
|
if( status.getId().equals(targetedId)) {
|
||||||
|
status.setMuted(false);
|
||||||
|
notifyStatusChanged(status);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}else if( statusAction == API.StatusAction.UNSTATUS ){
|
}else if( statusAction == API.StatusAction.UNSTATUS ){
|
||||||
int position = 0;
|
int position = 0;
|
||||||
for(Status status: statuses){
|
for(Status status: statuses){
|
||||||
|
|
|
@ -894,6 +894,10 @@ public class Helper {
|
||||||
message = context.getString(R.string.toast_mute);
|
message = context.getString(R.string.toast_mute);
|
||||||
}else if(statusAction == API.StatusAction.UNMUTE){
|
}else if(statusAction == API.StatusAction.UNMUTE){
|
||||||
message = context.getString(R.string.toast_unmute);
|
message = context.getString(R.string.toast_unmute);
|
||||||
|
}else if(statusAction == API.StatusAction.MUTE_CONVERSATION){
|
||||||
|
message = context.getString(R.string.toast_mute_conversation);
|
||||||
|
}else if(statusAction == API.StatusAction.UNMUTE_CONVERSATION){
|
||||||
|
message = context.getString(R.string.toast_unmute_conversation);
|
||||||
}else if(statusAction == API.StatusAction.FOLLOW){
|
}else if(statusAction == API.StatusAction.FOLLOW){
|
||||||
message = context.getString(R.string.toast_follow);
|
message = context.getString(R.string.toast_follow);
|
||||||
}else if(statusAction == API.StatusAction.UNFOLLOW){
|
}else if(statusAction == API.StatusAction.UNFOLLOW){
|
||||||
|
|
|
@ -31,6 +31,14 @@
|
||||||
android:id="@+id/action_copy_link"
|
android:id="@+id/action_copy_link"
|
||||||
android:title="@string/copy_link"
|
android:title="@string/copy_link"
|
||||||
app:showAsAction="never" />
|
app:showAsAction="never" />
|
||||||
|
<item
|
||||||
|
android:id="@+id/action_mute_conversation"
|
||||||
|
android:title="@string/mute_conversation"
|
||||||
|
app:showAsAction="never" />
|
||||||
|
<item
|
||||||
|
android:id="@+id/action_mute"
|
||||||
|
android:title="@string/more_action_1"
|
||||||
|
app:showAsAction="never" />
|
||||||
<item
|
<item
|
||||||
android:id="@+id/action_timed_mute"
|
android:id="@+id/action_timed_mute"
|
||||||
android:title="@string/more_action_8"
|
android:title="@string/more_action_8"
|
||||||
|
@ -39,10 +47,7 @@
|
||||||
android:id="@+id/action_schedule_boost"
|
android:id="@+id/action_schedule_boost"
|
||||||
android:title="@string/schedule_boost"
|
android:title="@string/schedule_boost"
|
||||||
app:showAsAction="never" />
|
app:showAsAction="never" />
|
||||||
<item
|
|
||||||
android:id="@+id/action_mute"
|
|
||||||
android:title="@string/more_action_1"
|
|
||||||
app:showAsAction="never" />
|
|
||||||
<item
|
<item
|
||||||
android:id="@+id/action_block"
|
android:id="@+id/action_block"
|
||||||
android:title="@string/more_action_2"
|
android:title="@string/more_action_2"
|
||||||
|
|
|
@ -979,6 +979,10 @@
|
||||||
<string name="set_photo_editor">Enable photo editor</string>
|
<string name="set_photo_editor">Enable photo editor</string>
|
||||||
<string name="add_poll_item">Add a poll item</string>
|
<string name="add_poll_item">Add a poll item</string>
|
||||||
<string name="remove_poll_item">Remove last poll item</string>
|
<string name="remove_poll_item">Remove last poll item</string>
|
||||||
|
<string name="mute_conversation">Mute conversation</string>
|
||||||
|
<string name="unmute_conversation">Unmute conversation</string>
|
||||||
|
<string name="toast_unmute_conversation">The conversation is no longer muted!</string>
|
||||||
|
<string name="toast_mute_conversation">The conversation is muted</string>
|
||||||
<plurals name="number_of_vote">
|
<plurals name="number_of_vote">
|
||||||
<item quantity="one">%d vote</item>
|
<item quantity="one">%d vote</item>
|
||||||
<item quantity="other">%d votes</item>
|
<item quantity="other">%d votes</item>
|
||||||
|
|
Loading…
Reference in New Issue