mirror of
https://github.com/M66B/FairEmail.git
synced 2026-01-06 12:54:11 +01:00
Added selective resetting of questions
This commit is contained in:
@@ -8,6 +8,7 @@
|
||||
|
||||
* Added multiple select spam / block sender
|
||||
* Added conditional searching via search index
|
||||
* Added selective resetting of questions
|
||||
* Small improvements and minor bug fixes
|
||||
* Updated translations
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
|
||||
* Added multiple select spam / block sender
|
||||
* Added conditional searching via search index
|
||||
* Added selective resetting of questions
|
||||
* Small improvements and minor bug fixes
|
||||
* Updated translations
|
||||
|
||||
|
||||
@@ -50,6 +50,7 @@ import android.view.ViewGroup;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.Button;
|
||||
import android.widget.CheckBox;
|
||||
import android.widget.CompoundButton;
|
||||
import android.widget.ImageButton;
|
||||
import android.widget.SeekBar;
|
||||
@@ -1044,21 +1045,33 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
|
||||
|
||||
private void onResetQuestions() {
|
||||
final Context context = getContext();
|
||||
View dview = LayoutInflater.from(context).inflate(R.layout.dialog_reset_questions, null);
|
||||
final CheckBox cbGeneral = dview.findViewById(R.id.cbGeneral);
|
||||
final CheckBox cbFull = dview.findViewById(R.id.cbFull);
|
||||
final CheckBox cbImages = dview.findViewById(R.id.cbImages);
|
||||
final CheckBox cbLinks = dview.findViewById(R.id.cbLinks);
|
||||
|
||||
new AlertDialog.Builder(context)
|
||||
.setTitle(R.string.title_setup_reset_questions)
|
||||
.setView(dview)
|
||||
.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
SharedPreferences.Editor editor = prefs.edit();
|
||||
for (String option : RESET_QUESTIONS)
|
||||
editor.remove(option);
|
||||
|
||||
if (cbGeneral.isChecked())
|
||||
for (String option : RESET_QUESTIONS)
|
||||
editor.remove(option);
|
||||
|
||||
for (String key : prefs.getAll().keySet())
|
||||
if (key.startsWith("translated_") ||
|
||||
key.endsWith(".show_full") ||
|
||||
key.endsWith(".show_images") ||
|
||||
key.endsWith(".confirm_link"))
|
||||
if ((key.startsWith("translated_") && cbGeneral.isChecked()) ||
|
||||
(key.endsWith(".show_full") && cbFull.isChecked()) ||
|
||||
(key.endsWith(".show_images") && cbImages.isChecked()) ||
|
||||
(key.endsWith(".confirm_link") && cbLinks.isChecked())) {
|
||||
Log.i("Removing option=" + key);
|
||||
editor.remove(key);
|
||||
}
|
||||
|
||||
editor.apply();
|
||||
|
||||
ToastEx.makeText(context, R.string.title_setup_done, Toast.LENGTH_LONG).show();
|
||||
|
||||
13
app/src/main/res/drawable/twotone_restart_alt_24.xml
Normal file
13
app/src/main/res/drawable/twotone_restart_alt_24.xml
Normal file
@@ -0,0 +1,13 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24"
|
||||
android:tint="?attr/colorControlNormal">
|
||||
<path
|
||||
android:fillColor="@android:color/white"
|
||||
android:pathData="M12,5V2L8,6l4,4V7c3.31,0 6,2.69 6,6c0,2.97 -2.17,5.43 -5,5.91v2.02c3.95,-0.49 7,-3.85 7,-7.93C20,8.58 16.42,5 12,5z"/>
|
||||
<path
|
||||
android:fillColor="@android:color/white"
|
||||
android:pathData="M6,13c0,-1.65 0.67,-3.15 1.76,-4.24L6.34,7.34C4.9,8.79 4,10.79 4,13c0,4.08 3.05,7.44 7,7.93v-2.02C8.17,18.43 6,15.97 6,13z"/>
|
||||
</vector>
|
||||
68
app/src/main/res/layout/dialog_reset_questions.xml
Normal file
68
app/src/main/res/layout/dialog_reset_questions.xml
Normal file
@@ -0,0 +1,68 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<eu.faircode.email.ScrollViewEx xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="24dp"
|
||||
android:scrollbarStyle="outsideOverlay">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<eu.faircode.email.FixedTextView
|
||||
android:id="@+id/tvAddImage"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:drawableStart="@drawable/twotone_restart_alt_24"
|
||||
android:drawablePadding="6dp"
|
||||
android:text="@string/title_setup_reset_questions"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Large"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/cbGeneral"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="24dp"
|
||||
android:checked="true"
|
||||
android:text="@string/title_setup_reset_general"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tvAddImage" />
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/cbFull"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="12dp"
|
||||
android:checked="true"
|
||||
android:text="@string/title_setup_reset_full"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/cbGeneral" />
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/cbImages"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="12dp"
|
||||
android:checked="true"
|
||||
android:text="@string/title_setup_reset_images"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/cbFull" />
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/cbLinks"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="12dp"
|
||||
android:checked="true"
|
||||
android:text="@string/title_setup_reset_links"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/cbImages" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</eu.faircode.email.ScrollViewEx>
|
||||
@@ -420,7 +420,7 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="12dp"
|
||||
android:drawableEnd="@drawable/twotone_close_24"
|
||||
android:drawableEnd="@drawable/twotone_restart_alt_24"
|
||||
android:drawablePadding="6dp"
|
||||
android:text="@string/title_setup_reset_questions"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
|
||||
@@ -304,7 +304,12 @@
|
||||
|
||||
<string name="title_setup_options">Options</string>
|
||||
<string name="title_setup_defaults">Restore defaults</string>
|
||||
|
||||
<string name="title_setup_reset_questions">Reset questions</string>
|
||||
<string name="title_setup_reset_general">General questions</string>
|
||||
<string name="title_setup_reset_full">Show original messages</string>
|
||||
<string name="title_setup_reset_images">Show images</string>
|
||||
<string name="title_setup_reset_links">Confirm links</string>
|
||||
|
||||
<string name="title_advanced_hint_title">More advanced options</string>
|
||||
<string name="title_advanced_hint_message">
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
|
||||
* Added multiple select spam / block sender
|
||||
* Added conditional searching via search index
|
||||
* Added selective resetting of questions
|
||||
* Small improvements and minor bug fixes
|
||||
* Updated translations
|
||||
|
||||
|
||||
Reference in New Issue
Block a user