mirror of
https://github.com/sudoxnym/habitica-android.git
synced 2026-07-14 02:01:56 +00:00
Fixes #1536
This commit is contained in:
parent
9ab2f6f206
commit
3d7a41bbaa
2 changed files with 17 additions and 4 deletions
|
|
@ -8,8 +8,13 @@ import android.view.ViewGroup
|
|||
import android.webkit.WebChromeClient
|
||||
import com.habitrpg.android.habitica.components.UserComponent
|
||||
import com.habitrpg.android.habitica.databinding.FragmentNewsBinding
|
||||
import com.habitrpg.android.habitica.modules.AppModule
|
||||
import javax.inject.Inject
|
||||
import javax.inject.Named
|
||||
|
||||
class PromoWebFragment : BaseMainFragment<FragmentNewsBinding>() {
|
||||
@field:[Inject Named(AppModule.NAMED_USER_ID)]
|
||||
lateinit var userID: String
|
||||
|
||||
override var binding: FragmentNewsBinding? = null
|
||||
|
||||
|
|
@ -32,7 +37,9 @@ class PromoWebFragment : BaseMainFragment<FragmentNewsBinding>() {
|
|||
}
|
||||
arguments?.let {
|
||||
val args = PromoWebFragmentArgs.fromBundle(it)
|
||||
binding?.newsWebview?.loadUrl(args.url)
|
||||
var url = args.url
|
||||
url = url.replace("USER_ID", userID)
|
||||
binding?.newsWebview?.loadUrl(url)
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -191,9 +191,15 @@ class PurchaseDialog(context: Context, component: UserComponent?, val item: Shop
|
|||
}
|
||||
} else if (shopItem.locked) {
|
||||
buyLabel.text = context.getString(R.string.locked)
|
||||
limitedTextView.visibility = View.VISIBLE
|
||||
limitedTextView.background = ContextCompat.getColor(context, R.color.offset_background).toDrawable()
|
||||
limitedTextView.setTextColor(ContextCompat.getColor(context, R.color.text_secondary))
|
||||
limitedTextView.visibility = View.GONE
|
||||
if (shopItem.isTypeGear && shopItem.key.last().toString().toIntOrNull() != null) {
|
||||
val previousKey = "${shopItem.key.dropLast(1)}${shopItem.key.last().toString().toIntOrNull()}"
|
||||
if (user?.items?.gear?.owned?.find { it.key == previousKey} == null) {
|
||||
limitedTextView.visibility = View.VISIBLE
|
||||
limitedTextView.background = ContextCompat.getColor(context, R.color.offset_background).toDrawable()
|
||||
limitedTextView.setTextColor(ContextCompat.getColor(context, R.color.text_secondary))
|
||||
}
|
||||
}
|
||||
} else {
|
||||
limitedTextView.visibility = View.GONE
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue