Last active
January 6, 2020 13:00
-
-
Save ernestkamara/ee640e998cefb371268d1e5a747ed06e to your computer and use it in GitHub Desktop.
Onboarding Bubble Item
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class OnboardingBubbleItem | |
@kotlin.jvm.JvmOverloads | |
constructor(context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0) : FrameLayout(context, attrs, defStyleAttr) { | |
init { initView(attrs) } | |
private fun initView(attrs: AttributeSet?) { | |
View.inflate(context, R.layout.layout_bubble_item, this) | |
val ta = context.obtainStyledAttributes(attrs, R.styleable.OnboardingBubbleItem) | |
val textColor = ta.getColor(R.styleable.OnboardingBubbleItem_bl_text_color, Color.BLACK) | |
val gravity = ta.getInt(R.styleable.OnboardingBubbleItem_bl_alignment, 0) | |
val text = ta.getString(R.styleable.OnboardingBubbleItem_bl_text) | |
bubbleItemTitle.text = text | |
bubbleItemTitle.setTextColor(textColor) | |
bubbleItemTitle.setTextGravity(gravity) | |
val description = ta.getString(R.styleable.OnboardingBubbleItem_bl_description) | |
bubbleItemDescription.text = description | |
bubbleItemDescription.setTextColor(textColor) | |
bubbleItemDescription.setTextGravity(gravity) | |
ta.recycle() | |
} | |
private fun TextView.setTextGravity(value: Int) { } | |
private fun ImageView.setGravity(value: Int) { } | |
private fun showDetail(visibility: Int) { } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment