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,6 +6365,39 @@ 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) {
if (inJunk) {
new SimpleTask<EntityFolder>() {
@Override
protected EntityFolder onExecute(Context context, Bundle args) throws Throwable {
long account = args.getLong("account");
DB db = DB.getInstance(context);
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()); LocalBroadcastManager lbm = LocalBroadcastManager.getInstance(getContext());
lbm.sendBroadcast( lbm.sendBroadcast(
new Intent(ActivityView.ACTION_EDIT_RULES) new Intent(ActivityView.ACTION_EDIT_RULES)
@ -6374,6 +6407,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
.putExtra("type", type)); .putExtra("type", type));
dismiss(); dismiss();
} }
}
}); });
grpInJunk.setVisibility(inJunk ? View.GONE : View.VISIBLE); grpInJunk.setVisibility(inJunk ? View.GONE : View.VISIBLE);

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>