improve guild list display

This commit is contained in:
Phillip Thelen 2021-02-17 11:03:34 +01:00
parent 5a87a6a5cc
commit 4ea15382f5
10 changed files with 27 additions and 83 deletions

View file

@ -113,14 +113,14 @@ dependencies {
implementation 'com.google.firebase:firebase-core:18.0.2'
implementation 'com.google.firebase:firebase-messaging:21.0.1'
implementation 'com.google.firebase:firebase-config:20.0.3'
implementation 'com.google.firebase:firebase-perf:19.1.0'
implementation 'com.google.firebase:firebase-perf:19.1.1'
implementation 'com.google.android.gms:play-services-auth:19.0.0'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'com.nex3z:flow-layout:1.2.2'
implementation 'androidx.core:core-ktx:1.3.2'
implementation "androidx.lifecycle:lifecycle-extensions:2.2.0"
implementation "androidx.lifecycle:lifecycle-common-java8:2.2.0"
implementation "androidx.lifecycle:lifecycle-common-java8:2.3.0"
implementation 'androidx.navigation:navigation-fragment-ktx:2.3.3'
implementation 'androidx.navigation:navigation-ui-ktx:2.3.3'
implementation "androidx.paging:paging-runtime-ktx:2.1.2"
@ -150,7 +150,7 @@ android {
buildConfigField "String", "TESTING_LEVEL", "\"production\""
resConfigs "en", "bg", "de", "en-rGB", "es", "fr", "hr-rHR", "in", "it", "iw", "ja", "ko", "lt", "nl", "pl", "pt-rBR", "pt-rPT", "ru", "tr", "zh", "zh-rTW"
versionCode 2820
versionCode 2824
versionName "3.2"
}

View file

@ -101,37 +101,10 @@
android:layout_height="1dp"
android:background="@color/black_10_alpha"/>
<LinearLayout
android:id="@+id/quest_participant_response_wrapper"
android:id="@+id/quest_response_wrapper"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:visibility="gone"
android:gravity="center_vertical"
android:padding="@dimen/content_border">
<Button
android:id="@+id/quest_accept_button"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:text="@string/quest_accept"
style="@style/HabiticaButton.Green"
android:layout_marginEnd="16dp" />
<Button
android:id="@+id/quest_reject_button"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:text="@string/quest_reject"
style="@style/HabiticaButton.Red"/>
</LinearLayout>
<LinearLayout
android:id="@+id/quest_leader_response_wrapper"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:visibility="gone"
android:gravity="center_vertical"
android:padding="@dimen/content_border">
<Button

View file

@ -240,7 +240,7 @@
<string name="outfit_weapon">Main-Hand</string>
<string name="wear_costume">Wear Costume</string>
<string name="equipped">Equipped</string>
<string name="quest_cancel_message">Are you sure you want to cancel this quest? All invitation acceptances will be lost. The quest owner will retain possession of the quest scroll.</string>
<string name="quest_cancel_message">Are you sure you want to cancel this Quest? Canceling the Quest will cancel all accepted and pending invitations. The Quest will be returned to the owners inventory.</string>
<string name="quest_begin_message">Are you sure? Only %1$d of your %2$d party members have joined this quest! Quests start automatically when all players have joined or rejected the invitation.</string>
<string name="ago_1month">1 month ago</string>
<string name="ago_months">%d months ago</string>
@ -548,7 +548,7 @@
<string name="participants">Participants</string>
<string name="invitations">Invitations</string>
<string name="quest_leader_header">Started by %s</string>
<string name="quest_abort_message">Are you sure you want to abort this mission? It will abort it for everyone in your party and all progress will be lost. The quest scroll will be returned to the quest owner.</string>
<string name="quest_abort_message">Are you sure you want to cancel this Quest? All progress will be lost. The Quest will be returned to the owners inventory.</string>
<string name="reloading_content">Reloading Content</string>
<string name="reloaded_content">Reloaded Content</string>
<string name="thousand_abbrev">k</string>
@ -1140,4 +1140,6 @@
<string name="team_information">Team Information</string>
<string name="mystery_item_title">You open the Mystery Box and find…</string>
<string name="cant_like_own_message">Can\'t like your own messages</string>
<string name="quest_leave_message">Are you sure you want to leave the Quest? All your progress will be lost.</string>
<string name="quest_leave_message_nostart">Are you sure you want to leave the Quest? You won\'t be able to participate.</string>
</resources>

View file

@ -20,6 +20,7 @@ import com.habitrpg.android.habitica.helpers.NumberAbbreviator
import com.habitrpg.android.habitica.helpers.RxErrorHandler
import com.habitrpg.android.habitica.models.social.Group
import com.habitrpg.android.habitica.ui.adapter.BaseRecyclerViewAdapter
import com.habitrpg.android.habitica.ui.helpers.EmojiParser
import com.habitrpg.android.habitica.ui.helpers.setMarkdown
import com.habitrpg.android.habitica.ui.views.HabiticaIcons
import com.habitrpg.android.habitica.ui.views.HabiticaIconsHelper
@ -127,7 +128,7 @@ class GuildListAdapter(private val onlyShowUsersGuilds: Boolean) : BaseRecyclerV
else -> 0
}
binding.memberCountTextView.text = NumberAbbreviator.abbreviate(itemView.context, guild.memberCount.toDouble(), number)
binding.descriptionTextView.setMarkdown(guild.summary)
binding.descriptionTextView.text = EmojiParser.parseEmojis(guild.summary)
binding.descriptionTextView.setOnClickListener {
itemView.callOnClick()
}

View file

@ -63,8 +63,6 @@ class QuestDetailFragment : BaseMainFragment<FragmentQuestDetailBinding>() {
showsBackButton = true
super.onViewCreated(view, savedInstanceState)
binding?.questAcceptButton?.setOnClickListener { onQuestAccept() }
binding?.questRejectButton?.setOnClickListener { onQuestReject() }
binding?.questBeginButton?.setOnClickListener { onQuestBegin() }
binding?.questCancelButton?.setOnClickListener { onQuestCancel() }
binding?.questLeaveButton?.setOnClickListener { onQuestLeave() }
@ -105,27 +103,22 @@ class QuestDetailFragment : BaseMainFragment<FragmentQuestDetailBinding>() {
}
}, RxErrorHandler.handleEmptyError()))
if (binding?.questLeaderResponseWrapper != null) {
if (showParticipatantButtons()) {
binding?.questLeaderResponseWrapper?.visibility = View.GONE
binding?.questParticipantResponseWrapper?.visibility = View.VISIBLE
} else if (showLeaderButtons()) {
binding?.questParticipantResponseWrapper?.visibility = View.GONE
binding?.questLeaderResponseWrapper?.visibility = View.VISIBLE
if (binding?.questResponseWrapper != null) {
if (userId != party?.quest?.leader && showParticipatantButtons()) {
binding?.questLeaveButton?.visibility = View.VISIBLE
} else {
binding?.questLeaveButton?.visibility = View.GONE
}
if (showLeaderButtons()) {
binding?.questCancelButton?.visibility = View.VISIBLE
if (isQuestActive) {
if (userId != party?.quest?.leader) {
binding?.questLeaveButton?.visibility = View.VISIBLE
} else {
binding?.questLeaveButton?.visibility = View.GONE
}
binding?.questBeginButton?.visibility = View.GONE
} else {
binding?.questBeginButton?.visibility = View.VISIBLE
}
} else {
binding?.questLeaderResponseWrapper?.visibility = View.GONE
binding?.questParticipantResponseWrapper?.visibility = View.GONE
binding?.questCancelButton?.visibility = View.GONE
binding?.questBeginButton?.visibility = View.GONE
}
}
}
@ -137,7 +130,7 @@ class QuestDetailFragment : BaseMainFragment<FragmentQuestDetailBinding>() {
private fun showParticipatantButtons(): Boolean {
return if (user?.party?.quest == null) {
false
} else !isQuestActive && user?.party?.quest?.RSVPNeeded == true
} else party?.quest?.participants?.find { it.id == user?.id } != null
}
@ -212,19 +205,6 @@ class QuestDetailFragment : BaseMainFragment<FragmentQuestDetailBinding>() {
super.onDestroyView()
}
private fun onQuestAccept() {
party?.id?.let { partyID ->
socialRepository.acceptQuest(user, partyID).subscribe({ }, RxErrorHandler.handleEmptyError())
}
}
private fun onQuestReject() {
party?.id?.let { partyID ->
socialRepository.rejectQuest(user, partyID).subscribe({ }, RxErrorHandler.handleEmptyError())
}
}
private fun onQuestBegin() {
val context = context
if (context != null) {
@ -245,7 +225,6 @@ class QuestDetailFragment : BaseMainFragment<FragmentQuestDetailBinding>() {
private fun onQuestCancel() {
context?.let {
if (isQuestActive) {
val builder = AlertDialog.Builder(getActivity())
.setMessage(R.string.quest_abort_message)
.setPositiveButton(R.string.yes) { _, _ ->
@ -276,12 +255,13 @@ class QuestDetailFragment : BaseMainFragment<FragmentQuestDetailBinding>() {
private fun onQuestLeave() {
val builder = AlertDialog.Builder(getActivity())
.setMessage(R.string.quest_abort_message)
.setMessage(if (quest?.active == true) R.string.quest_leave_message else R.string.quest_leave_message_nostart)
.setPositiveButton(R.string.yes) { _, _ ->
party?.id?.let { partyID ->
@Suppress("DEPRECATION")
socialRepository.leaveQuest(partyID)
.flatMap { userRepository.retrieveUser() }
.flatMap { socialRepository.retrieveGroup(partyID) }
.subscribe({ getActivity()?.supportFragmentManager?.popBackStack() }, RxErrorHandler.handleEmptyError())
}
}.setNegativeButton(R.string.no) { _, _ -> }

View file

@ -362,8 +362,6 @@ class PartyDetailFragment : BaseFragment<FragmentPartyDetailBinding>() {
}
private fun questDetailButtonClicked() {
viewModel?.getGroupData()?.value?.let { party ->
MainNavigationController.navigate(PartyFragmentDirections.openQuestDetail())
}
MainNavigationController.navigate(PartyFragmentDirections.openQuestDetail())
}
}

View file

@ -39,13 +39,6 @@ public class HabiticaIcons {
private static class GlobalCache {
static PaintCodeBitmap rageStrikeNPC = new PaintCodeBitmap();
static PorterDuffXfermode blendModeSourceIn = new PorterDuffXfermode(PorterDuff.Mode.SRC_IN);
static Typeface.Builder helveticaNeue = null;
private static void initializeTypefaceBuilders(AssetManager assetManager) {
if (GlobalCache.helveticaNeue == null) {
GlobalCache.helveticaNeue = new Typeface.Builder(assetManager, "HelveticaNeue.ttc");
}
}
}
// Resizing Behavior
@ -9846,8 +9839,7 @@ public class HabiticaIcons {
Stack<Matrix> currentTransformation = new Stack<Matrix>();
currentTransformation.push(new Matrix());
Paint paint = CacheForGuildCrest.paint;
GlobalCache.initializeTypefaceBuilders(context.getAssets());
// Local Colors
int crestSilver5 = Color.argb(255, 141, 141, 141);
int crestBronze3 = Color.argb(255, 179, 98, 19);
@ -10334,8 +10326,6 @@ public class HabiticaIcons {
labelTextPaint.reset();
labelTextPaint.setFlags(Paint.ANTI_ALIAS_FLAG);
labelTextPaint.setColor(crestColor5);
GlobalCache.helveticaNeue.setTtcIndex(0);
labelTextPaint.setTypeface(GlobalCache.helveticaNeue.build());
labelTextPaint.setTextSize(12f);
StaticLayout labelStaticLayout = CacheForGuildCrest.labelStaticLayout.get((int) labelRect.width(), Layout.Alignment.ALIGN_CENTER, memberCountLabel, labelTextPaint);
canvas.save();

View file

@ -10,7 +10,7 @@
{
"type": "SINGLE",
"filters": [],
"versionCode": 2813,
"versionCode": 2824,
"versionName": "3.2",
"outputFile": "Habitica-staff-release.apk"
}

View file

@ -1,7 +1,7 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = '1.4.21'
ext.kotlin_version = '1.4.30'
ext.build_tools_version = '29.0.0'
ext.sdk_version = 30
@ -14,7 +14,7 @@ buildscript {
classpath 'com.android.tools.build:gradle:4.1.2'
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
classpath 'com.google.gms:google-services:4.3.5'
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.4.1'
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.5.0'
classpath "io.realm:realm-gradle-plugin:10.3.0"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "io.gitlab.arturbosch.detekt:detekt-gradle-plugin:1.1.0"