mirror of
https://codeberg.org/tom79/Fedilab.git
synced 2025-01-07 00:20:08 +02:00
Mute from lists
This commit is contained in:
parent
d8de016407
commit
a55401df77
6 changed files with 25 additions and 3 deletions
|
@ -143,6 +143,22 @@ public class MastodonListActivity extends BaseBarActivity implements MastodonLis
|
||||||
if (item.getItemId() == android.R.id.home) {
|
if (item.getItemId() == android.R.id.home) {
|
||||||
onBackPressed();
|
onBackPressed();
|
||||||
return true;
|
return true;
|
||||||
|
} else if (item.getItemId() == R.id.action_user_mute_home) {
|
||||||
|
AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(MastodonListActivity.this, Helper.dialogStyle());
|
||||||
|
dialogBuilder.setTitle(R.string.put_all_accounts_in_home_muted);
|
||||||
|
dialogBuilder.setPositiveButton(R.string.mute_them_all, (dialog, id) -> {
|
||||||
|
timelinesVM.getAccountsInList(BaseMainActivity.currentInstance, BaseMainActivity.currentToken, mastodonList.id, null, null, 0)
|
||||||
|
.observe(MastodonListActivity.this, accounts -> {
|
||||||
|
if (accounts != null && accounts.size() > 0) {
|
||||||
|
for (Account account : accounts) {
|
||||||
|
accountsVM.muteHome(MainActivity.currentAccount, account);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
dialog.dismiss();
|
||||||
|
});
|
||||||
|
dialogBuilder.setNegativeButton(R.string.cancel, (dialog, id) -> dialog.dismiss());
|
||||||
|
dialogBuilder.show();
|
||||||
} else if (item.getItemId() == R.id.action_manage_users) {
|
} else if (item.getItemId() == R.id.action_manage_users) {
|
||||||
AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(MastodonListActivity.this, Helper.dialogStyle());
|
AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(MastodonListActivity.this, Helper.dialogStyle());
|
||||||
PopupManageAccountsListBinding popupManageAccountsListBinding = PopupManageAccountsListBinding.inflate(getLayoutInflater());
|
PopupManageAccountsListBinding popupManageAccountsListBinding = PopupManageAccountsListBinding.inflate(getLayoutInflater());
|
||||||
|
|
|
@ -16,7 +16,6 @@ package app.fedilab.android.activities;
|
||||||
|
|
||||||
|
|
||||||
import static app.fedilab.android.BaseMainActivity.currentAccount;
|
import static app.fedilab.android.BaseMainActivity.currentAccount;
|
||||||
import static app.fedilab.android.ui.drawer.StatusAdapter.sendAction;
|
|
||||||
|
|
||||||
import android.content.BroadcastReceiver;
|
import android.content.BroadcastReceiver;
|
||||||
import android.content.ClipData;
|
import android.content.ClipData;
|
||||||
|
@ -1020,7 +1019,6 @@ public class ProfileActivity extends BaseActivity {
|
||||||
.observe(ProfileActivity.this, account -> {
|
.observe(ProfileActivity.this, account -> {
|
||||||
homeMuted = true;
|
homeMuted = true;
|
||||||
invalidateOptionsMenu();
|
invalidateOptionsMenu();
|
||||||
sendAction(ProfileActivity.this, Helper.ARG_STATUS_ACCOUNT_ID_DELETED, null, account.id);
|
|
||||||
Toasty.info(ProfileActivity.this, getString(R.string.toast_mute), Toasty.LENGTH_LONG).show();
|
Toasty.info(ProfileActivity.this, getString(R.string.toast_mute), Toasty.LENGTH_LONG).show();
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
|
@ -1662,7 +1662,6 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
|
||||||
builderInner.setNeutralButton(R.string.cancel, (dialog, which) -> dialog.dismiss());
|
builderInner.setNeutralButton(R.string.cancel, (dialog, which) -> dialog.dismiss());
|
||||||
builderInner.setPositiveButton(R.string.action_mute, (dialog, which) -> accountsVM.muteHome(currentAccount, statusToDeal.account)
|
builderInner.setPositiveButton(R.string.action_mute, (dialog, which) -> accountsVM.muteHome(currentAccount, statusToDeal.account)
|
||||||
.observe((LifecycleOwner) context, account -> {
|
.observe((LifecycleOwner) context, account -> {
|
||||||
sendAction(context, Helper.ARG_STATUS_ACCOUNT_ID_DELETED, null, statusToDeal.account.id);
|
|
||||||
Toasty.info(context, context.getString(R.string.toast_mute), Toasty.LENGTH_LONG).show();
|
Toasty.info(context, context.getString(R.string.toast_mute), Toasty.LENGTH_LONG).show();
|
||||||
}));
|
}));
|
||||||
builderInner.show();
|
builderInner.show();
|
||||||
|
|
|
@ -821,6 +821,7 @@ public class AccountsVM extends AndroidViewModel {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
Handler mainHandler = new Handler(Looper.getMainLooper());
|
Handler mainHandler = new Handler(Looper.getMainLooper());
|
||||||
|
sendAction(getApplication().getApplicationContext(), Helper.ARG_STATUS_ACCOUNT_ID_DELETED, null, target.id);
|
||||||
Runnable myRunnable = () -> accountMutableLiveData.setValue(target);
|
Runnable myRunnable = () -> accountMutableLiveData.setValue(target);
|
||||||
mainHandler.post(myRunnable);
|
mainHandler.post(myRunnable);
|
||||||
}).start();
|
}).start();
|
||||||
|
|
|
@ -11,6 +11,11 @@
|
||||||
android:icon="@drawable/ic_baseline_edit_note_24"
|
android:icon="@drawable/ic_baseline_edit_note_24"
|
||||||
android:title="@string/action_lists_edit"
|
android:title="@string/action_lists_edit"
|
||||||
app:showAsAction="ifRoom" />
|
app:showAsAction="ifRoom" />
|
||||||
|
<item
|
||||||
|
android:id="@+id/action_user_mute_home"
|
||||||
|
android:icon="@drawable/ic_baseline_volume_mute_24"
|
||||||
|
android:title="@string/add_all_users_home_muted"
|
||||||
|
app:showAsAction="ifRoom" />
|
||||||
<item
|
<item
|
||||||
android:id="@+id/action_delete"
|
android:id="@+id/action_delete"
|
||||||
android:icon="@drawable/ic_baseline_delete_24"
|
android:icon="@drawable/ic_baseline_delete_24"
|
||||||
|
|
|
@ -2062,4 +2062,7 @@
|
||||||
<string name="unfollow_tag">Unfollow tag</string>
|
<string name="unfollow_tag">Unfollow tag</string>
|
||||||
<string name="mute_home">Mute for home</string>
|
<string name="mute_home">Mute for home</string>
|
||||||
<string name="unmute_home">Unmute for home</string>
|
<string name="unmute_home">Unmute for home</string>
|
||||||
|
<string name="add_all_users_home_muted">Add all users in muted home</string>
|
||||||
|
<string name="put_all_accounts_in_home_muted">All accounts will be muted for the Home timeline.</string>
|
||||||
|
<string name="mute_them_all">Mute them all</string>
|
||||||
</resources>
|
</resources>
|
Loading…
Reference in a new issue