Skip to content

Instantly share code, notes, and snippets.

@ernestkamara
Last active January 6, 2020 13:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ernestkamara/ee640e998cefb371268d1e5a747ed06e to your computer and use it in GitHub Desktop.
Save ernestkamara/ee640e998cefb371268d1e5a747ed06e to your computer and use it in GitHub Desktop.
Onboarding Bubble Item
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