mirror of
https://github.com/M66B/FairEmail.git
synced 2026-05-19 13:34:00 +02:00
Added debug option to add new folders to the nav menu
This commit is contained in:
@@ -3025,7 +3025,7 @@ class Core {
|
||||
folder.setSpecials(account);
|
||||
|
||||
if (selectable) {
|
||||
folder.inheritFrom(parent);
|
||||
folder.inheritFrom(parent, context);
|
||||
if (user && sync_added_folders && EntityFolder.USER.equals(type)) {
|
||||
folder.synchronize = true;
|
||||
folder.notify = true;
|
||||
|
||||
@@ -22,9 +22,11 @@ package eu.faircode.email;
|
||||
import static androidx.room.ForeignKey.CASCADE;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.preference.PreferenceManager;
|
||||
import androidx.room.Entity;
|
||||
import androidx.room.ForeignKey;
|
||||
import androidx.room.Index;
|
||||
@@ -331,7 +333,7 @@ public class EntityFolder extends EntityOrder implements Serializable {
|
||||
display = "Envoyés";
|
||||
}
|
||||
|
||||
void inheritFrom(EntityFolder parent) {
|
||||
void inheritFrom(EntityFolder parent, Context context) {
|
||||
if (parent == null)
|
||||
return;
|
||||
if (!EntityFolder.USER.equals(type))
|
||||
@@ -344,6 +346,11 @@ public class EntityFolder extends EntityOrder implements Serializable {
|
||||
this.sync_days = parent.sync_days;
|
||||
this.keep_days = parent.keep_days;
|
||||
this.notify = parent.notify;
|
||||
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
boolean auto_folder_nav = prefs.getBoolean("auto_folder_nav", false);
|
||||
if (auto_folder_nav)
|
||||
this.navigation = true;
|
||||
}
|
||||
|
||||
static boolean shouldPoll(String type) {
|
||||
|
||||
@@ -554,7 +554,7 @@ public class FragmentDialogSelectFolder extends FragmentDialogBase {
|
||||
folder.type = EntityFolder.USER;
|
||||
folder.parent = (parent == null ? null : parent.id);
|
||||
folder.setProperties();
|
||||
folder.inheritFrom(parent);
|
||||
folder.inheritFrom(parent, context);
|
||||
folder.id = db.folder().insertFolder(folder);
|
||||
}
|
||||
|
||||
|
||||
@@ -253,6 +253,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
|
||||
private SwitchCompat swAdjacentLandscape;
|
||||
private SwitchCompat swDeleteConfirmation;
|
||||
private SwitchCompat swDeleteNotification;
|
||||
private SwitchCompat swAutoFolderNav;
|
||||
private SwitchCompat swDmarcViewer;
|
||||
private EditText etKeywords;
|
||||
private SwitchCompat swTestIab;
|
||||
@@ -318,7 +319,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
|
||||
"easy_correct", "paste_plain", "paste_quote", "favicon_uri", "infra", "email_junk", "tld_flags", "json_ld", "dup_msgids", "thread_byref", "save_user_flags", "mdn",
|
||||
"app_chooser", "app_chooser_share", "share_task",
|
||||
"adjacent_links", "adjacent_documents", "adjacent_portrait", "adjacent_landscape",
|
||||
"delete_confirmation", "delete_notification", "global_keywords", "test_iab"
|
||||
"delete_confirmation", "delete_notification", "auto_folder_nav", "global_keywords", "test_iab"
|
||||
));
|
||||
|
||||
private final static String[] RESET_QUESTIONS = new String[]{
|
||||
@@ -526,6 +527,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
|
||||
swAdjacentLandscape = view.findViewById(R.id.swAdjacentLandscape);
|
||||
swDeleteConfirmation = view.findViewById(R.id.swDeleteConfirmation);
|
||||
swDeleteNotification = view.findViewById(R.id.swDeleteNotification);
|
||||
swAutoFolderNav = view.findViewById(R.id.swAutoFolderNav);
|
||||
swDmarcViewer = view.findViewById(R.id.swDmarcViewer);
|
||||
etKeywords = view.findViewById(R.id.etKeywords);
|
||||
swTestIab = view.findViewById(R.id.swTestIab);
|
||||
@@ -1887,6 +1889,13 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
|
||||
}
|
||||
});
|
||||
|
||||
swAutoFolderNav.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
||||
prefs.edit().putBoolean("auto_folder_nav", checked).apply();
|
||||
}
|
||||
});
|
||||
|
||||
swDmarcViewer.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
||||
@@ -2676,6 +2685,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
|
||||
swAdjacentLandscape.setChecked(prefs.getBoolean("adjacent_landscape", false));
|
||||
swDeleteConfirmation.setChecked(prefs.getBoolean("delete_confirmation", true));
|
||||
swDeleteNotification.setChecked(prefs.getBoolean("delete_notification", false));
|
||||
swAutoFolderNav.setChecked(prefs.getBoolean("auto_folder_nav", false));
|
||||
swDmarcViewer.setChecked(Helper.isComponentEnabled(getContext(), ActivityDMARC.class));
|
||||
etKeywords.setText(prefs.getString("global_keywords", null));
|
||||
swTestIab.setChecked(prefs.getBoolean("test_iab", false));
|
||||
|
||||
@@ -2308,6 +2308,17 @@
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/swDeleteNotification" />
|
||||
|
||||
<androidx.appcompat.widget.SwitchCompat
|
||||
android:id="@+id/swAutoFolderNav"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="12dp"
|
||||
android:text="@string/title_auto_folder_nav"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tvDeleteNotificationHint"
|
||||
app:switchPadding="12dp" />
|
||||
|
||||
<androidx.appcompat.widget.SwitchCompat
|
||||
android:id="@+id/swDmarcViewer"
|
||||
android:layout_width="0dp"
|
||||
@@ -2316,7 +2327,7 @@
|
||||
android:text="@string/title_advanced_dmarc_viewer"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tvDeleteNotificationHint"
|
||||
app:layout_constraintTop_toBottomOf="@id/swAutoFolderNav"
|
||||
app:switchPadding="12dp" />
|
||||
|
||||
<EditText
|
||||
|
||||
@@ -1046,6 +1046,7 @@
|
||||
<string name="title_advanced_delete_confirmation" translatable="false">Permanent deletion confirmation</string>
|
||||
<string name="title_advanced_delete_notification" translatable="false">Delete permanently from notifications</string>
|
||||
<string name="title_advanced_deletion_confirmation_hint" translatable="false">If you change this setting, please do not complain if you accidentally deleted messages irreversibly</string>
|
||||
<string name="title_auto_folder_nav" translatable="false">Add new folders automatically to the navigation menu</string>
|
||||
<string name="title_advanced_dmarc_viewer" translatable="false">DMARC viewer</string>
|
||||
<string name="title_advanced_global_keywords" translatable="false">Global keywords</string>
|
||||
<string name="title_advanced_test_iab" translatable="false">Test IAB</string>
|
||||
|
||||
Reference in New Issue
Block a user