mirror of
https://github.com/sudoxnym/habitica-android.git
synced 2026-05-18 19:59:00 +00:00
Handle new backgrounds
This commit is contained in:
parent
c7d61c18e4
commit
4562ac3d10
7 changed files with 18 additions and 23 deletions
|
|
@ -151,7 +151,7 @@ android {
|
|||
multiDexEnabled true
|
||||
resConfigs "en", "bg", "de", "en-rGB", "es", "fr", "hr-rHR", "in", "it", "iw", "ja", "ko", "lt", "nl", "pl", "pt-rBR", "pt-rPT", "ru", "tr", "zh", "zh-rTW"
|
||||
|
||||
versionCode 2330
|
||||
versionCode 2336
|
||||
versionName "2.4"
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -20,7 +20,8 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:id="@+id/priceLabel"
|
||||
android:layout_gravity="center_horizontal" />
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_marginEnd="2dp"/>
|
||||
|
||||
<ImageView
|
||||
android:layout_width="wrap_content"
|
||||
|
|
|
|||
|
|
@ -111,7 +111,7 @@ class TaskFilterHelper {
|
|||
Task.FILTER_GRAY -> query = query.equalTo("completed", true).or().equalTo("isDue", false)
|
||||
Task.FILTER_WEAK -> query = query.lessThan("value", 1.0)
|
||||
Task.FILTER_STRONG -> query = query.greaterThanOrEqualTo("value", 1.0)
|
||||
Task.FILTER_DATED -> query = query.isNotNull("dueDate").equalTo("completed", false).sortBy("dueDate")
|
||||
Task.FILTER_DATED -> query = query.isNotNull("dueDate").equalTo("completed", false).sort("dueDate")
|
||||
Task.FILTER_COMPLETED -> query = query.equalTo("completed", true)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -556,6 +556,9 @@ class AvatarView : View {
|
|||
tempMap["Pet-Gryphon-Gryphatrice"] = "gif"
|
||||
tempMap["Mount_Head_Gryphon-Gryphatrice"] = "gif"
|
||||
tempMap["Mount_Body_Gryphon-Gryphatrice"] = "gif"
|
||||
tempMap["background_clocktower"] = "gif"
|
||||
tempMap["background_airship"] = "gif"
|
||||
tempMap["background_steamworks"] = "gif"
|
||||
FILEFORMAT_MAP = Collections.unmodifiableMap(tempMap)
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -60,11 +60,7 @@ class CustomizationRecyclerViewAdapter : androidx.recyclerview.widget.RecyclerVi
|
|||
.inflate(R.layout.customization_section_header, parent, false)
|
||||
SectionViewHolder(view)
|
||||
} else {
|
||||
val viewID: Int = if (viewType == 1) {
|
||||
R.layout.customization_grid_item
|
||||
} else {
|
||||
R.layout.customization_grid_background_item
|
||||
}
|
||||
val viewID: Int = R.layout.customization_grid_item
|
||||
|
||||
val view = LayoutInflater.from(parent.context).inflate(viewID, parent, false)
|
||||
CustomizationViewHolder(view)
|
||||
|
|
@ -90,17 +86,14 @@ class CustomizationRecyclerViewAdapter : androidx.recyclerview.widget.RecyclerVi
|
|||
return if (this.customizationList[position].javaClass == CustomizationSet::class.java) {
|
||||
0
|
||||
} else {
|
||||
val customization = customizationList[position] as Customization
|
||||
if (customization.type == "background") {
|
||||
2
|
||||
} else 1
|
||||
1
|
||||
}
|
||||
}
|
||||
|
||||
fun setCustomizations(newCustomizationList: List<Customization>) {
|
||||
this.customizationList = ArrayList()
|
||||
var lastSet = CustomizationSet()
|
||||
for (customization in newCustomizationList) {
|
||||
for (customization in newCustomizationList.reversed()) {
|
||||
if (customization.customizationSet != null && customization.customizationSet != lastSet.identifier) {
|
||||
val set = CustomizationSet()
|
||||
set.identifier = customization.customizationSet
|
||||
|
|
@ -172,7 +165,7 @@ class CustomizationRecyclerViewAdapter : androidx.recyclerview.widget.RecyclerVi
|
|||
val priceLabel = dialogContent.findViewById<TextView>(R.id.priceLabel)
|
||||
priceLabel.text = customization?.price.toString()
|
||||
|
||||
(dialogContent.findViewById<View>(R.id.gem_icon) as ImageView).setImageBitmap(HabiticaIconsHelper.imageOfGem())
|
||||
(dialogContent.findViewById<View>(R.id.gem_icon) as? ImageView)?.setImageBitmap(HabiticaIconsHelper.imageOfGem())
|
||||
|
||||
val dialog = HabiticaAlertDialog(itemView.context)
|
||||
dialog.addButton(R.string.purchase_button, true) { _, _ ->
|
||||
|
|
@ -216,7 +209,7 @@ class CustomizationRecyclerViewAdapter : androidx.recyclerview.widget.RecyclerVi
|
|||
fun bind(set: CustomizationSet) {
|
||||
this.set = set
|
||||
this.label.text = set.text
|
||||
if (set.hasPurchasable) {
|
||||
if (set.hasPurchasable && !set.identifier.contains("timeTravel")) {
|
||||
this.purchaseSetButton.visibility = View.VISIBLE
|
||||
this.purchaseSetButton.text = context.getString(R.string.purchase_set_button, set.price)
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -122,14 +122,7 @@ class AvatarCustomizationFragment : BaseMainFragment() {
|
|||
}
|
||||
|
||||
private fun setGridSpanCount(width: Int) {
|
||||
var itemWidth = 0F
|
||||
context?.resources?.let {
|
||||
itemWidth = if (this.type != null && this.type == "background") {
|
||||
context?.resources?.getDimension(R.dimen.avatar_width)
|
||||
} else {
|
||||
context?.resources?.getDimension(R.dimen.customization_width)
|
||||
} ?: 0F
|
||||
}
|
||||
val itemWidth = context?.resources?.getDimension(R.dimen.customization_width) ?: 0F
|
||||
var spanCount = (width / itemWidth).toInt()
|
||||
if (spanCount == 0) {
|
||||
spanCount = 1
|
||||
|
|
|
|||
|
|
@ -128,6 +128,11 @@ class CustomizationDeserializer : JsonDeserializer<List<Customization>> {
|
|||
customization.price = 0
|
||||
customization.setPrice = 0
|
||||
customization.isBuyable = false
|
||||
} else if ("timeTravelBackgrounds" == setName) {
|
||||
customization.customizationSetName = "Time Travel Backgrounds"
|
||||
customization.price = 0
|
||||
customization.setPrice = 0
|
||||
customization.isBuyable = false
|
||||
} else {
|
||||
customization.price = 7
|
||||
customization.setPrice = 15
|
||||
|
|
|
|||
Loading…
Reference in a new issue