mirror of
https://github.com/M66B/FairEmail.git
synced 2024-12-26 17:57:16 +00:00
Moved conversation action options to behavior settings
This commit is contained in:
parent
3637878bb9
commit
25e01cec7e
4 changed files with 62 additions and 61 deletions
|
@ -20,6 +20,7 @@ package eu.faircode.email;
|
|||
*/
|
||||
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.text.Editable;
|
||||
import android.text.TextUtils;
|
||||
|
@ -39,11 +40,14 @@ import android.widget.Toast;
|
|||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.widget.SwitchCompat;
|
||||
import androidx.constraintlayout.widget.Group;
|
||||
import androidx.lifecycle.Lifecycle;
|
||||
import androidx.preference.PreferenceManager;
|
||||
|
||||
public class FragmentOptionsBehavior extends FragmentBase implements SharedPreferences.OnSharedPreferenceChangeListener {
|
||||
private SwitchCompat swDoubleBack;
|
||||
private SwitchCompat swConversationActions;
|
||||
private SwitchCompat swConversationActionsReplies;
|
||||
private EditText etDefaultSnooze;
|
||||
private SwitchCompat swPull;
|
||||
private SwitchCompat swAutoScroll;
|
||||
|
@ -65,9 +69,10 @@ public class FragmentOptionsBehavior extends FragmentBase implements SharedPrefe
|
|||
private SwitchCompat swAutoImportant;
|
||||
private SwitchCompat swResetImportance;
|
||||
private SwitchCompat swDiscardDelete;
|
||||
private Group grpConversationActions;
|
||||
|
||||
private final static String[] RESET_OPTIONS = new String[]{
|
||||
"double_back", "default_snooze",
|
||||
"double_back", "conversation_actions", "conversation_actions_replies", "default_snooze",
|
||||
"pull", "autoscroll", "quick_filter", "quick_scroll",
|
||||
"doubletap", "swipenav", "volumenav", "reversed",
|
||||
"autoexpand", "expand_all", "expand_one", "collapse_multiple",
|
||||
|
@ -86,6 +91,8 @@ public class FragmentOptionsBehavior extends FragmentBase implements SharedPrefe
|
|||
// Get controls
|
||||
|
||||
swDoubleBack = view.findViewById(R.id.swDoubleBack);
|
||||
swConversationActions = view.findViewById(R.id.swConversationActions);
|
||||
swConversationActionsReplies = view.findViewById(R.id.swConversationActionsReplies);
|
||||
etDefaultSnooze = view.findViewById(R.id.etDefaultSnooze);
|
||||
swPull = view.findViewById(R.id.swPull);
|
||||
swAutoScroll = view.findViewById(R.id.swAutoScroll);
|
||||
|
@ -107,6 +114,7 @@ public class FragmentOptionsBehavior extends FragmentBase implements SharedPrefe
|
|||
swAutoImportant = view.findViewById(R.id.swAutoImportant);
|
||||
swResetImportance = view.findViewById(R.id.swResetImportance);
|
||||
swDiscardDelete = view.findViewById(R.id.swDiscardDelete);
|
||||
grpConversationActions = view.findViewById(R.id.grpConversationActions);
|
||||
|
||||
setOptions();
|
||||
|
||||
|
@ -121,6 +129,21 @@ public class FragmentOptionsBehavior extends FragmentBase implements SharedPrefe
|
|||
}
|
||||
});
|
||||
|
||||
swConversationActions.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
||||
prefs.edit().putBoolean("conversation_actions", checked).apply();
|
||||
swConversationActionsReplies.setEnabled(checked);
|
||||
}
|
||||
});
|
||||
|
||||
swConversationActionsReplies.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
||||
prefs.edit().putBoolean("conversation_actions_replies", checked).apply();
|
||||
}
|
||||
});
|
||||
|
||||
etDefaultSnooze.addTextChangedListener(new TextWatcher() {
|
||||
@Override
|
||||
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
||||
|
@ -350,6 +373,9 @@ public class FragmentOptionsBehavior extends FragmentBase implements SharedPrefe
|
|||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
|
||||
|
||||
swDoubleBack.setChecked(prefs.getBoolean("double_back", true));
|
||||
swConversationActions.setChecked(prefs.getBoolean("conversation_actions", true));
|
||||
swConversationActionsReplies.setChecked(prefs.getBoolean("conversation_actions_replies", true));
|
||||
swConversationActionsReplies.setEnabled(swConversationActions.isChecked());
|
||||
int default_snooze = prefs.getInt("default_snooze", 1);
|
||||
etDefaultSnooze.setText(default_snooze == 1 ? null : Integer.toString(default_snooze));
|
||||
etDefaultSnooze.setHint("1");
|
||||
|
@ -389,5 +415,7 @@ public class FragmentOptionsBehavior extends FragmentBase implements SharedPrefe
|
|||
swAutoImportant.setChecked(prefs.getBoolean("auto_important", false));
|
||||
swResetImportance.setChecked(prefs.getBoolean("reset_importance", false));
|
||||
swDiscardDelete.setChecked(prefs.getBoolean("discard_delete", false));
|
||||
|
||||
grpConversationActions.setVisibility(Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q ? View.VISIBLE : View.GONE);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,7 +27,6 @@ import android.content.Intent;
|
|||
import android.content.SharedPreferences;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.graphics.Paint;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.Menu;
|
||||
|
@ -54,8 +53,6 @@ import io.requery.android.database.sqlite.SQLiteDatabase;
|
|||
public class FragmentOptionsMisc extends FragmentBase implements SharedPreferences.OnSharedPreferenceChangeListener {
|
||||
private SwitchCompat swExternalSearch;
|
||||
private SwitchCompat swShortcuts;
|
||||
private SwitchCompat swConversationActions;
|
||||
private SwitchCompat swConversationActionsReplies;
|
||||
private SwitchCompat swFts;
|
||||
private TextView tvFtsIndexed;
|
||||
private TextView tvFtsPro;
|
||||
|
@ -78,12 +75,10 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
|
|||
private TextView tvStorageSpace;
|
||||
private TextView tvFingerprint;
|
||||
|
||||
private Group grpConversationActions;
|
||||
private Group grpDebug;
|
||||
|
||||
private final static String[] RESET_OPTIONS = new String[]{
|
||||
"shortcuts", "conversation_actions", "conversation_actions_replies",
|
||||
"fts", "english", "watchdog", "auto_optimize", "updates", "experiments", "crash_reports", "debug"
|
||||
"shortcuts", "fts", "english", "watchdog", "auto_optimize", "updates", "experiments", "crash_reports", "debug"
|
||||
};
|
||||
|
||||
private final static String[] RESET_QUESTIONS = new String[]{
|
||||
|
@ -105,8 +100,6 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
|
|||
|
||||
swExternalSearch = view.findViewById(R.id.swExternalSearch);
|
||||
swShortcuts = view.findViewById(R.id.swShortcuts);
|
||||
swConversationActions = view.findViewById(R.id.swConversationActions);
|
||||
swConversationActionsReplies = view.findViewById(R.id.swConversationActionsReplies);
|
||||
swFts = view.findViewById(R.id.swFts);
|
||||
tvFtsIndexed = view.findViewById(R.id.tvFtsIndexed);
|
||||
tvFtsPro = view.findViewById(R.id.tvFtsPro);
|
||||
|
@ -129,7 +122,6 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
|
|||
tvStorageSpace = view.findViewById(R.id.tvStorageSpace);
|
||||
tvFingerprint = view.findViewById(R.id.tvFingerprint);
|
||||
|
||||
grpConversationActions = view.findViewById(R.id.grpConversationActions);
|
||||
grpDebug = view.findViewById(R.id.grpDebug);
|
||||
|
||||
setOptions();
|
||||
|
@ -159,21 +151,6 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
|
|||
}
|
||||
});
|
||||
|
||||
swConversationActions.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
||||
prefs.edit().putBoolean("conversation_actions", checked).apply();
|
||||
swConversationActionsReplies.setEnabled(checked);
|
||||
}
|
||||
});
|
||||
|
||||
swConversationActionsReplies.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
||||
prefs.edit().putBoolean("conversation_actions_replies", checked).apply();
|
||||
}
|
||||
});
|
||||
|
||||
swFts.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
||||
|
@ -413,9 +390,6 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
|
|||
|
||||
swExternalSearch.setChecked(state != PackageManager.COMPONENT_ENABLED_STATE_DISABLED);
|
||||
swShortcuts.setChecked(prefs.getBoolean("shortcuts", true));
|
||||
swConversationActions.setChecked(prefs.getBoolean("conversation_actions", true));
|
||||
swConversationActionsReplies.setChecked(prefs.getBoolean("conversation_actions_replies", true));
|
||||
swConversationActionsReplies.setEnabled(swConversationActions.isChecked());
|
||||
swFts.setChecked(prefs.getBoolean("fts", false));
|
||||
swEnglish.setChecked(prefs.getBoolean("english", false));
|
||||
swWatchdog.setChecked(prefs.getBoolean("watchdog", true));
|
||||
|
@ -440,7 +414,6 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
|
|||
Helper.humanReadableByteCount(Helper.getTotalStorageSpace(), true)));
|
||||
tvFingerprint.setText(Helper.getFingerprint(getContext()));
|
||||
|
||||
grpConversationActions.setVisibility(Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q ? View.VISIBLE : View.GONE);
|
||||
grpDebug.setVisibility(swDebug.isChecked() || BuildConfig.DEBUG ? View.VISIBLE : View.GONE);
|
||||
}
|
||||
|
||||
|
|
|
@ -40,6 +40,30 @@
|
|||
app:layout_constraintTop_toBottomOf="@id/tvCaptionGeneral"
|
||||
app:switchPadding="12dp" />
|
||||
|
||||
<androidx.appcompat.widget.SwitchCompat
|
||||
android:id="@+id/swConversationActions"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="12dp"
|
||||
android:checked="true"
|
||||
android:text="@string/title_advanced_conversation_actions"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/swDoubleBack"
|
||||
app:switchPadding="12dp" />
|
||||
|
||||
<androidx.appcompat.widget.SwitchCompat
|
||||
android:id="@+id/swConversationActionsReplies"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="12dp"
|
||||
android:checked="true"
|
||||
android:text="@string/title_advanced_conversation_actions_replies"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/swConversationActions"
|
||||
app:switchPadding="12dp" />
|
||||
|
||||
<eu.faircode.email.FixedTextView
|
||||
android:id="@+id/tvDefaultSnooze"
|
||||
android:layout_width="0dp"
|
||||
|
@ -51,7 +75,7 @@
|
|||
android:textColor="?android:attr/textColorPrimary"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/swDoubleBack" />
|
||||
app:layout_constraintTop_toBottomOf="@id/swConversationActionsReplies" />
|
||||
|
||||
<eu.faircode.email.EditTextPlain
|
||||
android:id="@+id/etDefaultSnooze"
|
||||
|
@ -371,5 +395,11 @@
|
|||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/swResetImportance"
|
||||
app:switchPadding="12dp" />
|
||||
|
||||
<androidx.constraintlayout.widget.Group
|
||||
android:id="@+id/grpConversationActions"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
app:constraint_referenced_ids="swConversationActions,swConversationActionsReplies" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</ScrollView>
|
||||
|
|
|
@ -64,30 +64,6 @@
|
|||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/swShortcuts" />
|
||||
|
||||
<androidx.appcompat.widget.SwitchCompat
|
||||
android:id="@+id/swConversationActions"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="12dp"
|
||||
android:checked="true"
|
||||
android:text="@string/title_advanced_conversation_actions"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tvShortcutsHint"
|
||||
app:switchPadding="12dp" />
|
||||
|
||||
<androidx.appcompat.widget.SwitchCompat
|
||||
android:id="@+id/swConversationActionsReplies"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="12dp"
|
||||
android:checked="true"
|
||||
android:text="@string/title_advanced_conversation_actions_replies"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/swConversationActions"
|
||||
app:switchPadding="12dp" />
|
||||
|
||||
<androidx.appcompat.widget.SwitchCompat
|
||||
android:id="@+id/swFts"
|
||||
android:layout_width="0dp"
|
||||
|
@ -96,7 +72,7 @@
|
|||
android:text="@string/title_advanced_fts"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/swConversationActionsReplies"
|
||||
app:layout_constraintTop_toBottomOf="@id/tvShortcutsHint"
|
||||
app:switchPadding="12dp" />
|
||||
|
||||
<eu.faircode.email.FixedTextView
|
||||
|
@ -364,12 +340,6 @@
|
|||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tvStorageSpace" />
|
||||
|
||||
<androidx.constraintlayout.widget.Group
|
||||
android:id="@+id/grpConversationActions"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
app:constraint_referenced_ids="swConversationActions,swConversationActionsReplies" />
|
||||
|
||||
<androidx.constraintlayout.widget.Group
|
||||
android:id="@+id/grpDebug"
|
||||
android:layout_width="0dp"
|
||||
|
|
Loading…
Reference in a new issue