From baffc79c545a10b84be6acf453a0f4eee9368023 Mon Sep 17 00:00:00 2001 From: Alexander Sytnyk Date: Mon, 26 Feb 2018 19:09:00 +0200 Subject: [PATCH] Add bottomSheetItemWithDescription --- .../BottomSheetItemWithDescription.java | 92 +++++++++++++++++++ .../SimpleBottomSheetItem.java | 3 +- 2 files changed, 94 insertions(+), 1 deletion(-) create mode 100644 OsmAnd/src/net/osmand/plus/base/bottomsheetmenu/BottomSheetItemWithDescription.java diff --git a/OsmAnd/src/net/osmand/plus/base/bottomsheetmenu/BottomSheetItemWithDescription.java b/OsmAnd/src/net/osmand/plus/base/bottomsheetmenu/BottomSheetItemWithDescription.java new file mode 100644 index 0000000000..d6eef8e95e --- /dev/null +++ b/OsmAnd/src/net/osmand/plus/base/bottomsheetmenu/BottomSheetItemWithDescription.java @@ -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); + } + } +} diff --git a/OsmAnd/src/net/osmand/plus/base/bottomsheetmenu/SimpleBottomSheetItem.java b/OsmAnd/src/net/osmand/plus/base/bottomsheetmenu/SimpleBottomSheetItem.java index 25cae08154..37290afcc5 100644 --- a/OsmAnd/src/net/osmand/plus/base/bottomsheetmenu/SimpleBottomSheetItem.java +++ b/OsmAnd/src/net/osmand/plus/base/bottomsheetmenu/SimpleBottomSheetItem.java @@ -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,