mirror of
https://github.com/sudoxnym/habitica-android.git
synced 2026-05-20 12:49:02 +00:00
change class dropdown design.
This commit is contained in:
parent
f0da87f0d3
commit
cda345de1c
3 changed files with 25 additions and 7 deletions
|
|
@ -2,7 +2,7 @@
|
|||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:minWidth="100dp"
|
||||
android:minWidth="120dp"
|
||||
android:paddingLeft="12dp"
|
||||
android:paddingRight="12dp"
|
||||
android:paddingTop="4dp"
|
||||
|
|
@ -16,5 +16,6 @@
|
|||
<TextView
|
||||
android:id="@+id/textView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
android:layout_height="wrap_content"
|
||||
android:lines="1"/>
|
||||
</LinearLayout>
|
||||
18
Habitica/res/layout/class_spinner_dropdown_item_selected.xml
Normal file
18
Habitica/res/layout/class_spinner_dropdown_item_selected.xml
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:paddingTop="4dp"
|
||||
android:paddingBottom="4dp"
|
||||
android:gravity="center_vertical|right">
|
||||
<ImageView
|
||||
android:id="@+id/classIconView"
|
||||
android:layout_width="32dp"
|
||||
android:layout_height="32dp"
|
||||
android:layout_marginRight="8dp"/>
|
||||
<TextView
|
||||
android:id="@+id/textView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="16sp"/>
|
||||
</LinearLayout>
|
||||
|
|
@ -16,11 +16,12 @@ import com.habitrpg.android.habitica.ui.views.HabiticaIconsHelper
|
|||
class HabiticaClassArrayAdapter(context: Context?, resource: Int, objects: List<CharSequence>?) : ArrayAdapter<CharSequence>(context, resource, R.id.textView, objects) {
|
||||
|
||||
override fun getDropDownView(position: Int, convertView: View?, parent: ViewGroup?): View =
|
||||
getView(position, convertView, parent)
|
||||
createView(position, convertView ?: parent?.inflate(R.layout.class_spinner_dropdown_item, false))
|
||||
|
||||
override fun getView(position: Int, convertView: View?, parent: ViewGroup?): View {
|
||||
val row = convertView ?: parent?.inflate(R.layout.class_spinner_dropdown_item, false)
|
||||
override fun getView(position: Int, convertView: View?, parent: ViewGroup?): View =
|
||||
createView(position, convertView ?: parent?.inflate(R.layout.class_spinner_dropdown_item_selected, false))
|
||||
|
||||
private fun createView(position: Int, row: View?): View {
|
||||
val textView: TextView? = row?.findViewById(R.id.textView)
|
||||
val imageView: ImageView? = row?.findViewById(R.id.classIconView)
|
||||
|
||||
|
|
@ -51,8 +52,6 @@ class HabiticaClassArrayAdapter(context: Context?, resource: Int, objects: List<
|
|||
imageView?.setImageBitmap(null)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return row ?: View(context)
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue