mirror of
https://github.com/sudoxnym/habitica-android.git
synced 2026-05-20 04:39:04 +00:00
Small changes to setup process
This commit is contained in:
parent
2294d17000
commit
c68e4ff12a
4 changed files with 25 additions and 38 deletions
|
|
@ -40,7 +40,7 @@
|
|||
tools:text="@string/intro_2_title"
|
||||
android:layout_marginBottom="28dp" />
|
||||
|
||||
<com.facebook.drawee.view.SimpleDraweeView
|
||||
<ImageView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/imageView"
|
||||
|
|
|
|||
|
|
@ -23,7 +23,6 @@ import com.habitrpg.android.habitica.data.ApiClient
|
|||
import com.habitrpg.android.habitica.data.InventoryRepository
|
||||
import com.habitrpg.android.habitica.data.TaskRepository
|
||||
import com.habitrpg.android.habitica.data.UserRepository
|
||||
import com.habitrpg.android.habitica.extensions.subscribeWithErrorHandler
|
||||
import com.habitrpg.android.habitica.helpers.AmplitudeManager
|
||||
import com.habitrpg.android.habitica.helpers.RxErrorHandler
|
||||
import com.habitrpg.android.habitica.models.user.User
|
||||
|
|
@ -72,8 +71,8 @@ class SetupActivity : BaseActivity(), ViewPager.OnPageChangeListener {
|
|||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
compositeSubscription.add(userRepository.getUser().subscribeWithErrorHandler(Consumer { this.onUserReceived(it) }))
|
||||
compositeSubscription.add(userRepository.retrieveUser().subscribeWithErrorHandler(Consumer {}))
|
||||
compositeSubscription.add(userRepository.getUser().subscribe(Consumer { this.onUserReceived(it) }, RxErrorHandler.handleEmptyError()))
|
||||
compositeSubscription.add(userRepository.retrieveUser().subscribe(Consumer {}, RxErrorHandler.handleEmptyError()))
|
||||
val additionalData = HashMap<String, Any>()
|
||||
additionalData["status"] = "displayed"
|
||||
AmplitudeManager.sendEvent("setup", AmplitudeManager.EVENT_CATEGORY_BEHAVIOUR, AmplitudeManager.EVENT_HITTYPE_EVENT, additionalData)
|
||||
|
|
@ -202,16 +201,15 @@ class SetupActivity : BaseActivity(), ViewPager.OnPageChangeListener {
|
|||
additionalData["status"] = "completed"
|
||||
AmplitudeManager.sendEvent("setup", AmplitudeManager.EVENT_CATEGORY_BEHAVIOUR, AmplitudeManager.EVENT_HITTYPE_EVENT, additionalData)
|
||||
|
||||
this.startMainActivity()
|
||||
startMainActivity()
|
||||
return
|
||||
}
|
||||
this.user = user
|
||||
if (this.pager.adapter == null) {
|
||||
this.setupViewpager()
|
||||
} else {
|
||||
this.avatarSetupFragment?.setUser(user)
|
||||
this.taskSetupFragment?.setUser(user)
|
||||
if (pager.adapter == null) {
|
||||
setupViewpager()
|
||||
}
|
||||
avatarSetupFragment?.setUser(user)
|
||||
taskSetupFragment?.setUser(user)
|
||||
}
|
||||
|
||||
private fun startMainActivity() {
|
||||
|
|
|
|||
|
|
@ -146,6 +146,7 @@ class AvatarSetupFragment : BaseFragment() {
|
|||
if (this.adapter != null) {
|
||||
this.adapter?.user = user
|
||||
this.adapter?.notifyDataSetChanged()
|
||||
loadCustomizations()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -5,24 +5,13 @@ import android.os.Bundle
|
|||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.ImageView
|
||||
import android.widget.TextView
|
||||
import com.habitrpg.android.habitica.R
|
||||
import com.habitrpg.android.habitica.components.UserComponent
|
||||
import com.habitrpg.android.habitica.extensions.inflate
|
||||
import com.habitrpg.android.habitica.databinding.FragmentIntroBinding
|
||||
import com.habitrpg.android.habitica.ui.fragments.BaseFragment
|
||||
import com.habitrpg.android.habitica.ui.helpers.bindOptionalView
|
||||
import com.habitrpg.android.habitica.ui.helpers.resetViews
|
||||
|
||||
class IntroFragment : BaseFragment() {
|
||||
|
||||
private val subtitleTextView: TextView? by bindOptionalView(R.id.subtitleTextView)
|
||||
private val titleTextView: TextView? by bindOptionalView(R.id.titleTextView)
|
||||
private val titleImageView: ImageView? by bindOptionalView(R.id.titleImageView)
|
||||
private val descriptionTextView: TextView? by bindOptionalView(R.id.descriptionTextView)
|
||||
private val imageView: ImageView? by bindOptionalView(R.id.imageView)
|
||||
private val containerView: ViewGroup? by bindOptionalView(R.id.container_view)
|
||||
|
||||
private var binding: FragmentIntroBinding? = null
|
||||
private var image: Drawable? = null
|
||||
private var titleImage: Drawable? = null
|
||||
private var subtitle: String? = null
|
||||
|
|
@ -32,36 +21,35 @@ class IntroFragment : BaseFragment() {
|
|||
|
||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
|
||||
super.onCreateView(inflater, container, savedInstanceState)
|
||||
return container?.inflate(R.layout.fragment_intro)
|
||||
binding = FragmentIntroBinding.inflate(layoutInflater, container, false)
|
||||
return binding?.root
|
||||
}
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
|
||||
resetViews()
|
||||
|
||||
if (this.image != null) {
|
||||
this.imageView?.setImageDrawable(this.image)
|
||||
binding?.imageView?.setImageDrawable(this.image)
|
||||
}
|
||||
|
||||
if (this.titleImage != null) {
|
||||
this.titleImageView?.setImageDrawable(this.titleImage)
|
||||
binding?.titleImageView?.setImageDrawable(this.titleImage)
|
||||
}
|
||||
|
||||
if (this.subtitle != null) {
|
||||
this.subtitleTextView?.text = this.subtitle
|
||||
binding?.subtitleTextView?.text = this.subtitle
|
||||
}
|
||||
|
||||
if (this.title != null) {
|
||||
this.titleTextView?.text = this.title
|
||||
binding?.titleTextView?.text = this.title
|
||||
}
|
||||
|
||||
if (this.description != null) {
|
||||
this.descriptionTextView?.text = this.description
|
||||
binding?.descriptionTextView?.text = this.description
|
||||
}
|
||||
|
||||
backgroundColor?.let {
|
||||
this.containerView?.setBackgroundColor(it)
|
||||
binding?.containerView?.setBackgroundColor(it)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -72,33 +60,33 @@ class IntroFragment : BaseFragment() {
|
|||
fun setImage(image: Drawable?) {
|
||||
this.image = image
|
||||
if (image != null) {
|
||||
this.imageView?.setImageDrawable(image)
|
||||
binding?.imageView?.setImageDrawable(image)
|
||||
}
|
||||
}
|
||||
|
||||
fun setTitleImage(image: Drawable?) {
|
||||
this.titleImage = image
|
||||
this.titleImageView?.setImageDrawable(image)
|
||||
binding?.titleImageView?.setImageDrawable(image)
|
||||
}
|
||||
|
||||
fun setSubtitle(text: String?) {
|
||||
this.subtitle = text
|
||||
subtitleTextView?.text = text
|
||||
binding?.subtitleTextView?.text = text
|
||||
}
|
||||
|
||||
fun setTitle(text: String?) {
|
||||
this.title = text
|
||||
titleTextView?.text = text
|
||||
binding?.titleTextView?.text = text
|
||||
}
|
||||
|
||||
fun setDescription(text: String?) {
|
||||
this.description = text
|
||||
descriptionTextView?.text = text
|
||||
binding?.descriptionTextView?.text = text
|
||||
}
|
||||
|
||||
fun setBackgroundColor(color: Int) {
|
||||
this.backgroundColor = color
|
||||
containerView?.setBackgroundColor(color)
|
||||
binding?.containerView?.setBackgroundColor(color)
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue