create special insufficient gem view

This commit is contained in:
Phillip Thelen 2019-09-25 21:36:54 +02:00
parent 9888a3bc22
commit 8cc46fb860
3 changed files with 23 additions and 2 deletions

View file

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical">
<ImageView
android:id="@+id/imageView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="12dp"
android:scaleType="center" />
<TextView
android:id="@+id/textView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"/>
</LinearLayout>

View file

@ -16,10 +16,11 @@ abstract class InsufficientCurrencyDialog(context: Context) : HabiticaAlertDialo
protected var imageView: ImageView
protected var textView: TextView
init {
open var layoutID = R.layout.dialog_insufficient_currency
init {
val inflater = LayoutInflater.from(context)
val view = inflater.inflate(R.layout.dialog_insufficient_currency, contentView, false)
val view = inflater.inflate(layoutID, contentView, false)
setAdditionalContentView(view)
imageView = view.findViewById(R.id.imageView)

View file

@ -11,6 +11,8 @@ import com.habitrpg.android.habitica.helpers.MainNavigationController
class InsufficientGemsDialog(context: Context) : InsufficientCurrencyDialog(context) {
override var layoutID: Int = R.layout.dialog_insufficient_gems
init {
imageView.setImageResource(R.drawable.gems_84)
textView.setText(R.string.insufficientGems)