|
|
|
@ -62,9 +62,9 @@ import java.util.Objects;
|
|
|
|
|
|
|
|
|
|
public class FragmentOptionsSynchronize extends FragmentBase implements SharedPreferences.OnSharedPreferenceChangeListener {
|
|
|
|
|
private SwitchCompat swEnabled;
|
|
|
|
|
private Spinner spPollInterval;
|
|
|
|
|
private SwitchCompat swOptimize;
|
|
|
|
|
private ImageButton ibOptimizeInfo;
|
|
|
|
|
private Spinner spPollInterval;
|
|
|
|
|
private RecyclerView rvExempted;
|
|
|
|
|
private SwitchCompat swSchedule;
|
|
|
|
|
private TextView tvSchedulePro;
|
|
|
|
@ -105,9 +105,9 @@ public class FragmentOptionsSynchronize extends FragmentBase implements SharedPr
|
|
|
|
|
// Get controls
|
|
|
|
|
|
|
|
|
|
swEnabled = view.findViewById(R.id.swEnabled);
|
|
|
|
|
spPollInterval = view.findViewById(R.id.spPollInterval);
|
|
|
|
|
swOptimize = view.findViewById(R.id.swOptimize);
|
|
|
|
|
ibOptimizeInfo = view.findViewById(R.id.ibOptimizeInfo);
|
|
|
|
|
spPollInterval = view.findViewById(R.id.spPollInterval);
|
|
|
|
|
swSchedule = view.findViewById(R.id.swSchedule);
|
|
|
|
|
rvExempted = view.findViewById(R.id.rvExempted);
|
|
|
|
|
tvSchedulePro = view.findViewById(R.id.tvSchedulePro);
|
|
|
|
@ -150,6 +150,21 @@ public class FragmentOptionsSynchronize extends FragmentBase implements SharedPr
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
swOptimize.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
|
|
|
|
@Override
|
|
|
|
|
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
|
|
|
|
prefs.edit().putBoolean("auto_optimize", checked).apply();
|
|
|
|
|
ServiceSynchronize.reload(getContext(), null, false, "optimize");
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
ibOptimizeInfo.setOnClickListener(new View.OnClickListener() {
|
|
|
|
|
@Override
|
|
|
|
|
public void onClick(View view) {
|
|
|
|
|
Helper.viewFAQ(getContext(), 39);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
spPollInterval.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
|
|
|
|
|
@Override
|
|
|
|
|
public void onItemSelected(AdapterView<?> adapterView, View view, int position, long id) {
|
|
|
|
@ -174,21 +189,6 @@ public class FragmentOptionsSynchronize extends FragmentBase implements SharedPr
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
swOptimize.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
|
|
|
|
@Override
|
|
|
|
|
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
|
|
|
|
prefs.edit().putBoolean("auto_optimize", checked).apply();
|
|
|
|
|
ServiceSynchronize.reload(getContext(), null, false, "optimize");
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
ibOptimizeInfo.setOnClickListener(new View.OnClickListener() {
|
|
|
|
|
@Override
|
|
|
|
|
public void onClick(View view) {
|
|
|
|
|
Helper.viewFAQ(getContext(), 39);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
rvExempted.setHasFixedSize(false);
|
|
|
|
|
LinearLayoutManager llm = new LinearLayoutManager(getContext());
|
|
|
|
|
rvExempted.setLayoutManager(llm);
|
|
|
|
@ -391,6 +391,7 @@ public class FragmentOptionsSynchronize extends FragmentBase implements SharedPr
|
|
|
|
|
boolean pro = ActivityBilling.isPro(getContext());
|
|
|
|
|
|
|
|
|
|
swEnabled.setChecked(prefs.getBoolean("enabled", true));
|
|
|
|
|
swOptimize.setChecked(prefs.getBoolean("auto_optimize", true));
|
|
|
|
|
|
|
|
|
|
int pollInterval = prefs.getInt("poll_interval", ServiceSynchronize.DEFAULT_POLL_INTERVAL);
|
|
|
|
|
int[] pollIntervalValues = getResources().getIntArray(R.array.pollIntervalValues);
|
|
|
|
@ -401,7 +402,6 @@ public class FragmentOptionsSynchronize extends FragmentBase implements SharedPr
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
swOptimize.setChecked(prefs.getBoolean("auto_optimize", true));
|
|
|
|
|
grpExempted.setVisibility(pollInterval == 0 ? View.GONE : View.VISIBLE);
|
|
|
|
|
|
|
|
|
|
swSchedule.setChecked(prefs.getBoolean("schedule", false) && pro);
|
|
|
|
|