fix crashes

This commit is contained in:
Phillip Thelen 2018-07-27 12:08:00 +02:00
parent c674b1b49f
commit cda7e4a403
10 changed files with 76 additions and 68 deletions

View file

@ -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" >

View 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>

View file

@ -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>

View file

@ -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>

View file

@ -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,

View file

@ -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()

View file

@ -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"
}
}

View file

@ -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()

View file

@ -39,7 +39,7 @@ class SubscriptionDetailsView : LinearLayout {
}
private fun setupView() {
inflate(R.layout.subscription_details)
inflate(R.layout.subscription_details, true)
visitWebsiteButton.setOnClickListener { openSubscriptionWebsite() }
}

View file

@ -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,