|
|
@ -49,7 +49,6 @@ import androidx.preference.PreferenceManager;
|
|
|
|
import static android.app.Activity.RESULT_OK;
|
|
|
|
import static android.app.Activity.RESULT_OK;
|
|
|
|
|
|
|
|
|
|
|
|
public class FragmentOptionsNotifications extends FragmentBase implements SharedPreferences.OnSharedPreferenceChangeListener {
|
|
|
|
public class FragmentOptionsNotifications extends FragmentBase implements SharedPreferences.OnSharedPreferenceChangeListener {
|
|
|
|
private SwitchCompat swNotifyGroup;
|
|
|
|
|
|
|
|
private SwitchCompat swNotifyPreview;
|
|
|
|
private SwitchCompat swNotifyPreview;
|
|
|
|
private CheckBox cbNotifyActionTrash;
|
|
|
|
private CheckBox cbNotifyActionTrash;
|
|
|
|
private CheckBox cbNotifyActionArchive;
|
|
|
|
private CheckBox cbNotifyActionArchive;
|
|
|
@ -64,7 +63,7 @@ public class FragmentOptionsNotifications extends FragmentBase implements Shared
|
|
|
|
private Group grpNotification;
|
|
|
|
private Group grpNotification;
|
|
|
|
|
|
|
|
|
|
|
|
private final static String[] RESET_OPTIONS = new String[]{
|
|
|
|
private final static String[] RESET_OPTIONS = new String[]{
|
|
|
|
"notify_group", "notify_preview", "notify_trash", "notify_archive", "notify_reply", "notify_flag", "notify_seen", "light", "sound"
|
|
|
|
"notify_preview", "notify_trash", "notify_archive", "notify_reply", "notify_flag", "notify_seen", "light", "sound"
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
@ -77,7 +76,6 @@ public class FragmentOptionsNotifications extends FragmentBase implements Shared
|
|
|
|
|
|
|
|
|
|
|
|
// Get controls
|
|
|
|
// Get controls
|
|
|
|
|
|
|
|
|
|
|
|
swNotifyGroup = view.findViewById(R.id.swNotifyGroup);
|
|
|
|
|
|
|
|
swNotifyPreview = view.findViewById(R.id.swNotifyPreview);
|
|
|
|
swNotifyPreview = view.findViewById(R.id.swNotifyPreview);
|
|
|
|
cbNotifyActionTrash = view.findViewById(R.id.cbNotifyActionTrash);
|
|
|
|
cbNotifyActionTrash = view.findViewById(R.id.cbNotifyActionTrash);
|
|
|
|
cbNotifyActionArchive = view.findViewById(R.id.cbNotifyActionArchive);
|
|
|
|
cbNotifyActionArchive = view.findViewById(R.id.cbNotifyActionArchive);
|
|
|
@ -98,13 +96,6 @@ public class FragmentOptionsNotifications extends FragmentBase implements Shared
|
|
|
|
PackageManager pm = getContext().getPackageManager();
|
|
|
|
PackageManager pm = getContext().getPackageManager();
|
|
|
|
final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
|
|
|
|
final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
|
|
|
|
|
|
|
|
|
|
|
|
swNotifyGroup.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
|
|
|
|
|
|
|
prefs.edit().putBoolean("notify_group", checked).apply();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
swNotifyPreview.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
|
|
|
swNotifyPreview.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
|
|
|
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
|
|
@ -233,8 +224,6 @@ public class FragmentOptionsNotifications extends FragmentBase implements Shared
|
|
|
|
boolean pro = Helper.isPro(getContext());
|
|
|
|
boolean pro = Helper.isPro(getContext());
|
|
|
|
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
|
|
|
|
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
|
|
|
|
|
|
|
|
|
|
|
|
swNotifyGroup.setChecked(prefs.getBoolean("notify_group", true));
|
|
|
|
|
|
|
|
swNotifyGroup.setVisibility(Build.VERSION.SDK_INT >= Build.VERSION_CODES.N ? View.VISIBLE : View.GONE);
|
|
|
|
|
|
|
|
swNotifyPreview.setChecked(prefs.getBoolean("notify_preview", true));
|
|
|
|
swNotifyPreview.setChecked(prefs.getBoolean("notify_preview", true));
|
|
|
|
|
|
|
|
|
|
|
|
cbNotifyActionTrash.setChecked(prefs.getBoolean("notify_trash", true));
|
|
|
|
cbNotifyActionTrash.setChecked(prefs.getBoolean("notify_trash", true));
|
|
|
|