|
@ -33,7 +33,7 @@ import androidx.annotation.NonNull; |
|
|
import androidx.annotation.Nullable; |
|
|
import androidx.annotation.Nullable; |
|
|
|
|
|
|
|
|
public class FragmentOptions extends FragmentEx { |
|
|
public class FragmentOptions extends FragmentEx { |
|
|
private Switch optEnabled; |
|
|
|
|
|
|
|
|
private Switch optSyncEnabled; |
|
|
private Switch optAvatars; |
|
|
private Switch optAvatars; |
|
|
private Switch optLight; |
|
|
private Switch optLight; |
|
|
private Switch optBrowse; |
|
|
private Switch optBrowse; |
|
@ -50,7 +50,7 @@ public class FragmentOptions extends FragmentEx { |
|
|
View view = inflater.inflate(R.layout.fragment_options, container, false); |
|
|
View view = inflater.inflate(R.layout.fragment_options, container, false); |
|
|
|
|
|
|
|
|
// Get controls |
|
|
// Get controls |
|
|
optEnabled = view.findViewById(R.id.optEnabled); |
|
|
|
|
|
|
|
|
optSyncEnabled = view.findViewById(R.id.optSyncEnabled); |
|
|
optAvatars = view.findViewById(R.id.optAvatars); |
|
|
optAvatars = view.findViewById(R.id.optAvatars); |
|
|
optLight = view.findViewById(R.id.optLight); |
|
|
optLight = view.findViewById(R.id.optLight); |
|
|
optBrowse = view.findViewById(R.id.optBrowse); |
|
|
optBrowse = view.findViewById(R.id.optBrowse); |
|
@ -63,15 +63,16 @@ public class FragmentOptions extends FragmentEx { |
|
|
|
|
|
|
|
|
final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext()); |
|
|
final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext()); |
|
|
|
|
|
|
|
|
optEnabled.setChecked(prefs.getBoolean("enabled", true)); |
|
|
|
|
|
optEnabled.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { |
|
|
|
|
|
|
|
|
optSyncEnabled.setChecked(prefs.getBoolean("enabled", true)); |
|
|
|
|
|
optSyncEnabled.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { |
|
|
@Override |
|
|
@Override |
|
|
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) { |
|
|
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) { |
|
|
prefs.edit().putBoolean("enabled", checked).apply(); |
|
|
prefs.edit().putBoolean("enabled", checked).apply(); |
|
|
if (checked) |
|
|
if (checked) |
|
|
ServiceSynchronize.start(getContext()); |
|
|
ServiceSynchronize.start(getContext()); |
|
|
else |
|
|
|
|
|
|
|
|
else { |
|
|
ServiceSynchronize.stop(getContext()); |
|
|
ServiceSynchronize.stop(getContext()); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|