File tree Expand file tree Collapse file tree 3 files changed +43
-1
lines changed
java/org/buffer/android/components Expand file tree Collapse file tree 3 files changed +43
-1
lines changed Original file line number Diff line number Diff line change @@ -36,7 +36,7 @@ publish {
36
36
userOrg = ' buffer'
37
37
groupId = ' org.buffer.android'
38
38
artifactId = ' android-components'
39
- publishVersion = ' 0.18 '
39
+ publishVersion = ' 0.19 '
40
40
desc = ' An Android library for frequently used UI components'
41
41
website = ' https://github.com/bufferapp/android-components'
42
42
}
Original file line number Diff line number Diff line change
1
+ package org.buffer.android.components
2
+
3
+ import android.buffer.org.ui_kit.R
4
+ import android.content.Context
5
+ import android.view.View
6
+ import android.view.ViewGroup
7
+ import android.widget.ArrayAdapter
8
+ import android.widget.TextView
9
+
10
+ open class TextOptionAdapter (
11
+ context : Context ,
12
+ private val values : Array <String >
13
+ ) : ArrayAdapter<String>(context, R .layout.item_share_option, values) {
14
+
15
+ override fun getView (position : Int , convertView : View ? , parent : ViewGroup ): View {
16
+ val optionViewHolder: OptionViewHolder
17
+ var shareOptionRow = convertView
18
+ if (shareOptionRow == null ) {
19
+ shareOptionRow = View .inflate(context, R .layout.item_share_option, null )
20
+ optionViewHolder = OptionViewHolder (shareOptionRow)
21
+ shareOptionRow.tag = optionViewHolder
22
+ } else {
23
+ optionViewHolder = shareOptionRow.tag as OptionViewHolder
24
+ }
25
+ optionViewHolder.optionText.text = values[position]
26
+ return shareOptionRow!!
27
+ }
28
+
29
+ internal class OptionViewHolder (itemView : View ) {
30
+ var optionText: TextView = itemView.findViewById<View >(R .id.text_option) as TextView
31
+ }
32
+ }
Original file line number Diff line number Diff line change
1
+ <?xml version =" 1.0" encoding =" utf-8" ?>
2
+ <TextView xmlns : android =" http://schemas.android.com/apk/res/android"
3
+ android : id =" @+id/text_option"
4
+ android : layout_width =" match_parent"
5
+ android : layout_height =" wrap_content"
6
+ android : layout_gravity =" center_vertical"
7
+ android : background =" ?android:attr/selectableItemBackground"
8
+ android : padding =" 16dp"
9
+ android : textColor =" ?android:textColorPrimary"
10
+ android : textSize =" @dimen/text_body" />
You can’t perform that action at this time.
0 commit comments