Add small fixes to BaseBottomSheetItem and SimpleBottomSheetItem
This commit is contained in:
parent
5e3a6135b7
commit
ba2819cb7c
2 changed files with 66 additions and 58 deletions
|
@ -7,19 +7,19 @@ public class BaseBottomSheetItem {
|
||||||
|
|
||||||
private View customView;
|
private View customView;
|
||||||
@LayoutRes
|
@LayoutRes
|
||||||
private int layoutResId;
|
private int layoutId;
|
||||||
private boolean clickable = true;
|
private boolean disabled;
|
||||||
private View.OnClickListener onClickListener;
|
private View.OnClickListener onClickListener;
|
||||||
private int position = -1;
|
private int position = -1;
|
||||||
|
|
||||||
public BaseBottomSheetItem(View customView,
|
public BaseBottomSheetItem(View customView,
|
||||||
@LayoutRes int layoutResId,
|
@LayoutRes int layoutId,
|
||||||
boolean clickable,
|
boolean disabled,
|
||||||
View.OnClickListener onClickListener,
|
View.OnClickListener onClickListener,
|
||||||
int position) {
|
int position) {
|
||||||
this.customView = customView;
|
this.customView = customView;
|
||||||
this.layoutResId = layoutResId;
|
this.layoutId = layoutId;
|
||||||
this.clickable = clickable;
|
this.disabled = disabled;
|
||||||
this.onClickListener = onClickListener;
|
this.onClickListener = onClickListener;
|
||||||
this.position = position;
|
this.position = position;
|
||||||
}
|
}
|
||||||
|
@ -29,12 +29,12 @@ public class BaseBottomSheetItem {
|
||||||
}
|
}
|
||||||
|
|
||||||
@LayoutRes
|
@LayoutRes
|
||||||
public int getLayoutResId() {
|
public int getLayoutId() {
|
||||||
return layoutResId;
|
return layoutId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isClickable() {
|
public boolean isDisabled() {
|
||||||
return clickable;
|
return disabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
public View.OnClickListener getOnClickListener() {
|
public View.OnClickListener getOnClickListener() {
|
||||||
|
@ -49,8 +49,8 @@ public class BaseBottomSheetItem {
|
||||||
|
|
||||||
protected View customView;
|
protected View customView;
|
||||||
@LayoutRes
|
@LayoutRes
|
||||||
protected int layoutResId;
|
protected int layoutId;
|
||||||
protected boolean clickable;
|
protected boolean disabled;
|
||||||
protected View.OnClickListener onClickListener;
|
protected View.OnClickListener onClickListener;
|
||||||
protected int position;
|
protected int position;
|
||||||
|
|
||||||
|
@ -59,13 +59,13 @@ public class BaseBottomSheetItem {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Builder setLayoutResId(@LayoutRes int layoutResId) {
|
public Builder setLayoutId(@LayoutRes int layoutId) {
|
||||||
this.layoutResId = layoutResId;
|
this.layoutId = layoutId;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Builder setClickable(boolean clickable) {
|
public Builder setDisabled(boolean disabled) {
|
||||||
this.clickable = clickable;
|
this.disabled = disabled;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -80,7 +80,7 @@ public class BaseBottomSheetItem {
|
||||||
}
|
}
|
||||||
|
|
||||||
public BaseBottomSheetItem create() {
|
public BaseBottomSheetItem create() {
|
||||||
return new BaseBottomSheetItem(customView, layoutResId, clickable, onClickListener, position);
|
return new BaseBottomSheetItem(customView, layoutId, disabled, onClickListener, position);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,14 +10,14 @@ public class SimpleBottomSheetItem extends BaseBottomSheetItem {
|
||||||
|
|
||||||
private Drawable icon;
|
private Drawable icon;
|
||||||
@DrawableRes
|
@DrawableRes
|
||||||
private int iconResId;
|
private int iconId;
|
||||||
@ColorRes
|
@ColorRes
|
||||||
private int iconColorResId;
|
private int iconColorId;
|
||||||
private String title;
|
private String title;
|
||||||
@StringRes
|
@StringRes
|
||||||
private int titleResId;
|
private int titleId;
|
||||||
@ColorRes
|
@ColorRes
|
||||||
private int titleColorResId;
|
private int titleColorId;
|
||||||
|
|
||||||
public SimpleBottomSheetItem(View customView,
|
public SimpleBottomSheetItem(View customView,
|
||||||
int layoutResId,
|
int layoutResId,
|
||||||
|
@ -25,65 +25,73 @@ public class SimpleBottomSheetItem extends BaseBottomSheetItem {
|
||||||
View.OnClickListener onClickListener,
|
View.OnClickListener onClickListener,
|
||||||
int position,
|
int position,
|
||||||
Drawable icon,
|
Drawable icon,
|
||||||
int iconResId,
|
@DrawableRes int iconId,
|
||||||
int iconColorResId,
|
@ColorRes int iconColorId,
|
||||||
String title,
|
String title,
|
||||||
int titleResId,
|
@StringRes int titleId,
|
||||||
int titleColorResId) {
|
@ColorRes int titleColorId) {
|
||||||
super(customView, layoutResId, clickable, onClickListener, position);
|
super(customView, layoutResId, clickable, onClickListener, position);
|
||||||
this.icon = icon;
|
this.icon = icon;
|
||||||
this.iconResId = iconResId;
|
this.iconId = iconId;
|
||||||
this.iconColorResId = iconColorResId;
|
this.iconColorId = iconColorId;
|
||||||
this.title = title;
|
this.title = title;
|
||||||
this.titleResId = titleResId;
|
this.titleId = titleId;
|
||||||
this.titleColorResId = titleColorResId;
|
this.titleColorId = titleColorId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Drawable getIcon() {
|
public Drawable getIcon() {
|
||||||
return icon;
|
return icon;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getIconResId() {
|
@DrawableRes
|
||||||
return iconResId;
|
public int getIconId() {
|
||||||
|
return iconId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getIconColorResId() {
|
@ColorRes
|
||||||
return iconColorResId;
|
public int getIconColorId() {
|
||||||
|
return iconColorId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getTitle() {
|
public String getTitle() {
|
||||||
return title;
|
return title;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getTitleResId() {
|
@StringRes
|
||||||
return titleResId;
|
public int getTitleId() {
|
||||||
|
return titleId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getTitleColorResId() {
|
@ColorRes
|
||||||
return titleColorResId;
|
public int getTitleColorId() {
|
||||||
|
return titleColorId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class Builder extends BaseBottomSheetItem.Builder {
|
public static class Builder extends BaseBottomSheetItem.Builder {
|
||||||
|
|
||||||
private Drawable icon;
|
protected Drawable icon;
|
||||||
private int iconResId;
|
@DrawableRes
|
||||||
private int iconColorResId;
|
protected int iconId;
|
||||||
private String title;
|
@ColorRes
|
||||||
private int titleResId;
|
protected int iconColorId;
|
||||||
private int titleColorResId;
|
protected String title;
|
||||||
|
@StringRes
|
||||||
|
protected int titleId;
|
||||||
|
@ColorRes
|
||||||
|
protected int titleColorId;
|
||||||
|
|
||||||
public Builder setIcon(Drawable icon) {
|
public Builder setIcon(Drawable icon) {
|
||||||
this.icon = icon;
|
this.icon = icon;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Builder setIconResId(int iconResId) {
|
public Builder setIconId(@DrawableRes int iconId) {
|
||||||
this.iconResId = iconResId;
|
this.iconId = iconId;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Builder setIconColorResId(int iconColorResId) {
|
public Builder setIconColorId(@ColorRes int iconColorId) {
|
||||||
this.iconColorResId = iconColorResId;
|
this.iconColorId = iconColorId;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -92,28 +100,28 @@ public class SimpleBottomSheetItem extends BaseBottomSheetItem {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Builder setTitleResId(int titleResId) {
|
public Builder setTitleId(@StringRes int titleId) {
|
||||||
this.titleResId = titleResId;
|
this.titleId = titleId;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Builder setTitleColorResId(int titleColorResId) {
|
public Builder setTitleColorId(@ColorRes int titleColorId) {
|
||||||
this.titleColorResId = titleColorResId;
|
this.titleColorId = titleColorId;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public SimpleBottomSheetItem createSimpleBottomSheetItem() {
|
public SimpleBottomSheetItem create() {
|
||||||
return new SimpleBottomSheetItem(customView,
|
return new SimpleBottomSheetItem(customView,
|
||||||
layoutResId,
|
layoutId,
|
||||||
clickable,
|
disabled,
|
||||||
onClickListener,
|
onClickListener,
|
||||||
position,
|
position,
|
||||||
icon,
|
icon,
|
||||||
iconResId,
|
iconId,
|
||||||
iconColorResId,
|
iconColorId,
|
||||||
title,
|
title,
|
||||||
titleResId,
|
titleId,
|
||||||
titleColorResId);
|
titleColorId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue