2019-04-01 01:21:12 +02:00
|
|
|
package com.beemdevelopment.aegis;
|
|
|
|
|
2019-05-15 21:29:45 +02:00
|
|
|
import androidx.annotation.LayoutRes;
|
|
|
|
|
2019-04-01 01:21:12 +02:00
|
|
|
public enum ViewMode {
|
|
|
|
NORMAL,
|
2019-04-02 15:47:07 +02:00
|
|
|
COMPACT,
|
|
|
|
SMALL;
|
2019-04-01 01:21:12 +02:00
|
|
|
|
2019-05-15 21:29:45 +02:00
|
|
|
private static ViewMode[] _values;
|
2019-04-09 17:53:10 +02:00
|
|
|
|
2019-05-15 21:29:45 +02:00
|
|
|
static {
|
|
|
|
_values = values();
|
2019-04-01 01:21:12 +02:00
|
|
|
}
|
|
|
|
|
2019-05-15 21:29:45 +02:00
|
|
|
public static ViewMode fromInteger(int x) {
|
|
|
|
return _values[x];
|
2019-04-01 01:21:12 +02:00
|
|
|
}
|
2019-04-09 17:53:10 +02:00
|
|
|
|
2019-05-15 21:29:45 +02:00
|
|
|
@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;
|
|
|
|
}
|
2019-04-09 17:53:10 +02:00
|
|
|
}
|
2019-06-06 00:00:26 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* 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;
|
|
|
|
}
|
2019-04-01 01:21:12 +02:00
|
|
|
}
|