Added manage filters/contacts to spam dialog

pull/194/merge
M66B 4 years ago
parent 686a4d1f9c
commit b9f446f0fa

@ -83,6 +83,14 @@ public class FragmentContacts extends FragmentBase {
private static final int REQUEST_EXPORT = 3; private static final int REQUEST_EXPORT = 3;
static final int REQUEST_EDIT_NAME = 4; static final int REQUEST_EDIT_NAME = 4;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Bundle args = getArguments();
this.junk = (args != null && args.getBoolean("junk"));
}
@Override @Override
@Nullable @Nullable
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {

@ -82,6 +82,8 @@ public class FragmentDialogJunk extends FragmentDialogBase {
final TextView tvBlocklist = view.findViewById(R.id.tvBlocklist); final TextView tvBlocklist = view.findViewById(R.id.tvBlocklist);
final ImageButton ibInfoBlocklist = view.findViewById(R.id.ibInfoBlocklist); final ImageButton ibInfoBlocklist = view.findViewById(R.id.ibInfoBlocklist);
final Button btnClear = view.findViewById(R.id.btnClear); final Button btnClear = view.findViewById(R.id.btnClear);
final ImageButton ibRules = view.findViewById(R.id.ibRules);
final ImageButton ibManage = view.findViewById(R.id.ibManage);
final Group grpInJunk = view.findViewById(R.id.grpInJunk); final Group grpInJunk = view.findViewById(R.id.grpInJunk);
final Group grpMore = view.findViewById(R.id.grpMore); final Group grpMore = view.findViewById(R.id.grpMore);
@ -271,6 +273,38 @@ public class FragmentDialogJunk extends FragmentDialogBase {
} }
}); });
ibRules.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
LocalBroadcastManager lbm = LocalBroadcastManager.getInstance(v.getContext());
lbm.sendBroadcast(
new Intent(ActivityView.ACTION_EDIT_RULES)
.putExtra("account", account)
.putExtra("protocol", protocol)
.putExtra("folder", folder)
.putExtra("type", type));
dismiss();
}
});
ibManage.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Bundle args = new Bundle();
args.putBoolean("junk", true);
FragmentContacts fragment = new FragmentContacts();
fragment.setArguments(args);
FragmentTransaction fragmentTransaction = getParentFragmentManager().beginTransaction();
fragmentTransaction.replace(R.id.content_frame, fragment).addToBackStack("contacts");
fragmentTransaction.commit();
dismiss();
}
});
try { try {
boolean common = false; boolean common = false;
Address[] froms = InternetAddress.parseHeader(from, false); Address[] froms = InternetAddress.parseHeader(from, false);

@ -206,6 +206,34 @@
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvBlocklistHint" /> app:layout_constraintTop_toBottomOf="@id/tvBlocklistHint" />
<ImageButton
android:id="@+id/ibRules"
android:layout_width="36dp"
android:layout_height="36dp"
android:background="?android:attr/selectableItemBackgroundBorderless"
android:contentDescription="@string/title_edit_rules"
android:padding="6dp"
android:scaleType="fitCenter"
android:tooltipText="@string/title_edit_rules"
app:layout_constraintBottom_toBottomOf="@id/btnClear"
app:layout_constraintEnd_toStartOf="@+id/ibManage"
app:layout_constraintTop_toTopOf="@id/btnClear"
app:srcCompat="@drawable/twotone_filter_alt_24" />
<ImageButton
android:id="@+id/ibManage"
android:layout_width="36dp"
android:layout_height="36dp"
android:background="?android:attr/selectableItemBackgroundBorderless"
android:contentDescription="@string/title_setup_manage"
android:padding="6dp"
android:scaleType="fitCenter"
android:tooltipText="@string/title_setup_manage"
app:layout_constraintBottom_toBottomOf="@id/btnClear"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="@id/btnClear"
app:srcCompat="@drawable/twotone_settings_24" />
<eu.faircode.email.FixedTextView <eu.faircode.email.FixedTextView
android:id="@+id/tvClearHint" android:id="@+id/tvClearHint"
android:layout_width="0dp" android:layout_width="0dp"
@ -234,6 +262,6 @@
app:constraint_referenced_ids=" app:constraint_referenced_ids="
cbJunkFilter,tvJunkFilterHint,ibInfoFilter, cbJunkFilter,tvJunkFilterHint,ibInfoFilter,
cbBlocklist,tvBlocklist,tvBlocklistHint,ibInfoBlocklist, cbBlocklist,tvBlocklist,tvBlocklistHint,ibInfoBlocklist,
btnClear,tvClearHint" /> btnClear,ibRules,ibManage,tvClearHint" />
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>
</eu.faircode.email.ScrollViewEx> </eu.faircode.email.ScrollViewEx>

Loading…
Cancel
Save