Add some default values to builders

This commit is contained in:
Alexander Sytnyk 2018-02-27 12:31:19 +02:00
parent baffc79c54
commit 5c78fc904b
3 changed files with 14 additions and 9 deletions

View file

@ -5,12 +5,15 @@ import android.view.View;
public class BaseBottomSheetItem { public class BaseBottomSheetItem {
public static final int INVALID_POSITION = -1;
public static final int INVALID_ID = -1;
private View customView; private View customView;
@LayoutRes @LayoutRes
private int layoutId; private int layoutId;
private boolean disabled; private boolean disabled;
private View.OnClickListener onClickListener; private View.OnClickListener onClickListener;
private int position = -1; private int position;
public BaseBottomSheetItem(View customView, public BaseBottomSheetItem(View customView,
@LayoutRes int layoutId, @LayoutRes int layoutId,
@ -49,10 +52,10 @@ public class BaseBottomSheetItem {
protected View customView; protected View customView;
@LayoutRes @LayoutRes
protected int layoutId; protected int layoutId = INVALID_ID;
protected boolean disabled; protected boolean disabled;
protected View.OnClickListener onClickListener; protected View.OnClickListener onClickListener;
protected int position; protected int position = INVALID_POSITION;
public Builder setCustomView(View customView) { public Builder setCustomView(View customView) {
this.customView = customView; this.customView = customView;

View file

@ -53,9 +53,9 @@ public class BottomSheetItemWithDescription extends SimpleBottomSheetItem {
protected String description; protected String description;
@StringRes @StringRes
protected int descriptionId; protected int descriptionId = INVALID_ID;
@ColorRes @ColorRes
protected int descriptionColorId; protected int descriptionColorId = INVALID_ID;
public Builder setDescription(String description) { public Builder setDescription(String description) {
this.description = description; this.description = description;

View file

@ -9,6 +9,8 @@ import android.view.View;
public class SimpleBottomSheetItem extends BaseBottomSheetItem { public class SimpleBottomSheetItem extends BaseBottomSheetItem {
public static final int CONTENT_ICON_COLOR = -1;
private Drawable icon; private Drawable icon;
@DrawableRes @DrawableRes
private int iconId; private int iconId;
@ -72,14 +74,14 @@ public class SimpleBottomSheetItem extends BaseBottomSheetItem {
protected Drawable icon; protected Drawable icon;
@DrawableRes @DrawableRes
protected int iconId; protected int iconId = INVALID_ID;
@ColorRes @ColorRes
protected int iconColorId; protected int iconColorId = CONTENT_ICON_COLOR;
protected String title; protected String title;
@StringRes @StringRes
protected int titleId; protected int titleId = INVALID_ID;
@ColorRes @ColorRes
protected int titleColorId; protected int titleColorId = INVALID_ID;
public Builder setIcon(Drawable icon) { public Builder setIcon(Drawable icon) {
this.icon = icon; this.icon = icon;