mirror of
https://github.com/sudoxnym/habitica-android.git
synced 2026-07-13 17:51:57 +00:00
fix formatting
This commit is contained in:
parent
8dc433e7bf
commit
6d18238df5
22 changed files with 68 additions and 113 deletions
5
Habitica/res/drawable/bottom_sheet_title.xml
Normal file
5
Habitica/res/drawable/bottom_sheet_title.xml
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:shape="rectangle">
|
||||||
|
<solid android:color="@color/window_background" />
|
||||||
|
</shape>
|
||||||
|
|
@ -5,7 +5,8 @@
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
style="@style/BottomMenu"
|
style="@style/BottomMenu"
|
||||||
android:clickable="false">
|
android:clickable="false"
|
||||||
|
android:background="@drawable/rounded_avatar_bg">
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/title_view"
|
android:id="@+id/title_view"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
|
@ -13,7 +14,7 @@
|
||||||
tools:text="Title"
|
tools:text="Title"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
style="@style/Subheader1"
|
style="@style/Subheader1"
|
||||||
android:background="@color/window_background"
|
android:background="@drawable/bottom_sheet_title"
|
||||||
android:padding="8dp"/>
|
android:padding="8dp"/>
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/menu_items"
|
android:id="@+id/menu_items"
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,7 @@ import kotlin.reflect.KMutableProperty1
|
||||||
import kotlin.reflect.full.starProjectedType
|
import kotlin.reflect.full.starProjectedType
|
||||||
import kotlin.reflect.jvm.javaField
|
import kotlin.reflect.jvm.javaField
|
||||||
|
|
||||||
open class HabiticaTestCase: TestCase() {
|
open class HabiticaTestCase : TestCase() {
|
||||||
val gson = GSonFactoryCreator.createGson()
|
val gson = GSonFactoryCreator.createGson()
|
||||||
|
|
||||||
val apiClient: ApiClient = mockk(relaxed = true)
|
val apiClient: ApiClient = mockk(relaxed = true)
|
||||||
|
|
@ -107,7 +107,7 @@ open class HabiticaTestCase: TestCase() {
|
||||||
}
|
}
|
||||||
|
|
||||||
internal fun <T> loadJsonFile(s: String, type: Type): T {
|
internal fun <T> loadJsonFile(s: String, type: Type): T {
|
||||||
val userStream = javaClass.classLoader?.getResourceAsStream("${s}.json")
|
val userStream = javaClass.classLoader?.getResourceAsStream("$s.json")
|
||||||
return gson.fromJson(gson.newJsonReader(InputStreamReader(userStream)), type)
|
return gson.fromJson(gson.newJsonReader(InputStreamReader(userStream)), type)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,6 @@ import io.reactivex.rxjava3.core.Flowable
|
||||||
import org.hamcrest.Description
|
import org.hamcrest.Description
|
||||||
import org.hamcrest.TypeSafeMatcher
|
import org.hamcrest.TypeSafeMatcher
|
||||||
|
|
||||||
|
|
||||||
class Capture<T : View>(val klass: Class<T>) : TypeSafeMatcher<View>(View::class.java) {
|
class Capture<T : View>(val klass: Class<T>) : TypeSafeMatcher<View>(View::class.java) {
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
|
@ -105,7 +104,6 @@ class Capture<T : View>(val klass: Class<T>) : TypeSafeMatcher<View>(View::class
|
||||||
var view: T? = null
|
var view: T? = null
|
||||||
|
|
||||||
override fun describeTo(desc: Description) {
|
override fun describeTo(desc: Description) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun matchesSafely(v: View): Boolean {
|
override fun matchesSafely(v: View): Boolean {
|
||||||
|
|
@ -115,4 +113,4 @@ class Capture<T : View>(val klass: Class<T>) : TypeSafeMatcher<View>(View::class
|
||||||
this.view = v as T
|
this.view = v as T
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,5 +2,4 @@ package com.habitrpg.android.habitica.ui.activities
|
||||||
|
|
||||||
import com.habitrpg.android.habitica.HabiticaTestCase
|
import com.habitrpg.android.habitica.HabiticaTestCase
|
||||||
|
|
||||||
open class ActivityTestCase: HabiticaTestCase() {
|
open class ActivityTestCase : HabiticaTestCase()
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -66,12 +66,12 @@ class MainActivityTest : ActivityTestCase() {
|
||||||
screen.pressBack()
|
screen.pressBack()
|
||||||
screen.pressBack()
|
screen.pressBack()
|
||||||
KButton { withText("Discard") }.click()
|
KButton { withText("Discard") }.click()
|
||||||
KView { withId(R.id.dailies_tab)}.click()
|
KView { withId(R.id.dailies_tab) }.click()
|
||||||
KView { withId(R.id.add_button) }.click()
|
KView { withId(R.id.add_button) }.click()
|
||||||
KView { withText("Create Daily") }.isVisible()
|
KView { withText("Create Daily") }.isVisible()
|
||||||
screen.pressBack()
|
screen.pressBack()
|
||||||
screen.pressBack()
|
screen.pressBack()
|
||||||
KView { withId(R.id.todos_tab)}.click()
|
KView { withId(R.id.todos_tab) }.click()
|
||||||
KView { withId(R.id.add_button) }.click()
|
KView { withId(R.id.add_button) }.click()
|
||||||
KView { withText("Create To Do") }.isVisible()
|
KView { withText("Create To Do") }.isVisible()
|
||||||
}
|
}
|
||||||
|
|
@ -85,7 +85,7 @@ class MainActivityTest : ActivityTestCase() {
|
||||||
KView { withId(R.id.action_filter) }.click()
|
KView { withId(R.id.action_filter) }.click()
|
||||||
KView { withText(R.string.filters) }.isVisible()
|
KView { withText(R.string.filters) }.isVisible()
|
||||||
screen.pressBack()
|
screen.pressBack()
|
||||||
KView { withText(R.string.filters)}.doesNotExist()
|
KView { withText(R.string.filters) }.doesNotExist()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -38,11 +38,10 @@ import org.junit.runner.RunWith
|
||||||
import java.util.Date
|
import java.util.Date
|
||||||
import java.util.UUID
|
import java.util.UUID
|
||||||
|
|
||||||
|
|
||||||
class TaskFormScreen : Screen<TaskFormScreen>() {
|
class TaskFormScreen : Screen<TaskFormScreen>() {
|
||||||
val toolbar = KToolbar { withId(R.id.toolbar) }
|
val toolbar = KToolbar { withId(R.id.toolbar) }
|
||||||
val textEditText = KEditText { withId(R.id.text_edit_text)}
|
val textEditText = KEditText { withId(R.id.text_edit_text) }
|
||||||
val notesEditText = KEditText { withId(R.id.notes_edit_text)}
|
val notesEditText = KEditText { withId(R.id.notes_edit_text) }
|
||||||
val taskDifficultyButtons = KView { withId(R.id.task_difficulty_buttons) }
|
val taskDifficultyButtons = KView { withId(R.id.task_difficulty_buttons) }
|
||||||
val tagsWrapper = KView { withId(R.id.tags_wrapper) }
|
val tagsWrapper = KView { withId(R.id.tags_wrapper) }
|
||||||
}
|
}
|
||||||
|
|
@ -162,7 +161,7 @@ class TaskFormActivityTest : ActivityTestCase() {
|
||||||
screen {
|
screen {
|
||||||
device.activities.isCurrent(TaskFormActivity::class.java)
|
device.activities.isCurrent(TaskFormActivity::class.java)
|
||||||
textEditText.typeText("New Habit")
|
textEditText.typeText("New Habit")
|
||||||
KButton { withId(R.id.action_save)}.click()
|
KButton { withId(R.id.action_save) }.click()
|
||||||
verify(exactly = 1) { taskRepository.createTaskInBackground(any()) }
|
verify(exactly = 1) { taskRepository.createTaskInBackground(any()) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -208,8 +207,8 @@ class TaskFormActivityTest : ActivityTestCase() {
|
||||||
scenario = launchActivity(intent)
|
scenario = launchActivity(intent)
|
||||||
screen {
|
screen {
|
||||||
device.activities.isCurrent(TaskFormActivity::class.java)
|
device.activities.isCurrent(TaskFormActivity::class.java)
|
||||||
KButton { withId(R.id.action_delete)}.click()
|
KButton { withId(R.id.action_delete) }.click()
|
||||||
KButton { withText(R.string.delete_task) }.click()
|
KButton { withText(R.string.delete_task) }.click()
|
||||||
verify(exactly = 1) { taskRepository.deleteTask(task.id!!) }
|
verify(exactly = 1) { taskRepository.deleteTask(task.id!!) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -295,8 +294,8 @@ class TaskFormActivityTest : ActivityTestCase() {
|
||||||
intent.putExtras(bundle)
|
intent.putExtras(bundle)
|
||||||
scenario = launchActivity(intent)
|
scenario = launchActivity(intent)
|
||||||
screen {
|
screen {
|
||||||
KView { withId(R.id.start_date_wrapper)}.click()
|
KView { withId(R.id.start_date_wrapper) }.click()
|
||||||
KDatePickerDialog() perform {
|
KDatePickerDialog() perform {
|
||||||
datePicker.setDate(2021, 10, 2)
|
datePicker.setDate(2021, 10, 2)
|
||||||
okButton.click()
|
okButton.click()
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -25,9 +25,9 @@ class NavigationDrawerScreen : Screen<NavigationDrawerScreen>() {
|
||||||
val recycler: KRecyclerView = KRecyclerView({
|
val recycler: KRecyclerView = KRecyclerView({
|
||||||
withId(R.id.recyclerView)
|
withId(R.id.recyclerView)
|
||||||
}, itemTypeBuilder = {
|
}, itemTypeBuilder = {
|
||||||
itemType(::SectionHeaderItem)
|
itemType(::SectionHeaderItem)
|
||||||
itemType(::MainItem)
|
itemType(::MainItem)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@LargeTest
|
@LargeTest
|
||||||
|
|
@ -60,4 +60,4 @@ internal class NavigationDrawerFragmentTest : FragmentTestCase<NavigationDrawerF
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -24,21 +24,22 @@ import org.junit.Test
|
||||||
private val KTextView.text: CharSequence?
|
private val KTextView.text: CharSequence?
|
||||||
get() {
|
get() {
|
||||||
var string: CharSequence? = null
|
var string: CharSequence? = null
|
||||||
(this.view.perform(object : ViewAction {
|
(
|
||||||
override fun getConstraints(): Matcher<View> {
|
this.view.perform(object : ViewAction {
|
||||||
return isA(TextView::class.java)
|
override fun getConstraints(): Matcher<View> {
|
||||||
}
|
return isA(TextView::class.java)
|
||||||
|
}
|
||||||
|
|
||||||
override fun getDescription(): String {
|
override fun getDescription(): String {
|
||||||
return "getting text from a TextView";
|
return "getting text from a TextView"
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun perform(uiController: UiController?, view: View?) {
|
override fun perform(uiController: UiController?, view: View?) {
|
||||||
val tv = view as TextView
|
val tv = view as TextView
|
||||||
string = tv.text
|
string = tv.text
|
||||||
}
|
}
|
||||||
|
})
|
||||||
}))
|
)
|
||||||
return string
|
return string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -51,8 +52,8 @@ class ItemScreen : Screen<ItemScreen>() {
|
||||||
val recycler: KRecyclerView = KRecyclerView({
|
val recycler: KRecyclerView = KRecyclerView({
|
||||||
withId(R.id.recyclerView)
|
withId(R.id.recyclerView)
|
||||||
}, itemTypeBuilder = {
|
}, itemTypeBuilder = {
|
||||||
itemType(::ItemItem)
|
itemType(::ItemItem)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
internal class ItemRecyclerFragmentTest : FragmentTestCase<ItemRecyclerFragment, FragmentRecyclerviewBinding, ItemScreen>(false) {
|
internal class ItemRecyclerFragmentTest : FragmentTestCase<ItemRecyclerFragment, FragmentRecyclerviewBinding, ItemScreen>(false) {
|
||||||
|
|
@ -91,7 +92,7 @@ internal class ItemRecyclerFragmentTest : FragmentTestCase<ItemRecyclerFragment,
|
||||||
fun doesNotHaveDuplicates() {
|
fun doesNotHaveDuplicates() {
|
||||||
clearMocks(inventoryRepository)
|
clearMocks(inventoryRepository)
|
||||||
every { inventoryRepository.getOwnedItems("food") } answers {
|
every { inventoryRepository.getOwnedItems("food") } answers {
|
||||||
var items = user.items?.food!!.filter { it.numberOwned > 0 }
|
var items = user.items?.food!!.filter { it.numberOwned > 0 }
|
||||||
items = (items + items).sortedBy { it.key }
|
items = (items + items).sortedBy { it.key }
|
||||||
Flowable.just(items)
|
Flowable.just(items)
|
||||||
}
|
}
|
||||||
|
|
@ -110,4 +111,4 @@ internal class ItemRecyclerFragmentTest : FragmentTestCase<ItemRecyclerFragment,
|
||||||
}
|
}
|
||||||
assert(foundItems.distinct().size == foundItems.size)
|
assert(foundItems.distinct().size == foundItems.size)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -14,9 +14,9 @@ class PetDetailScreen : Screen<PetDetailScreen>() {
|
||||||
val recycler: KRecyclerView = KRecyclerView({
|
val recycler: KRecyclerView = KRecyclerView({
|
||||||
withId(R.id.recyclerView)
|
withId(R.id.recyclerView)
|
||||||
}, itemTypeBuilder = {
|
}, itemTypeBuilder = {
|
||||||
itemType(::SectionItem)
|
itemType(::SectionItem)
|
||||||
itemType(::PetItem)
|
itemType(::PetItem)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
internal class PetDetailRecyclerFragmentTest : FragmentTestCase<PetDetailRecyclerFragment, FragmentRecyclerviewBinding, PetDetailScreen>(false) {
|
internal class PetDetailRecyclerFragmentTest : FragmentTestCase<PetDetailRecyclerFragment, FragmentRecyclerviewBinding, PetDetailScreen>(false) {
|
||||||
|
|
@ -34,4 +34,4 @@ internal class PetDetailRecyclerFragmentTest : FragmentTestCase<PetDetailRecycle
|
||||||
}
|
}
|
||||||
|
|
||||||
override val screen = PetDetailScreen()
|
override val screen = PetDetailScreen()
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -32,9 +32,9 @@ class StableScreen : Screen<StableScreen>() {
|
||||||
val recycler: KRecyclerView = KRecyclerView({
|
val recycler: KRecyclerView = KRecyclerView({
|
||||||
withId(R.id.recyclerView)
|
withId(R.id.recyclerView)
|
||||||
}, itemTypeBuilder = {
|
}, itemTypeBuilder = {
|
||||||
itemType(::SectionItem)
|
itemType(::SectionItem)
|
||||||
itemType(::PetItem)
|
itemType(::PetItem)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
internal class StableRecyclerFragmentTest : FragmentTestCase<StableRecyclerFragment, FragmentRecyclerviewBinding, StableScreen>(false) {
|
internal class StableRecyclerFragmentTest : FragmentTestCase<StableRecyclerFragment, FragmentRecyclerviewBinding, StableScreen>(false) {
|
||||||
|
|
@ -145,4 +145,4 @@ internal class StableRecyclerFragmentTest : FragmentTestCase<StableRecyclerFragm
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,6 @@ import io.reactivex.rxjava3.core.Flowable
|
||||||
import org.hamcrest.Matcher
|
import org.hamcrest.Matcher
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
|
|
||||||
|
|
||||||
open class TaskItem(val parent: Matcher<View>) : KRecyclerItem<TaskItem>(parent) {
|
open class TaskItem(val parent: Matcher<View>) : KRecyclerItem<TaskItem>(parent) {
|
||||||
val title = KTextView(parent) { withId(R.id.checkedTextView) }
|
val title = KTextView(parent) { withId(R.id.checkedTextView) }
|
||||||
val notes = KTextView(parent) { withId(R.id.notesTextView) }
|
val notes = KTextView(parent) { withId(R.id.notesTextView) }
|
||||||
|
|
@ -31,8 +30,8 @@ class TaskListScreen : Screen<TaskListScreen>() {
|
||||||
val recycler: KRecyclerView = KRecyclerView({
|
val recycler: KRecyclerView = KRecyclerView({
|
||||||
withId(R.id.recyclerView)
|
withId(R.id.recyclerView)
|
||||||
}, itemTypeBuilder = {
|
}, itemTypeBuilder = {
|
||||||
itemType(::TaskItem)
|
itemType(::TaskItem)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
internal class TaskRecyclerViewFragmentTest : FragmentTestCase<TaskRecyclerViewFragment, FragmentRefreshRecyclerviewBinding, TaskListScreen>(false) {
|
internal class TaskRecyclerViewFragmentTest : FragmentTestCase<TaskRecyclerViewFragment, FragmentRefreshRecyclerviewBinding, TaskListScreen>(false) {
|
||||||
|
|
@ -219,7 +218,6 @@ internal class TaskRecyclerViewFragmentTest : FragmentTestCase<TaskRecyclerViewF
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun completeDaily() {
|
fun completeDaily() {
|
||||||
val dailies = tasks.filter { it.type == TaskType.DAILY }
|
val dailies = tasks.filter { it.type == TaskType.DAILY }
|
||||||
|
|
@ -263,4 +261,4 @@ internal class TaskRecyclerViewFragmentTest : FragmentTestCase<TaskRecyclerViewF
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -24,8 +24,12 @@ open class TutorialStep : RealmObject(), BaseMainObject {
|
||||||
|
|
||||||
val shouldDisplay: Boolean
|
val shouldDisplay: Boolean
|
||||||
get() {
|
get() {
|
||||||
return !this.wasCompleted && (this.displayedOn == null || Date().time - (displayedOn?.time
|
return !this.wasCompleted && (
|
||||||
?: 0) > 86400000)
|
this.displayedOn == null || Date().time - (
|
||||||
|
displayedOn?.time
|
||||||
|
?: 0
|
||||||
|
) > 86400000
|
||||||
|
)
|
||||||
}
|
}
|
||||||
override val realmClass: Class<out RealmModel>
|
override val realmClass: Class<out RealmModel>
|
||||||
get() = TutorialStep::class.java
|
get() = TutorialStep::class.java
|
||||||
|
|
@ -35,5 +39,5 @@ open class TutorialStep : RealmObject(), BaseMainObject {
|
||||||
get() = "key"
|
get() = "key"
|
||||||
|
|
||||||
val flagPath: String
|
val flagPath: String
|
||||||
get() = "flags.tutorial.$tutorialGroup.$identifier"
|
get() = "flags.tutorial.$tutorialGroup.$identifier"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -73,7 +73,7 @@ class AvatarWithBarsViewModel(private val context: Context, private val binding:
|
||||||
if (!stats.isBuffed) {
|
if (!stats.isBuffed) {
|
||||||
binding.buffImageView.visibility = View.GONE
|
binding.buffImageView.visibility = View.GONE
|
||||||
}
|
}
|
||||||
|
|
||||||
if (user is User) {
|
if (user is User) {
|
||||||
binding.currencyView.gold = stats.gp ?: 0.0
|
binding.currencyView.gold = stats.gp ?: 0.0
|
||||||
binding.currencyView.hourglasses = user.hourglassCount.toDouble()
|
binding.currencyView.hourglasses = user.hourglassCount.toDouble()
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,6 @@ package com.habitrpg.android.habitica.ui.adapter.inventory
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.content.res.Resources
|
import android.content.res.Resources
|
||||||
import android.os.Bundle
|
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import androidx.fragment.app.DialogFragment
|
import androidx.fragment.app.DialogFragment
|
||||||
|
|
@ -168,7 +167,7 @@ class ItemRecyclerAdapter(val context: Context, val user: User?) : BaseRecyclerV
|
||||||
menu.addMenuItem(BottomSheetMenuItem(resources.getString(R.string.hatch_egg)))
|
menu.addMenuItem(BottomSheetMenuItem(resources.getString(R.string.hatch_egg)))
|
||||||
} else if (item is QuestContent) {
|
} else if (item is QuestContent) {
|
||||||
menu.addMenuItem(BottomSheetMenuItem(resources.getString(R.string.details)))
|
menu.addMenuItem(BottomSheetMenuItem(resources.getString(R.string.details)))
|
||||||
if (user?.hasParty == true){
|
if (user?.hasParty == true) {
|
||||||
menu.addMenuItem(BottomSheetMenuItem(resources.getString(R.string.invite_party)))
|
menu.addMenuItem(BottomSheetMenuItem(resources.getString(R.string.invite_party)))
|
||||||
} else {
|
} else {
|
||||||
menu.addMenuItem(BottomSheetMenuItem(resources.getString(R.string.create_new_party)))
|
menu.addMenuItem(BottomSheetMenuItem(resources.getString(R.string.create_new_party)))
|
||||||
|
|
@ -201,7 +200,6 @@ class ItemRecyclerAdapter(val context: Context, val user: User?) : BaseRecyclerV
|
||||||
} else {
|
} else {
|
||||||
createNewPartySubject.onNext(true)
|
createNewPartySubject.onNext(true)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
is SpecialItem ->
|
is SpecialItem ->
|
||||||
|
|
|
||||||
|
|
@ -233,7 +233,6 @@ class StableRecyclerAdapter : RecyclerView.Adapter<RecyclerView.ViewHolder>() {
|
||||||
this.ownedTextView.setTextColor(ContextCompat.getColor(context, R.color.white))
|
this.ownedTextView.setTextColor(ContextCompat.getColor(context, R.color.white))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
itemView.contentDescription = "${titleView.text} ${ownedTextView.text}"
|
itemView.contentDescription = "${titleView.text} ${ownedTextView.text}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -71,7 +71,7 @@ abstract class BaseDialogFragment<VB : ViewBinding> : DialogFragment() {
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
.subscribe(
|
.subscribe(
|
||||||
Consumer { step ->
|
Consumer { step ->
|
||||||
if (step.isValid && step.isManaged && step.shouldDisplay()) {
|
if (step.isValid && step.isManaged && step.shouldDisplay) {
|
||||||
val mainActivity = activity as? MainActivity ?: return@Consumer
|
val mainActivity = activity as? MainActivity ?: return@Consumer
|
||||||
mainActivity.displayTutorialStep(step, tutorialTexts, tutorialCanBeDeferred)
|
mainActivity.displayTutorialStep(step, tutorialTexts, tutorialCanBeDeferred)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -73,7 +73,8 @@ abstract class BaseFragment<VB : ViewBinding> : Fragment() {
|
||||||
.firstElement()
|
.firstElement()
|
||||||
.delay(1, TimeUnit.SECONDS)
|
.delay(1, TimeUnit.SECONDS)
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
.subscribe({ step ->
|
.subscribe(
|
||||||
|
{ step ->
|
||||||
if (step.isValid && step.isManaged && step.shouldDisplay) {
|
if (step.isValid && step.isManaged && step.shouldDisplay) {
|
||||||
val mainActivity = activity as? MainActivity ?: return@subscribe
|
val mainActivity = activity as? MainActivity ?: return@subscribe
|
||||||
mainActivity.displayTutorialStep(step, tutorialTexts, tutorialCanBeDeferred)
|
mainActivity.displayTutorialStep(step, tutorialTexts, tutorialCanBeDeferred)
|
||||||
|
|
|
||||||
|
|
@ -247,7 +247,6 @@ class ItemRecyclerFragment : BaseFragment<FragmentItemsBinding>(), SwipeRefreshL
|
||||||
},
|
},
|
||||||
RxErrorHandler.handleEmptyError()
|
RxErrorHandler.handleEmptyError()
|
||||||
)
|
)
|
||||||
|
|
||||||
}
|
}
|
||||||
alert?.addButton(R.string.close, false) { _, _ ->
|
alert?.addButton(R.string.close, false) { _, _ ->
|
||||||
alert.dismiss()
|
alert.dismiss()
|
||||||
|
|
@ -290,7 +289,6 @@ class ItemRecyclerFragment : BaseFragment<FragmentItemsBinding>(), SwipeRefreshL
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
compositeSubscription.add(inventoryRepository.getPets().subscribe({ adapter?.setExistingPets(it) }, RxErrorHandler.handleEmptyError()))
|
compositeSubscription.add(inventoryRepository.getPets().subscribe({ adapter?.setExistingPets(it) }, RxErrorHandler.handleEmptyError()))
|
||||||
compositeSubscription.add(
|
compositeSubscription.add(
|
||||||
|
|
|
||||||
|
|
@ -317,7 +317,7 @@ class TasksFragment : BaseMainFragment<FragmentViewpagerBinding>(), SearchView.O
|
||||||
else -> TaskType.HABIT
|
else -> TaskType.HABIT
|
||||||
}
|
}
|
||||||
val tab = bottomNavigation?.tabWithId(id)
|
val tab = bottomNavigation?.tabWithId(id)
|
||||||
if (step.shouldDisplay()) {
|
if (step.shouldDisplay) {
|
||||||
tab?.badgeCount = 1
|
tab?.badgeCount = 1
|
||||||
activeTutorialFragments.add(taskType)
|
activeTutorialFragments.add(taskType)
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -290,49 +290,6 @@ class TeamBoardFragment : BaseMainFragment<FragmentViewpagerBinding>(), SearchVi
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun updateBottomBarBadges() {
|
|
||||||
if (bottomNavigation == null) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
compositeSubscription.add(
|
|
||||||
tutorialRepository.getTutorialSteps(listOf("habits", "dailies", "todos", "rewards")).subscribe(
|
|
||||||
{ tutorialSteps ->
|
|
||||||
val activeTutorialFragments = ArrayList<TaskType>()
|
|
||||||
for (step in tutorialSteps) {
|
|
||||||
var id = -1
|
|
||||||
val taskType = when (step.identifier) {
|
|
||||||
"habits" -> {
|
|
||||||
id = R.id.habits_tab
|
|
||||||
TaskType.HABIT
|
|
||||||
}
|
|
||||||
"dailies" -> {
|
|
||||||
id = R.id.dailies_tab
|
|
||||||
TaskType.DAILY
|
|
||||||
}
|
|
||||||
"todos" -> {
|
|
||||||
id = R.id.todos_tab
|
|
||||||
TaskType.TODO
|
|
||||||
}
|
|
||||||
"rewards" -> {
|
|
||||||
id = R.id.rewards_tab
|
|
||||||
TaskType.REWARD
|
|
||||||
}
|
|
||||||
else -> TaskType.HABIT
|
|
||||||
}
|
|
||||||
val tab = bottomNavigation?.tabWithId(id)
|
|
||||||
if (step.shouldDisplay()) {
|
|
||||||
tab?.badgeCount = 1
|
|
||||||
activeTutorialFragments.add(taskType)
|
|
||||||
} else {
|
|
||||||
tab?.badgeCount = 0
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
RxErrorHandler.handleEmptyError()
|
|
||||||
)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
// endregion
|
// endregion
|
||||||
|
|
||||||
private fun openNewTaskActivity(type: TaskType) {
|
private fun openNewTaskActivity(type: TaskType) {
|
||||||
|
|
@ -390,7 +347,6 @@ class TeamBoardFragment : BaseMainFragment<FragmentViewpagerBinding>(), SearchVi
|
||||||
val index = indexForTaskType(taskType)
|
val index = indexForTaskType(taskType)
|
||||||
if (binding?.viewPager != null && index != -1) {
|
if (binding?.viewPager != null && index != -1) {
|
||||||
binding?.viewPager?.currentItem = index
|
binding?.viewPager?.currentItem = index
|
||||||
updateBottomBarBadges()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -424,7 +380,6 @@ class TeamBoardFragment : BaseMainFragment<FragmentViewpagerBinding>(), SearchVi
|
||||||
else -> 0
|
else -> 0
|
||||||
}
|
}
|
||||||
binding?.viewPager?.setCurrentItem(newItem, smooth)
|
binding?.viewPager?.setCurrentItem(newItem, smooth)
|
||||||
updateBottomBarBadges()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onAdd(taskType: TaskType) {
|
override fun onAdd(taskType: TaskType) {
|
||||||
|
|
|
||||||
|
|
@ -177,7 +177,6 @@ class ChatRecyclerMessageViewHolder(itemView: View, private var userId: String,
|
||||||
itemView.setPadding(16.dpToPx(context), itemView.paddingTop, itemView.paddingRight, itemView.paddingBottom)
|
itemView.setPadding(16.dpToPx(context), itemView.paddingTop, itemView.paddingRight, itemView.paddingBottom)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
binding.messageText.setParsedMarkdown(chatMessage?.parsedText)
|
binding.messageText.setParsedMarkdown(chatMessage?.parsedText)
|
||||||
if (msg.parsedText == null) {
|
if (msg.parsedText == null) {
|
||||||
binding.messageText.text = chatMessage?.text
|
binding.messageText.text = chatMessage?.text
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue