Implement new party tutorial view

This commit is contained in:
Phillip Thelen 2023-05-18 13:44:37 +02:00
parent 011a4c8097
commit 20dd390e6c
6 changed files with 29 additions and 5 deletions

View file

@ -43,6 +43,7 @@
<Button
android:id="@+id/dismissButton"
style="?android:attr/buttonBarButtonStyle"
android:textSize="16sp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
@ -52,6 +53,7 @@
<Button
android:id="@+id/completeButton"
style="?android:attr/buttonBarButtonStyle"
android:textSize="16sp"
android:layout_width="0px"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"

View file

@ -14,7 +14,8 @@
<string name="tutorial_tasks_complete">That\'s all for now. If you need a reminder, check the FAQ section.</string>
<string name="tutorial_skills">Skills are special abilities that have powerful effects! Tap on a skill to use it. It will cost Mana (the blue bar), which you earn by checking in every day and by completing your real-life tasks. Check out the FAQ in the menu for more info!</string>
<string name="tutorial_party_created">Welcome to your Party! You can find more members from a list of players looking for a Party or invite friends directly to earn the Basi-List Quest Scroll.\n\nVisit Support to learn more about Parties.</string>
<string name="tutorial_party">This is where you and your friends can hold each other accountable to your goals and fight monsters with your tasks!</string>
<string name="tutorial_tavern">Welcome to the Tavern, a public, all-ages chatroom! Here you can chat about productivity and ask questions. Have fun!</string>
<string name="tutorial_stats">Tap the gray button to allocate lots of your stats at once, or tap the arrows to add them one point at a time.</string>
</resources>
</resources>

View file

@ -1391,6 +1391,7 @@
<string name="username_requirements">Can only contain letters a-z, numbers, hyphens, or underscores</string>
<string name="contributor_tiers">Contributor Tiers</string>
<string name="contrib_tier_description">If you see an account with a colored display name and an icon, thats a contributor tier! Tiers are given to people who help around Habitica, whether it be for translation, coding, or just being helpful. The higher the tier, the more the player has contributed.</string>
<string name="visit_faq">Visit FAQ</string>
<plurals name="you_x_others">
<item quantity="zero">You</item>

View file

@ -40,4 +40,9 @@ open class TutorialStep : RealmObject(), BaseMainObject {
val flagPath: String
get() = "flags.tutorial.$tutorialGroup.$identifier"
val linkFAQ : Boolean
get() {
return key == "party"
}
}

View file

@ -4,7 +4,9 @@ import android.content.Context
import android.view.View
import android.view.ViewGroup
import android.widget.FrameLayout
import com.habitrpg.android.habitica.R
import com.habitrpg.android.habitica.databinding.OverlayTutorialBinding
import com.habitrpg.android.habitica.helpers.MainNavigationController
import com.habitrpg.android.habitica.models.TutorialStep
import com.habitrpg.common.habitica.extensions.layoutInflater
@ -31,6 +33,10 @@ class TutorialView(
binding.speechBubbleView.binding.completeButton.setOnClickListener { completeButtonClicked() }
binding.speechBubbleView.binding.dismissButton.setOnClickListener { dismissButtonClicked() }
binding.background.setOnClickListener { backgroundClicked() }
if (step.linkFAQ) {
binding.speechBubbleView.binding.dismissButton.setText(R.string.visit_faq)
}
}
fun setTutorialText(text: String) {
@ -75,10 +81,14 @@ class TutorialView(
}
private fun dismissButtonClicked() {
onReaction.onTutorialDeferred(step)
post {
(parent as? ViewGroup)?.removeView(this)
}
if (step.linkFAQ) {
MainNavigationController.navigate(R.id.FAQOverviewFragment)
} else {
onReaction.onTutorialDeferred(step)
}
}
private fun backgroundClicked() {

View file

@ -74,12 +74,17 @@ class PartyFragment : BaseMainFragment<FragmentViewpagerBinding>() {
viewModel.loadPartyID()
this.tutorialStepIdentifier = "party"
this.tutorialTexts = listOf(getString(R.string.tutorial_party))
viewModel.retrieveGroup {}
}
override fun onResume() {
if (viewModel.isLeader) {
this.tutorialStepIdentifier = "party"
this.tutorialTexts = listOf(getString(R.string.tutorial_party_created))
}
super.onResume()
}
private fun updateGroupUI(group: Group?) {
viewPagerAdapter?.notifyDataSetChanged()