mirror of
https://github.com/sudoxnym/habitica-android.git
synced 2026-04-14 19:56:32 +00:00
update accept guidelines design
This commit is contained in:
parent
86c54b5e6b
commit
9fb3ac7fd6
5 changed files with 55 additions and 24 deletions
|
|
@ -6,14 +6,14 @@
|
|||
android:id="@+id/chatBarContainer"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:paddingLeft="@dimen/spacing_medium"
|
||||
android:paddingRight="@dimen/spacing_medium">
|
||||
android:orientation="vertical">
|
||||
<LinearLayout
|
||||
android:id="@+id/chatBarContent"
|
||||
android:layout_width="match_parent"
|
||||
android:orientation="horizontal"
|
||||
android:layout_height="wrap_content">
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="@dimen/spacing_medium"
|
||||
android:paddingRight="@dimen/spacing_medium">
|
||||
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
android:layout_width="0dp"
|
||||
|
|
@ -70,16 +70,33 @@
|
|||
android:contentDescription="@string/send"/>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
<TextView
|
||||
<LinearLayout
|
||||
android:id="@+id/communityGuidelinesView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/read_community_guidelines"
|
||||
style="@style/Caption2"
|
||||
android:gravity="center"
|
||||
android:textColor="@color/brand_300"
|
||||
android:orientation="vertical"
|
||||
android:background="#cc6133b4"
|
||||
android:paddingStart="@dimen/spacing_large"
|
||||
android:paddingEnd="@dimen/spacing_large"
|
||||
android:paddingTop="@dimen/spacing_large"
|
||||
android:paddingBottom="@dimen/spacing_large"/>
|
||||
android:paddingBottom="@dimen/spacing_large">
|
||||
<TextView
|
||||
android:id="@+id/communityGuidelinesReviewView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/read_community_guidelines"
|
||||
style="@style/Caption3"
|
||||
android:gravity="center"
|
||||
android:textColor="@color/white"
|
||||
android:layout_marginBottom="@dimen/spacing_medium"/>
|
||||
<Button
|
||||
android:id="@+id/communityGuidelinesAcceptButton"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/HabiticaButton.Blue"
|
||||
android:text="@string/i_agree_to_follow_the_guidelines"/>
|
||||
</LinearLayout>
|
||||
|
||||
<Space
|
||||
android:id="@+id/spacing"
|
||||
android:layout_width="match_parent"
|
||||
|
|
|
|||
|
|
@ -584,7 +584,7 @@
|
|||
<string name="empty_description_todos">To-Dos are tasks that only need to be completed once. Add checklists to your To-Dos to increase their value.</string>
|
||||
<string name="empty_title_rewards">You don\'t have any Rewards</string>
|
||||
<string name="reset_walkthrough">Reset Tutorials</string>
|
||||
<string name="read_community_guidelines">Read our Community Guidelines before posting</string>
|
||||
<string name="read_community_guidelines">Review our <u>Community Guidelines</u> before posting</string>
|
||||
<string name="maintenance">Maintenance</string>
|
||||
<string name="reload_content">Reload Content</string>
|
||||
<string name="dailyDueDefaultView">Set Dailies default to ‘due’ tab</string>
|
||||
|
|
@ -895,4 +895,5 @@
|
|||
<string name="invite_to_guild">Invite to Guild</string>
|
||||
<string name="join_guild">Join Guild</string>
|
||||
<string name="garden">Garden</string>
|
||||
<string name="i_agree_to_follow_the_guidelines">I agree to follow the guidelines</string>
|
||||
</resources>
|
||||
|
|
|
|||
|
|
@ -398,6 +398,10 @@
|
|||
<item name="android:background">@drawable/layout_rounded_bg_red</item>
|
||||
</style>
|
||||
|
||||
<style name="HabiticaButton.Blue" parent="HabiticaButton">
|
||||
<item name="android:background">@drawable/layout_rounded_bg_blue</item>
|
||||
</style>
|
||||
|
||||
<style name="SegmentTitle" parent="Headline">
|
||||
<item name="android:layout_marginBottom">@dimen/spacing_medium</item>
|
||||
</style>
|
||||
|
|
|
|||
|
|
@ -104,17 +104,23 @@ class ChatFragment : BaseFragment(), SwipeRefreshLayout.OnRefreshListener {
|
|||
|
||||
viewModel?.getChatMessages()?.subscribe(Consumer<RealmResults<ChatMessage>> { this.setChatMessages(it) }, RxErrorHandler.handleEmptyError())?.let { compositeSubscription.add(it) }
|
||||
|
||||
communityGuidelinesReviewView.setOnClickListener {
|
||||
val i = Intent(Intent.ACTION_VIEW)
|
||||
i.data = "https://habitica.com/static/community-guidelines".toUri()
|
||||
context?.startActivity(i)
|
||||
}
|
||||
communityGuidelinesAcceptButton.setOnClickListener {
|
||||
viewModel?.updateUser("flags.communityGuidelinesAccepted", true)
|
||||
}
|
||||
|
||||
viewModel?.getUserData()?.observe(viewLifecycleOwner, Observer {
|
||||
chatAdapter?.user = it
|
||||
if (it?.flags?.isCommunityGuidelinesAccepted == true) {
|
||||
communityGuidelinesView.visibility = View.GONE
|
||||
chatBarContent.visibility = View.VISIBLE
|
||||
} else {
|
||||
communityGuidelinesView.setOnClickListener { _ ->
|
||||
val i = Intent(Intent.ACTION_VIEW)
|
||||
i.data = "https://habitica.com/static/community-guidelines".toUri()
|
||||
context?.startActivity(i)
|
||||
viewModel?.updateUser("flags.communityGuidelinesAccepted", true)
|
||||
}
|
||||
chatBarContent.visibility = View.GONE
|
||||
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -146,19 +146,22 @@ class ChatListFragment : BaseFragment(), SwipeRefreshLayout.OnRefreshListener {
|
|||
.subscribe(Consumer<RealmResults<ChatMessage>> { this.setChatMessages(it) }, RxErrorHandler.handleEmptyError())
|
||||
}
|
||||
|
||||
communityGuidelinesReviewView.setOnClickListener {
|
||||
val i = Intent(Intent.ACTION_VIEW)
|
||||
i.data = "https://habitica.com/static/community-guidelines".toUri()
|
||||
context?.startActivity(i)
|
||||
}
|
||||
communityGuidelinesAcceptButton.setOnClickListener {
|
||||
userRepository.updateUser(user, "flags.communityGuidelinesAccepted", true).subscribe(Consumer {}, RxErrorHandler.handleEmptyError())
|
||||
}
|
||||
|
||||
compositeSubscription.add(userRepository.getUser().subscribe {user ->
|
||||
if (user?.flags?.isCommunityGuidelinesAccepted == true) {
|
||||
communityGuidelinesView.visibility = View.GONE
|
||||
chatBarContent.visibility = View.VISIBLE
|
||||
} else {
|
||||
chatBarContent.visibility = View.GONE
|
||||
communityGuidelinesView.setOnClickListener {
|
||||
userRepository.updateUser(user, "flags.communityGuidelinesAccepted", true).subscribe(Consumer {
|
||||
val i = Intent(Intent.ACTION_VIEW)
|
||||
i.data = "https://habitica.com/static/community-guidelines".toUri()
|
||||
context?.startActivity(i)
|
||||
}, RxErrorHandler.handleEmptyError())
|
||||
}
|
||||
communityGuidelinesView.visibility = View.VISIBLE
|
||||
}
|
||||
})
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue