Added edit rules from spam

This commit is contained in:
M66B 2020-12-10 09:49:10 +01:00
parent 2031e2a5be
commit b829e09b24
2 changed files with 43 additions and 9 deletions

View File

@ -6365,14 +6365,48 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
btnEditRules.setOnClickListener(new View.OnClickListener() { btnEditRules.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
LocalBroadcastManager lbm = LocalBroadcastManager.getInstance(getContext()); if (inJunk) {
lbm.sendBroadcast( new SimpleTask<EntityFolder>() {
new Intent(ActivityView.ACTION_EDIT_RULES) @Override
.putExtra("account", account) protected EntityFolder onExecute(Context context, Bundle args) throws Throwable {
.putExtra("protocol", protocol) long account = args.getLong("account");
.putExtra("folder", folder)
.putExtra("type", type)); DB db = DB.getInstance(context);
dismiss(); EntityFolder inbox = db.folder().getFolderByType(account, EntityFolder.INBOX);
if (inbox == null)
throw new IllegalArgumentException(context.getString(R.string.title_no_inbox));
return inbox;
}
@Override
protected void onExecuted(Bundle args, EntityFolder inbox) {
LocalBroadcastManager lbm = LocalBroadcastManager.getInstance(getContext());
lbm.sendBroadcast(
new Intent(ActivityView.ACTION_EDIT_RULES)
.putExtra("account", account)
.putExtra("protocol", protocol)
.putExtra("folder", inbox.id)
.putExtra("type", inbox.type));
dismiss();
}
@Override
protected void onException(Bundle args, Throwable ex) {
Log.unexpectedError(getParentFragmentManager(), ex);
}
}.execute(FragmentDialogJunk.this, getArguments(), "junk");
} else {
LocalBroadcastManager lbm = LocalBroadcastManager.getInstance(getContext());
lbm.sendBroadcast(
new Intent(ActivityView.ACTION_EDIT_RULES)
.putExtra("account", account)
.putExtra("protocol", protocol)
.putExtra("folder", folder)
.putExtra("type", type));
dismiss();
}
} }
}); });

View File

@ -88,6 +88,6 @@
android:id="@+id/grpInJunk" android:id="@+id/grpInJunk"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="0dp" android:layout_height="0dp"
app:constraint_referenced_ids="tvMessage,tvJunkHint,ibInfo,btnEditRules" /> app:constraint_referenced_ids="tvMessage,tvJunkHint,ibInfo" />
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>
</eu.faircode.email.ScrollViewEx> </eu.faircode.email.ScrollViewEx>