mirror of
https://github.com/sudoxnym/habitica-android.git
synced 2026-04-14 19:56:32 +00:00
-Update Armoire equip type from "Gear" to "Equipped
-Switch filter to active state when filtering on backgrounds -Check if Avatar Customization set is a deal (If total set costs less then total of individual item), and continue showing "buy set" button -For Habitica Account Dialog, auto resize input when keyboard opened -HabiticaAccountDialog (Delete dialog) UI fixes -Check if Uri has scheme, if not adds https:// (to support in-line -Avatar Customization item filter UI fixes
This commit is contained in:
parent
d5a3bb5635
commit
cad11e8588
12 changed files with 134 additions and 98 deletions
|
|
@ -1,5 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:state_checked="true" android:color="@color/white"/>
|
||||
<item android:state_checked="false" android:color="@color/white"/>
|
||||
<item android:color="@color/text_dimmed"/>
|
||||
</selector>
|
||||
|
|
@ -13,7 +13,7 @@
|
|||
android:layout_marginBottom="@dimen/spacing_large">
|
||||
|
||||
<TextView
|
||||
style="@style/Headline"
|
||||
style="@style/SubHeader1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/background_filters"
|
||||
|
|
@ -31,7 +31,7 @@
|
|||
android:layout_gravity="end"
|
||||
android:text="@string/clear"
|
||||
android:textColor="@color/text_primary"
|
||||
android:textSize="16sp"
|
||||
android:textSize="14sp"
|
||||
android:gravity="end|center_vertical"
|
||||
android:paddingEnd="0dp"
|
||||
android:paddingStart="0dp"/>
|
||||
|
|
|
|||
|
|
@ -1,104 +1,109 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<androidx.core.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<androidx.cardview.widget.CardView
|
||||
android:id="@+id/toolbar_cardview"
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="?attr/actionBarSize"
|
||||
app:cardElevation="0dp"
|
||||
app:cardBackgroundColor="@color/gray_2_alpha"
|
||||
app:cardCornerRadius="0dp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<RelativeLayout
|
||||
<androidx.cardview.widget.CardView
|
||||
android:id="@+id/toolbar_cardview"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
android:layout_height="?attr/actionBarSize"
|
||||
app:cardBackgroundColor="@color/gray_2_alpha"
|
||||
app:cardCornerRadius="0dp"
|
||||
app:cardElevation="0dp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/back_imagebutton"
|
||||
android:layout_width="22dp"
|
||||
android:layout_height="22dp"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginStart="@dimen/button_padding_small"
|
||||
android:background="?attr/selectableItemBackgroundBorderless"
|
||||
android:padding="8dp"
|
||||
android:src="@drawable/ic_arrow_back_white_36dp"
|
||||
app:tint="@android:color/black" />
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/confirm_action_textview"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:alpha=".4"
|
||||
android:background="?attr/selectableItemBackground"
|
||||
android:fontFamily="@string/font_family_medium"
|
||||
android:padding="8dp"
|
||||
android:text="@string/delete_account"
|
||||
android:textColor="@color/gray_200"
|
||||
android:textSize="18sp" />
|
||||
<ImageButton
|
||||
android:id="@+id/back_imagebutton"
|
||||
android:layout_width="22dp"
|
||||
android:layout_height="22dp"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginStart="@dimen/button_padding_small"
|
||||
android:background="?attr/selectableItemBackgroundBorderless"
|
||||
android:padding="8dp"
|
||||
android:src="@drawable/ic_arrow_back_white_36dp"
|
||||
app:tint="@color/back_button" />
|
||||
|
||||
</RelativeLayout>
|
||||
<TextView
|
||||
android:id="@+id/confirm_action_textview"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:alpha=".4"
|
||||
android:background="?attr/selectableItemBackground"
|
||||
android:fontFamily="@string/font_family_medium"
|
||||
android:padding="8dp"
|
||||
android:text="@string/delete_account"
|
||||
android:textColor="@color/gray_300"
|
||||
android:textSize="18sp" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
|
||||
</androidx.cardview.widget.CardView>
|
||||
</androidx.cardview.widget.CardView>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/title_textview"
|
||||
style="@style/DialogHabiticaAccountTitle"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/toolbar_cardview"
|
||||
android:layout_marginStart="@dimen/spacing_large"
|
||||
android:layout_marginTop="@dimen/spacing_large"
|
||||
android:layout_marginEnd="@dimen/spacing_large"
|
||||
android:text="@string/are_you_sure_you_want_to_delete" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/warning_description_textview"
|
||||
style="@style/DialogHabiticaAccountBody"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/title_textview"
|
||||
android:layout_marginStart="@dimen/spacing_large"
|
||||
android:layout_marginTop="@dimen/spacing_large"
|
||||
android:layout_marginEnd="@dimen/spacing_large"
|
||||
android:text="@string/delete_account_description" />
|
||||
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
android:id="@+id/confirmation_text_input_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/layout_rounded_bg_window"
|
||||
android:layout_below="@id/warning_description_textview"
|
||||
android:layout_marginStart="@dimen/spacing_large"
|
||||
style="@style/DialogHabiticaAccountInputLayout"
|
||||
android:layout_marginTop="@dimen/spacing_large"
|
||||
android:layout_marginEnd="@dimen/spacing_large"
|
||||
android:hint="@string/password"
|
||||
app:hintTextColor="@color/gray_10"
|
||||
android:textColorHint="@color/text_secondary"
|
||||
app:hintTextAppearance="@style/DialogHabiticaAccountHintLabel">
|
||||
|
||||
<com.google.android.material.textfield.TextInputEditText
|
||||
android:id="@+id/confirmation_input_edittext"
|
||||
<TextView
|
||||
android:id="@+id/title_textview"
|
||||
style="@style/DialogHabiticaAccountTitle"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:background="@android:color/transparent"
|
||||
android:textSize="20sp"
|
||||
android:inputType="textPassword"
|
||||
android:paddingStart="@dimen/spacing_large"
|
||||
android:paddingEnd="@dimen/spacing_large"
|
||||
android:textColorHint="@color/text_secondary" />
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
android:layout_below="@id/toolbar_cardview"
|
||||
android:layout_marginStart="@dimen/spacing_large"
|
||||
android:layout_marginTop="@dimen/spacing_large"
|
||||
android:layout_marginEnd="@dimen/spacing_large"
|
||||
android:text="@string/are_you_sure_you_want_to_delete" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/warning_description_textview"
|
||||
style="@style/DialogHabiticaAccountBody"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/title_textview"
|
||||
android:layout_marginStart="@dimen/spacing_large"
|
||||
android:layout_marginTop="@dimen/spacing_large"
|
||||
android:layout_marginEnd="@dimen/spacing_large"
|
||||
android:text="@string/delete_account_description" />
|
||||
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
android:id="@+id/confirmation_text_input_layout"
|
||||
style="@style/DialogHabiticaAccountInputLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/warning_description_textview"
|
||||
android:layout_marginStart="@dimen/spacing_large"
|
||||
android:layout_marginTop="@dimen/spacing_large"
|
||||
android:layout_marginEnd="@dimen/spacing_large"
|
||||
android:background="@drawable/layout_rounded_bg_window"
|
||||
android:hint="@string/password"
|
||||
android:textColorHint="@color/text_secondary"
|
||||
app:hintTextAppearance="@style/DialogHabiticaAccountHintLabel"
|
||||
app:hintTextColor="@color/gray_10">
|
||||
|
||||
<com.google.android.material.textfield.TextInputEditText
|
||||
android:id="@+id/confirmation_input_edittext"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:background="@android:color/transparent"
|
||||
android:inputType="textPassword"
|
||||
android:paddingStart="@dimen/spacing_large"
|
||||
android:paddingEnd="@dimen/spacing_large"
|
||||
android:textColorHint="@color/text_secondary"
|
||||
android:textSize="20sp" />
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
|
||||
|
||||
</RelativeLayout>
|
||||
</RelativeLayout>
|
||||
</androidx.core.widget.NestedScrollView>
|
||||
|
|
@ -46,6 +46,7 @@
|
|||
<color name="checkbox_fill_selected">#40ffffff</color>
|
||||
<color name="taskform_gray">#3D3945</color>
|
||||
<color name="reward_buy_button_text">#FFFFB445</color>
|
||||
<color name="back_button">#FFFFFF</color>
|
||||
|
||||
<color name="content_95_alpha">#f21A181D</color>
|
||||
<color name="content_80_alpha">#cc1A181D</color>
|
||||
|
|
|
|||
|
|
@ -99,6 +99,7 @@
|
|||
<color name="checkbox_fill_inactive">#99FFFFFF</color>
|
||||
<color name="checkbox_fill_selected">@color/gray_600</color>
|
||||
<color name="taskform_gray">#99edecee</color>
|
||||
<color name="back_button">#000000</color>
|
||||
|
||||
<color name="content_95_alpha">#f2ffffff</color>
|
||||
<color name="content_80_alpha">#ccffffff</color>
|
||||
|
|
|
|||
|
|
@ -392,6 +392,7 @@
|
|||
<item name="android:statusBarColor">@color/gray_2_alpha</item>
|
||||
<item name="android:windowAnimationStyle">@android:style/Animation.Dialog</item>
|
||||
<item name="android:navigationBarColor">@color/account_dialog_bars</item>
|
||||
<item name="android:windowSoftInputMode">adjustResize</item>
|
||||
</style>
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -6,4 +6,18 @@ class CustomizationSet {
|
|||
var price: Int = 0
|
||||
var hasPurchasable = false
|
||||
var customizations: MutableList<Customization> = mutableListOf()
|
||||
var ownedCustomizations: MutableList<Customization> = mutableListOf()
|
||||
|
||||
fun isSetDeal(): Boolean {
|
||||
var total = 0
|
||||
for (customization in customizations) {
|
||||
if (!ownedCustomizations.contains(customization)) {
|
||||
customization.price?.let { total += it }
|
||||
}
|
||||
}
|
||||
if (total >= price) {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -115,7 +115,7 @@ class ArmoireActivity : BaseActivity() {
|
|||
finish()
|
||||
}
|
||||
binding.equipButton.setOnClickListener {
|
||||
equipmentKey?.let { it1 -> inventoryRepository.equip("gear", it1).subscribe({}, RxErrorHandler.handleEmptyError()) }
|
||||
equipmentKey?.let { it1 -> inventoryRepository.equip("equipped", it1).subscribe({}, RxErrorHandler.handleEmptyError()) }
|
||||
finish()
|
||||
}
|
||||
binding.dropRateButton.setOnClickListener {
|
||||
|
|
|
|||
|
|
@ -134,7 +134,10 @@ class CustomizationRecyclerViewAdapter() : androidx.recyclerview.widget.Recycler
|
|||
customizationList.add(customization)
|
||||
lastSet.customizations.add(customization)
|
||||
if (customization.isUsable(ownedCustomizations.contains(customization.id)) && lastSet.hasPurchasable) {
|
||||
lastSet.hasPurchasable = false
|
||||
lastSet.ownedCustomizations.add(customization)
|
||||
if (!lastSet.isSetDeal()) {
|
||||
lastSet.hasPurchasable = false
|
||||
}
|
||||
}
|
||||
}
|
||||
this.notifyDataSetChanged()
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package com.habitrpg.android.habitica.ui.fragments.inventory.customization
|
||||
|
||||
import android.graphics.PorterDuff
|
||||
import android.graphics.Typeface
|
||||
import android.os.Bundle
|
||||
import android.view.LayoutInflater
|
||||
import android.view.Menu
|
||||
|
|
@ -308,6 +309,7 @@ class AvatarCustomizationFragment :
|
|||
binding.monthReleasedWrapper.visibility = View.GONE
|
||||
}
|
||||
dialog.setContentView(binding.root)
|
||||
dialog.setOnDismissListener { updateFilterIcon() }
|
||||
dialog.show()
|
||||
}
|
||||
|
||||
|
|
@ -317,8 +319,10 @@ class AvatarCustomizationFragment :
|
|||
button.text
|
||||
button.setOnCheckedChangeListener { _, isChecked ->
|
||||
if (!isChecked && filter.months.contains(identifier)) {
|
||||
button.typeface = Typeface.create("sans-serif", Typeface.NORMAL)
|
||||
filter.months.remove(identifier)
|
||||
} else if (isChecked && !filter.months.contains(identifier)) {
|
||||
button.typeface = Typeface.create("sans-serif-medium", Typeface.NORMAL)
|
||||
filter.months.add(identifier)
|
||||
}
|
||||
currentFilter.onNext(filter)
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ import android.text.TextWatcher
|
|||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.view.WindowManager
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.fragment.app.DialogFragment
|
||||
import com.habitrpg.android.habitica.R
|
||||
|
|
@ -14,7 +15,7 @@ import com.habitrpg.android.habitica.databinding.DialogHabiticaAccountBinding
|
|||
import com.habitrpg.android.habitica.models.user.User
|
||||
|
||||
|
||||
class HabiticaAccountDialog(private var thisContext: Context, ) : DialogFragment(R.layout.dialog_habitica_account) {
|
||||
class HabiticaAccountDialog(private var thisContext: Context) : DialogFragment(R.layout.dialog_habitica_account) {
|
||||
|
||||
private var _binding: DialogHabiticaAccountBinding? = null
|
||||
private val binding get() = _binding!!
|
||||
|
|
@ -31,6 +32,7 @@ class HabiticaAccountDialog(private var thisContext: Context, ) : DialogFragment
|
|||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
|
||||
|
||||
when (accountAction) {
|
||||
"reset_account" -> setResetAccountViews()
|
||||
"delete_account" -> setDeleteAccountViews()
|
||||
|
|
@ -48,7 +50,7 @@ class HabiticaAccountDialog(private var thisContext: Context, ) : DialogFragment
|
|||
|
||||
binding.confirmationInputEdittext.addTextChangedListener(object : TextWatcher {
|
||||
override fun beforeTextChanged(p0: CharSequence?, p1: Int, p2: Int, p3: Int) {
|
||||
binding.confirmActionTextview.setTextColor(ContextCompat.getColor(thisContext, R.color.gray_10))
|
||||
binding.confirmActionTextview.setTextColor(ContextCompat.getColor(thisContext, R.color.gray_300))
|
||||
binding.confirmActionTextview.alpha = .4f
|
||||
}
|
||||
|
||||
|
|
@ -57,7 +59,7 @@ class HabiticaAccountDialog(private var thisContext: Context, ) : DialogFragment
|
|||
binding.confirmActionTextview.setTextColor(ContextCompat.getColor(thisContext, R.color.red_100))
|
||||
binding.confirmActionTextview.alpha = 1.0f
|
||||
} else {
|
||||
binding.confirmActionTextview.setTextColor(ContextCompat.getColor(thisContext, R.color.gray_10))
|
||||
binding.confirmActionTextview.setTextColor(ContextCompat.getColor(thisContext, R.color.gray_300))
|
||||
binding.confirmActionTextview.alpha = .4f
|
||||
}
|
||||
}
|
||||
|
|
@ -85,19 +87,19 @@ class HabiticaAccountDialog(private var thisContext: Context, ) : DialogFragment
|
|||
|
||||
binding.confirmationInputEdittext.addTextChangedListener(object : TextWatcher {
|
||||
override fun beforeTextChanged(p0: CharSequence?, p1: Int, p2: Int, p3: Int) {
|
||||
binding.confirmActionTextview.setTextColor(ContextCompat.getColor(thisContext, R.color.gray_10))
|
||||
binding.confirmActionTextview.setTextColor(ContextCompat.getColor(thisContext, R.color.gray_300))
|
||||
binding.confirmActionTextview.alpha = .4f
|
||||
}
|
||||
|
||||
override fun onTextChanged(p0: CharSequence?, p1: Int, p2: Int, p3: Int) {
|
||||
if (binding.confirmationInputEdittext.text.toString().length > 5) {
|
||||
if ((user?.authentication?.hasPassword != true && binding.confirmationInputEdittext.text.toString() == context?.getString(R.string.delete_caps)) ||
|
||||
user?.authentication?.hasPassword == true) {
|
||||
user?.authentication?.hasPassword == true) {
|
||||
binding.confirmActionTextview.setTextColor(ContextCompat.getColor(thisContext, R.color.red_100))
|
||||
binding.confirmActionTextview.alpha = 1.0f
|
||||
}
|
||||
} else {
|
||||
binding.confirmActionTextview.setTextColor(ContextCompat.getColor(thisContext, R.color.gray_10))
|
||||
binding.confirmActionTextview.setTextColor(ContextCompat.getColor(thisContext, R.color.gray_300))
|
||||
binding.confirmActionTextview.alpha = .4f
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -150,7 +150,11 @@ private fun handleUrlClicks(context: Context, url: String) {
|
|||
val webpage = if (url.startsWith("/")) {
|
||||
Uri.parse("${context.getString(R.string.base_url)}$url")
|
||||
} else {
|
||||
Uri.parse(url)
|
||||
if (Uri.parse(url).scheme == null) {
|
||||
Uri.parse("http://$url");
|
||||
} else {
|
||||
Uri.parse(url)
|
||||
}
|
||||
}
|
||||
val intent = Intent(Intent.ACTION_VIEW, webpage)
|
||||
if (intent.resolveActivity(context.packageManager) != null) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue