mirror of
https://github.com/sudoxnym/habitica-android.git
synced 2026-04-14 19:56:32 +00:00
fix crashes
This commit is contained in:
parent
c674b1b49f
commit
cda7e4a403
10 changed files with 76 additions and 68 deletions
|
|
@ -2,7 +2,7 @@
|
|||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
package="com.habitrpg.android.habitica"
|
||||
android:versionCode="1979"
|
||||
android:versionCode="1980"
|
||||
android:versionName="1.5"
|
||||
android:screenOrientation="portrait"
|
||||
android:installLocation="auto" >
|
||||
|
|
|
|||
6
Habitica/res/drawable/pill_bg_gray.xml
Normal file
6
Habitica/res/drawable/pill_bg_gray.xml
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<solid android:color="@color/pill_gray"/>
|
||||
<corners android:radius="20dip"/>
|
||||
<padding android:left="0dip" android:top="0dip" android:right="0dip" android:bottom="0dip" />
|
||||
</shape>
|
||||
|
|
@ -1,72 +1,72 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:orientation="horizontal" android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/gem_view_background"
|
||||
android:gravity="center"
|
||||
android:minHeight="80dp"
|
||||
android:layout_marginBottom="12dp">
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:orientation="horizontal" android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/gem_view_background"
|
||||
android:gravity="center"
|
||||
android:minHeight="80dp"
|
||||
android:layout_marginBottom="12dp">
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="50dp"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/brand_700"
|
||||
android:id="@+id/subscriptionSelectedFrameView">
|
||||
android:layout_width="50dp"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/brand_700"
|
||||
android:id="@+id/subscriptionSelectedFrameView">
|
||||
<View
|
||||
android:id="@+id/subscriptionSelectedView"
|
||||
android:layout_width="16dp"
|
||||
android:layout_height="16dp"
|
||||
android:background="@drawable/subscription_unselected"
|
||||
android:layout_gravity="center"/>
|
||||
</FrameLayout>
|
||||
android:id="@+id/subscriptionSelectedView"
|
||||
android:layout_width="16dp"
|
||||
android:layout_height="16dp"
|
||||
android:background="@drawable/subscription_unselected"
|
||||
android:layout_gravity="center"/>
|
||||
</FrameLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="vertical"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="@dimen/spacing_medium"
|
||||
android:layout_marginRight="@dimen/spacing_medium"
|
||||
android:layout_marginStart="@dimen/spacing_large"
|
||||
android:layout_marginLeft="@dimen/spacing_large"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginBottom="8dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginBottom="8dp">
|
||||
android:id="@+id/priceLabel"
|
||||
android:textColor="@color/brand_100"
|
||||
android:textSize="24sp"
|
||||
tools:text="$ 21"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/priceLabel"
|
||||
android:textColor="@color/brand_100"
|
||||
android:textSize="24sp"
|
||||
tools:text="$ 21"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/descriptionTextView"
|
||||
android:textColor="@color/brand_100"
|
||||
tools:text="recurring every month"
|
||||
/>
|
||||
<org.apmem.tools.layouts.FlowLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
>
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/descriptionTextView"
|
||||
android:textColor="@color/brand_100"
|
||||
tools:text="recurring every month"
|
||||
/>
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
<TextView
|
||||
android:id="@+id/gemCapTextView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
tools:text="@string/subscribe1month.gemcap"
|
||||
style="@style/Pill"
|
||||
android:layout_marginTop="4dp"
|
||||
android:layout_marginRight="8dp"
|
||||
android:layout_marginEnd="8dp"/>
|
||||
android:id="@+id/gemCapTextView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
tools:text="@string/subscribe1month.gemcap"
|
||||
style="@style/Pill"
|
||||
android:layout_marginTop="4dp"
|
||||
android:layout_marginRight="8dp"
|
||||
android:layout_marginEnd="8dp"/>
|
||||
<TextView
|
||||
android:id="@+id/hourglassTextView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
tools:text="+1 Mystic Hourglass"
|
||||
style="@style/Pill"
|
||||
android:layout_marginTop="4dp"/>
|
||||
</org.apmem.tools.layouts.FlowLayout>
|
||||
android:id="@+id/hourglassTextView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
tools:text="+1 Mystic Hourglass"
|
||||
style="@style/Pill"
|
||||
android:layout_marginTop="4dp"/>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
|
@ -217,7 +217,7 @@
|
|||
|
||||
<style name="Pill">
|
||||
<item name="android:textSize">11sp</item>
|
||||
<item name="android:background">@drawable/pill_bg</item>
|
||||
<item name="android:background">@drawable/pill_bg_gray</item>
|
||||
<item name="android:paddingRight">@dimen/pill_horizontal_padding</item>
|
||||
<item name="android:paddingLeft">@dimen/pill_horizontal_padding</item>
|
||||
<item name="android:paddingTop">@dimen/pill_vertical_padding</item>
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ class GemPurchaseOptionsView(context: Context, attrs: AttributeSet) : FrameLayou
|
|||
var sku: String? = null
|
||||
|
||||
init {
|
||||
inflate(R.layout.purchase_gem_view)
|
||||
inflate(R.layout.purchase_gem_view, true)
|
||||
|
||||
val a = context.theme.obtainStyledAttributes(
|
||||
attrs,
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ class AvatarCustomizationFragment : BaseMainFragment() {
|
|||
compositeSubscription.add(adapter.getUnlockCustomizationEvents()
|
||||
.flatMap<UnlockResponse> { customization ->
|
||||
val user = this.user
|
||||
return@flatMap if (user != null) {
|
||||
if (user != null) {
|
||||
userRepository.unlockPath(user, customization)
|
||||
} else {
|
||||
Flowable.empty()
|
||||
|
|
@ -62,7 +62,7 @@ class AvatarCustomizationFragment : BaseMainFragment() {
|
|||
compositeSubscription.add(adapter.getUnlockSetEvents()
|
||||
.flatMap<UnlockResponse> { set ->
|
||||
val user = this.user
|
||||
return@flatMap if (user != null) {
|
||||
if (user != null) {
|
||||
userRepository.unlockPath(user, set)
|
||||
} else {
|
||||
Flowable.empty()
|
||||
|
|
|
|||
|
|
@ -81,8 +81,8 @@ class PetDetailRecyclerFragment : BaseMainFragment() {
|
|||
|
||||
private fun setGridSpanCount(width: Int) {
|
||||
var spanCount = 0
|
||||
if (context != null && context!!.resources != null) {
|
||||
val itemWidth: Float = context!!.resources.getDimension(R.dimen.pet_width)
|
||||
if (context != null && context?.resources != null) {
|
||||
val itemWidth: Float = context?.resources?.getDimension(R.dimen.pet_width) ?: 120f
|
||||
|
||||
spanCount = (width / itemWidth).toInt()
|
||||
}
|
||||
|
|
@ -120,6 +120,6 @@ class PetDetailRecyclerFragment : BaseMainFragment() {
|
|||
}
|
||||
|
||||
companion object {
|
||||
private val ANIMAL_TYPE_KEY = "ANIMAL_TYPE_KEY"
|
||||
private const val ANIMAL_TYPE_KEY = "ANIMAL_TYPE_KEY"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ import com.habitrpg.android.habitica.R
|
|||
import com.habitrpg.android.habitica.components.AppComponent
|
||||
import com.habitrpg.android.habitica.ui.fragments.BaseMainFragment
|
||||
import com.habitrpg.android.habitica.ui.helpers.bindView
|
||||
import com.habitrpg.android.habitica.ui.helpers.resetViews
|
||||
|
||||
class StableFragment : BaseMainFragment() {
|
||||
|
||||
|
|
@ -26,6 +27,7 @@ class StableFragment : BaseMainFragment() {
|
|||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
resetViews()
|
||||
viewPager?.currentItem = 0
|
||||
|
||||
setViewPagerAdapter()
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ class SubscriptionDetailsView : LinearLayout {
|
|||
}
|
||||
|
||||
private fun setupView() {
|
||||
inflate(R.layout.subscription_details)
|
||||
inflate(R.layout.subscription_details, true)
|
||||
|
||||
visitWebsiteButton.setOnClickListener { openSubscriptionWebsite() }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ class SubscriptionOptionView(context: Context, attrs: AttributeSet) : FrameLayou
|
|||
var sku: String? = null
|
||||
|
||||
init {
|
||||
inflate(R.layout.purchase_subscription_view)
|
||||
inflate(R.layout.purchase_subscription_view, true)
|
||||
|
||||
val a = context.theme.obtainStyledAttributes(
|
||||
attrs,
|
||||
|
|
|
|||
Loading…
Reference in a new issue