Add bottomSheetItemWithDescription

This commit is contained in:
Alexander Sytnyk 2018-02-26 19:09:00 +02:00
parent ba2819cb7c
commit baffc79c54
2 changed files with 94 additions and 1 deletions

View file

@ -0,0 +1,92 @@
package net.osmand.plus.base.bottomsheetmenu;
import android.graphics.drawable.Drawable;
import android.support.annotation.ColorRes;
import android.support.annotation.DrawableRes;
import android.support.annotation.LayoutRes;
import android.support.annotation.StringRes;
import android.view.View;
public class BottomSheetItemWithDescription extends SimpleBottomSheetItem {
private String description;
@StringRes
private int descriptionId;
@ColorRes
private int descriptionColorId;
public BottomSheetItemWithDescription(View customView,
@LayoutRes int layoutResId,
boolean clickable,
View.OnClickListener onClickListener,
int position,
Drawable icon,
@DrawableRes int iconId,
@ColorRes int iconColorId,
String title,
@StringRes int titleId,
@ColorRes int titleColorId,
String description,
@StringRes int descriptionId,
@ColorRes int descriptionColorId) {
super(customView, layoutResId, clickable, onClickListener, position, icon, iconId, iconColorId, title, titleId, titleColorId);
this.description = description;
this.descriptionId = descriptionId;
this.descriptionColorId = descriptionColorId;
}
public String getDescription() {
return description;
}
@StringRes
public int getDescriptionId() {
return descriptionId;
}
@ColorRes
public int getDescriptionColorId() {
return descriptionColorId;
}
public static class Builder extends SimpleBottomSheetItem.Builder {
protected String description;
@StringRes
protected int descriptionId;
@ColorRes
protected int descriptionColorId;
public Builder setDescription(String description) {
this.description = description;
return this;
}
public Builder setDescriptionId(@StringRes int descriptionId) {
this.descriptionId = descriptionId;
return this;
}
public Builder setDescriptionColorId(@ColorRes int descriptionColorId) {
this.descriptionColorId = descriptionColorId;
return this;
}
public BottomSheetItemWithDescription create() {
return new BottomSheetItemWithDescription(customView,
layoutId,
disabled,
onClickListener,
position,
icon,
iconId,
iconColorId,
title,
titleId,
titleColorId,
description,
descriptionId,
descriptionColorId);
}
}
}

View file

@ -3,6 +3,7 @@ package net.osmand.plus.base.bottomsheetmenu;
import android.graphics.drawable.Drawable;
import android.support.annotation.ColorRes;
import android.support.annotation.DrawableRes;
import android.support.annotation.LayoutRes;
import android.support.annotation.StringRes;
import android.view.View;
@ -20,7 +21,7 @@ public class SimpleBottomSheetItem extends BaseBottomSheetItem {
private int titleColorId;
public SimpleBottomSheetItem(View customView,
int layoutResId,
@LayoutRes int layoutResId,
boolean clickable,
View.OnClickListener onClickListener,
int position,