|
|
@ -38,7 +38,6 @@ import org.isoron.platform.gui.toInt
|
|
|
|
import org.isoron.uhabits.R
|
|
|
|
import org.isoron.uhabits.R
|
|
|
|
import org.isoron.uhabits.activities.common.views.RingView
|
|
|
|
import org.isoron.uhabits.activities.common.views.RingView
|
|
|
|
import org.isoron.uhabits.core.models.Habit
|
|
|
|
import org.isoron.uhabits.core.models.Habit
|
|
|
|
import org.isoron.uhabits.core.models.HabitGroup
|
|
|
|
|
|
|
|
import org.isoron.uhabits.core.models.ModelObservable
|
|
|
|
import org.isoron.uhabits.core.models.ModelObservable
|
|
|
|
import org.isoron.uhabits.core.models.Timestamp
|
|
|
|
import org.isoron.uhabits.core.models.Timestamp
|
|
|
|
import org.isoron.uhabits.core.ui.screens.habits.list.ListHabitsBehavior
|
|
|
|
import org.isoron.uhabits.core.ui.screens.habits.list.ListHabitsBehavior
|
|
|
@ -267,16 +266,15 @@ class HabitCardView(
|
|
|
|
}
|
|
|
|
}
|
|
|
|
scoreRing.apply {
|
|
|
|
scoreRing.apply {
|
|
|
|
setColor(c)
|
|
|
|
setColor(c)
|
|
|
|
if (h.isSubHabit()) {
|
|
|
|
// if (h.isSubHabit()) {
|
|
|
|
val rightMargin = dp(8f).toInt()
|
|
|
|
val rightMargin = dp(8f).toInt()
|
|
|
|
val ringSize = dp(15f).toInt()
|
|
|
|
val ringSize = dp(15f).toInt()
|
|
|
|
val leftMargin =
|
|
|
|
val leftMargin = if (h.isSubHabit() == true) dp(30f).toInt() else dp(8f).toInt()
|
|
|
|
if (habit?.isSubHabit() == true) dp(30f).toInt() else dp(8f).toInt()
|
|
|
|
|
|
|
|
layoutParams = LinearLayout.LayoutParams(ringSize, ringSize).apply {
|
|
|
|
layoutParams = LinearLayout.LayoutParams(ringSize, ringSize).apply {
|
|
|
|
setMargins(leftMargin, 0, rightMargin, 0)
|
|
|
|
setMargins(leftMargin, 0, rightMargin, 0)
|
|
|
|
gravity = Gravity.CENTER
|
|
|
|
gravity = Gravity.CENTER
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
checkmarkPanel.apply {
|
|
|
|
checkmarkPanel.apply {
|
|
|
|
color = c
|
|
|
|
color = c
|
|
|
@ -297,32 +295,6 @@ class HabitCardView(
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private fun copyAttributesFrom(hgr: HabitGroup) {
|
|
|
|
|
|
|
|
fun getActiveColor(habitGroup: HabitGroup): Int {
|
|
|
|
|
|
|
|
return when (habitGroup.isArchived) {
|
|
|
|
|
|
|
|
true -> sres.getColor(R.attr.contrast60)
|
|
|
|
|
|
|
|
false -> currentTheme().color(habitGroup.color).toInt()
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
val c = getActiveColor(hgr)
|
|
|
|
|
|
|
|
label.apply {
|
|
|
|
|
|
|
|
text = hgr.name
|
|
|
|
|
|
|
|
setTextColor(c)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
scoreRing.apply {
|
|
|
|
|
|
|
|
setColor(c)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
checkmarkPanel.apply {
|
|
|
|
|
|
|
|
color = c
|
|
|
|
|
|
|
|
visibility = View.GONE
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
numberPanel.apply {
|
|
|
|
|
|
|
|
color = c
|
|
|
|
|
|
|
|
visibility = View.GONE
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private fun triggerRipple(x: Float, y: Float) {
|
|
|
|
private fun triggerRipple(x: Float, y: Float) {
|
|
|
|
val background = innerFrame.background
|
|
|
|
val background = innerFrame.background
|
|
|
|
background.setHotspot(x, y)
|
|
|
|
background.setHotspot(x, y)
|
|
|
|