mirror of
https://github.com/M66B/FairEmail.git
synced 2025-02-24 15:11:03 +00:00
Moved badge settings to notification tab
This commit is contained in:
parent
2cf5a01e25
commit
7ce6b4a3cf
5 changed files with 46 additions and 45 deletions
|
@ -45,7 +45,6 @@ import androidx.constraintlayout.widget.Group;
|
|||
import androidx.preference.PreferenceManager;
|
||||
|
||||
public class FragmentOptionsMisc extends FragmentBase implements SharedPreferences.OnSharedPreferenceChangeListener {
|
||||
private SwitchCompat swBadge;
|
||||
private SwitchCompat swSubscriptions;
|
||||
private TextView tvSubscriptionPro;
|
||||
private SwitchCompat swSubscribedOnly;
|
||||
|
@ -66,7 +65,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
|
|||
private Group grpDebug;
|
||||
|
||||
private final static String[] RESET_OPTIONS = new String[]{
|
||||
"badge", "subscriptions", "subscribed_only", "biometrics_timeout", "double_back", "english", "watchdog", "updates", "crash_reports", "debug"
|
||||
"subscriptions", "subscribed_only", "biometrics_timeout", "double_back", "english", "watchdog", "updates", "crash_reports", "debug"
|
||||
};
|
||||
|
||||
private final static String[] RESET_QUESTIONS = new String[]{
|
||||
|
@ -83,7 +82,6 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
|
|||
|
||||
// Get controls
|
||||
|
||||
swBadge = view.findViewById(R.id.swBadge);
|
||||
swSubscriptions = view.findViewById(R.id.swSubscriptions);
|
||||
tvSubscriptionPro = view.findViewById(R.id.tvSubscriptionPro);
|
||||
swSubscribedOnly = view.findViewById(R.id.swSubscribedOnly);
|
||||
|
@ -109,14 +107,6 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
|
|||
|
||||
final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
|
||||
|
||||
swBadge.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
||||
prefs.edit().putBoolean("badge", checked).apply();
|
||||
ServiceSynchronize.reload(getContext(), "badge");
|
||||
}
|
||||
});
|
||||
|
||||
swSubscriptions.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
||||
|
@ -287,8 +277,6 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
|
|||
private void setOptions() {
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
|
||||
|
||||
swBadge.setChecked(prefs.getBoolean("badge", true));
|
||||
|
||||
boolean pro = ActivityBilling.isPro(getContext());
|
||||
swSubscriptions.setChecked(prefs.getBoolean("subscriptions", false) && pro);
|
||||
swSubscriptions.setEnabled(pro);
|
||||
|
|
|
@ -50,6 +50,7 @@ import androidx.preference.PreferenceManager;
|
|||
import static android.app.Activity.RESULT_OK;
|
||||
|
||||
public class FragmentOptionsNotifications extends FragmentBase implements SharedPreferences.OnSharedPreferenceChangeListener {
|
||||
private SwitchCompat swBadge;
|
||||
private SwitchCompat swNotifyPreview;
|
||||
private CheckBox cbNotifyActionTrash;
|
||||
private CheckBox cbNotifyActionArchive;
|
||||
|
@ -66,7 +67,7 @@ public class FragmentOptionsNotifications extends FragmentBase implements Shared
|
|||
private Group grpNotification;
|
||||
|
||||
private final static String[] RESET_OPTIONS = new String[]{
|
||||
"notify_preview", "notify_trash", "notify_archive", "notify_reply", "notify_flag", "notify_seen", "light", "sound"
|
||||
"badge", "notify_preview", "notify_trash", "notify_archive", "notify_reply", "notify_flag", "notify_seen", "light", "sound"
|
||||
};
|
||||
|
||||
@Override
|
||||
|
@ -79,6 +80,7 @@ public class FragmentOptionsNotifications extends FragmentBase implements Shared
|
|||
|
||||
// Get controls
|
||||
|
||||
swBadge = view.findViewById(R.id.swBadge);
|
||||
swNotifyPreview = view.findViewById(R.id.swNotifyPreview);
|
||||
cbNotifyActionTrash = view.findViewById(R.id.cbNotifyActionTrash);
|
||||
cbNotifyActionArchive = view.findViewById(R.id.cbNotifyActionArchive);
|
||||
|
@ -101,6 +103,14 @@ public class FragmentOptionsNotifications extends FragmentBase implements Shared
|
|||
PackageManager pm = getContext().getPackageManager();
|
||||
final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
|
||||
|
||||
swBadge.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
||||
prefs.edit().putBoolean("badge", checked).apply();
|
||||
ServiceSynchronize.reload(getContext(), "badge");
|
||||
}
|
||||
});
|
||||
|
||||
swNotifyPreview.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
||||
|
@ -235,6 +245,7 @@ public class FragmentOptionsNotifications extends FragmentBase implements Shared
|
|||
boolean pro = ActivityBilling.isPro(getContext());
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
|
||||
|
||||
swBadge.setChecked(prefs.getBoolean("badge", true));
|
||||
swNotifyPreview.setChecked(prefs.getBoolean("notify_preview", true));
|
||||
|
||||
cbNotifyActionTrash.setChecked(prefs.getBoolean("notify_trash", true) || !pro);
|
||||
|
|
|
@ -19,38 +19,14 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<androidx.appcompat.widget.SwitchCompat
|
||||
android:id="@+id/swBadge"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:checked="true"
|
||||
android:text="@string/title_advanced_badge"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:switchPadding="12dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvBadgeHint"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="48dp"
|
||||
android:text="@string/title_advanced_badge_hint"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Small"
|
||||
android:textStyle="italic"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/swBadge" />
|
||||
|
||||
<androidx.appcompat.widget.SwitchCompat
|
||||
android:id="@+id/swSubscriptions"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="12dp"
|
||||
android:text="@string/title_advanced_subscriptions"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tvBadgeHint"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:switchPadding="12dp" />
|
||||
|
||||
<TextView
|
||||
|
|
|
@ -20,15 +20,40 @@
|
|||
android:layout_height="wrap_content">
|
||||
|
||||
<androidx.appcompat.widget.SwitchCompat
|
||||
android:id="@+id/swNotifyPreview"
|
||||
android:id="@+id/swBadge"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/title_advanced_notify_preview"
|
||||
android:checked="true"
|
||||
android:text="@string/title_advanced_badge"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:switchPadding="12dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvBadgeHint"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="48dp"
|
||||
android:text="@string/title_advanced_badge_hint"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Small"
|
||||
android:textStyle="italic"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/swBadge" />
|
||||
|
||||
<androidx.appcompat.widget.SwitchCompat
|
||||
android:id="@+id/swNotifyPreview"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="12dp"
|
||||
android:checked="true"
|
||||
android:text="@string/title_advanced_notify_preview"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tvBadgeHint"
|
||||
app:switchPadding="12dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvNotifyPreviewHint"
|
||||
android:layout_width="0dp"
|
||||
|
|
|
@ -249,6 +249,7 @@
|
|||
<string name="title_advanced_authentication">Show a warning when the receiving server could not authenticate the message</string>
|
||||
<string name="title_advanced_tracking">Automatically recognize and disable tracking images</string>
|
||||
|
||||
<string name="title_advanced_badge">Show launcher icon with number of new messages</string>
|
||||
<string name="title_advanced_notify_preview">Show message preview in notifications</string>
|
||||
<string name="title_advanced_notify_actions">Notification actions</string>
|
||||
<string name="title_advanced_notify_action_trash">Trash</string>
|
||||
|
@ -256,12 +257,13 @@
|
|||
<string name="title_advanced_notify_action_reply">Reply</string>
|
||||
<string name="title_advanced_notify_action_flag">Star</string>
|
||||
<string name="title_advanced_notify_action_seen">Read</string>
|
||||
<string name="title_advanced_notify_action_hint">At most three actions will be shown</string>
|
||||
<string name="title_advanced_notify_manage_hint">Tap on the channel name \'Notifications\' to set the default notification sound, etc</string>
|
||||
<string name="title_advanced_light">Use notification light</string>
|
||||
<string name="title_advanced_sound">Select notification sound</string>
|
||||
|
||||
<string name="title_advanced_badge">Show launcher icon with number of new messages</string>
|
||||
<string name="title_advanced_badge_hint">Only available on supported launchers</string>
|
||||
<string name="title_advanced_notify_action_hint">At most three actions will be shown</string>
|
||||
<string name="title_advanced_notify_manage_hint">Tap on the channel name \'Notifications\' to set the default notification sound, etc</string>
|
||||
|
||||
<string name="title_advanced_subscriptions">Manage folder subscriptions</string>
|
||||
<string name="title_advanced_sync_subscribed">Synchronize subscribed folders only</string>
|
||||
<string name="title_advanced_biometrics_timeout">Biometric authentication timeout</string>
|
||||
|
@ -305,7 +307,6 @@
|
|||
<string name="title_advanced_autoclose_hint">Automatically close conversations when all messages are archived, sent or trashed</string>
|
||||
<string name="title_advanced_sender_hint">Most providers do not allow modified sender addresses</string>
|
||||
|
||||
<string name="title_advanced_badge_hint">Only available on supported launchers</string>
|
||||
<string name="title_advanced_subscribed_only_hint">Enabling this will delete all local folders without subscription</string>
|
||||
<string name="title_advanced_english_hint">This will restart the app</string>
|
||||
<string name="title_advanced_debug_hint">Enable extra logging and show debug information at various places</string>
|
||||
|
|
Loading…
Reference in a new issue