Improve setup layout

This commit is contained in:
Phillip Thelen 2019-11-07 18:04:06 +01:00
parent f36bc739bc
commit 1d871728f5
5 changed files with 75 additions and 62 deletions

View file

@ -1,29 +1,30 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/setup_background"
android:gravity="center_horizontal">
<Space
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_weight="1" />
<Button
android:id="@+id/randomize_button"
android:layout_width="wrap_content"
android:text="@string/randomize"
style="@style/DiamondButton"
android:layout_marginTop="@dimen/setup_vertical_spacing"
android:layout_centerHorizontal="true"/>
<ImageView
android:id="@+id/randomize_button"
android:layout_width="wrap_content"
android:text="@string/randomize"
style="@style/DiamondButton" />
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/setup_vertical_spacing">
<ImageView
android:id="@+id/avatar_background"
android:layout_marginTop="@dimen/setup_vertical_spacing"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/randomize_button"
android:src="@drawable/creator_hills_bg"
android:layout_centerHorizontal="true" />
<com.habitrpg.android.habitica.ui.AvatarView
android:layout_centerInParent="true" />
<com.habitrpg.android.habitica.ui.AvatarView
android:id="@+id/avatarView"
android:layout_width="@dimen/avatar_small_width"
android:layout_height="@dimen/avatar_small_height"
@ -31,11 +32,24 @@
app:showMount="false"
app:showPet="false"
app:showSleeping="false"
android:layout_centerHorizontal="true"
android:layout_alignTop="@id/avatar_background"
android:layout_marginTop="6dp"
android:layout_marginStart="54dp"
/>
</RelativeLayout>
<Space
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_weight="1" />
<com.habitrpg.android.habitica.ui.SpeechBubbleView
android:id="@+id/speech_bubble"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:namePlate="Justin"
app:npcDrawable="@drawable/justin_textbox"
android:layout_marginLeft="@dimen/content_inset"
android:layout_marginRight="@dimen/content_inset"
android:layout_above="@id/customization_drawer"
android:layout_marginBottom="12dp"/>
<com.habitrpg.android.habitica.ui.views.setup.AvatarCustomizationDrawer
android:id="@+id/customization_drawer"
@ -44,15 +58,4 @@
android:layout_alignParentBottom="true"
/>
<com.habitrpg.android.habitica.ui.SpeechBubbleView
android:id="@+id/speech_bubble"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:namePlate="Justin"
app:npcDrawable="@drawable/justin_textbox"
android:layout_marginLeft="@dimen/content_inset"
android:layout_marginRight="@dimen/content_inset"
android:layout_above="@id/customization_drawer"
android:layout_marginBottom="12dp"/>
</RelativeLayout>
</LinearLayout>

View file

@ -1,28 +1,29 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/setup_background"
android:gravity="center_horizontal">
<ImageView
android:id="@+id/heart_icon"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_marginTop="@dimen/setup_vertical_spacing"
android:layout_centerHorizontal="true"/>
<Space
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_weight="1" />
<ImageView
android:id="@+id/heart_icon"
android:layout_height="36dp"
android:layout_width="36dp" />
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/setup_vertical_spacing">
<ImageView
android:id="@+id/avatar_background"
android:layout_marginTop="@dimen/setup_vertical_spacing"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/heart_icon"
android:src="@drawable/creator_purple_bg"
android:layout_centerHorizontal="true" />
<com.habitrpg.android.habitica.ui.AvatarView
android:layout_centerInParent="true" />
<com.habitrpg.android.habitica.ui.AvatarView
android:id="@+id/avatarView"
android:layout_width="@dimen/avatar_small_width"
android:layout_height="@dimen/avatar_small_height"
@ -30,26 +31,28 @@
app:showMount="false"
app:showPet="false"
app:showSleeping="false"
android:layout_centerHorizontal="true"
android:layout_alignTop="@id/avatar_background"
android:layout_marginTop="6dp"/>
android:layout_marginStart="54dp"
/>
</RelativeLayout>
<Space
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_weight="1" />
<com.habitrpg.android.habitica.ui.SpeechBubbleView
android:id="@+id/speech_bubble"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:namePlate="Justin"
app:npcDrawable="@drawable/justin_textbox"
android:layout_marginLeft="@dimen/content_inset"
android:layout_marginRight="@dimen/content_inset"
android:layout_marginBottom="12dp"/>
<androidx.recyclerview.widget.RecyclerView
android:layout_width="match_parent"
android:layout_height="230dp"
android:layout_alignParentBottom="true"
android:background="@drawable/avatar_customization_category_bg"
android:id="@+id/recyclerView"
android:padding="17dp"/>
<com.habitrpg.android.habitica.ui.SpeechBubbleView
android:id="@+id/speech_bubble"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:namePlate="Justin"
app:npcDrawable="@drawable/justin_textbox"
android:layout_marginLeft="@dimen/content_inset"
android:layout_marginRight="@dimen/content_inset"
android:layout_above="@id/recyclerView"
android:layout_marginBottom="12dp"/>
</RelativeLayout>
</LinearLayout>

View file

@ -47,7 +47,9 @@
android:defaultValue="0"/>
<argument
android:name="partyID"
app:argType="string" />
app:argType="string"
app:nullable="true"
android:defaultValue=""/>
</fragment>
<fragment
android:id="@+id/noPartyFragment"

View file

@ -1,9 +1,11 @@
package com.habitrpg.android.habitica.ui.fragments.setup
import android.graphics.drawable.BitmapDrawable
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.ImageView
import androidx.recyclerview.widget.GridLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.habitrpg.android.habitica.R
@ -19,6 +21,7 @@ import com.habitrpg.android.habitica.ui.adapter.setup.TaskSetupAdapter
import com.habitrpg.android.habitica.ui.fragments.BaseFragment
import com.habitrpg.android.habitica.ui.helpers.bindOptionalView
import com.habitrpg.android.habitica.ui.helpers.resetViews
import com.habitrpg.android.habitica.ui.views.HabiticaIconsHelper
import java.util.*
class TaskSetupFragment : BaseFragment() {
@ -29,6 +32,7 @@ class TaskSetupFragment : BaseFragment() {
private val recyclerView: RecyclerView? by bindOptionalView(R.id.recyclerView)
private val avatarView: AvatarView? by bindOptionalView(R.id.avatarView)
private val speechBubbleView: SpeechBubbleView? by bindOptionalView(R.id.speech_bubble)
private val heartView: ImageView? by bindOptionalView(R.id.heart_icon)
internal var adapter: TaskSetupAdapter = TaskSetupAdapter()
private var taskGroups: List<List<String>> = listOf()
private var tasks: List<List<Any>> = listOf()
@ -56,6 +60,7 @@ class TaskSetupFragment : BaseFragment() {
this.updateAvatar()
}
heartView?.setImageDrawable(BitmapDrawable(HabiticaIconsHelper.imageOfHeartLightBg()))
}
override fun setUserVisibleHint(isVisibleToUser: Boolean) {

View file

@ -61,8 +61,8 @@ class PartyFragment : BaseMainFragment() {
arguments?.let {
val args = PartyFragmentArgs.fromBundle(it)
viewPager?.currentItem = args.tabToOpen
if (args.partyID.isNotEmpty()) {
viewModel.setGroupID(args.partyID)
if (args.partyID?.isNotEmpty() == true) {
viewModel.setGroupID(args.partyID ?: "")
}
}