Improve task list display
|
|
@ -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 4000
|
||||
versionCode app_version_code
|
||||
versionName app_version_name
|
||||
|
||||
targetSdkVersion target_sdk
|
||||
|
|
@ -212,22 +212,26 @@ android {
|
|||
dimension "buildType"
|
||||
buildConfigField "String", "TESTING_LEVEL", "\"staff\""
|
||||
resValue "string", "app_name", "Habitica Staff"
|
||||
versionCode app_version_code + 6
|
||||
}
|
||||
|
||||
alpha {
|
||||
dimension "buildType"
|
||||
buildConfigField "String", "TESTING_LEVEL", "\"alpha\""
|
||||
resValue "string", "app_name", "Habitica Alpha"
|
||||
versionCode app_version_code + 4
|
||||
}
|
||||
|
||||
beta {
|
||||
buildConfigField "String", "TESTING_LEVEL", "\"beta\""
|
||||
dimension "buildType"
|
||||
versionCode app_version_code + 2
|
||||
}
|
||||
|
||||
prod {
|
||||
buildConfigField "String", "TESTING_LEVEL", "\"production\""
|
||||
dimension "buildType"
|
||||
versionCode app_version_code
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ class ChallengeRepositoryImpl(
|
|||
|
||||
for ((key, value) in stringListMap) {
|
||||
val taskIdList = value.map { t -> t.id ?: "" }
|
||||
|
||||
if (key == null) continue
|
||||
when (key) {
|
||||
TaskType.HABIT -> tasksOrder.habits = taskIdList
|
||||
TaskType.DAILY -> tasksOrder.dailys = taskIdList
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
package com.habitrpg.android.habitica.interactors
|
||||
|
||||
import com.habitrpg.common.habitica.models.responses.TaskDirection
|
||||
import com.habitrpg.common.habitica.models.responses.TaskDirectionData
|
||||
import com.habitrpg.android.habitica.models.tasks.Task
|
||||
import com.habitrpg.common.habitica.models.tasks.TaskType
|
||||
import com.habitrpg.android.habitica.models.user.Stats
|
||||
import com.habitrpg.android.habitica.models.user.User
|
||||
import com.habitrpg.common.habitica.models.responses.TaskDirection
|
||||
import com.habitrpg.common.habitica.models.responses.TaskDirectionData
|
||||
import com.habitrpg.common.habitica.models.tasks.TaskType
|
||||
import kotlin.math.min
|
||||
import kotlin.math.pow
|
||||
import kotlin.math.roundToLong
|
||||
|
|
@ -46,6 +46,9 @@ class ScoreTaskLocallyInteractor {
|
|||
private fun scoreToDo(user: User, task: Task, direction: TaskDirection) {
|
||||
}
|
||||
|
||||
private fun scoreReward(user: User, task: Task, direction: TaskDirection) {
|
||||
}
|
||||
|
||||
fun score(user: User, task: Task, direction: TaskDirection): TaskDirectionData? {
|
||||
return if (task.type == TaskType.HABIT || direction == TaskDirection.UP) {
|
||||
val stats = user.stats ?: return null
|
||||
|
|
@ -67,14 +70,16 @@ class ScoreTaskLocallyInteractor {
|
|||
TaskType.HABIT -> scoreHabit(user, task, direction)
|
||||
TaskType.DAILY -> scoreDaily(user, task, direction)
|
||||
TaskType.TODO -> scoreToDo(user, task, direction)
|
||||
TaskType.REWARD -> scoreReward(user, task, direction)
|
||||
else -> {}
|
||||
}
|
||||
|
||||
if (result.hp <= 0.0) {
|
||||
result.hp = 0.0
|
||||
}
|
||||
if (result.exp >= stats.toNextLevel?.toDouble() ?: 0.0) {
|
||||
if (result.exp >= (stats.toNextLevel?.toDouble() ?: 0.0)) {
|
||||
result.exp = result.exp - (stats.toNextLevel?.toDouble() ?: 0.0)
|
||||
result.lvl = user.stats?.lvl ?: 0 + 1
|
||||
result.lvl = (user.stats?.lvl ?: 0) + 1
|
||||
result.hp = 50.0
|
||||
} else {
|
||||
result.lvl = user.stats?.lvl ?: 0
|
||||
|
|
|
|||
|
|
@ -29,7 +29,6 @@ import java.util.Date
|
|||
import java.util.GregorianCalendar
|
||||
|
||||
open class Task : RealmObject, BaseMainObject, Parcelable {
|
||||
|
||||
override val realmClass: Class<Task>
|
||||
get() = Task::class.java
|
||||
override val primaryIdentifier: String?
|
||||
|
|
@ -109,6 +108,21 @@ open class Task : RealmObject, BaseMainObject, Parcelable {
|
|||
val completedChecklistCount: Int
|
||||
get() = checklist?.count { it.completed } ?: 0
|
||||
|
||||
val streakString: String?
|
||||
get() {
|
||||
return if (counterUp != null && (counterUp ?: 0) > 0 && counterDown != null && (counterDown ?: 0) > 0) {
|
||||
"+" + counterUp.toString() + " | -" + counterDown?.toString()
|
||||
} else if (counterUp != null && (counterUp ?: 0) > 0) {
|
||||
"+" + counterUp.toString()
|
||||
} else if (counterDown != null && (counterDown ?: 0) > 0) {
|
||||
"-" + counterDown.toString()
|
||||
} else if ((streak ?: 0) > 0) {
|
||||
return streak.toString()
|
||||
} else {
|
||||
null
|
||||
}
|
||||
}
|
||||
|
||||
val extraLightTaskColor: Int
|
||||
get() {
|
||||
return when {
|
||||
|
|
|
|||
|
|
@ -496,7 +496,7 @@ open class MainActivity : BaseActivity(), SnackbarActivity {
|
|||
|
||||
private fun checkMaintenance() {
|
||||
viewModel.ifNeedsMaintenance { maintenanceResponse ->
|
||||
if (maintenanceResponse.activeMaintenance) {
|
||||
if (maintenanceResponse.activeMaintenance == true) {
|
||||
val intent = createMaintenanceIntent(maintenanceResponse, false)
|
||||
startActivity(intent)
|
||||
} else {
|
||||
|
|
@ -504,7 +504,7 @@ open class MainActivity : BaseActivity(), SnackbarActivity {
|
|||
try {
|
||||
val packageInfo = packageManager.getPackageInfo(packageName, 0)
|
||||
@Suppress("DEPRECATION")
|
||||
if (packageInfo.versionCode < maintenanceResponse.minBuild) {
|
||||
if (packageInfo.versionCode < (maintenanceResponse.minBuild ?: 0)) {
|
||||
val intent = createMaintenanceIntent(maintenanceResponse, true)
|
||||
startActivity(intent)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ class MaintenanceActivity : BaseActivity() {
|
|||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(
|
||||
{ maintenanceResponse ->
|
||||
if (!maintenanceResponse.activeMaintenance) {
|
||||
if (maintenanceResponse.activeMaintenance == false) {
|
||||
finish()
|
||||
}
|
||||
},
|
||||
|
|
|
|||
|
|
@ -24,21 +24,21 @@ import com.habitrpg.android.habitica.helpers.RxErrorHandler
|
|||
import com.habitrpg.android.habitica.models.members.Member
|
||||
import com.habitrpg.android.habitica.models.social.Challenge
|
||||
import com.habitrpg.android.habitica.models.tasks.Task
|
||||
import com.habitrpg.common.habitica.models.tasks.TaskType
|
||||
import com.habitrpg.android.habitica.ui.activities.ChallengeFormActivity
|
||||
import com.habitrpg.android.habitica.ui.activities.FullProfileActivity
|
||||
import com.habitrpg.android.habitica.ui.fragments.BaseMainFragment
|
||||
import com.habitrpg.common.habitica.helpers.EmojiParser
|
||||
import com.habitrpg.common.habitica.helpers.setMarkdown
|
||||
import com.habitrpg.android.habitica.ui.viewHolders.tasks.DailyViewHolder
|
||||
import com.habitrpg.android.habitica.ui.viewHolders.tasks.HabitViewHolder
|
||||
import com.habitrpg.android.habitica.ui.viewHolders.tasks.RewardViewHolder
|
||||
import com.habitrpg.android.habitica.ui.viewHolders.tasks.TodoViewHolder
|
||||
import com.habitrpg.android.habitica.ui.viewmodels.MainUserViewModel
|
||||
import com.habitrpg.common.habitica.views.HabiticaIconsHelper
|
||||
import com.habitrpg.android.habitica.ui.views.dialogs.HabiticaAlertDialog
|
||||
import javax.inject.Inject
|
||||
import com.habitrpg.common.habitica.helpers.EmojiParser
|
||||
import com.habitrpg.common.habitica.helpers.setMarkdown
|
||||
import com.habitrpg.common.habitica.models.tasks.TaskType
|
||||
import com.habitrpg.common.habitica.views.HabiticaIconsHelper
|
||||
import retrofit2.HttpException
|
||||
import javax.inject.Inject
|
||||
|
||||
class ChallengeDetailFragment : BaseMainFragment<FragmentChallengeDetailBinding>() {
|
||||
|
||||
|
|
@ -117,7 +117,8 @@ class ChallengeDetailFragment : BaseMainFragment<FragmentChallengeDetailBinding>
|
|||
val rewards = ArrayList<Task>()
|
||||
|
||||
for (entry in taskList) {
|
||||
when (entry.type) {
|
||||
val type = entry.type ?: continue
|
||||
when (type) {
|
||||
TaskType.TODO -> todos.add(entry)
|
||||
TaskType.HABIT -> habits.add(entry)
|
||||
TaskType.DAILY -> dailies.add(entry)
|
||||
|
|
|
|||
|
|
@ -28,10 +28,7 @@ import com.habitrpg.android.habitica.helpers.MainNavigationController
|
|||
import com.habitrpg.android.habitica.helpers.NotificationsManager
|
||||
import com.habitrpg.android.habitica.helpers.RxErrorHandler
|
||||
import com.habitrpg.android.habitica.helpers.SoundManager
|
||||
import com.habitrpg.common.habitica.models.responses.TaskDirection
|
||||
import com.habitrpg.common.habitica.models.responses.TaskScoringResult
|
||||
import com.habitrpg.android.habitica.models.tasks.Task
|
||||
import com.habitrpg.common.habitica.models.tasks.TaskType
|
||||
import com.habitrpg.android.habitica.ui.activities.MainActivity
|
||||
import com.habitrpg.android.habitica.ui.activities.TaskFormActivity
|
||||
import com.habitrpg.android.habitica.ui.adapter.BaseRecyclerViewAdapter
|
||||
|
|
@ -45,9 +42,12 @@ import com.habitrpg.android.habitica.ui.helpers.EmptyItem
|
|||
import com.habitrpg.android.habitica.ui.helpers.SafeDefaultItemAnimator
|
||||
import com.habitrpg.android.habitica.ui.viewHolders.tasks.BaseTaskViewHolder
|
||||
import com.habitrpg.android.habitica.ui.viewmodels.TasksViewModel
|
||||
import com.habitrpg.common.habitica.views.HabiticaIconsHelper
|
||||
import com.habitrpg.android.habitica.ui.views.HabiticaSnackbar
|
||||
import com.habitrpg.android.habitica.ui.views.dialogs.HabiticaAlertDialog
|
||||
import com.habitrpg.common.habitica.models.responses.TaskDirection
|
||||
import com.habitrpg.common.habitica.models.responses.TaskScoringResult
|
||||
import com.habitrpg.common.habitica.models.tasks.TaskType
|
||||
import com.habitrpg.common.habitica.views.HabiticaIconsHelper
|
||||
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers
|
||||
import io.reactivex.rxjava3.disposables.CompositeDisposable
|
||||
import kotlinx.coroutines.Job
|
||||
|
|
@ -471,6 +471,7 @@ open class TaskRecyclerViewFragment : BaseFragment<FragmentRefreshRecyclerviewBi
|
|||
viewModel?.setActiveFilter(TaskType.DAILY, Task.FILTER_ACTIVE)
|
||||
}
|
||||
}
|
||||
else -> {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -534,6 +535,10 @@ open class TaskRecyclerViewFragment : BaseFragment<FragmentRefreshRecyclerviewBi
|
|||
fragment.tutorialStepIdentifier = "todos"
|
||||
tutorialTexts = listOf(context.getString(R.string.tutorial_todos_1), context.getString(R.string.tutorial_todos_2))
|
||||
}
|
||||
TaskType.REWARD -> {
|
||||
fragment.tutorialStepIdentifier = "rewards"
|
||||
tutorialTexts = listOf(context.getString(R.string.tutorial_rewards_1), context.getString(R.string.tutorial_rewards_2))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -7,8 +7,8 @@ import android.widget.FrameLayout
|
|||
import android.widget.ImageView
|
||||
import androidx.core.content.ContextCompat
|
||||
import com.habitrpg.android.habitica.R
|
||||
import com.habitrpg.common.habitica.models.responses.TaskDirection
|
||||
import com.habitrpg.android.habitica.models.tasks.Task
|
||||
import com.habitrpg.common.habitica.models.responses.TaskDirection
|
||||
|
||||
class HabitViewHolder(
|
||||
itemView: View,
|
||||
|
|
@ -110,15 +110,8 @@ class HabitViewHolder(
|
|||
this.btnMinus.isClickable = false
|
||||
}
|
||||
|
||||
var streakString = ""
|
||||
if (data.counterUp != null && data.counterUp ?: 0 > 0 && data.counterDown != null && data.counterDown ?: 0 > 0) {
|
||||
streakString = streakString + "+" + data.counterUp.toString() + " | -" + data.counterDown?.toString()
|
||||
} else if (data.counterUp != null && data.counterUp ?: 0 > 0) {
|
||||
streakString = streakString + "+" + data.counterUp.toString()
|
||||
} else if (data.counterDown != null && data.counterDown ?: 0 > 0) {
|
||||
streakString = streakString + "-" + data.counterDown.toString()
|
||||
}
|
||||
if (streakString.isNotEmpty()) {
|
||||
val streakString = task?.streakString
|
||||
if (streakString?.isNotEmpty() == true) {
|
||||
streakTextView.text = streakString
|
||||
streakTextView.visibility = View.VISIBLE
|
||||
streakIconView.visibility = View.VISIBLE
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ import android.content.SharedPreferences
|
|||
import androidx.core.content.edit
|
||||
import androidx.lifecycle.viewModelScope
|
||||
import com.habitrpg.android.habitica.R
|
||||
import com.habitrpg.common.habitica.api.HostConfig
|
||||
import com.habitrpg.android.habitica.api.MaintenanceApiService
|
||||
import com.habitrpg.android.habitica.components.UserComponent
|
||||
import com.habitrpg.android.habitica.data.ContentRepository
|
||||
|
|
@ -16,9 +15,10 @@ import com.habitrpg.android.habitica.helpers.TaskAlarmManager
|
|||
import com.habitrpg.android.habitica.helpers.notifications.PushNotificationManager
|
||||
import com.habitrpg.android.habitica.models.TutorialStep
|
||||
import com.habitrpg.android.habitica.models.inventory.Egg
|
||||
import com.habitrpg.common.habitica.models.responses.MaintenanceResponse
|
||||
import com.habitrpg.android.habitica.proxy.AnalyticsManager
|
||||
import com.habitrpg.android.habitica.ui.TutorialView
|
||||
import com.habitrpg.common.habitica.api.HostConfig
|
||||
import com.habitrpg.common.habitica.models.responses.MaintenanceResponse
|
||||
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers
|
||||
import io.reactivex.rxjava3.schedulers.Schedulers
|
||||
import io.realm.kotlin.isValid
|
||||
|
|
@ -136,7 +136,7 @@ class MainActivityViewModel : BaseViewModel(), TutorialView.OnTutorialReaction {
|
|||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(
|
||||
{ maintenanceResponse ->
|
||||
if (maintenanceResponse == null) {
|
||||
if (maintenanceResponse.activeMaintenance == null) {
|
||||
return@subscribe
|
||||
}
|
||||
onResult(maintenanceResponse)
|
||||
|
|
|
|||
|
|
@ -63,6 +63,9 @@ class TaskFilterDialog(context: Context, component: UserComponent?) : HabiticaBo
|
|||
binding.secondTaskFilter.setText(R.string.dated)
|
||||
binding.thirdTaskFilter.setText(R.string.completed)
|
||||
}
|
||||
TaskType.REWARD -> {
|
||||
|
||||
}
|
||||
}
|
||||
setActiveFilter(viewModel.getActiveFilter(value))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -184,6 +184,9 @@ class TaskSerializer : JsonSerializer<Task>, JsonDeserializer<Task> {
|
|||
}
|
||||
obj.addProperty("completed", task.completed)
|
||||
}
|
||||
else -> {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return obj
|
||||
|
|
|
|||
|
|
@ -4,9 +4,10 @@ buildscript {
|
|||
ext {
|
||||
target_sdk = 32
|
||||
app_version_name = '4.0'
|
||||
app_version_code = 4010
|
||||
|
||||
|
||||
kotlin_version = '1.6.21'
|
||||
kotlin_version = '1.7.0'
|
||||
core_ktx_version = '1.8.0'
|
||||
appcompat_version = '1.4.2'
|
||||
lifecycle_version = '2.4.1'
|
||||
|
|
@ -37,7 +38,7 @@ buildscript {
|
|||
classpath "io.realm:realm-gradle-plugin:10.10.1"
|
||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||
classpath "io.gitlab.arturbosch.detekt:detekt-gradle-plugin:1.19.0"
|
||||
classpath "androidx.navigation:navigation-safe-args-gradle-plugin:2.5.0-rc01"
|
||||
classpath "androidx.navigation:navigation-safe-args-gradle-plugin:2.5.0-rc02"
|
||||
classpath 'com.google.firebase:perf-plugin:1.4.1'
|
||||
classpath "com.google.dagger:hilt-android-gradle-plugin:$daggerhilt_version"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,10 +0,0 @@
|
|||
package com.habitrpg.common.habitica.models.responses;
|
||||
|
||||
public class MaintenanceResponse {
|
||||
|
||||
public Boolean activeMaintenance;
|
||||
public Integer minBuild;
|
||||
public String title;
|
||||
public String imageUrl;
|
||||
public String description;
|
||||
}
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
package com.habitrpg.common.habitica.models.responses
|
||||
|
||||
class MaintenanceResponse {
|
||||
var activeMaintenance: Boolean? = null
|
||||
var minBuild: Int? = null
|
||||
var title: String? = null
|
||||
var imageUrl: String? = null
|
||||
var description: String? = null
|
||||
}
|
||||
|
Before Width: | Height: | Size: 214 B After Width: | Height: | Size: 214 B |
|
Before Width: | Height: | Size: 660 B After Width: | Height: | Size: 660 B |
|
Before Width: | Height: | Size: 189 B After Width: | Height: | Size: 189 B |
|
Before Width: | Height: | Size: 262 B After Width: | Height: | Size: 262 B |
|
Before Width: | Height: | Size: 211 B After Width: | Height: | Size: 211 B |
|
Before Width: | Height: | Size: 159 B After Width: | Height: | Size: 159 B |
|
Before Width: | Height: | Size: 479 B After Width: | Height: | Size: 479 B |
|
Before Width: | Height: | Size: 168 B After Width: | Height: | Size: 168 B |
|
Before Width: | Height: | Size: 194 B After Width: | Height: | Size: 194 B |
|
Before Width: | Height: | Size: 142 B After Width: | Height: | Size: 142 B |
|
Before Width: | Height: | Size: 217 B After Width: | Height: | Size: 217 B |
|
Before Width: | Height: | Size: 887 B After Width: | Height: | Size: 887 B |
|
Before Width: | Height: | Size: 228 B After Width: | Height: | Size: 228 B |
|
Before Width: | Height: | Size: 320 B After Width: | Height: | Size: 320 B |
|
Before Width: | Height: | Size: 230 B After Width: | Height: | Size: 230 B |
|
Before Width: | Height: | Size: 291 B After Width: | Height: | Size: 291 B |
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 284 B After Width: | Height: | Size: 284 B |
|
Before Width: | Height: | Size: 453 B After Width: | Height: | Size: 453 B |
|
Before Width: | Height: | Size: 322 B After Width: | Height: | Size: 322 B |
|
|
@ -13,7 +13,7 @@ android {
|
|||
applicationId "com.habitrpg.android.habitica"
|
||||
minSdk 26
|
||||
targetSdk target_sdk
|
||||
versionCode 4001
|
||||
versionCode app_version_code + 1
|
||||
versionName app_version_name
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -92,6 +92,21 @@ open class Task constructor(): Parcelable {
|
|||
val completedChecklistCount: Int
|
||||
get() = checklist?.count { it.completed } ?: 0
|
||||
|
||||
val streakString: String?
|
||||
get() {
|
||||
return if (counterUp != null && (counterUp ?: 0) > 0 && counterDown != null && (counterDown ?: 0) > 0) {
|
||||
"+" + counterUp.toString() + " | -" + counterDown?.toString()
|
||||
} else if (counterUp != null && (counterUp ?: 0) > 0) {
|
||||
"+" + counterUp.toString()
|
||||
} else if (counterDown != null && (counterDown ?: 0) > 0) {
|
||||
"-" + counterDown.toString()
|
||||
} else if ((streak ?: 0) > 0) {
|
||||
return streak.toString()
|
||||
} else {
|
||||
null
|
||||
}
|
||||
}
|
||||
|
||||
val extraLightTaskColor: Int
|
||||
get() {
|
||||
return when {
|
||||
|
|
|
|||
|
|
@ -66,17 +66,10 @@ class SettingsActivity: BaseActivity<ActivitySettingsBinding, SettingsViewModel>
|
|||
adapter.data[index].value = viewModel.isTaskResultHidden()
|
||||
adapter.notifyItemChanged(index)
|
||||
},
|
||||
SettingsItem(
|
||||
"spacer",
|
||||
getString(R.string.settings),
|
||||
SettingsItem.Types.SPACER,
|
||||
null
|
||||
) {
|
||||
},
|
||||
SettingsItem(
|
||||
"logout",
|
||||
getString(R.string.logout),
|
||||
SettingsItem.Types.DESTRUCTIVE_BUTTON,
|
||||
SettingsItem.Types.BUTTON,
|
||||
null
|
||||
) {
|
||||
showLogoutConfirmation()
|
||||
|
|
|
|||
|
|
@ -80,7 +80,7 @@ class SettingsViewHolder(itemView: View) : BindableViewHolder<SettingsItem>(item
|
|||
|
||||
if (data.value as? Boolean == true) {
|
||||
binding.row.backgroundTintList = ColorStateList.valueOf(ContextCompat.getColor(itemView.context, R.color.watch_purple_100))
|
||||
binding.row.background.alpha = 127
|
||||
binding.row.background.alpha = 102
|
||||
} else {
|
||||
binding.row.backgroundTintList = ColorStateList.valueOf(ContextCompat.getColor(itemView.context, R.color.watch_purple_5))
|
||||
binding.row.background.alpha = 255
|
||||
|
|
|
|||
|
|
@ -4,7 +4,9 @@ import android.view.View
|
|||
import android.view.ViewGroup
|
||||
import android.widget.ImageView
|
||||
import android.widget.TextView
|
||||
import androidx.core.view.isVisible
|
||||
import com.habitrpg.android.habitica.databinding.RowDailyBinding
|
||||
import com.habitrpg.wearos.habitica.models.tasks.Task
|
||||
|
||||
class DailyViewHolder(itemView: View) : CheckedTaskViewHolder(itemView) {
|
||||
private val binding = RowDailyBinding.bind(itemView)
|
||||
|
|
@ -14,4 +16,15 @@ class DailyViewHolder(itemView: View) : CheckedTaskViewHolder(itemView) {
|
|||
get() = binding.checkbox
|
||||
override val checkboxWrapper: ViewGroup
|
||||
get() = binding.checkboxWrapper
|
||||
|
||||
override fun bind(data: Task) {
|
||||
super.bind(data)
|
||||
val streakString = data.streakString
|
||||
if (streakString?.isNotBlank() == true) {
|
||||
binding.streakView.text = streakString
|
||||
binding.streakView.isVisible = true
|
||||
} else {
|
||||
binding.streakView.isVisible = false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -3,6 +3,7 @@ package com.habitrpg.wearos.habitica.ui.viewHolders.tasks
|
|||
import android.content.res.ColorStateList
|
||||
import android.view.View
|
||||
import android.widget.TextView
|
||||
import androidx.core.view.isVisible
|
||||
import androidx.core.content.ContextCompat
|
||||
import com.habitrpg.android.habitica.R
|
||||
import com.habitrpg.android.habitica.databinding.RowHabitBinding
|
||||
|
|
@ -42,5 +43,12 @@ class HabitViewHolder(itemView: View) : TaskViewHolder(itemView) {
|
|||
binding.habitButtonIcon.backgroundTintList = ColorStateList.valueOf(ContextCompat.getColor(itemView.context, data.mediumTaskColor))
|
||||
binding.habitButtonIcon.imageTintList = ColorStateList.valueOf(ContextCompat.getColor(itemView.context, R.color.white))
|
||||
}
|
||||
val streakString = data.streakString
|
||||
if (streakString?.isNotBlank() == true) {
|
||||
binding.streakView.text = streakString
|
||||
binding.streakView.isVisible = true
|
||||
} else {
|
||||
binding.streakView.isVisible = false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2,7 +2,8 @@
|
|||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
android:layout_height="wrap_content"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
|
|
@ -21,11 +22,24 @@
|
|||
android:scaleType="center"
|
||||
android:layout_gravity="center"/>
|
||||
</FrameLayout>
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
<TextView
|
||||
android:id="@+id/title"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:lines="1"
|
||||
tools:text="Task Title"/>
|
||||
tools:text="Task Title"
|
||||
style="@style/Text.Body2"/>
|
||||
<TextView
|
||||
android:id="@+id/streak_view"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:drawableStartCompat="@drawable/task_icon_streak"
|
||||
android:drawablePadding="@dimen/spacing_small"
|
||||
android:visibility="gone"/>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</FrameLayout>
|
||||
|
|
@ -2,7 +2,8 @@
|
|||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
android:layout_height="wrap_content"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
|
|
@ -20,12 +21,24 @@
|
|||
android:layout_height="match_parent"
|
||||
android:scaleType="center"/>
|
||||
</FrameLayout>
|
||||
<TextView
|
||||
android:id="@+id/title"
|
||||
android:layout_width="match_parent"
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:lines="1"
|
||||
tools:text="Task Title"
|
||||
style="@style/Text.Body2"/>
|
||||
android:orientation="vertical">
|
||||
<TextView
|
||||
android:id="@+id/title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:lines="1"
|
||||
tools:text="Task Title"
|
||||
style="@style/Text.Body2"/>
|
||||
<TextView
|
||||
android:id="@+id/streak_view"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:drawableStartCompat="@drawable/task_icon_streak"
|
||||
android:drawablePadding="@dimen/spacing_small"
|
||||
android:visibility="gone"/>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</FrameLayout>
|
||||
|
|
@ -10,7 +10,8 @@
|
|||
android:id="@+id/row"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/Chip">
|
||||
style="@style/Chip"
|
||||
android:paddingHorizontal="20dp">
|
||||
<TextView
|
||||
android:id="@+id/title_view"
|
||||
android:layout_width="wrap_content"
|
||||
|
|
|
|||
|
|
@ -2,7 +2,8 @@
|
|||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
android:layout_height="wrap_content"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
|
|
@ -22,12 +23,24 @@
|
|||
android:scaleType="center"
|
||||
android:layout_gravity="center"/>
|
||||
</FrameLayout>
|
||||
<TextView
|
||||
android:id="@+id/title"
|
||||
android:layout_width="match_parent"
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:lines="1"
|
||||
tools:text="Task Title"
|
||||
style="@style/Text.Body2"/>
|
||||
android:orientation="vertical">
|
||||
<TextView
|
||||
android:id="@+id/title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:lines="1"
|
||||
tools:text="Task Title"
|
||||
style="@style/Text.Body2"/>
|
||||
<TextView
|
||||
android:id="@+id/streak_view"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:drawableStartCompat="@drawable/task_icon_streak"
|
||||
android:drawablePadding="@dimen/spacing_small"
|
||||
android:visibility="gone"/>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</FrameLayout>
|
||||