mirror of
https://github.com/gabehf/tempus.git
synced 2026-03-14 09:55:53 -07:00
refactor: extracted common toolbar to better handle two flavors and minimized file duplication
This commit is contained in:
parent
a3fe0de233
commit
c711b387bb
29 changed files with 308 additions and 2097 deletions
|
|
@ -0,0 +1,9 @@
|
|||
package com.cappielloantonio.tempo.util;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
public class Flavors {
|
||||
public static void initializeCastContext(Context context) {
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -1,34 +0,0 @@
|
|||
package com.cappielloantonio.tempo.util;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.TypedArray;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.graphics.drawable.InsetDrawable;
|
||||
|
||||
import androidx.recyclerview.widget.DividerItemDecoration;
|
||||
|
||||
public class UIUtil {
|
||||
public static int getSpanCount(int itemCount, int maxSpan) {
|
||||
int itemSize = itemCount == 0 ? 1 : itemCount;
|
||||
|
||||
if (itemSize / maxSpan > 0) {
|
||||
return maxSpan;
|
||||
} else {
|
||||
return itemSize % maxSpan;
|
||||
}
|
||||
}
|
||||
|
||||
public static DividerItemDecoration getDividerItemDecoration(Context context) {
|
||||
int[] ATTRS = new int[]{android.R.attr.listDivider};
|
||||
|
||||
TypedArray a = context.obtainStyledAttributes(ATTRS);
|
||||
Drawable divider = a.getDrawable(0);
|
||||
InsetDrawable insetDivider = new InsetDrawable(divider, 42, 0, 42, 42);
|
||||
a.recycle();
|
||||
|
||||
DividerItemDecoration itemDecoration = new DividerItemDecoration(context, DividerItemDecoration.VERTICAL);
|
||||
itemDecoration.setDrawable(insetDivider);
|
||||
|
||||
return itemDecoration;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue