Added option to open folder when opening new message

pull/213/head
M66B 1 year ago
parent 96032d78a9
commit 6f084368a6

@ -1995,7 +1995,9 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
if (ignore)
ServiceUI.ignore(this, id, group);
intent.putExtra("id", id);
if (account > 0 && folder > 0 && !TextUtils.isEmpty(type) && BuildConfig.DEBUG) {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(ActivityView.this);
boolean notify_open_folder = prefs.getBoolean("notify_open_folder", false);
if (account > 0 && folder > 0 && !TextUtils.isEmpty(type) && notify_open_folder) {
if (getLifecycle().getCurrentState().isAtLeast(Lifecycle.State.STARTED)) {
getSupportFragmentManager().popBackStack("messages", FragmentManager.POP_BACK_STACK_INCLUSIVE);

@ -117,6 +117,7 @@ public class FragmentOptionsNotifications extends FragmentBase implements Shared
private SwitchCompat swMessagingStyle;
private ImageButton ibCar;
private SwitchCompat swBiometricsNotify;
private SwitchCompat swNotifyOpenFolder;
private SwitchCompat swBackground;
private SwitchCompat swAlertOnce;
private ImageButton ibTileSync;
@ -142,7 +143,7 @@ public class FragmentOptionsNotifications extends FragmentBase implements Shared
"notify_subtext", "notify_preview", "notify_preview_all", "notify_preview_only", "notify_transliterate",
"wearable_preview",
"notify_messaging",
"biometrics_notify", "background_service", "alert_once"
"biometrics_notify", "notify_open_folder", "background_service", "alert_once"
};
@Override
@ -206,6 +207,7 @@ public class FragmentOptionsNotifications extends FragmentBase implements Shared
swMessagingStyle = view.findViewById(R.id.swMessagingStyle);
ibCar = view.findViewById(R.id.ibCar);
swBiometricsNotify = view.findViewById(R.id.swBiometricsNotify);
swNotifyOpenFolder = view.findViewById(R.id.swNotifyOpenFolder);
swBackground = view.findViewById(R.id.swBackground);
swAlertOnce = view.findViewById(R.id.swAlertOnce);
ibTileSync = view.findViewById(R.id.ibTileSync);
@ -694,6 +696,13 @@ public class FragmentOptionsNotifications extends FragmentBase implements Shared
}
});
swNotifyOpenFolder.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
prefs.edit().putBoolean("notify_open_folder", checked).apply();
}
});
swBackground.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
@ -844,6 +853,7 @@ public class FragmentOptionsNotifications extends FragmentBase implements Shared
swWearablePreview.setChecked(prefs.getBoolean("wearable_preview", false));
swMessagingStyle.setChecked(prefs.getBoolean("notify_messaging", false));
swBiometricsNotify.setChecked(prefs.getBoolean("biometrics_notify", true));
swNotifyOpenFolder.setChecked(prefs.getBoolean("notify_open_folder", false));
swBackground.setChecked(prefs.getBoolean("background_service", false));
swAlertOnce.setChecked(!prefs.getBoolean("alert_once", true));

@ -843,6 +843,18 @@
app:layout_constraintTop_toBottomOf="@id/ibCar"
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swNotifyOpenFolder"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:checked="true"
android:text="@string/title_advanced_notify_open_folder"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swBiometricsNotify"
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swBackground"
android:layout_width="0dp"
@ -851,7 +863,7 @@
android:text="@string/title_advanced_notifications_background"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swBiometricsNotify"
app:layout_constraintTop_toBottomOf="@id/swNotifyOpenFolder"
app:switchPadding="12dp" />
<TextView

@ -727,6 +727,7 @@
<string name="title_advanced_wearable_preview">Only send notifications with a message preview to wearables</string>
<string name="title_advanced_notify_messaging">Use Android \'messaging style\' notification format</string>
<string name="title_advanced_biometrics_notify">Show notification content when using biometric authentication</string>
<string name="title_advanced_notify_open_folder">Open folder when opening new message</string>
<string name="title_advanced_light">Use notification light</string>
<string name="title_advanced_sound">Select notification sound</string>
<string name="title_advanced_notify_screen_on">Briefly turn on the screen for new message notifications</string>

Loading…
Cancel
Save