|
|
@ -57,6 +57,7 @@ import androidx.appcompat.widget.SwitchCompat;
|
|
|
|
import androidx.constraintlayout.widget.Group;
|
|
|
|
import androidx.constraintlayout.widget.Group;
|
|
|
|
import androidx.fragment.app.DialogFragment;
|
|
|
|
import androidx.fragment.app.DialogFragment;
|
|
|
|
import androidx.fragment.app.FragmentActivity;
|
|
|
|
import androidx.fragment.app.FragmentActivity;
|
|
|
|
|
|
|
|
import androidx.fragment.app.FragmentTransaction;
|
|
|
|
import androidx.lifecycle.Lifecycle;
|
|
|
|
import androidx.lifecycle.Lifecycle;
|
|
|
|
|
|
|
|
|
|
|
|
import static android.app.Activity.RESULT_OK;
|
|
|
|
import static android.app.Activity.RESULT_OK;
|
|
|
@ -190,11 +191,21 @@ public class FragmentOptions extends FragmentBase implements SharedPreferences.O
|
|
|
|
swSchedule.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
|
|
|
swSchedule.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
|
|
|
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
|
|
|
prefs.edit().putBoolean("schedule", checked).apply();
|
|
|
|
if (checked) {
|
|
|
|
if (checked)
|
|
|
|
if (Helper.isPro(getContext())) {
|
|
|
|
ServiceSynchronize.schedule(getContext());
|
|
|
|
prefs.edit().putBoolean("schedule", true).apply();
|
|
|
|
else {
|
|
|
|
ServiceSynchronize.schedule(getContext());
|
|
|
|
prefs.edit().putBoolean("enabled", true).apply();
|
|
|
|
} else {
|
|
|
|
|
|
|
|
swSchedule.setChecked(false);
|
|
|
|
|
|
|
|
FragmentTransaction fragmentTransaction = getFragmentManager().beginTransaction();
|
|
|
|
|
|
|
|
fragmentTransaction.replace(R.id.content_frame, new FragmentPro()).addToBackStack("pro");
|
|
|
|
|
|
|
|
fragmentTransaction.commit();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
SharedPreferences.Editor editor = prefs.edit();
|
|
|
|
|
|
|
|
editor.putBoolean("schedule", false);
|
|
|
|
|
|
|
|
editor.putBoolean("enabled", true);
|
|
|
|
|
|
|
|
editor.apply();
|
|
|
|
ServiceSynchronize.reload(getContext(), "schedule=" + checked);
|
|
|
|
ServiceSynchronize.reload(getContext(), "schedule=" + checked);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|