Added section to collapse addresses section by default

This commit is contained in:
M66B
2019-01-09 14:51:18 +00:00
parent f893a11c8d
commit c99ebc751a
6 changed files with 31 additions and 5 deletions

View File

@@ -41,7 +41,7 @@ abstract class ActivityBase extends AppCompatActivity implements SharedPreferenc
private boolean contacts;
private static String[] restart = new String[]{
"unified", "threading", "compact", "avatars", "identicons", "preview",
"unified", "threading", "compact", "avatars", "identicons", "preview", "addresses",
"pull", "actionbar", "autoclose", "confirm", "debug"
};

View File

@@ -117,6 +117,7 @@ public class FragmentMessages extends FragmentEx {
private boolean pull;
private boolean actionbar;
private boolean autoclose;
private boolean addresses;
private long primary = -1;
private boolean outbox = false;
@@ -178,7 +179,7 @@ public class FragmentMessages extends FragmentEx {
threading = prefs.getBoolean("threading", true);
actionbar = prefs.getBoolean("actionbar", true);
autoclose = prefs.getBoolean("autoclose", true);
addresses = prefs.getBoolean("addresses", true);
}
@Override
@@ -350,6 +351,8 @@ public class FragmentMessages extends FragmentEx {
public boolean getValue(String name, long id) {
if (values.containsKey(name))
return values.get(name).contains(id);
else if ("addresses".equals(name))
return !addresses;
return false;
}

View File

@@ -64,6 +64,7 @@ public class FragmentOptions extends FragmentEx implements SharedPreferences.OnS
private SwitchCompat swAvatars;
private SwitchCompat swIdenticons;
private SwitchCompat swPreview;
private SwitchCompat swAddresses;
private SwitchCompat swPull;
private SwitchCompat swSwipe;
@@ -104,6 +105,7 @@ public class FragmentOptions extends FragmentEx implements SharedPreferences.OnS
swAvatars = view.findViewById(R.id.swAvatars);
swIdenticons = view.findViewById(R.id.swIdenticons);
swPreview = view.findViewById(R.id.swPreview);
swAddresses = view.findViewById(R.id.swAddresses);
swPull = view.findViewById(R.id.swPull);
swSwipe = view.findViewById(R.id.swSwipe);
@@ -254,6 +256,14 @@ public class FragmentOptions extends FragmentEx implements SharedPreferences.OnS
}
});
swAddresses.setChecked(prefs.getBoolean("addresses", true));
swAddresses.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
prefs.edit().putBoolean("addresses", checked).apply();
}
});
swPull.setChecked(prefs.getBoolean("pull", true));
swPull.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override