mirror of
https://github.com/beemdevelopment/Aegis.git
synced 2025-04-24 15:56:07 +00:00
This patch makes EntryListView responsible for providing the divider between entries, instead of setting a margin on every entry like we do now. It also fixes a couple of miscellaneous issues, like use of the old package name.
44 lines
932 B
Java
44 lines
932 B
Java
package com.beemdevelopment.aegis;
|
|
|
|
import androidx.annotation.LayoutRes;
|
|
|
|
public enum ViewMode {
|
|
NORMAL,
|
|
COMPACT,
|
|
SMALL;
|
|
|
|
private static ViewMode[] _values;
|
|
|
|
static {
|
|
_values = values();
|
|
}
|
|
|
|
public static ViewMode fromInteger(int x) {
|
|
return _values[x];
|
|
}
|
|
|
|
@LayoutRes
|
|
public int getLayoutId() {
|
|
switch (this) {
|
|
case NORMAL:
|
|
return R.layout.card_entry;
|
|
case COMPACT:
|
|
return R.layout.card_entry_compact;
|
|
case SMALL:
|
|
return R.layout.card_entry_small;
|
|
default:
|
|
return R.layout.card_entry;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Retrieves the height (in dp) that the divider between entries should have in this view mode.
|
|
*/
|
|
public float getDividerHeight() {
|
|
if (this == ViewMode.COMPACT) {
|
|
return 0;
|
|
}
|
|
|
|
return 20;
|
|
}
|
|
}
|