More colors

This commit is contained in:
Phillip Thelen 2022-11-22 15:48:09 +01:00
parent 95c78d12e1
commit 472a35281f
19 changed files with 92 additions and 50 deletions

View file

@ -2,5 +2,5 @@
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">
<size android:width="32dp" android:height="32dp" />
<stroke android:width="2dp" android:color="@color/content_background_offset" />
<stroke android:width="2dp" android:color="?colorTintedBackgroundOffset" />
</shape>

View file

@ -2,5 +2,5 @@
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@color/white" />
<corners android:radius="4dp" />
<corners android:radius="8dp" />
</shape>

View file

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="?colorTintedBackgroundOffset" />
<corners android:radius="@dimen/rounded_button_radius"/>
<padding android:left="0dip" android:top="0dip" android:right="0dip" android:bottom="0dip" />
</shape>

View file

@ -2,14 +2,14 @@
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<solid android:color="@color/content_background_offset" />
<solid android:color="?colorPrimaryDark" />
<corners android:radius="4dp" android:topLeftRadius="8dp" android:topRightRadius="8dp" />
</shape>
</item>
<item android:bottom="4dp">
<item android:bottom="2dp">
<shape android:shape="rectangle">
<solid android:color="@color/window_background" />
<solid android:color="?colorTintedBackgroundOffset" />
<corners android:topLeftRadius="4dp" android:topRightRadius="4dp" android:bottomLeftRadius="2dp" android:bottomRightRadius="2dp" />
</shape>
</item>

View file

@ -29,7 +29,7 @@
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?attr/colorContentBackground"
android:background="?attr/colorTintedBackground"
android:paddingBottom="@dimen/spacing_large">
<LinearLayout
android:id="@+id/upper_text_wrapper"
@ -165,6 +165,7 @@
android:id="@+id/habit_adjust_positive_input_layout"
android:layout_width="0dp"
android:layout_height="wrap_content"
app:boxBackgroundColor="?attr/colorTintedBackgroundOffset"
android:hint="@string/positive_habit_form"
android:layout_weight="1">
<androidx.appcompat.widget.AppCompatEditText
@ -181,6 +182,7 @@
android:layout_width="0dp"
android:layout_height="wrap_content"
android:hint="@string/negative_habit_form"
app:boxBackgroundColor="?attr/colorTintedBackgroundOffset"
android:layout_weight="1">
<androidx.appcompat.widget.AppCompatEditText
android:id="@+id/habit_adjust_negative_streak_view"
@ -214,7 +216,7 @@
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/spacing_large">
android:layout_marginBottom="10dp">
<TextView
android:id="@+id/stat_strength_button"
style="@style/TaskFormToggle"
@ -241,7 +243,7 @@
android:layout_weight="1"
android:layout_height="wrap_content"
android:text="@string/intelligence"
android:layout_marginEnd="@dimen/spacing_large"/>
android:layout_marginEnd="10dp"/>
<TextView
android:id="@+id/stat_perception_button"
style="@style/TaskFormToggle"

View file

@ -56,7 +56,7 @@
app:shimmer_duration="200"
app:shimmer_base_color="@color/text_dimmed"
app:shimmer_highlight_color="@color/content_background"
app:shimmer_highlight_alpha="0.8">
app:shimmer_highlight_alpha="0.4">
<com.habitrpg.common.habitica.views.PixelArtView
android:id="@+id/pet_view"
android:layout_width="@dimen/gear_image_size"

View file

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<merge xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="horizontal"
android:layout_width="match_parent"
@ -7,39 +8,36 @@
tools:parentTag="android.widget.RelativeLayout">
<View android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/window_background"
android:layout_alignParentBottom="true"
android:layout_alignParentStart="true"/>
<View android:layout_width="match_parent"
android:layout_height="2dp"
android:background="@color/content_background_offset"
android:background="@drawable/layout_rounded_bg_task_form"
android:backgroundTint="?colorTintedBackgroundOffset"
android:layout_alignParentBottom="true"
android:layout_alignParentStart="true"/>
<ImageButton
android:id="@+id/down_button"
android:layout_width="56dp"
android:layout_height="match_parent"
android:background="@color/offset_background"
android:background="@color/transparent"
android:src="@drawable/ic_arrow_drop_down_gray_48dp_states"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
app:tint="?colorPrimaryDark"
/>
<ImageButton
android:id="@+id/up_button"
android:layout_width="56dp"
android:layout_height="match_parent"
android:background="@color/offset_background"
android:background="@color/transparent"
android:src="@drawable/ic_arrow_drop_up_gray_48dp_states"
android:layout_alignParentEnd="true"
android:layout_alignParentTop="true"
/>
app:tint="?colorPrimaryDark" />
<EditText
android:id="@+id/edit_text"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_centerHorizontal="true"
android:background="@color/transparent"
android:textColor="@color/text_secondary"
android:textColor="?colorPrimaryDark"
android:textSize="16sp"
tools:text="100.0"
android:inputType="numberDecimal"

View file

@ -5,7 +5,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/layout_rounded_bg_task_form"
android:minHeight="38dp"
android:minHeight="40dp"
android:gravity="center_vertical"
android:paddingStart="@dimen/spacing_medium"
android:paddingEnd="@dimen/spacing_medium"

View file

@ -3,6 +3,8 @@
<attr name="colorPrimaryDistinct" format="color" />
<attr name="colorBadgeBackground" format="color" />
<attr name="colorContentBackground" format="color" />
<attr name="colorTintedBackground" format="color" />
<attr name="colorTintedBackgroundOffset" format="color" />
<attr name="colorContentBackgroundOffset" format="color" />
<attr name="colorWindowBackground" format="color" />
<attr name="textColorPrimary" format="color" />

View file

@ -19,7 +19,7 @@
<color name="checkbox_checked_fill">#c8ffffff</color>
<color name="checkbox_checklist_fill">#23000000</color>
<color name="habit_inactive_gray">#F9F9F9</color>
<color name="habit_inactive_gray">@color/window_background</color>
<!-- buttons -->
<color name="btn_success">@color/green_10</color>

View file

@ -38,6 +38,8 @@
<item name="colorContentBackground">@color/content_background</item>
<item name="colorWindowBackground">@color/window_background</item>
<item name="colorTintedBackground">@color/brand_800</item>
<item name="colorTintedBackgroundOffset">@color/brand_700</item>
<item name="popupMenuStyle">@style/PopupTheme</item>
<item name="actionOverflowMenuStyle">@style/PopupTheme</item>
@ -93,6 +95,8 @@
<item name="taskFormTint">@color/red_50</item>
<item name="toolbarContentColor">@color/red_1</item>
<item name="colorPrimaryText">@color/red_1</item>
<item name="colorTintedBackground">@color/red_700</item>
<item name="colorTintedBackgroundOffset">@color/red_600</item>
</style>
<style name="MainAppTheme.Red.Dark">
@ -101,6 +105,8 @@
<item name="colorBoxStroke">@color/red_10</item>
<item name="textColorPrimaryDark">@color/gray_200</item>
<item name="toolbarContentColor">@color/red_100</item>
<item name="colorTintedBackground">@color/red_1</item>
<item name="colorTintedBackgroundOffset">@color/red_5</item>
</style>
<style name="MainAppTheme.Maroon">
@ -120,6 +126,8 @@
<item name="barColor">@color/red_1</item>
<item name="taskFormTint">@color/maroon_50</item>
<item name="colorPrimaryText">@color/maroon_1</item>
<item name="colorTintedBackground">@color/maroon_700</item>
<item name="colorTintedBackgroundOffset">@color/maroon_600</item>
</style>
<style name="MainAppTheme.Maroon.Dark">
@ -127,6 +135,8 @@
<item name="colorPrimaryOffset">@color/gray_10</item>
<item name="textColorPrimaryDark">@color/gray_200</item>
<item name="toolbarContentColor">@color/maroon_100</item>
<item name="colorTintedBackground">@color/maroon_1</item>
<item name="colorTintedBackgroundOffset">@color/maroon_5</item>
</style>
<style name="MainAppTheme.Orange">
@ -147,6 +157,8 @@
<item name="taskFormTint">@color/orange_50</item>
<item name="toolbarContentColor">@color/orange_1</item>
<item name="colorPrimaryText">@color/orange_1</item>
<item name="colorTintedBackground">@color/orange_700</item>
<item name="colorTintedBackgroundOffset">@color/orange_600</item>
</style>
<style name="MainAppTheme.Orange.Dark">
@ -155,6 +167,8 @@
<item name="colorBoxStroke">@color/orange_10</item>
<item name="textColorPrimaryDark">@color/gray_200</item>
<item name="toolbarContentColor">@color/orange_100</item>
<item name="colorTintedBackground">@color/orange_1</item>
<item name="colorTintedBackgroundOffset">@color/orange_5</item>
</style>
<style name="MainAppTheme.Yellow">
@ -175,6 +189,8 @@
<item name="taskFormTint">@color/yellow_10</item>
<item name="toolbarContentColor">@color/yellow_1</item>
<item name="colorPrimaryText">@color/yellow_1</item>
<item name="colorTintedBackground">@color/yellow_700</item>
<item name="colorTintedBackgroundOffset">@color/yellow_600</item>
</style>
<style name="MainAppTheme.Yellow.Dark">
@ -183,6 +199,7 @@
<item name="colorBoxStroke">@color/yellow_5</item>
<item name="textColorPrimaryDark">@color/gray_200</item>
<item name="toolbarContentColor">@color/yellow_100</item>
<item name="colorTintedBackground">@color/yellow_5</item>
</style>
<style name="MainAppTheme.Green">
@ -203,6 +220,8 @@
<item name="taskFormTint">@color/green_50</item>
<item name="toolbarContentColor">@color/green_1</item>
<item name="colorPrimaryText">@color/green_1</item>
<item name="colorTintedBackground">@color/green_700</item>
<item name="colorTintedBackgroundOffset">@color/green_600</item>
</style>
<style name="MainAppTheme.Green.Dark">
@ -211,6 +230,8 @@
<item name="colorBoxStroke">@color/green_10</item>
<item name="textColorPrimaryDark">@color/gray_200</item>
<item name="toolbarContentColor">@color/green_100</item>
<item name="colorTintedBackground">@color/green_1</item>
<item name="colorTintedBackgroundOffset">@color/green_5</item>
</style>
<style name="MainAppTheme.Teal">
@ -231,6 +252,8 @@
<item name="taskFormTint">@color/teal_50</item>
<item name="toolbarContentColor">@color/teal_1</item>
<item name="colorPrimaryText">@color/teal_1</item>
<item name="colorTintedBackground">@color/teal_700</item>
<item name="colorTintedBackgroundOffset">@color/teal_600</item>
</style>
<style name="MainAppTheme.Teal.Dark">
@ -239,6 +262,8 @@
<item name="colorBoxStroke">@color/teal_10</item>
<item name="textColorPrimaryDark">@color/gray_200</item>
<item name="toolbarContentColor">@color/teal_100</item>
<item name="colorTintedBackground">@color/teal_1</item>
<item name="colorTintedBackgroundOffset">@color/teal_5</item>
</style>
<style name="MainAppTheme.Blue">
@ -259,6 +284,8 @@
<item name="taskFormTint">@color/blue_50</item>
<item name="toolbarContentColor">@color/blue_1</item>
<item name="colorPrimaryText">@color/blue_1</item>
<item name="colorTintedBackground">@color/blue_700</item>
<item name="colorTintedBackgroundOffset">@color/blue_600</item>
</style>
<style name="MainAppTheme.Blue.Dark">
@ -267,6 +294,8 @@
<item name="textColorPrimaryDark">@color/gray_200</item>
<item name="colorBoxStroke">@color/blue_10</item>
<item name="toolbarContentColor">@color/blue_100</item>
<item name="colorTintedBackground">@color/blue_1</item>
<item name="colorTintedBackgroundOffset">@color/blue_5</item>
</style>
<style name="MyWidgetTheme">
@ -852,18 +881,18 @@
<style name="TaskFormSectionheader">
<item name="android:textSize">16sp</item>
<item name="android:textColor">@color/text_primary</item>
<item name="android:textColor">?colorPrimaryDark</item>
<item name="android:layout_marginTop">@dimen/spacing_large</item>
<item name="android:layout_marginBottom">@dimen/spacing_medium</item>
<item name="android:accessibilityHeading">true</item>
</style>
<style name="TaskFormToggle">
<item name="android:background">@drawable/layout_rounded_bg_content</item>
<item name="android:background">@drawable/layout_rounded_bg_tinted</item>
<item name="android:gravity">center</item>
<item name="android:paddingTop">@dimen/spacing_small</item>
<item name="android:paddingBottom">@dimen/spacing_small</item>
<item name="android:height">28dp</item>
<item name="android:height">48dp</item>
</style>
<style name="TaskFormWeekdayButton">

View file

@ -395,6 +395,7 @@ class TaskFormActivity : BaseActivity() {
val view = CheckBox(this)
view.setPadding(padding, view.paddingTop, view.paddingRight, view.paddingBottom)
view.text = tag.name
view.setTextColor(getThemeColor(R.attr.colorPrimaryDark))
if (preselectedTags?.contains(tag.id) == true) {
view.isChecked = true
}
@ -479,13 +480,10 @@ class TaskFormActivity : BaseActivity() {
private fun configureStatsButton(button: TextView, isSelected: Boolean) {
button.background.setTint(
if (isSelected) tintColor else ContextCompat.getColor(
this,
R.color.taskform_gray
)
if (isSelected) tintColor else getThemeColor(R.attr.colorTintedBackgroundOffset)
)
val textColorID = if (isSelected) R.color.window_background else R.color.text_secondary
button.setTextColor(ContextCompat.getColor(this, textColorID))
val textColorID = if (isSelected) R.attr.colorTintedBackground else R.attr.colorPrimaryDark
button.setTextColor(getThemeColor(textColorID))
if (isSelected) {
button.typeface = Typeface.create("sans-serif-medium", Typeface.NORMAL)
} else {
@ -501,7 +499,7 @@ class TaskFormActivity : BaseActivity() {
intArrayOf(-android.R.attr.state_checked), // unchecked
intArrayOf(android.R.attr.state_checked) // checked
),
intArrayOf(ContextCompat.getColor(this, R.color.text_dimmed), tintColor)
intArrayOf(getThemeColor(R.attr.colorTintedBackgroundOffset), tintColor)
)
tagView?.buttonTintList = colorStateList
}

View file

@ -121,7 +121,7 @@ fun TaskSummaryView(viewModel: TaskSummaryViewModel) {
MainNavigationController.navigateBack()
},
colors = ButtonDefaults.textButtonColors(contentColor = darkestColor),
elevation = ButtonDefaults.elevation(0.dp)
elevation = ButtonDefaults.elevation(0.dp, 0.dp)
) {
Image(
painterResource(R.drawable.arrow_back),
@ -260,6 +260,9 @@ fun TaskSummaryView(viewModel: TaskSummaryViewModel) {
}) else null
)
}
task?.group?.assignedUsersDetail?.find { it.assignedUserID == viewModel.userViewModel.userID }?.let {
Text("", )
}
}
}
}

View file

@ -13,10 +13,10 @@ import androidx.core.content.ContextCompat
import com.habitrpg.android.habitica.R
import com.habitrpg.android.habitica.databinding.TaskFormChecklistItemBinding
import com.habitrpg.android.habitica.extensions.OnChangeTextWatcher
import com.habitrpg.android.habitica.models.tasks.ChecklistItem
import com.habitrpg.common.habitica.extensions.dpToPx
import com.habitrpg.common.habitica.extensions.getThemeColor
import com.habitrpg.common.habitica.extensions.layoutInflater
import com.habitrpg.android.habitica.models.tasks.ChecklistItem
class ChecklistItemFormView @JvmOverloads constructor(
context: Context,
@ -77,7 +77,7 @@ class ChecklistItemFormView @JvmOverloads constructor(
init {
minimumHeight = 38.dpToPx(context)
background = ContextCompat.getDrawable(context, R.drawable.layout_rounded_bg_task_form)
background.mutate().setTint(ContextCompat.getColor(context, R.color.taskform_gray))
background.mutate().setTint(context.getThemeColor(R.attr.colorTintedBackgroundOffset))
gravity = Gravity.CENTER_VERTICAL
binding.button.setOnClickListener {

View file

@ -11,6 +11,7 @@ import android.widget.TextView
import androidx.core.content.ContextCompat
import com.habitrpg.android.habitica.R
import com.habitrpg.common.habitica.extensions.dpToPx
import com.habitrpg.common.habitica.extensions.getThemeColor
import com.habitrpg.common.habitica.extensions.nameRes
import com.habitrpg.shared.habitica.models.tasks.HabitResetOption
@ -40,8 +41,8 @@ class HabitResetStreakButtons @JvmOverloads constructor(
private fun addAllButtons() {
val lastResetOption = HabitResetOption.values().last()
val margin = 16.dpToPx(context)
val height = 28.dpToPx(context)
val margin = 10.dpToPx(context)
val height = 48.dpToPx(context)
for (resetOption in HabitResetOption.values()) {
val button = createButton(resetOption)
val layoutParams = LayoutParams(0, height)
@ -70,11 +71,11 @@ class HabitResetStreakButtons @JvmOverloads constructor(
if (isActive) {
button.background.setTint(tintColor)
button.setTextColor(ContextCompat.getColor(context, R.color.white))
button.setTextColor(context.getThemeColor(R.attr.colorTintedBackground))
button.typeface = Typeface.create("sans-serif-medium", Typeface.NORMAL)
} else {
button.background.setTint(ContextCompat.getColor(context, R.color.taskform_gray))
button.setTextColor(ContextCompat.getColor(context, R.color.text_secondary))
button.background.setTint(context.getThemeColor(R.attr.colorTintedBackgroundOffset))
button.setTextColor(context.getThemeColor(R.attr.colorPrimaryDark))
button.typeface = Typeface.create("sans-serif", Typeface.NORMAL)
}
button.setOnClickListener {

View file

@ -91,7 +91,7 @@ class ReminderItemFormView @JvmOverloads constructor(
init {
minimumHeight = 38.dpToPx(context)
background = ContextCompat.getDrawable(context, R.drawable.layout_rounded_bg_task_form)
background.mutate().setTint(ContextCompat.getColor(context, R.color.taskform_gray))
background.mutate().setTint(context.getThemeColor(R.attr.colorTintedBackgroundOffset))
gravity = Gravity.CENTER_VERTICAL
binding.button.setOnClickListener {

View file

@ -15,6 +15,7 @@ import com.habitrpg.android.habitica.R
import com.habitrpg.android.habitica.extensions.asDrawable
import com.habitrpg.android.habitica.extensions.inflate
import com.habitrpg.android.habitica.ui.views.HabiticaIconsHelper
import com.habitrpg.common.habitica.extensions.getThemeColor
import com.habitrpg.common.habitica.extensions.nameRes
import com.habitrpg.shared.habitica.models.tasks.TaskDifficulty
@ -75,9 +76,9 @@ class TaskDifficultyButtons @JvmOverloads constructor(
view.findViewById<TextView>(R.id.text_view).setTextColor(textTintColor ?: tintColor)
view.findViewById<TextView>(R.id.text_view).typeface = Typeface.create("sans-serif-medium", Typeface.NORMAL)
} else {
view.findViewById<ImageView>(R.id.image_view).background.mutate().setTint(ContextCompat.getColor(context, R.color.taskform_gray))
view.findViewById<ImageView>(R.id.image_view).background.mutate().setTint(context.getThemeColor(R.attr.colorTintedBackgroundOffset))
view.findViewById<TextView>(R.id.text_view).setTextColor(ContextCompat.getColor(context, R.color.text_secondary))
difficultyColor = ContextCompat.getColor(context, R.color.disabled_background)
difficultyColor = context.getThemeColor(R.attr.colorPrimaryDark)
view.findViewById<TextView>(R.id.text_view).typeface = Typeface.create("sans-serif", Typeface.NORMAL)
}
val drawable = HabiticaIconsHelper.imageOfTaskDifficultyStars(difficultyColor, difficulty.value, true).asDrawable(resources)

View file

@ -21,6 +21,7 @@ import com.habitrpg.android.habitica.databinding.TaskFormTaskSchedulingBinding
import com.habitrpg.android.habitica.models.tasks.Days
import com.habitrpg.android.habitica.ui.adapter.SimpleSpinnerAdapter
import com.habitrpg.common.habitica.extensions.dpToPx
import com.habitrpg.common.habitica.extensions.getThemeColor
import com.habitrpg.common.habitica.extensions.layoutInflater
import com.habitrpg.shared.habitica.models.tasks.Frequency
import com.habitrpg.shared.habitica.models.tasks.TaskType
@ -287,10 +288,10 @@ class TaskSchedulingControls @JvmOverloads constructor(
if (isActive) {
button.background = ContextCompat.getDrawable(context, R.drawable.habit_scoring_circle_selected)
button.background.mutate().setTint(tintColor)
button.setTextColor(ContextCompat.getColor(context, R.color.white))
button.setTextColor(context.getThemeColor(R.attr.colorTintedBackground))
} else {
button.background = ContextCompat.getDrawable(context, R.drawable.habit_scoring_circle)
button.setTextColor(ContextCompat.getColor(context, R.color.text_secondary))
button.setTextColor(context.getThemeColor(R.attr.colorPrimaryDark))
}
button.setOnClickListener {
setWeekdayActive(weekdayCode, !isActive)
@ -320,14 +321,14 @@ class TaskSchedulingControls @JvmOverloads constructor(
}
private fun styleButtonAsActive(button: TextView) {
button.setTextColor(ContextCompat.getColor(context, R.color.white))
button.setTextColor(context.getThemeColor(R.attr.colorTintedBackground))
button.background.mutate().setTint(tintColor)
button.contentDescription = toContentDescription(button.text, true)
}
private fun styleButtonAsInactive(button: TextView) {
button.setTextColor(ContextCompat.getColor(context, R.color.text_secondary))
button.background.mutate().setTint(ContextCompat.getColor(context, R.color.taskform_gray))
button.setTextColor(context.getThemeColor(R.attr.colorPrimaryDark))
button.background.mutate().setTint(context.getThemeColor(R.attr.colorTintedBackgroundOffset))
button.contentDescription = toContentDescription(button.text, false)
}

View file

@ -12,7 +12,8 @@
<color name="brand_400">#925CF3</color>
<color name="brand_500">#bda8ff</color>
<color name="brand_600">#D5C8FF</color>
<color name="brand_700">#ede7f6</color>
<color name="brand_700">#F4F0FC</color>
<color name="brand_800">#FAF7FF</color>
<color name="brand">@color/brand_100</color>
<!-- HabitRPG task color -->
@ -50,8 +51,8 @@
<color name="yellow_10">#FFA624</color>
<color name="yellow_5">#EE9109</color>
<color name="green_700">#F5FFFB</color>
<color name="green_600">#EDFCF7</color>
<color name="green_700">#F7FFFC</color>
<color name="green_600">#EDFAF6</color>
<color name="green_500">#77f4c7</color>
<color name="green_100">#24CC8F</color>
<color name="green_50">#20B780</color>