|
|
|
@ -43,7 +43,6 @@ import androidx.annotation.NonNull;
|
|
|
|
|
import androidx.annotation.Nullable;
|
|
|
|
|
import androidx.appcompat.widget.SwitchCompat;
|
|
|
|
|
import androidx.constraintlayout.widget.Group;
|
|
|
|
|
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
|
|
|
|
|
import androidx.preference.PreferenceManager;
|
|
|
|
|
|
|
|
|
|
import static android.app.Activity.RESULT_OK;
|
|
|
|
@ -106,35 +105,35 @@ public class FragmentOptionsNotifications extends FragmentBase implements Shared
|
|
|
|
|
cbNotifyActionTrash.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
|
|
|
|
@Override
|
|
|
|
|
public void onCheckedChanged(CompoundButton buttonView, boolean checked) {
|
|
|
|
|
setAction(buttonView, "notify_trash", checked);
|
|
|
|
|
prefs.edit().putBoolean("notify_trash", checked).apply();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
cbNotifyActionArchive.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
|
|
|
|
@Override
|
|
|
|
|
public void onCheckedChanged(CompoundButton buttonView, boolean checked) {
|
|
|
|
|
setAction(buttonView, "notify_archive", checked);
|
|
|
|
|
prefs.edit().putBoolean("notify_archive", checked).apply();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
cbNotifyActionReply.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
|
|
|
|
@Override
|
|
|
|
|
public void onCheckedChanged(CompoundButton buttonView, boolean checked) {
|
|
|
|
|
setAction(buttonView, "notify_reply", checked);
|
|
|
|
|
prefs.edit().putBoolean("notify_reply", checked).apply();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
cbNotifyActionFlag.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
|
|
|
|
@Override
|
|
|
|
|
public void onCheckedChanged(CompoundButton buttonView, boolean checked) {
|
|
|
|
|
setAction(buttonView, "notify_flag", checked);
|
|
|
|
|
prefs.edit().putBoolean("notify_flag", checked).apply();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
cbNotifyActionSeen.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
|
|
|
|
@Override
|
|
|
|
|
public void onCheckedChanged(CompoundButton buttonView, boolean checked) {
|
|
|
|
|
setAction(buttonView, "notify_seen", checked);
|
|
|
|
|
prefs.edit().putBoolean("notify_seen", checked).apply();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
@ -226,28 +225,23 @@ public class FragmentOptionsNotifications extends FragmentBase implements Shared
|
|
|
|
|
|
|
|
|
|
swNotifyPreview.setChecked(prefs.getBoolean("notify_preview", true));
|
|
|
|
|
|
|
|
|
|
cbNotifyActionTrash.setChecked(prefs.getBoolean("notify_trash", true));
|
|
|
|
|
cbNotifyActionArchive.setChecked(prefs.getBoolean("notify_archive", true));
|
|
|
|
|
cbNotifyActionTrash.setChecked(prefs.getBoolean("notify_trash", true) || !pro);
|
|
|
|
|
cbNotifyActionArchive.setChecked(prefs.getBoolean("notify_archive", true) || !pro);
|
|
|
|
|
cbNotifyActionReply.setChecked(prefs.getBoolean("notify_reply", false) && pro);
|
|
|
|
|
cbNotifyActionFlag.setChecked(prefs.getBoolean("notify_flag", false) && pro);
|
|
|
|
|
cbNotifyActionSeen.setChecked(prefs.getBoolean("notify_seen", true));
|
|
|
|
|
cbNotifyActionSeen.setChecked(prefs.getBoolean("notify_seen", true) || !pro);
|
|
|
|
|
|
|
|
|
|
cbNotifyActionTrash.setEnabled(pro);
|
|
|
|
|
cbNotifyActionArchive.setEnabled(pro);
|
|
|
|
|
cbNotifyActionReply.setEnabled(pro);
|
|
|
|
|
cbNotifyActionFlag.setEnabled(pro);
|
|
|
|
|
cbNotifyActionSeen.setEnabled(pro);
|
|
|
|
|
|
|
|
|
|
swLight.setChecked(prefs.getBoolean("light", false));
|
|
|
|
|
|
|
|
|
|
grpNotification.setVisibility(Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.O ? View.VISIBLE : View.GONE);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void setAction(CompoundButton cb, String key, boolean checked) {
|
|
|
|
|
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
|
|
|
|
|
if (Helper.isPro(getContext()))
|
|
|
|
|
prefs.edit().putBoolean(key, checked).apply();
|
|
|
|
|
else {
|
|
|
|
|
cb.setChecked(!checked);
|
|
|
|
|
LocalBroadcastManager lbm = LocalBroadcastManager.getInstance(getContext());
|
|
|
|
|
lbm.sendBroadcast(new Intent(ActivitySetup.ACTION_SHOW_PRO));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void onActivityResult(int requestCode, int resultCode, Intent data) {
|
|
|
|
|
Log.i("Result class=" + this.getClass().getSimpleName() +
|
|
|
|
|