mirror of
https://github.com/sudoxnym/habitica-android.git
synced 2026-05-22 13:48:55 +00:00
display if pet can be hatched in pet detail screen. Fixes #1341
This commit is contained in:
parent
60a1b2f5f6
commit
19a2f787dd
2 changed files with 48 additions and 4 deletions
|
|
@ -40,4 +40,30 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:src="@drawable/pet_status_potion" />
|
||||
</LinearLayout>
|
||||
<RelativeLayout
|
||||
android:id="@+id/item_wrapper"
|
||||
android:layout_width="85dp"
|
||||
android:layout_height="70dp"
|
||||
android:layout_gravity="center">
|
||||
<com.facebook.drawee.view.SimpleDraweeView
|
||||
android:id="@+id/hatchingPotion_view"
|
||||
android:layout_width="72dp"
|
||||
android:layout_height="72dp"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_alignParentEnd="true" />
|
||||
<com.facebook.drawee.view.SimpleDraweeView
|
||||
android:id="@+id/egg_view"
|
||||
android:layout_width="72dp"
|
||||
android:layout_height="72dp"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_alignParentStart="true" />
|
||||
</RelativeLayout>
|
||||
<ImageView
|
||||
android:id="@+id/checkmark_view"
|
||||
android:layout_width="22dp"
|
||||
android:layout_height="16dp"
|
||||
android:src="@drawable/ic_check"
|
||||
android:tint="@color/brand_300"
|
||||
android:tintMode="src_in"
|
||||
android:layout_gravity="center" />
|
||||
</LinearLayout>
|
||||
|
|
@ -89,7 +89,11 @@ class PetDetailRecyclerAdapter(data: OrderedRealmCollection<Pet>?, autoUpdate: B
|
|||
private val trainedProgressbar: ProgressBar by bindView(R.id.trainedProgressBar)
|
||||
private val availableWrapper: ViewGroup by bindView(R.id.items_available_wrapper)
|
||||
private val eggAvailableView: ImageView by bindView(R.id.egg_available_view)
|
||||
private val potionAvailableView: ImageView by bindView(R.id.egg_available_view)
|
||||
private val potionAvailableView: ImageView by bindView(R.id.potion_available_view)
|
||||
private val itemWrapper: ViewGroup by bindView(R.id.item_wrapper)
|
||||
private val eggView: SimpleDraweeView by bindView(R.id.egg_view)
|
||||
private val hatchingPotionView: SimpleDraweeView by bindView(R.id.hatchingPotion_view)
|
||||
private val checkMarkView: ImageView by bindView(R.id.checkmark_view)
|
||||
|
||||
private val isOwned: Boolean
|
||||
get() = this.ownedPet?.trained ?: 0 > 0
|
||||
|
|
@ -126,7 +130,11 @@ class PetDetailRecyclerAdapter(data: OrderedRealmCollection<Pet>?, autoUpdate: B
|
|||
this.animal = item
|
||||
this.ownedPet = ownedPet
|
||||
this.imageView.alpha = 1.0f
|
||||
imageView.visibility = View.VISIBLE
|
||||
itemWrapper.visibility = View.GONE
|
||||
checkMarkView.visibility = View.GONE
|
||||
val imageName = "social_Pet-$itemType-${item.color}"
|
||||
itemView.setBackgroundResource(R.drawable.layout_rounded_bg_gray_700)
|
||||
if (this.ownedPet?.trained ?: 0 > 0) {
|
||||
if (this.canRaiseToMount) {
|
||||
this.trainedProgressbar.visibility = View.VISIBLE
|
||||
|
|
@ -138,9 +146,19 @@ class PetDetailRecyclerAdapter(data: OrderedRealmCollection<Pet>?, autoUpdate: B
|
|||
} else {
|
||||
this.trainedProgressbar.visibility = View.GONE
|
||||
this.imageView.alpha = 0.1f
|
||||
availableWrapper.visibility = View.VISIBLE
|
||||
eggAvailableView.alpha = if (hasEgg) 1.0f else 0.2f
|
||||
potionAvailableView.alpha = if (hasPotion) 1.0f else 0.2f
|
||||
if (canHatch) {
|
||||
imageView.visibility = View.GONE
|
||||
availableWrapper.visibility = View.GONE
|
||||
itemWrapper.visibility = View.VISIBLE
|
||||
checkMarkView.visibility = View.VISIBLE
|
||||
itemView.setBackgroundResource(R.drawable.layout_rounded_bg_gray_700_brand_border)
|
||||
DataBindingUtils.loadImage(eggView, "Pet_Egg_${item.animal}")
|
||||
DataBindingUtils.loadImage(hatchingPotionView, "Pet_HatchingPotion_${item.color}")
|
||||
} else {
|
||||
availableWrapper.visibility = View.VISIBLE
|
||||
eggAvailableView.alpha = if (hasEgg) 1.0f else 0.2f
|
||||
potionAvailableView.alpha = if (hasPotion) 1.0f else 0.2f
|
||||
}
|
||||
}
|
||||
|
||||
if (android.os.Build.VERSION.SDK_INT > android.os.Build.VERSION_CODES.LOLLIPOP_MR1) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue