|
|
@ -25,21 +25,21 @@ import android.preference.PreferenceManager;
|
|
|
|
import android.view.LayoutInflater;
|
|
|
|
import android.view.LayoutInflater;
|
|
|
|
import android.view.View;
|
|
|
|
import android.view.View;
|
|
|
|
import android.view.ViewGroup;
|
|
|
|
import android.view.ViewGroup;
|
|
|
|
import android.widget.CheckBox;
|
|
|
|
|
|
|
|
import android.widget.CompoundButton;
|
|
|
|
import android.widget.CompoundButton;
|
|
|
|
|
|
|
|
|
|
|
|
import androidx.annotation.NonNull;
|
|
|
|
import androidx.annotation.NonNull;
|
|
|
|
import androidx.annotation.Nullable;
|
|
|
|
import androidx.annotation.Nullable;
|
|
|
|
|
|
|
|
import androidx.appcompat.widget.SwitchCompat;
|
|
|
|
|
|
|
|
|
|
|
|
public class FragmentOptions extends FragmentEx {
|
|
|
|
public class FragmentOptions extends FragmentEx {
|
|
|
|
private CheckBox cbEnabled;
|
|
|
|
private SwitchCompat swEnabled;
|
|
|
|
private CheckBox cbAvatars;
|
|
|
|
private SwitchCompat swAvatars;
|
|
|
|
private CheckBox cbLight;
|
|
|
|
private SwitchCompat swLight;
|
|
|
|
private CheckBox cbBrowse;
|
|
|
|
private SwitchCompat swBrowse;
|
|
|
|
private CheckBox cbSwipe;
|
|
|
|
private SwitchCompat swSwipe;
|
|
|
|
private CheckBox cbCompact;
|
|
|
|
private SwitchCompat swCompact;
|
|
|
|
private CheckBox cbInsecure;
|
|
|
|
private SwitchCompat swInsecure;
|
|
|
|
private CheckBox cbDebug;
|
|
|
|
private SwitchCompat swDebug;
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
@Nullable
|
|
|
|
@Nullable
|
|
|
@ -49,21 +49,21 @@ 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
|
|
|
|
cbEnabled = view.findViewById(R.id.cbEnabled);
|
|
|
|
swEnabled = view.findViewById(R.id.swEnabled);
|
|
|
|
cbAvatars = view.findViewById(R.id.cbAvatars);
|
|
|
|
swAvatars = view.findViewById(R.id.swAvatars);
|
|
|
|
cbLight = view.findViewById(R.id.cbLight);
|
|
|
|
swLight = view.findViewById(R.id.swLight);
|
|
|
|
cbBrowse = view.findViewById(R.id.cbBrowse);
|
|
|
|
swBrowse = view.findViewById(R.id.swBrowse);
|
|
|
|
cbSwipe = view.findViewById(R.id.cbSwipe);
|
|
|
|
swSwipe = view.findViewById(R.id.swSwipe);
|
|
|
|
cbCompact = view.findViewById(R.id.cbCompact);
|
|
|
|
swCompact = view.findViewById(R.id.swCompact);
|
|
|
|
cbInsecure = view.findViewById(R.id.cbInsecure);
|
|
|
|
swInsecure = view.findViewById(R.id.swInsecure);
|
|
|
|
cbDebug = view.findViewById(R.id.cbDebug);
|
|
|
|
swDebug = view.findViewById(R.id.swDebug);
|
|
|
|
|
|
|
|
|
|
|
|
// Wire controls
|
|
|
|
// Wire controls
|
|
|
|
|
|
|
|
|
|
|
|
final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
|
|
|
|
final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
|
|
|
|
|
|
|
|
|
|
|
|
cbEnabled.setChecked(prefs.getBoolean("enabled", true));
|
|
|
|
swEnabled.setChecked(prefs.getBoolean("enabled", true));
|
|
|
|
cbEnabled.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
|
|
|
swEnabled.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();
|
|
|
@ -74,56 +74,56 @@ public class FragmentOptions extends FragmentEx {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
cbAvatars.setChecked(prefs.getBoolean("avatars", true));
|
|
|
|
swAvatars.setChecked(prefs.getBoolean("avatars", true));
|
|
|
|
cbAvatars.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
|
|
|
swAvatars.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
|
|
|
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
|
|
|
prefs.edit().putBoolean("avatars", checked).apply();
|
|
|
|
prefs.edit().putBoolean("avatars", checked).apply();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
cbLight.setChecked(prefs.getBoolean("light", false));
|
|
|
|
swLight.setChecked(prefs.getBoolean("light", false));
|
|
|
|
cbLight.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
|
|
|
swLight.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
|
|
|
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
|
|
|
prefs.edit().putBoolean("light", checked).apply();
|
|
|
|
prefs.edit().putBoolean("light", checked).apply();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
cbBrowse.setChecked(prefs.getBoolean("browse", true));
|
|
|
|
swBrowse.setChecked(prefs.getBoolean("browse", true));
|
|
|
|
cbBrowse.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
|
|
|
swBrowse.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
|
|
|
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
|
|
|
prefs.edit().putBoolean("browse", checked).apply();
|
|
|
|
prefs.edit().putBoolean("browse", checked).apply();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
cbSwipe.setChecked(prefs.getBoolean("swipe", true));
|
|
|
|
swSwipe.setChecked(prefs.getBoolean("swipe", true));
|
|
|
|
cbSwipe.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
|
|
|
swSwipe.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
|
|
|
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
|
|
|
prefs.edit().putBoolean("swipe", checked).apply();
|
|
|
|
prefs.edit().putBoolean("swipe", checked).apply();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
cbCompact.setChecked(prefs.getBoolean("compact", false));
|
|
|
|
swCompact.setChecked(prefs.getBoolean("compact", false));
|
|
|
|
cbCompact.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
|
|
|
swCompact.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
|
|
|
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
|
|
|
prefs.edit().putBoolean("compact", checked).apply();
|
|
|
|
prefs.edit().putBoolean("compact", checked).apply();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
cbInsecure.setChecked(prefs.getBoolean("insecure", false));
|
|
|
|
swInsecure.setChecked(prefs.getBoolean("insecure", false));
|
|
|
|
cbInsecure.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
|
|
|
swInsecure.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
|
|
|
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
|
|
|
prefs.edit().putBoolean("insecure", checked).apply();
|
|
|
|
prefs.edit().putBoolean("insecure", checked).apply();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
cbDebug.setChecked(prefs.getBoolean("debug", false));
|
|
|
|
swDebug.setChecked(prefs.getBoolean("debug", false));
|
|
|
|
cbDebug.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
|
|
|
swDebug.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
|
|
|
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
|
|
|
prefs.edit().putBoolean("debug", checked).apply();
|
|
|
|
prefs.edit().putBoolean("debug", checked).apply();
|
|
|
@ -131,7 +131,7 @@ public class FragmentOptions extends FragmentEx {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
cbLight.setVisibility(android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.O ? View.VISIBLE : View.GONE);
|
|
|
|
swLight.setVisibility(android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.O ? View.VISIBLE : View.GONE);
|
|
|
|
|
|
|
|
|
|
|
|
return view;
|
|
|
|
return view;
|
|
|
|
}
|
|
|
|
}
|
|
|
|