Added edit rules button to junk dialog

pull/177/head
M66B 6 years ago
parent 28d254a5b2
commit 5e8098942e

@ -3186,6 +3186,8 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
private void onActionJunk(TupleMessageEx message) {
Bundle aargs = new Bundle();
aargs.putLong("id", message.id);
aargs.putLong("account", message.account);
aargs.putLong("folder", message.folder);
aargs.putString("from", MessageHelper.formatAddresses(message.from));
FragmentDialogJunk ask = new FragmentDialogJunk();
@ -5110,12 +5112,16 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
@NonNull
@Override
public Dialog onCreateDialog(@Nullable Bundle savedInstanceState) {
String from = getArguments().getString("from");
Bundle args = getArguments();
final long account = args.getLong("account");
final long folder = args.getLong("folder");
final String from = args.getString("from");
View view = LayoutInflater.from(getContext()).inflate(R.layout.dialog_junk, null);
final TextView tvMessage = view.findViewById(R.id.tvMessage);
final CheckBox cbBlockSender = view.findViewById(R.id.cbBlockSender);
final CheckBox cbBlockDomain = view.findViewById(R.id.cbBlockDomain);
final Button btnEditRules = view.findViewById(R.id.btnEditRules);
tvMessage.setText(getString(R.string.title_ask_spam_who, from));
cbBlockSender.setEnabled(ActivityBilling.isPro(getContext()));
@ -5128,6 +5134,18 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
}
});
btnEditRules.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
LocalBroadcastManager lbm = LocalBroadcastManager.getInstance(getContext());
lbm.sendBroadcast(
new Intent(ActivityView.ACTION_EDIT_RULES)
.putExtra("account", account)
.putExtra("folder", folder));
dismiss();
}
});
return new AlertDialog.Builder(getContext())
.setView(view)
.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {

@ -1927,6 +1927,8 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
private void onSwipeJunk(final @NonNull TupleMessageEx message) {
Bundle aargs = new Bundle();
aargs.putLong("id", message.id);
aargs.putLong("account", message.account);
aargs.putLong("folder", message.folder);
aargs.putString("from", MessageHelper.formatAddresses(message.from));
AdapterMessage.FragmentDialogJunk ask = new AdapterMessage.FragmentDialogJunk();

@ -50,5 +50,17 @@
android:textColor="?android:attr/textColorPrimary"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/cbBlockDomain" />
<Button
android:id="@+id/btnEditRules"
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:minWidth="0dp"
android:minHeight="0dp"
android:text="@string/title_edit_rules"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvBlockHint" />
</androidx.constraintlayout.widget.ConstraintLayout>
</ScrollView>
Loading…
Cancel
Save