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 static final int INVALID_POSITION = -1;
public static final int INVALID_ID = -1;
private View customView;
@LayoutRes
private int layoutId;
private boolean disabled;
private View.OnClickListener onClickListener;
private int position = -1;
private int position;
public BaseBottomSheetItem(View customView,
@LayoutRes int layoutId,
@ -49,10 +52,10 @@ public class BaseBottomSheetItem {
protected View customView;
@LayoutRes
protected int layoutId;
protected int layoutId = INVALID_ID;
protected boolean disabled;
protected View.OnClickListener onClickListener;
protected int position;
protected int position = INVALID_POSITION;
public Builder setCustomView(View customView) {
this.customView = customView;

View file

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

View file

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