mirror of
https://github.com/M66B/FairEmail.git
synced 2026-04-15 13:33:35 +02:00
Added configurable card padding
This commit is contained in:
@@ -4517,6 +4517,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
|
||||
menu.findItem(R.id.menu_filter_duplicates).setChecked(filter_duplicates);
|
||||
|
||||
menu.findItem(R.id.menu_compact).setChecked(compact);
|
||||
menu.findItem(R.id.menu_padding).setVisible(cards);
|
||||
menu.findItem(R.id.menu_theme).setVisible(viewType == AdapterMessage.ViewType.UNIFIED);
|
||||
|
||||
menu.findItem(R.id.menu_select_all).setVisible(folder);
|
||||
@@ -4623,6 +4624,9 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
|
||||
} else if (itemId == R.id.menu_zoom) {
|
||||
onMenuZoom();
|
||||
return true;
|
||||
} else if (itemId == R.id.menu_padding) {
|
||||
onMenuPadding();
|
||||
return true;
|
||||
} else if (itemId == R.id.menu_compact) {
|
||||
onMenuCompact();
|
||||
return true;
|
||||
@@ -4875,16 +4879,31 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
|
||||
adapter.setZoom(zoom);
|
||||
}
|
||||
|
||||
private void onMenuPadding() {
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
|
||||
boolean compact = prefs.getBoolean("compact", false);
|
||||
int padding = prefs.getInt("view_padding", compact ? 0 : 1);
|
||||
padding = ++padding % 3;
|
||||
prefs.edit().putInt("view_padding", padding).apply();
|
||||
clearMeasurements();
|
||||
adapter.setPadding(padding);
|
||||
}
|
||||
|
||||
private void onMenuCompact() {
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
|
||||
boolean compact = !prefs.getBoolean("compact", false);
|
||||
prefs.edit().putBoolean("compact", compact).apply();
|
||||
|
||||
int zoom = (compact ? 0 : 1);
|
||||
prefs.edit().putInt("view_zoom", zoom).apply();
|
||||
int padding = (compact ? 0 : 1);
|
||||
prefs.edit()
|
||||
.putInt("view_zoom", zoom)
|
||||
.putInt("view_padding", padding)
|
||||
.apply();
|
||||
|
||||
adapter.setCompact(compact);
|
||||
adapter.setZoom(zoom);
|
||||
adapter.setPadding(padding);
|
||||
clearMeasurements();
|
||||
invalidateOptionsMenu();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user