mirror of
https://github.com/M66B/FairEmail.git
synced 2026-03-26 02:45:31 +01:00
Added button to manage blocked senders
This commit is contained in:
@@ -1645,8 +1645,14 @@ public class ActivitySetup extends ActivityBase implements FragmentManager.OnBac
|
||||
}
|
||||
|
||||
private void onManageLocalContacts(Intent intent) {
|
||||
Bundle args = new Bundle();
|
||||
args.putBoolean("junk", intent.getBooleanExtra("junk", false));
|
||||
|
||||
FragmentContacts fragment = new FragmentContacts();
|
||||
fragment.setArguments(args);
|
||||
|
||||
FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction();
|
||||
fragmentTransaction.replace(R.id.content_frame, new FragmentContacts()).addToBackStack("contacts");
|
||||
fragmentTransaction.replace(R.id.content_frame, fragment).addToBackStack("contacts");
|
||||
fragmentTransaction.commit();
|
||||
}
|
||||
|
||||
|
||||
@@ -96,7 +96,7 @@ public class FragmentContacts extends FragmentBase {
|
||||
@Override
|
||||
@Nullable
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
setSubtitle(junk ? R.string.title_block_sender : R.string.menu_contacts);
|
||||
setSubtitle(junk ? R.string.title_blocked_senders : R.string.menu_contacts);
|
||||
setHasOptionsMenu(true);
|
||||
|
||||
View view = inflater.inflate(R.layout.fragment_contacts, container, false);
|
||||
@@ -236,7 +236,7 @@ public class FragmentContacts extends FragmentBase {
|
||||
|
||||
private void onMenuJunk(boolean junk) {
|
||||
this.junk = junk;
|
||||
setSubtitle(junk ? R.string.title_block_sender : R.string.menu_contacts);
|
||||
setSubtitle(junk ? R.string.title_blocked_senders : R.string.menu_contacts);
|
||||
adapter.filter(junk
|
||||
? Arrays.asList(EntityContact.TYPE_JUNK, EntityContact.TYPE_NO_JUNK)
|
||||
: new ArrayList<>());
|
||||
|
||||
@@ -61,6 +61,7 @@ public class FragmentOptionsSend extends FragmentBase implements SharedPreferenc
|
||||
private SwitchCompat swSuggestReceived;
|
||||
private SwitchCompat swSuggestFrequently;
|
||||
private Button btnLocalContacts;
|
||||
private Button btnBlockedSenders;
|
||||
private SwitchCompat swPrefixOnce;
|
||||
private SwitchCompat swPrefixCount;
|
||||
private RadioGroup rgRe;
|
||||
@@ -128,6 +129,7 @@ public class FragmentOptionsSend extends FragmentBase implements SharedPreferenc
|
||||
swSuggestReceived = view.findViewById(R.id.swSuggestReceived);
|
||||
swSuggestFrequently = view.findViewById(R.id.swSuggestFrequently);
|
||||
btnLocalContacts = view.findViewById(R.id.btnLocalContacts);
|
||||
btnBlockedSenders = view.findViewById(R.id.btnBlockedSenders);
|
||||
swPrefixOnce = view.findViewById(R.id.swPrefixOnce);
|
||||
swPrefixCount = view.findViewById(R.id.swPrefixCount);
|
||||
rgRe = view.findViewById(R.id.rgRe);
|
||||
@@ -239,6 +241,15 @@ public class FragmentOptionsSend extends FragmentBase implements SharedPreferenc
|
||||
}
|
||||
});
|
||||
|
||||
btnBlockedSenders.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
LocalBroadcastManager lbm = LocalBroadcastManager.getInstance(getContext());
|
||||
lbm.sendBroadcast(new Intent(ActivitySetup.ACTION_MANAGE_LOCAL_CONTACTS)
|
||||
.putExtra("junk", true));
|
||||
}
|
||||
});
|
||||
|
||||
swPrefixOnce.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
||||
|
||||
@@ -183,6 +183,19 @@
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/swSuggestFrequently" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnBlockedSenders"
|
||||
style="?android:attr/buttonStyleSmall"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="12dp"
|
||||
android:layout_marginTop="12dp"
|
||||
android:drawableEnd="@drawable/twotone_report_24"
|
||||
android:drawablePadding="6dp"
|
||||
android:text="@string/title_blocked_senders"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/btnLocalContacts" />
|
||||
|
||||
<androidx.appcompat.widget.SwitchCompat
|
||||
android:id="@+id/swPrefixOnce"
|
||||
android:layout_width="0dp"
|
||||
@@ -192,7 +205,7 @@
|
||||
android:text="@string/title_advanced_prefix_once"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/btnLocalContacts"
|
||||
app:layout_constraintTop_toBottomOf="@id/btnBlockedSenders"
|
||||
app:switchPadding="12dp" />
|
||||
|
||||
<androidx.appcompat.widget.SwitchCompat
|
||||
|
||||
@@ -99,6 +99,7 @@
|
||||
Blocking a sender is a free feature.
|
||||
Blocking a sender domain uses filter rules, which is a pro feature.
|
||||
</string>
|
||||
<string name="title_blocked_senders">Blocked senders</string>
|
||||
|
||||
<string name="title_junk_filter">Use local spam filter</string>
|
||||
<string name="title_junk_filter_hint">This can increase battery usage and incorrectly mark messages as spam</string>
|
||||
|
||||
Reference in New Issue
Block a user