Begin implementing new task design

This commit is contained in:
Phillip Thelen 2020-08-25 13:21:27 +02:00
parent 436df2b9c7
commit e19f7222c2
57 changed files with 397 additions and 684 deletions

View file

@ -18,7 +18,7 @@ buildscript {
}
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
classpath 'com.android.tools.build:gradle:4.0.0'
classpath 'com.android.tools.build:gradle:4.0.1'
classpath('com.noveogroup.android:check:1.2.5') {
exclude module: 'checkstyle'
exclude module: 'pmd-java'
@ -162,7 +162,7 @@ android {
multiDexEnabled true
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 2509
versionCode 2514
versionName "2.8"
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 294 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 328 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 338 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 312 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 342 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 358 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 96 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 204 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 212 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 246 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 206 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 214 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 248 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 127 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 344 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 426 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 410 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 228 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 372 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 446 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 432 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 153 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 494 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 678 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 628 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 304 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 530 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 710 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 668 B

View file

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">
<size android:width="24dp" android:height="24dp" />
<solid android:color="@color/white" />
</shape>

View file

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">
<size android:width="24dp" android:height="24dp" />
<stroke android:color="@color/gray_600" android:width="2dp" />
</shape>

View 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/gray_700" />
<corners android:radius="8dp" />
</shape>

View file

@ -7,7 +7,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.habitrpg.android.habitica.ui.activities.MainActivity"
android:background="@color/gray_700">
android:background="@color/white">
<!-- As the main content view, the view below consumes the entire
space available using match_parent in both dimensions. -->
@ -32,7 +32,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:titleEnabled="false"
app:contentScrim="?attr/colorPrimaryDark"
app:contentScrim="?attr/headerBackgroundColor"
app:expandedTitleMarginEnd="?attr/actionBarSize"
app:expandedTitleMarginStart="0dp"
app:layout_scrollFlags="scroll|exitUntilCollapsed">
@ -50,8 +50,8 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="?attr/actionBarSize"
android:theme="@style/Toolbar"
android:background="?attr/colorPrimaryDark"
android:theme="@style/Toolbar.Modern"
android:background="?attr/headerBackgroundColor"
app:layout_collapseMode="pin"
app:popupTheme="@style/Theme.AppCompat.Light">
<RelativeLayout
@ -88,17 +88,17 @@
android:layout_width="match_parent"
android:layout_height="54dp"
android:layout_gravity="bottom"
android:background="?colorPrimary"
android:background="?headerOffsetColor"
android:elevation="0dp"
android:fillViewport="false"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
android:theme="@style/ThemeOverlay.AppCompat.Light"
app:layout_anchor="@+id/collapsing_toolbar"
app:layout_anchorGravity="bottom"
app:layout_collapseMode="pin"
app:tabGravity="fill"
app:tabIndicatorColor="?colorContentBackground"
app:tabIndicatorColor="?colorPrimary"
app:tabMode="fixed" />
<TextView
android:id="@+id/connection_issue_textview"

View file

@ -6,7 +6,7 @@
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:adjustViewBounds="true"
android:background="?colorPrimaryDark"
android:background="?attr/headerBackgroundColor"
android:focusable="true"
android:focusableInTouchMode="true"
android:orientation="vertical"
@ -42,6 +42,7 @@
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/header_bar_spacing"
app:barForegroundColor="@color/hpColor"
app:lightBackground="true"
app:description="@string/HP_default"/>
<com.habitrpg.android.habitica.ui.views.ValueBar
@ -50,6 +51,7 @@
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/header_bar_spacing"
app:barForegroundColor="@color/xpColor"
app:lightBackground="true"
app:description="@string/XP_default"/>
<com.habitrpg.android.habitica.ui.views.ValueBar
@ -57,6 +59,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:barForegroundColor="@color/mpColor"
app:lightBackground="true"
app:description="@string/MP_default"/>
</LinearLayout>
@ -75,7 +78,7 @@
android:layout_height="36dp"
android:drawablePadding="6dp"
android:gravity="center"
android:textColor="?textColorSecondaryDark"
android:textColor="?headerTextColor"
android:textSize="14sp"
tools:text="Lvl 12 Warrior"/>
@ -96,6 +99,6 @@
android:id="@+id/currencyView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:hasLightBackground="false"/>
app:hasLightBackground="true"/>
</LinearLayout>
</LinearLayout>

View file

@ -0,0 +1,37 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/checklistIndicatorWrapper"
android:layout_width="@dimen/checklist_wrapper_width"
android:layout_height="43dp"
android:gravity="center"
android:layout_gravity="center"
android:layout_marginEnd="12dp"
android:orientation="vertical">
<TextView
android:id="@+id/checkListCompletedTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:textColor="@color/white"
style="@style/Body3"
android:textSize="11sp"
tools:text="1" />
<View
android:id="@+id/checklistDivider"
android:layout_width="@dimen/checklist_divider_width"
android:layout_height="@dimen/hairline_height"
android:background="@color/white" />
<TextView
android:id="@+id/checkListAllTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:textColor="@color/white"
style="@style/Body3"
android:textSize="11sp"
tools:text="13" />
</LinearLayout>

View file

@ -9,226 +9,63 @@
android:orientation="vertical">
<FrameLayout
android:id="@+id/main_task_wrapper"
android:layout_width="match_parent"
android:layout_height="wrap_content">
android:layout_height="wrap_content"
android:layout_marginHorizontal="@dimen/task_spacing_horizontal"
android:layout_marginVertical="@dimen/task_spacing_vertical"
android:background="@drawable/task_background"
android:clipChildren="true"
android:minHeight="@dimen/task_min_height">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:baselineAligned="false"
android:minHeight="@dimen/task_min_height">
<FrameLayout
android:id="@+id/checkBoxHolder"
android:layout_width="@dimen/button_width"
android:layout_height="match_parent">
<View
android:layout_width="1dp"
android:layout_height="match_parent"
android:layout_gravity="end"
android:layout_marginBottom="1dp"
android:background="@color/task_border_gray" />
<CheckBox
android:id="@+id/checkBox"
android:layout_width="@dimen/checkbox_size"
android:layout_height="@dimen/checkbox_size"
android:layout_gravity="center"
android:button="@drawable/daily_checkbox"
android:gravity="center" />
</FrameLayout>
android:orientation="vertical">
<LinearLayout
android:id="@+id/linearLayout"
android:layout_width="0dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical"
android:paddingBottom="@dimen/task_top_bottom_padding"
android:paddingEnd="@dimen/task_text_padding"
android:paddingLeft="@dimen/task_text_padding"
android:paddingRight="@dimen/task_text_padding"
android:paddingStart="@dimen/task_text_padding"
android:paddingTop="@dimen/task_top_bottom_padding">
android:orientation="horizontal"
android:baselineAligned="false"
android:minHeight="@dimen/task_min_height">
<com.habitrpg.android.habitica.ui.views.EllipsisTextView
android:id="@+id/checkedTextView"
style="@style/Subheader3"
android:textColor="#000"
android:layout_width="match_parent"
<FrameLayout
android:id="@+id/checkBoxHolder"
android:layout_width="@dimen/button_width"
android:layout_height="match_parent">
<CheckBox
android:id="@+id/checkBox"
android:layout_width="@dimen/checkbox_size"
android:layout_height="@dimen/checkbox_size"
android:layout_gravity="center"
android:button="@drawable/daily_checkbox"
android:gravity="center" />
</FrameLayout>
<include layout="@layout/task_main_content" />
<ProgressBar
android:id="@+id/syncing_view"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_gravity="center_vertical"
android:layout_marginLeft="@dimen/spacing_small"
android:layout_marginRight="@dimen/spacing_small"
style="@style/Widget.AppCompat.ProgressBar"/>
<ImageButton
android:id="@+id/error_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
tools:text="Daily Title" />
<com.habitrpg.android.habitica.ui.views.EllipsisTextView
android:id="@+id/notesTextView"
style="@style/Caption2.Regular"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:maxLines="3"
android:ellipsize="end"
tools:text="Notes" />
<Button
android:id="@+id/expand_notes_button"
android:layout_width="match_parent"
android:layout_height="30dp"
style="@style/Base.Widget.AppCompat.Button.Borderless"
android:text="@string/expand_notes"
android:padding="0dp"
android:textColor="?colorAccent"/>
<TextView
android:id="@+id/approvalRequiredTextField"
android:layout_width="match_parent"
android:layout_height="wrap_content"
style="@style/Caption4"
android:text="@string/pending_approval"
/>
<LinearLayout
android:id="@+id/taskIconWrapper"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/task_icon_space"
android:orientation="horizontal"
android:gravity="center_vertical">
<TextView
android:id="@+id/specialTaskText"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:drawableStart="@drawable/task_icon_calendar"
android:drawableLeft="@drawable/task_icon_calendar"
android:textColor="@color/task_secondary_text"
android:visibility="invisible"
style="@style/Caption3"
tools:visibility="visible"
tools:text="special" />
<TextView
android:id="@+id/streakTextView"
android:layout_width="wrap_content"
android:layout_height="@dimen/task_icon_size"
android:layout_marginStart="@dimen/task_icon_space"
android:layout_marginLeft="@dimen/task_icon_space"
android:drawableStart="@drawable/task_icon_streak"
android:drawableLeft="@drawable/task_icon_streak"
android:textColor="@color/task_secondary_text"
tools:text="10"
android:gravity="center_vertical"
style="@style/Caption3" />
<ImageView
android:id="@+id/iconviewChallenge"
android:layout_width="@dimen/task_icon_size"
android:layout_height="@dimen/task_icon_size"
android:layout_marginStart="@dimen/task_icon_space"
android:layout_marginLeft="@dimen/task_icon_space"
android:contentDescription="@string/belongs_to_challenge"
android:scaleType="center"
app:srcCompat="@drawable/task_megaphone" />
<ImageView
android:id="@+id/iconviewReminder"
android:layout_width="@dimen/task_icon_size"
android:layout_height="@dimen/task_icon_size"
android:layout_marginStart="@dimen/task_icon_space"
android:layout_marginLeft="@dimen/task_icon_space"
android:contentDescription="@string/has_reminder"
android:scaleType="center"
app:srcCompat="@drawable/task_icon_reminder" />
<TextView
android:id="@+id/reminder_textview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/task_secondary_text"
style="@style/Caption3" />
<ImageView
android:id="@+id/iconviewTag"
android:layout_width="@dimen/task_icon_size"
android:layout_height="@dimen/task_icon_size"
android:layout_marginStart="@dimen/task_icon_space"
android:layout_marginLeft="@dimen/task_icon_space"
android:contentDescription="@string/has_tag"
android:scaleType="center"
app:srcCompat="@drawable/task_icon_tag" />
</LinearLayout>
android:layout_gravity="center_vertical"
android:background="@color/transparent"
android:src="@drawable/ic_warning_black"
android:layout_marginLeft="@dimen/spacing_small"
android:layout_marginRight="@dimen/spacing_small"/>
<include layout="@layout/checklist_indicator" />
</LinearLayout>
<ProgressBar
android:id="@+id/syncing_view"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_gravity="center_vertical"
android:layout_marginLeft="@dimen/spacing_small"
android:layout_marginRight="@dimen/spacing_small"
style="@style/Widget.AppCompat.ProgressBar"/>
<ImageButton
android:id="@+id/error_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:background="@color/transparent"
android:src="@drawable/ic_warning_black"
android:layout_marginLeft="@dimen/spacing_small"
android:layout_marginRight="@dimen/spacing_small"/>
<LinearLayout
android:id="@+id/checklistIndicatorWrapper"
android:layout_width="@dimen/checklist_wrapper_width"
android:layout_height="match_parent"
android:gravity="center"
android:orientation="vertical">
<TextView
android:id="@+id/checkListCompletedTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:textColor="@color/white"
style="@style/Body3"
tools:text="1" />
<View
android:id="@+id/checklistDivider"
android:layout_width="@dimen/checklist_divider_width"
android:layout_height="@dimen/hairline_height"
android:background="@color/white" />
<TextView
android:id="@+id/checkListAllTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:textColor="@color/white"
style="@style/Body3"
tools:text="13" />
</LinearLayout>
android:id="@+id/checklistView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_gravity="bottom"
android:background="@color/task_border_gray" />
</FrameLayout>
<View
android:layout_width="match_parent"
android:layout_height="@dimen/hairline_height"
android:background="@color/cell_separator" />
<LinearLayout
android:id="@+id/checklistView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" />
<View
android:id="@+id/checklistBottomSpace"
android:layout_width="match_parent"
android:layout_height="10dp"
android:background="@color/checklist_separator" />
</LinearLayout>

View file

@ -4,7 +4,7 @@
android:minHeight="60dp"
android:elevation="2dp"
android:layout_margin="4dp"
android:background="@drawable/layout_rounded_bg"
android:background="@drawable/task_background"
android:orientation="vertical"
android:padding="0dp">
<LinearLayout
@ -19,13 +19,6 @@
android:layout_width="@dimen/button_width"
android:layout_height="match_parent">
<View
android:layout_width="1dp"
android:layout_height="match_parent"
android:layout_gravity="end"
android:layout_marginBottom="1dp"
android:background="@color/task_border_gray" />
<CheckBox
android:id="@+id/checkBox"
android:layout_width="@dimen/checkbox_size"
@ -41,12 +34,6 @@
android:layout_height="wrap_content"
android:layout_margin="12dp" />
</LinearLayout>
<View
android:id="@+id/checklistDivider"
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="@color/gray_500"
android:visibility="gone"/>
<LinearLayout
android:id="@+id/checklistView"
android:layout_width="match_parent"

View file

@ -1,36 +1,32 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout 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:layout_width="match_parent"
android:layout_height="wrap_content">
android:layout_height="wrap_content"
android:background="@color/white">
<LinearLayout
android:id="@+id/main_task_wrapper"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/white"
android:baselineAligned="false"
android:foreground="?selectableItemBackground"
android:orientation="horizontal"
android:layout_marginHorizontal="@dimen/task_spacing_horizontal"
android:layout_marginVertical="@dimen/task_spacing_vertical"
android:background="@drawable/task_background"
android:clipChildren="true"
android:minHeight="@dimen/task_min_height">
<FrameLayout
android:id="@+id/btnPlusWrapper"
android:layout_width="@dimen/button_width"
android:layout_height="match_parent">
<View
android:layout_width="1dp"
android:layout_height="match_parent"
android:layout_gravity="end"
android:layout_marginBottom="1dp"
android:background="@color/task_border_gray" />
<ImageView
android:id="@+id/btnPlusIconView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_width="24dp"
android:layout_height="24dp"
android:scaleType="center"
android:layout_gravity="center"
android:src="@drawable/habit_plus" />
<Button
@ -41,111 +37,7 @@
android:background="@drawable/selection_highlight"
android:contentDescription="@string/positive_habit_form" />
</FrameLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical"
android:paddingBottom="@dimen/task_top_bottom_padding"
android:paddingEnd="@dimen/task_text_padding"
android:paddingLeft="@dimen/task_text_padding"
android:paddingRight="@dimen/task_text_padding"
android:paddingStart="@dimen/task_text_padding"
android:paddingTop="@dimen/task_top_bottom_padding">
<com.habitrpg.android.habitica.ui.views.EllipsisTextView
android:id="@+id/checkedTextView"
style="@style/Subheader3"
android:textColor="#000"
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:text="Habit Title" />
<com.habitrpg.android.habitica.ui.views.EllipsisTextView
android:id="@+id/notesTextView"
style="@style/Caption2.Regular"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:maxLines="3"
android:ellipsize="end"
tools:text="Notes"/>
<Button
android:id="@+id/expand_notes_button"
android:layout_width="match_parent"
android:layout_height="30dp"
style="@style/Base.Widget.AppCompat.Button.Borderless"
android:text="@string/expand_notes"
android:padding="0dp"
android:textColor="?colorAccent" />
<TextView
android:id="@+id/approvalRequiredTextField"
android:layout_width="match_parent"
android:layout_height="wrap_content"
style="@style/Caption4"
android:text="@string/pending_approval"
/>
<LinearLayout
android:id="@+id/taskIconWrapper"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/task_icon_space"
android:orientation="horizontal">
<TextView
android:id="@+id/specialTaskText"
style="@style/Caption3"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textColor="@color/task_secondary_text"
tools:text="special" />
<TextView
android:id="@+id/streakTextView"
android:layout_width="wrap_content"
android:layout_height="@dimen/task_icon_size"
android:layout_marginStart="@dimen/task_icon_space"
android:layout_marginLeft="@dimen/task_icon_space"
android:drawableStart="@drawable/task_icon_streak"
android:drawableLeft="@drawable/task_icon_streak"
android:textColor="@color/task_secondary_text"
tools:text="10"
android:gravity="center_vertical"
style="@style/Caption3" />
<ImageView
android:id="@+id/iconviewChallenge"
android:layout_width="@dimen/task_icon_size"
android:layout_height="@dimen/task_icon_size"
android:layout_marginStart="@dimen/task_icon_space"
android:contentDescription="@string/belongs_to_challenge"
android:scaleType="center"
app:srcCompat="@drawable/task_megaphone" />
<ImageView
android:id="@+id/iconviewReminder"
android:layout_width="@dimen/task_icon_size"
android:layout_height="@dimen/task_icon_size"
android:layout_marginStart="@dimen/task_icon_space"
android:contentDescription="@string/has_reminder"
android:scaleType="center"
app:srcCompat="@drawable/task_icon_reminder" />
<ImageView
android:id="@+id/iconviewTag"
android:layout_width="@dimen/task_icon_size"
android:layout_height="@dimen/task_icon_size"
android:layout_marginStart="@dimen/task_icon_space"
android:contentDescription="@string/has_tag"
android:scaleType="center"
app:srcCompat="@drawable/task_icon_tag" />
</LinearLayout>
</LinearLayout>
<include layout="@layout/task_main_content" />
<ProgressBar
android:id="@+id/syncing_view"
android:layout_width="20dp"
@ -167,22 +59,14 @@
android:id="@+id/btnMinusWrapper"
android:layout_width="@dimen/button_width"
android:layout_height="match_parent">
<View
android:layout_width="1dp"
android:layout_height="match_parent"
android:layout_gravity="start"
android:layout_marginBottom="1dp"
android:background="@color/task_border_gray" />
<ImageView
android:id="@+id/btnMinusIconView"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_gravity="center"
android:scaleType="center"
android:background="@drawable/habit_circle"
android:src="@drawable/habit_minus" />
<Button
android:id="@+id/btnMinus"
style="@style/HabitButton"
@ -192,10 +76,4 @@
android:contentDescription="@string/negative_habit_form" />
</FrameLayout>
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_gravity="bottom"
android:background="@color/task_border_gray" />
</FrameLayout>

View file

@ -6,62 +6,18 @@
android:background="@color/white">
<LinearLayout
android:id="@+id/main_task_wrapper"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:clickable="false"
android:orientation="horizontal">
android:orientation="horizontal"
android:layout_marginHorizontal="@dimen/task_spacing_horizontal"
android:layout_marginVertical="@dimen/task_spacing_vertical"
android:background="@drawable/task_background"
android:clipChildren="true"
android:minHeight="@dimen/task_min_height">
<ImageView
android:layout_width="40dp"
android:layout_height="30dp"
android:layout_gravity="center_vertical"
android:layout_margin="12dp"
android:scaleType="center"
android:src="@drawable/icon_custom_reward" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="1"
android:orientation="vertical"
android:paddingBottom="@dimen/task_top_bottom_padding"
android:paddingEnd="@dimen/reward_spacing"
android:paddingRight="@dimen/reward_spacing"
android:paddingTop="@dimen/task_top_bottom_padding">
<com.habitrpg.android.habitica.ui.views.EllipsisTextView
android:id="@+id/checkedTextView"
style="@style/Subheader3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="#000"
tools:text="Title" />
<com.habitrpg.android.habitica.ui.views.EllipsisTextView
android:id="@+id/notesTextView"
style="@style/Caption2.Regular"
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:text="Notes"/>
<Button
android:id="@+id/expand_notes_button"
android:layout_width="match_parent"
android:layout_height="30dp"
style="@style/Base.Widget.AppCompat.Button.Borderless"
android:text="@string/expand_notes"
android:padding="0dp"
android:textColor="?colorAccent"/>
<TextView
android:id="@+id/approvalRequiredTextField"
android:layout_width="match_parent"
android:layout_height="wrap_content"
style="@style/Caption4"
android:text="@string/pending_approval"
/>
</LinearLayout>
<include layout="@layout/task_main_content" />
<ProgressBar
android:id="@+id/syncing_view"
@ -82,8 +38,8 @@
android:layout_marginRight="@dimen/spacing_small"/>
<LinearLayout
android:id="@+id/buyButton"
android:layout_width="48dp"
android:layout_height="match_parent"
android:layout_width="56dp"
android:layout_height="fill_parent"
android:background="@color/reward_buy_button_bg"
android:gravity="center"
android:orientation="vertical">
@ -91,7 +47,7 @@
android:id="@+id/gold_icon"
android:layout_width="22dp"
android:layout_height="22dp"
android:paddingBottom="8dp"/>
android:paddingBottom="2dp"/>
<TextView
android:id="@+id/priceLabel"
android:layout_width="match_parent"
@ -102,10 +58,4 @@
style="@style/Body1"/>
</LinearLayout>
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_gravity="bottom"
android:background="@color/task_border_gray" />
</FrameLayout>

View file

@ -0,0 +1,108 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:paddingTop="@dimen/task_top_bottom_padding"
android:paddingBottom="@dimen/task_top_bottom_padding"
android:paddingEnd="@dimen/task_text_padding"
android:paddingStart="@dimen/task_text_padding">
<com.habitrpg.android.habitica.ui.views.EllipsisTextView
android:id="@+id/checkedTextView"
style="@style/Subheader3"
android:textColor="#000"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="15sp"
tools:text="Habit Title" />
<com.habitrpg.android.habitica.ui.views.EllipsisTextView
android:id="@+id/notesTextView"
style="@style/Caption2.Regular"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:maxLines="3"
android:ellipsize="end"
android:textSize="11sp"
tools:text="Notes"/>
<Button
android:id="@+id/expand_notes_button"
android:layout_width="match_parent"
android:layout_height="20dp"
style="@style/Base.Widget.AppCompat.Button.Borderless"
android:textSize="11sp"
android:text="@string/expand_notes"
android:padding="0dp"
android:textColor="?colorAccent" />
<TextView
android:id="@+id/approvalRequiredTextField"
android:layout_width="match_parent"
android:layout_height="wrap_content"
style="@style/Caption4"
android:text="@string/pending_approval"
/>
<Space
android:layout_width="wrap_content"
android:layout_height="7dp" />
<LinearLayout
android:id="@+id/taskIconWrapper"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<ImageView
android:id="@+id/iconViewCalelndar"
android:layout_width="@dimen/task_icon_size"
android:layout_height="@dimen/task_icon_size"
android:scaleType="center"
app:srcCompat="@drawable/task_icon_reminder" />
<TextView
android:id="@+id/specialTaskText"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textColor="@color/task_secondary_text"
android:visibility="invisible"
style="@style/Caption3"
tools:visibility="visible"
tools:text="special" />
<TextView
android:id="@+id/streakTextView"
android:layout_width="wrap_content"
android:layout_height="@dimen/task_icon_size"
android:layout_marginStart="@dimen/task_icon_space"
android:drawableStart="@drawable/task_icon_streak"
android:drawablePadding="2dp"
android:textColor="@color/task_secondary_text"
tools:text="10"
android:gravity="center_vertical"
style="@style/Caption3" />
<ImageView
android:id="@+id/iconviewChallenge"
android:layout_width="@dimen/task_icon_size"
android:layout_height="@dimen/task_icon_size"
android:layout_marginStart="@dimen/task_icon_space"
android:contentDescription="@string/belongs_to_challenge"
android:scaleType="center"
app:srcCompat="@drawable/task_megaphone" />
<ImageView
android:id="@+id/iconviewReminder"
android:layout_width="@dimen/task_icon_size"
android:layout_height="@dimen/task_icon_size"
android:layout_marginStart="@dimen/task_icon_space"
android:contentDescription="@string/has_reminder"
android:scaleType="center"
app:srcCompat="@drawable/task_icon_reminder" />
<TextView
android:id="@+id/reminder_textview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/task_secondary_text"
style="@style/Caption3" />
</LinearLayout>
</LinearLayout>

View file

@ -1,7 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/white"
@ -9,203 +7,63 @@
android:orientation="vertical">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:id="@+id/card_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:baselineAligned="false"
android:minHeight="@dimen/task_min_height">
<FrameLayout
android:id="@+id/checkBoxHolder"
android:layout_width="@dimen/button_width"
android:layout_height="match_parent">
<View
android:layout_width="1dp"
android:layout_height="match_parent"
android:layout_gravity="end"
android:layout_marginBottom="1dp"
android:background="@color/task_border_gray" />
<CheckBox
android:id="@+id/checkBox"
android:layout_width="@dimen/checkbox_size"
android:layout_height="@dimen/checkbox_size"
android:layout_gravity="center"
android:button="@drawable/todo_checkbox"
android:gravity="center" />
</FrameLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical"
android:paddingBottom="@dimen/task_top_bottom_padding"
android:paddingEnd="@dimen/task_text_padding"
android:paddingLeft="@dimen/task_text_padding"
android:paddingRight="@dimen/task_text_padding"
android:paddingStart="@dimen/task_text_padding"
android:paddingTop="@dimen/task_top_bottom_padding">
<com.habitrpg.android.habitica.ui.views.EllipsisTextView
android:id="@+id/checkedTextView"
style="@style/Subheader3"
android:textColor="#000"
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:text="To Do Title" />
<com.habitrpg.android.habitica.ui.views.EllipsisTextView
android:id="@+id/notesTextView"
style="@style/Caption2.Regular"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:maxLines="3"
android:ellipsize="end"
tools:text="Notes" />
<Button
android:id="@+id/expand_notes_button"
android:layout_width="match_parent"
android:layout_height="30dp"
style="@style/Base.Widget.AppCompat.Button.Borderless"
android:text="@string/expand_notes"
android:padding="0dp"
android:textColor="?colorAccent"/>
<TextView
android:id="@+id/approvalRequiredTextField"
android:layout_width="match_parent"
android:layout_height="wrap_content"
style="@style/Caption4"
android:text="@string/pending_approval"
/>
<LinearLayout
android:id="@+id/taskIconWrapper"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/task_icon_space"
android:orientation="horizontal">
<TextView
android:id="@+id/specialTaskText"
style="@style/Caption3"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:drawableStart="@drawable/task_icon_calendar"
android:drawableLeft="@drawable/task_icon_calendar"
android:textColor="@color/task_secondary_text"
android:visibility="invisible"
tools:visibility="visible"
android:scaleType="center"
tools:text="special" />
<ImageView
android:id="@+id/iconviewChallenge"
android:layout_width="@dimen/task_icon_size"
android:layout_height="@dimen/task_icon_size"
android:layout_marginStart="@dimen/task_icon_space"
android:layout_marginLeft="@dimen/task_icon_space"
android:contentDescription="@string/belongs_to_challenge"
android:scaleType="center"
app:srcCompat="@drawable/task_megaphone" />
<ImageView
android:id="@+id/iconviewReminder"
android:layout_width="@dimen/task_icon_size"
android:layout_height="@dimen/task_icon_size"
android:layout_marginStart="@dimen/task_icon_space"
android:layout_marginLeft="@dimen/task_icon_space"
android:contentDescription="@string/has_reminder"
android:scaleType="center"
app:srcCompat="@drawable/task_icon_reminder" />
<ImageView
android:id="@+id/iconviewTag"
android:layout_width="@dimen/task_icon_size"
android:layout_height="@dimen/task_icon_size"
android:layout_marginStart="@dimen/task_icon_space"
android:layout_marginLeft="@dimen/task_icon_space"
android:contentDescription="@string/has_tag"
android:scaleType="center"
app:srcCompat="@drawable/task_icon_tag" />
</LinearLayout>
</LinearLayout>
<ProgressBar
android:id="@+id/syncing_view"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_gravity="center_vertical"
android:layout_marginLeft="@dimen/spacing_small"
android:layout_marginRight="@dimen/spacing_small"
style="@style/Widget.AppCompat.ProgressBar"/>
<ImageButton
android:id="@+id/error_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:background="@color/transparent"
android:src="@drawable/ic_warning_black"
android:layout_marginLeft="@dimen/spacing_small"
android:layout_marginRight="@dimen/spacing_small"/>
<LinearLayout
android:id="@+id/checklistIndicatorWrapper"
android:layout_width="@dimen/checklist_wrapper_width"
android:layout_height="match_parent"
android:gravity="center"
android:orientation="vertical">
<TextView
android:id="@+id/checkListCompletedTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:textColor="@color/white"
style="@style/Body3"
tools:text="1"/>
<View
android:id="@+id/checklistDivider"
android:layout_width="@dimen/checklist_divider_width"
android:layout_height="@dimen/hairline_height"
android:background="@color/white" />
<TextView
android:id="@+id/checkListAllTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:textColor="@color/white"
style="@style/Body3"
tools:text="13" />
</LinearLayout>
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_gravity="bottom"
android:background="@color/task_border_gray" />
</FrameLayout>
<LinearLayout
android:id="@+id/checklistView"
android:id="@+id/main_task_wrapper"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" />
<View
android:id="@+id/checklistBottomSpace"
android:layout_width="match_parent"
android:layout_height="10dp"
android:background="@color/checklist_separator" />
android:layout_marginHorizontal="@dimen/task_spacing_horizontal"
android:layout_marginVertical="@dimen/task_spacing_vertical"
android:background="@drawable/task_background"
android:clipChildren="true"
android:minHeight="@dimen/task_min_height">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:id="@+id/card_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:baselineAligned="false"
android:minHeight="@dimen/task_min_height">
<FrameLayout
android:id="@+id/checkBoxHolder"
android:layout_width="@dimen/button_width"
android:layout_height="match_parent">
<CheckBox
android:id="@+id/checkBox"
android:layout_width="@dimen/checkbox_size"
android:layout_height="@dimen/checkbox_size"
android:layout_gravity="center"
android:button="@drawable/todo_checkbox"
android:gravity="center" />
</FrameLayout>
<include layout="@layout/task_main_content" />
<ProgressBar
android:id="@+id/syncing_view"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_gravity="center_vertical"
android:layout_marginLeft="@dimen/spacing_small"
android:layout_marginRight="@dimen/spacing_small"
style="@style/Widget.AppCompat.ProgressBar"/>
<ImageButton
android:id="@+id/error_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:background="@color/transparent"
android:src="@drawable/ic_warning_black"
android:layout_marginLeft="@dimen/spacing_small"
android:layout_marginRight="@dimen/spacing_small"/>
<include layout="@layout/checklist_indicator" />
</LinearLayout>
<LinearLayout
android:id="@+id/checklistView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" />
</LinearLayout>
</FrameLayout>
</LinearLayout>

View file

@ -23,6 +23,9 @@
<attr name="barForegroundColor" format="color" />
<attr name="barPendingColor" format="color" />
<attr name="barBackgroundColor" format="color" />
<attr name="headerBackgroundColor" format="color" />
<attr name="headerOffsetColor" format="color" />
<attr name="headerTextColor" format="color" />
<declare-styleable name="AvatarView">
<attr name="showBackground" format="boolean" />
<attr name="showMount" format="boolean" />

View file

@ -32,20 +32,20 @@
<!-- Widget -->
<dimen name="button_width">54dp</dimen>
<dimen name="button_compact_width">50dp</dimen>
<dimen name="button_width">40dp</dimen>
<dimen name="button_compact_width">36dp</dimen>
<dimen name="hairline_height">0.5dp</dimen>
<dimen name="checklist_divider_width">14dp</dimen>
<dimen name="checklist_wrapper_width">36dp</dimen>
<dimen name="checklist_wrapper_width">24dp</dimen>
<dimen name="checklist_item_min_height">50dp</dimen>
<dimen name="daily_checkbox_corner_radius">2dp</dimen>
<dimen name="checkbox_size">30dp</dimen>
<dimen name="checkbox_compact_size">25dp</dimen>
<dimen name="checkbox_size">24dp</dimen>
<dimen name="checkbox_compact_size">20dp</dimen>
<dimen name="task_top_bottom_padding">16dp</dimen>
<dimen name="task_top_bottom_compact_padding">16dp</dimen>
<dimen name="task_top_bottom_padding">10dp</dimen>
<dimen name="task_top_bottom_compact_padding">8dp</dimen>
<dimen name="reward_spacing">8dp</dimen>
<dimen name="grid_item_margin">6dp</dimen>
<dimen name="avatar_small_width">90dp</dimen>
@ -65,7 +65,7 @@
<dimen name="mount_image_height">99dp</dimen>
<dimen name="shop_height">124dp</dimen>
<dimen name="bar_icon_padding">4dp</dimen>
<dimen name="task_text_padding">16dp</dimen>
<dimen name="task_text_padding">15dp</dimen>
<dimen name="header_bar_spacing">9dp</dimen>
<dimen name="bar_size_slim">13dp</dimen>
@ -96,7 +96,7 @@
<dimen name="currency_icon_size">24dp</dimen>
<dimen name="shopitem_dialog_content_inset">24dp</dimen>
<dimen name="reward_width">84dp</dimen>
<dimen name="task_min_height">60dp</dimen>
<dimen name="task_min_height">50dp</dimen>
<!-- Per the design guidelines, navigation drawers should be between 240dp and 320dp:
https://developer.android.com/design/patterns/navigation-drawer.html -->
@ -119,4 +119,6 @@
<dimen name="downwards_drop_shadow_height">16dp</dimen>
<dimen name="collapsible_section_padding">12dp</dimen>
<dimen name="widget_rounding">5dp</dimen>
<dimen name="task_spacing_vertical">4dp</dimen>
<dimen name="task_spacing_horizontal">10dp</dimen>
</resources>

View file

@ -50,6 +50,12 @@
<item name="searchViewStyle">@style/SearchViewStyle</item>
<item name="toolbarContentColor">@color/white</item>
<item name="colorPrimaryText">@color/brand_50</item>
<item name="headerBackgroundColor">@color/white</item>
<item name="headerOffsetColor">@color/gray_700</item>
<item name="headerTextColor">@color/gray_10</item>
</style>
<style name="MainAppTheme" parent="AppTheme">
</style>
@ -200,9 +206,6 @@
<item name="android:windowBackground">@drawable/activity_launch_background</item>
</style>
<style name="MainAppTheme" parent="AppTheme">
</style>
<style name="PopupTheme" parent="Widget.AppCompat.Light.PopupMenu">
<item name="android:popupBackground">@android:color/white</item>
@ -278,6 +281,15 @@
<item name="android:actionMenuTextColor">?attr/toolbarContentColor</item>
</style>
<style name="Toolbar.Modern" parent="Base.ThemeOverlay.AppCompat.ActionBar">
<item name="android:textColorPrimary">?attr/headerTextColor</item>
<item name="textColorSecondary">?attr/headerTextColor</item>
<item name="background">?attr/headerBackgroundColor</item>
<item name="actionMenuTextColor">?attr/toolbarContentColor</item>
<item name="android:actionMenuTextColor">?attr/toolbarContentColor</item>
</style>
<style name="HabitButton" parent="android:Widget.Button">
<item name="android:radius">0dp</item>
<item name="android:layout_margin">0dp</item>

View file

@ -123,7 +123,7 @@ open class Task : RealmObject, Parcelable {
this.value < -20 -> return R.color.maroon_50
this.value < -10 -> return R.color.red_50
this.value < -1 -> return R.color.orange_50
this.value < 1 -> return R.color.yellow_50
this.value < 1 -> return R.color.yellow_10
this.value < 5 -> return R.color.green_50
this.value < 10 -> return R.color.teal_50
else -> R.color.blue_50
@ -136,7 +136,7 @@ open class Task : RealmObject, Parcelable {
this.value < -20 -> return R.color.maroon_10
this.value < -10 -> return R.color.red_10
this.value < -1 -> return R.color.orange_10
this.value < 1 -> return R.color.yellow_10
this.value < 1 -> return R.color.yellow_5
this.value < 5 -> return R.color.green_10
this.value < 10 -> return R.color.teal_10
else -> R.color.blue_10

View file

@ -3,6 +3,7 @@ package com.habitrpg.android.habitica.ui.activities
import android.content.Context
import android.content.SharedPreferences
import android.content.res.Configuration
import android.os.Build
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
@ -93,6 +94,7 @@ abstract class BaseActivity : AppCompatActivity() {
} else {
sharedPreferences.getString("theme_name", "purple")
}
val modernHeaderStyle = sharedPreferences.getBoolean("modern_header_style", true)
if (theme == currentTheme) return
setTheme(when (theme) {
"maroon" -> R.style.MainAppTheme_Maroon
@ -105,7 +107,14 @@ abstract class BaseActivity : AppCompatActivity() {
else -> R.style.MainAppTheme
})
window.navigationBarColor = getThemeColor(R.attr.colorPrimaryDark)
window.statusBarColor = getThemeColor(R.attr.colorPrimaryDark)
window.statusBarColor = if (modernHeaderStyle && Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
getThemeColor(R.attr.headerBackgroundColor)
} else {
getThemeColor(R.attr.colorPrimaryDark)
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
window.decorView.systemUiVisibility = View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR
}
if (currentTheme != null) {
reload()

View file

@ -84,7 +84,7 @@ class RewardsRecyclerViewAdapter(private var customRewards: OrderedRealmCollecti
if (customRewards != null && position < customRewardCount) {
val reward = customRewards?.get(position) ?: return
val gold = user?.stats?.gp ?: 0.0
(holder as? RewardViewHolder)?.bind(reward, position, reward.value < gold, taskDisplayMode)
(holder as? RewardViewHolder)?.bind(reward, position, reward.value <= gold, taskDisplayMode)
} else if (inAppRewards != null) {
val item = inAppRewards?.get(position - customRewardCount) ?: return
if (holder is ShopItemViewHolder) {

View file

@ -27,7 +27,9 @@ open class ShopsFragment : BaseMainFragment() {
lateinit var inventoryRepository: InventoryRepository
private val currencyView: CurrencyViews by lazy {
CurrencyViews(context)
val view = CurrencyViews(context)
view.lightBackground = true
view
}
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {

View file

@ -6,6 +6,7 @@ import android.graphics.PorterDuff
import android.os.Bundle
import android.view.*
import androidx.appcompat.widget.SearchView
import androidx.core.content.ContextCompat
import androidx.fragment.app.FragmentPagerAdapter
import com.habitrpg.android.habitica.HabiticaBaseApplication
import com.habitrpg.android.habitica.R
@ -249,6 +250,11 @@ class TasksFragment : BaseMainFragment(), SearchView.OnQueryTextListener {
}
if (filterCount == 0) {
filterMenuItem?.setIcon(R.drawable.ic_action_filter_list)
context?.let {
val filterIcon = it.getDrawable(R.drawable.ic_action_filter_list)
filterIcon?.setColorFilter(it.getThemeColor(R.attr.headerTextColor), PorterDuff.Mode.MULTIPLY)
filterMenuItem?.setIcon(filterIcon)
}
} else {
context?.let {
val filterIcon = it.getDrawable(R.drawable.ic_filters_active)

View file

@ -2,6 +2,7 @@ package com.habitrpg.android.habitica.ui.viewHolders.tasks
import android.content.Context
import android.view.View
import android.view.ViewGroup
import android.widget.*
import com.habitrpg.android.habitica.R
import com.habitrpg.android.habitica.helpers.RxErrorHandler
@ -27,13 +28,12 @@ abstract class BaseTaskViewHolder constructor(itemView: View, var scoreTaskFunc:
var movingFromPosition: Int? = null
var errorButtonClicked: Action? = null
protected var context: Context
private val mainTaskWrapper: ViewGroup by bindView(itemView, R.id.main_task_wrapper)
private val titleTextView: EllipsisTextView by bindView(itemView, R.id.checkedTextView)
private val notesTextView: EllipsisTextView? by bindView(itemView, R.id.notesTextView)
internal val rightBorderView: View? by bindOptionalView(itemView, R.id.rightBorderView)
protected val specialTaskTextView: TextView? by bindOptionalView(itemView, R.id.specialTaskText)
private val iconViewChallenge: ImageView? by bindView(itemView, R.id.iconviewChallenge)
private val iconViewReminder: ImageView? by bindOptionalView(itemView, R.id.iconviewReminder)
private val iconViewTag: ImageView? by bindView(itemView, R.id.iconviewTag)
private val taskIconWrapper: LinearLayout? by bindView(itemView, R.id.taskIconWrapper)
private val approvalRequiredTextView: TextView? by bindView(itemView, R.id.approvalRequiredTextField)
private val expandNotesButton: Button? by bindOptionalView(R.id.expand_notes_button)
@ -52,9 +52,6 @@ abstract class BaseTaskViewHolder constructor(itemView: View, var scoreTaskFunc:
if (iconViewReminder?.visibility == View.VISIBLE) {
isVisible = true
}
if (iconViewTag?.visibility == View.VISIBLE) {
isVisible = true
}
if (iconViewChallenge?.visibility == View.VISIBLE) {
isVisible = true
}
@ -70,6 +67,7 @@ abstract class BaseTaskViewHolder constructor(itemView: View, var scoreTaskFunc:
init {
itemView.setOnClickListener { onClick(it) }
itemView.isClickable = true
mainTaskWrapper.clipToOutline = true
titleTextView.setOnClickListener { onClick(it) }
notesTextView?.setOnClickListener { onClick(it) }
@ -172,10 +170,8 @@ abstract class BaseTaskViewHolder constructor(itemView: View, var scoreTaskFunc:
}
}
rightBorderView?.setBackgroundResource(data.lightTaskColor)
if (displayMode == "standard") {
iconViewReminder?.visibility = if (data.reminders?.size ?: 0 > 0) View.VISIBLE else View.GONE
iconViewTag?.visibility = if (data.tags?.size ?: 0 > 0) View.VISIBLE else View.GONE
iconViewChallenge?.visibility = if (task?.challengeID != null) View.VISIBLE else View.GONE
if (task?.challengeID != null) {

View file

@ -30,7 +30,6 @@ abstract class ChecklistedViewHolder(itemView: View, scoreTaskFunc: ((Task, Task
private val checkboxHolder: ViewGroup by bindView(itemView, R.id.checkBoxHolder)
internal val checkbox: CheckBox by bindView(itemView, R.id.checkBox)
internal val checklistView: LinearLayout by bindView(itemView, R.id.checklistView)
internal val checklistBottomSpace: View by bindView(itemView, R.id.checklistBottomSpace)
internal val checklistIndicatorWrapper: ViewGroup by bindView(itemView, R.id.checklistIndicatorWrapper)
private val checklistCompletedTextView: TextView by bindView(itemView, R.id.checkListCompletedTextView)
private val checklistAllTextView: TextView by bindView(itemView, R.id.checkListAllTextView)
@ -60,12 +59,6 @@ abstract class ChecklistedViewHolder(itemView: View, scoreTaskFunc: ((Task, Task
this.updateChecklistDisplay()
this.checklistIndicatorWrapper.visibility = if (newTask.checklist?.size == 0) View.GONE else View.VISIBLE
this.rightBorderView?.visibility = if (newTask.checklist?.size == 0) View.VISIBLE else View.GONE
if (newTask.completed) {
this.rightBorderView?.setBackgroundResource(newTask.lightTaskColor)
} else {
this.rightBorderView?.setBackgroundColor(this.taskGray)
}
super.bind(newTask, position, displayMode)
}
@ -100,11 +93,9 @@ abstract class ChecklistedViewHolder(itemView: View, scoreTaskFunc: ((Task, Task
}
}
this.checklistView.visibility = View.VISIBLE
this.checklistBottomSpace.visibility = View.VISIBLE
} else {
this.checklistView.removeAllViewsInLayout()
this.checklistView.visibility = View.GONE
this.checklistBottomSpace.visibility = View.GONE
}
}

View file

@ -1,10 +1,12 @@
package com.habitrpg.android.habitica.ui.viewHolders.tasks
import android.graphics.PorterDuff
import android.view.View
import android.widget.Button
import android.widget.FrameLayout
import android.widget.ImageView
import android.widget.TextView
import androidx.core.content.ContextCompat
import com.habitrpg.android.habitica.R
import com.habitrpg.android.habitica.models.responses.TaskDirection
import com.habitrpg.android.habitica.models.tasks.Task
@ -38,32 +40,46 @@ class HabitViewHolder(itemView: View, scoreTaskFunc: ((Task, TaskDirection) -> U
this.task = data
if (data.up == true) {
this.btnPlusWrapper.setBackgroundResource(data.lightTaskColor)
if (data.lightTaskColor == R.color.yellow_100) {
this.btnPlusIconView.setImageResource(R.drawable.habit_plus_yellow)
} else {
this.btnPlusIconView.setImageResource(R.drawable.habit_plus)
}
val plusIcon = ContextCompat.getDrawable(context, R.drawable.habit_plus)
plusIcon?.setTint(ContextCompat.getColor(context, R.color.white))
plusIcon?.setTintMode(PorterDuff.Mode.MULTIPLY)
this.btnPlusIconView.setImageDrawable(plusIcon)
val drawable = ContextCompat.getDrawable(context, R.drawable.habit_circle)
drawable?.setTint(ContextCompat.getColor(context, data.mediumTaskColor))
drawable?.setTintMode(PorterDuff.Mode.MULTIPLY)
btnPlusIconView.background = drawable
this.btnPlus.visibility = View.VISIBLE
this.btnPlus.isClickable = true
} else {
this.btnPlusWrapper.setBackgroundResource(R.color.habit_inactive_gray)
this.btnPlusIconView.setImageResource(R.drawable.habit_plus_disabled)
val plusIcon = ContextCompat.getDrawable(context, R.drawable.habit_plus)
plusIcon?.setTint(ContextCompat.getColor(context, R.color.gray_500))
plusIcon?.setTintMode(PorterDuff.Mode.MULTIPLY)
this.btnPlusIconView.setImageDrawable(plusIcon)
btnPlusIconView.background = ContextCompat.getDrawable(context, R.drawable.habit_circle_disabled)
this.btnPlus.visibility = View.GONE
this.btnPlus.isClickable = false
}
if (data.down == true) {
this.btnMinusWrapper.setBackgroundResource(data.lightTaskColor)
if (data.lightTaskColor == R.color.yellow_100) {
this.btnMinusIconView.setImageResource(R.drawable.habit_minus_yellow)
} else {
this.btnMinusIconView.setImageResource(R.drawable.habit_minus)
}
val minusIcon = ContextCompat.getDrawable(context, R.drawable.habit_minus)
minusIcon?.setTint(ContextCompat.getColor(context, R.color.white))
minusIcon?.setTintMode(PorterDuff.Mode.MULTIPLY)
this.btnMinusIconView.setImageDrawable(minusIcon)
val drawable = ContextCompat.getDrawable(context, R.drawable.habit_circle)
drawable?.setTint(ContextCompat.getColor(context, data.mediumTaskColor))
drawable?.setTintMode(PorterDuff.Mode.MULTIPLY)
btnMinusIconView.background = drawable
this.btnMinus.visibility = View.VISIBLE
this.btnMinus.isClickable = true
} else {
this.btnMinusWrapper.setBackgroundResource(R.color.habit_inactive_gray)
this.btnMinusIconView.setImageResource(R.drawable.habit_minus_disabled)
val minusIcon = ContextCompat.getDrawable(context, R.drawable.habit_minus)
minusIcon?.setTint(ContextCompat.getColor(context, R.color.gray_500))
minusIcon?.setTintMode(PorterDuff.Mode.MULTIPLY)
this.btnMinusIconView.setImageDrawable(minusIcon)
btnMinusIconView.background = ContextCompat.getDrawable(context, R.drawable.habit_circle_disabled)
this.btnMinus.visibility = View.GONE
this.btnMinus.isClickable = false
}

View file

@ -5,6 +5,7 @@ import android.view.View
import android.widget.ImageView
import android.widget.TextView
import androidx.core.content.ContextCompat
import androidx.core.graphics.ColorUtils
import com.habitrpg.android.habitica.R
import com.habitrpg.android.habitica.helpers.NumberAbbreviator
import com.habitrpg.android.habitica.models.responses.TaskDirection
@ -70,10 +71,12 @@ class RewardViewHolder(itemView: View, scoreTaskFunc: ((Task, TaskDirection) ->
if (canBuy) {
goldIconView.alpha = 1.0f
priceLabel.setTextColor(ContextCompat.getColor(context, R.color.yellow_5))
priceLabel.setTextColor(ContextCompat.getColor(context, R.color.yellow_1))
buyButton.setBackgroundColor(ContextCompat.getColor(context, R.color.yellow_500))
} else {
goldIconView.alpha = 0.4f
priceLabel.setTextColor(ContextCompat.getColor(context, R.color.gray_500))
goldIconView.alpha = 0.6f
priceLabel.setTextColor(ContextCompat.getColor(context, R.color.gray_300))
buyButton.setBackgroundColor(ColorUtils.setAlphaComponent(ContextCompat.getColor(context, R.color.gray_600), 127))
}
}
}

View file

@ -59,7 +59,7 @@ class CurrencyView : androidx.appcompat.widget.AppCompatTextView {
if ("gold" == currency) {
icon = HabiticaIconsHelper.imageOfGold()
if (lightBackground) {
setTextColor(ContextCompat.getColor(context, R.color.yellow_5))
setTextColor(ContextCompat.getColor(context, R.color.yellow_1))
} else {
setTextColor(ContextCompat.getColor(context, R.color.yellow_100))
}

View file

@ -79,9 +79,7 @@ class YesterdailyDialog private constructor(context: Context, private val userRe
private fun createTaskViews(inflater: LayoutInflater) {
for (task in tasks) {
val taskView = createNewTaskView(inflater)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
taskView.clipToOutline = true
}
taskView.clipToOutline = true
configureTaskView(taskView, task)
val taskContainer = taskView.findViewById<View>(R.id.taskHolder)
taskContainer.setOnClickListener {

View file

@ -11,7 +11,7 @@ buildscript {
maven { url "https://plugins.gradle.org/m2/" }
}
dependencies {
classpath 'com.android.tools.build:gradle:4.0.0'
classpath 'com.android.tools.build:gradle:4.0.1'
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
classpath 'com.google.gms:google-services:4.3.3'
classpath "io.realm:realm-gradle-plugin:6.0.2"