Merge branch 'develop' of https://github.com/HabitRPG/habitrpg-android into develop

This commit is contained in:
Negue 2015-08-18 18:07:41 +02:00
commit 96508a2447
65 changed files with 545 additions and 628 deletions

View file

@ -68,18 +68,18 @@
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dependency-cache" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dex" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dex-cache" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.databinding/library/1.0-rc0/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/appcompat-v7/22.2.0/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/cardview-v7/22.2.0/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/design/22.2.0/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/gridlayout-v7/22.2.0/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/recyclerview-v7/22.2.0/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/support-v4/22.2.0/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.databinding/library/1.0-rc1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/appcompat-v7/22.2.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/cardview-v7/22.2.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/design/22.2.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/gridlayout-v7/22.2.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/recyclerview-v7/22.2.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/support-v4/22.2.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.crashlytics.sdk.android/answers/1.2.0/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.crashlytics.sdk.android/beta/1.1.2/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.crashlytics.sdk.android/crashlytics-core/2.3.0/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.crashlytics.sdk.android/crashlytics/2.3.0/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.github.florent37/materialviewpager/1.0.6/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.github.florent37/materialviewpager/1.1.0/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.github.ksoichiro/android-observablescrollview/1.5.2/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.github.porokoro/paperboy/364c77b49f/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.instabug.library/instabugcore/1.6.1/jars" />
@ -109,58 +109,63 @@
</content>
<orderEntry type="jdk" jdkName="Android API 22 Platform" jdkType="Android SDK" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" exported="" name="gson-2.3.1" level="project" />
<orderEntry type="library" exported="" name="commons-io-2.4" level="project" />
<orderEntry type="library" exported="" name="library-1.0.17" level="project" />
<orderEntry type="library" exported="" name="library-1.0.18" level="project" />
<orderEntry type="library" exported="" name="okhttp-2.3.0" level="project" />
<orderEntry type="library" exported="" name="kenburnsview-1.0.6" level="project" />
<orderEntry type="library" exported="" name="retrofit-1.6.0" level="project" />
<orderEntry type="library" exported="" name="antlr4-4.4" level="project" />
<orderEntry type="library" exported="" name="rxjava-1.0.10" level="project" />
<orderEntry type="library" exported="" name="antlr4-4.5" level="project" />
<orderEntry type="library" exported="" name="crashlytics-core-2.3.0" level="project" />
<orderEntry type="library" exported="" name="aboutlibraries-5.0.5" level="project" />
<orderEntry type="library" exported="" name="library-1.0-rc0" level="project" />
<orderEntry type="library" exported="" name="antlr4-runtime-4.5" level="project" />
<orderEntry type="library" exported="" name="antlr4-annotations-4.5" level="project" />
<orderEntry type="library" exported="" name="instabugsupport-1.6.1" level="project" />
<orderEntry type="library" exported="" name="antlr4-annotations-4.4" level="project" />
<orderEntry type="library" exported="" name="library-1.0-rc1" level="project" />
<orderEntry type="library" exported="" name="org.abego.treelayout.core-1.0.1" level="project" />
<orderEntry type="library" exported="" name="paperboy-364c77b49f" level="project" />
<orderEntry type="library" exported="" name="library-1.1.0" level="project" />
<orderEntry type="library" exported="" name="DBFlow-2.2.1" level="project" />
<orderEntry type="library" exported="" name="mimecraft-1.1.1" level="project" />
<orderEntry type="library" exported="" name="compilerCommon-1.0-rc1" level="project" />
<orderEntry type="library" exported="" name="compiler-1.0-rc1" level="project" />
<orderEntry type="library" exported="" name="library-2.4.0" level="project" />
<orderEntry type="library" exported="" name="mimecraft-1.1.1" level="project" />
<orderEntry type="library" exported="" name="guava-18.0" level="project" />
<orderEntry type="library" exported="" name="iconics-1.1.0" level="project" />
<orderEntry type="library" exported="" name="support-v4-22.2.1" level="project" />
<orderEntry type="library" exported="" name="auto-service-1.0-rc2" level="project" />
<orderEntry type="library" exported="" name="support-v4-22.2.0" level="project" />
<orderEntry type="library" exported="" name="antlr4-runtime-4.4" level="project" />
<orderEntry type="library" exported="" name="baseLibrary-1.0-rc0" level="project" />
<orderEntry type="library" exported="" name="baseLibrary-1.0-rc1" level="project" />
<orderEntry type="library" exported="" name="fabric-1.3.1" level="project" />
<orderEntry type="library" exported="" name="materialviewpager-1.0.6" level="project" />
<orderEntry type="library" exported="" name="compiler-1.0-rc0" level="project" />
<orderEntry type="library" exported="" name="beta-1.1.2" level="project" />
<orderEntry type="library" exported="" name="gridlayout-v7-22.2.0" level="project" />
<orderEntry type="library" exported="" name="gridlayout-v7-22.2.1" level="project" />
<orderEntry type="library" exported="" name="commons-codec-1.10" level="project" />
<orderEntry type="library" exported="" name="javawriter-2.5.0" level="project" />
<orderEntry type="library" exported="" name="kotlin-stdlib-0.12.613" level="project" />
<orderEntry type="library" exported="" name="commons-lang3-3.3.2" level="project" />
<orderEntry type="library" exported="" name="design-22.2.0" level="project" />
<orderEntry type="library" exported="" name="cardview-v7-22.2.0" level="project" />
<orderEntry type="library" exported="" name="design-22.2.1" level="project" />
<orderEntry type="library" exported="" name="cardview-v7-22.2.1" level="project" />
<orderEntry type="library" exported="" name="kotlin-runtime-0.12.613" level="project" />
<orderEntry type="library" exported="" name="DBFlow-Compiler-2.2.1" level="project" />
<orderEntry type="library" exported="" name="gson-2.2.4" level="project" />
<orderEntry type="library" exported="" name="answers-1.2.0" level="project" />
<orderEntry type="library" exported="" name="recyclerview-v7-22.2.0" level="project" />
<orderEntry type="library" exported="" name="picasso-2.5.2" level="project" />
<orderEntry type="library" exported="" name="support-annotations-22.2.0" level="project" />
<orderEntry type="library" exported="" name="recyclerview-v7-22.2.1" level="project" />
<orderEntry type="library" exported="" name="support-annotations-22.2.1" level="project" />
<orderEntry type="library" exported="" name="retrofit-1.9.0" level="project" />
<orderEntry type="library" exported="" name="DBFlow-Core-2.2.1" level="project" />
<orderEntry type="library" exported="" name="appcompat-v7-22.2.0" level="project" />
<orderEntry type="library" exported="" name="materialdrawer-3.0.8" level="project" />
<orderEntry type="library" exported="" name="appcompat-v7-22.2.1" level="project" />
<orderEntry type="library" exported="" name="auto-common-0.3" level="project" />
<orderEntry type="library" exported="" name="antlr-runtime-3.5.2" level="project" />
<orderEntry type="library" exported="" name="butterknife-6.1.0" level="project" />
<orderEntry type="library" exported="" name="adapters-1.0-rc0" level="project" />
<orderEntry type="library" exported="" name="okio-1.3.0" level="project" />
<orderEntry type="library" exported="" name="adapters-1.0-rc1" level="project" />
<orderEntry type="library" exported="" name="okhttp-urlconnection-2.3.0" level="project" />
<orderEntry type="library" exported="" name="eventbus-2.4.0" level="project" />
<orderEntry type="library" exported="" name="library-2.1.4" level="project" />
<orderEntry type="library" exported="" name="materialviewpager-1.1.0" level="project" />
<orderEntry type="library" exported="" name="android-observablescrollview-1.5.2" level="project" />
<orderEntry type="library" exported="" name="kotlin-stdlib-0.11.91" level="project" />
<orderEntry type="library" exported="" name="instabugcore-1.6.1" level="project" />
<orderEntry type="library" exported="" name="crashlytics-2.3.0" level="project" />
<orderEntry type="library" exported="" name="ST4-4.0.8" level="project" />
<orderEntry type="library" exported="" name="kotlin-runtime-0.11.91" level="project" />
</component>
</module>

View file

@ -34,7 +34,10 @@ repositories {
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.squareup.retrofit:retrofit:1.6.0'
compile 'io.reactivex:rxjava:1.0.10'
compile 'com.squareup.okhttp:okhttp-urlconnection:2.3.0'
compile 'com.squareup.okhttp:okhttp:2.3.0'
compile 'com.squareup.retrofit:retrofit:1.9.0'
compile('com.crashlytics.sdk.android:crashlytics:2.3.0@aar') {
transitive = true;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 645 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 653 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 664 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 651 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 648 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 623 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 573 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 563 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 593 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 592 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 620 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 620 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 606 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 557 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 584 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 553 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 980 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 959 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 963 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 959 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 959 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 968 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 979 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 944 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 863 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

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="@color/white" />
<corners android:radius="@dimen/bar_radius"/>
<padding android:left="0dip" android:top="0dip" android:right="0dip" android:bottom="0dip" />
</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="@color/brand_50" />
<corners android:radius="@dimen/bar_radius"/>
<padding android:left="0dip" android:top="0dip" android:right="0dip" android:bottom="0dip" />
</shape>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 306 KiB

View file

@ -10,13 +10,19 @@
android:focusable="true"
android:focusableInTouchMode="true"
android:orientation="horizontal"
android:paddingRight="@dimen/activity_horizontal_margin">
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingEnd="@dimen/activity_horizontal_margin"
android:paddingTop="8dp">
<ImageView
android:id="@+id/IMG_ProfilePicture"
android:layout_width="@dimen/avatar_width"
android:layout_height="@dimen/avatar_height"
android:layout_gravity="center_vertical"
android:paddingLeft="16dp"
android:paddingStart="16dp"
android:paddingRight="24dp"
android:paddingEnd="24dp"
android:scaleType="fitStart"
android:src="@mipmap/ic_launcher" />

View file

@ -3,68 +3,105 @@
<layout xmlns:android="http://schemas.android.com/apk/res/android">
<data>
<import type="com.magicmicky.habitrpgwrapper.lib.models.tasks.Task" />
<import type="android.view.View"/>
<variable
name="daily"
type="Task" />
</data>
<FrameLayout xmlns:app="http://schemas.android.com/apk/res-auto"
<LinearLayout xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.v7.widget.CardView
android:id="@+id/card_view"
android:layout_height="match_parent"
android:background="@color/white"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="80dp"
android:layout_marginBottom="@dimen/cardMarginVertical"
android:layout_marginLeft="@dimen/cardMarginHorizontal"
android:layout_marginRight="@dimen/cardMarginHorizontal"
android:layout_marginTop="@dimen/cardMarginVertical"
app:cardCornerRadius="2dp"
app:cardElevation="2dp"
app:cardPreventCornerOverlap="false"
app:contentPadding="0dp"
app:cardColor="@{daily.getLightTaskColor}">
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="match_parent">
<CheckBox
android:id="@+id/checkBox"
android:layout_width="@dimen/button_width"
android:layout_height="match_parent"
android:layout_above="@+id/textView6"
android:layout_alignLeft="@+id/checkedTextView"
android:layout_alignStart="@+id/checkedTextView">
<CheckBox
android:id="@+id/checkBox"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:checked="@{daily.completed}"
app:backgroundColor="@{daily.getDarkTaskColor}"
android:gravity="center"/>
android:checked="@{daily.completed}"
app:backgroundColor="@{daily.getLightTaskColor}"
android:gravity="center"
android:layout_gravity="center_horizontal" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:padding="5dp">
<CheckedTextView
android:padding="5dp"
android:id="@+id/linearLayout"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_toLeftOf="@+id/checklistIndicatorWrapper"
android:layout_toStartOf="@+id/checklistIndicatorWrapper">
<TextView
android:id="@+id/checkedTextView"
style="@style/CardTitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@{daily.text}" />
<TextView
android:id="@+id/textView6"
style="@style/CardText"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="@{daily.notes}" />
android:text="@{daily.notes}"
android:visibility="@{daily.notes != null ? View.VISIBLE : View.GONE}"/>
</LinearLayout>
<RelativeLayout android:orientation="vertical"
android:id="@+id/checklistIndicatorWrapper"
android:layout_width="@dimen/checklist_wrapper_width"
android:layout_height="match_parent"
app:backgroundColor="@{daily.getLightTaskColor}"
android:visibility="@{daily.checklist.size > 0 ? View.VISIBLE : View.GONE}"
android:gravity="center"
android:layout_alignParentTop="true"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@{String.valueOf(daily.getCompletedChecklistCount)}"
android:textColor="@color/white"
android:gravity="center"
android:layout_above="@+id/checklistDivider"/>
<View
android:id="@+id/checklistDivider"
android:layout_width="@dimen/checklist_divider_width"
android:layout_height="@dimen/hairline_height"
android:background="@color/white"
android:layout_centerInParent="true"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@{String.valueOf(daily.checklist.size)}"
android:textColor="@color/white"
android:gravity="center"
android:layout_below="@+id/checklistDivider"/>
</RelativeLayout>
<View
android:id="@+id/rightBorderView"
android:layout_width="5dp"
android:layout_height="match_parent"
app:backgroundColor="@{daily.getLightTaskColor}"
android:gravity="center"
android:layout_alignParentTop="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true" />
</RelativeLayout>
</LinearLayout>
</android.support.v7.widget.CardView>
</FrameLayout>
</LinearLayout>
<View
android:id="@+id/bottomBorderView"
android:layout_width="match_parent"
android:layout_height="@dimen/hairline_height"
android:background="@color/cell_separator"/>
</LinearLayout>
</layout>

View file

@ -11,59 +11,42 @@
type="Task" />
</data>
<FrameLayout xmlns:app="http://schemas.android.com/apk/res-auto"
<LinearLayout xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.v7.widget.CardView
android:id="@+id/card_view"
android:layout_height="wrap_content"
android:orientation="vertical"
android:background="@color/white">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="100dp"
android:layout_marginBottom="@dimen/cardMarginVertical"
android:layout_marginLeft="@dimen/cardMarginHorizontal"
android:layout_marginRight="@dimen/cardMarginHorizontal"
android:layout_marginTop="@dimen/cardMarginVertical"
app:cardCornerRadius="2dp"
app:cardElevation="2dp"
app:cardPreventCornerOverlap="false"
app:contentPadding="0dp"
app:cardColor="@{habit.getLightTaskColor}">
android:layout_height="match_parent">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:orientation="vertical"
android:id="@+id/btnLayout">
<Button
android:id="@+id/btnPlus"
android:layout_width="@dimen/button_width"
android:layout_height="0dp"
android:layout_weight="1"
android:visibility="@{habit.up ? View.VISIBLE : View.GONE}"
android:text="+"
android:textSize="15sp"
app:backgroundColor="@{habit.getLightTaskColor}" />
<Button
android:id="@+id/btnMinus"
android:layout_width="@dimen/button_width"
android:layout_height="0dp"
android:layout_weight="1"
android:visibility="@{habit.down ? View.VISIBLE : View.GONE}"
app:backgroundColor="@{habit.getLightTaskColor}"
android:text="-"
android:textSize="15sp"/>
</LinearLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="fill_horizontal|center_vertical|center_horizontal|fill|clip_vertical|fill_vertical|center|start|clip_horizontal|bottom|left|right|end|top"
android:minHeight="250dp">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:orientation="vertical"
android:id="@+id/btnLayout">
<Button
android:id="@+id/btnPlus"
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_weight="1"
android:visibility="@{habit.up ? View.VISIBLE : View.GONE}"
android:text="+"
android:textSize="15sp"
app:backgroundColor="@{habit.getDarkTaskColor}" />
<Button
android:id="@+id/btnMinus"
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_weight="1"
android:visibility="@{habit.down ? View.VISIBLE : View.GONE}"
app:backgroundColor="@{habit.getDarkTaskColor}"
android:text="-"
android:textSize="15sp"/>
</LinearLayout>
<CheckedTextView
android:layout_height="match_parent">
<TextView
android:id="@+id/checkedTextView"
style="@style/CardTitle"
android:layout_width="match_parent"
@ -71,8 +54,6 @@
android:layout_alignParentBottom="false"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_toRightOf="@id/btnLayout"
android:layout_toEndOf="@id/btnLayout"
android:layout_alignParentTop="true"
android:paddingBottom="5dp"
android:paddingLeft="5dp"
@ -91,8 +72,21 @@
android:layout_below="@+id/checkedTextView"
android:text="@{habit.notes}" />
<View
android:id="@+id/rightBorderView"
android:layout_width="5dp"
android:layout_height="match_parent"
app:backgroundColor="@{habit.getLightTaskColor}"
android:gravity="center"
android:layout_alignParentTop="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true" />
</RelativeLayout>
</android.support.v7.widget.CardView>
</FrameLayout>
</LinearLayout>
<View
android:id="@+id/bottomBorderView"
android:layout_width="match_parent"
android:layout_height="0.5dp"
android:background="@color/cell_separator"/>
</LinearLayout>
</layout>

View file

@ -3,37 +3,29 @@
<data>
<import type="com.magicmicky.habitrpgwrapper.lib.models.tasks.Reward" />
<import type="com.magicmicky.habitrpgwrapper.lib.models.tasks.Task" />
<variable
name="reward"
type="Reward" />
type="Task" />
</data>
<FrameLayout xmlns:app="http://schemas.android.com/apk/res-auto"
<LinearLayout xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content">
android:layout_height="wrap_content"
android:orientation="vertical"
android:background="@color/white">
<android.support.v7.widget.CardView
<LinearLayout
android:id="@+id/card_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/cardMarginVertical"
android:layout_marginLeft="@dimen/cardMarginHorizontal"
android:layout_marginRight="@dimen/cardMarginHorizontal"
android:layout_marginTop="@dimen/cardMarginVertical"
app:cardCornerRadius="2dp"
app:cardElevation="2dp"
app:cardPreventCornerOverlap="false"
app:contentPadding="0dp">
android:layout_height="wrap_content">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="fill_horizontal|center_vertical|center_horizontal|fill|clip_vertical|fill_vertical|center|start|clip_horizontal|bottom|left|right|end|top">
android:layout_height="match_parent">
<CheckedTextView
<TextView
android:id="@+id/checkedTextView"
style="@style/CardTitle"
android:layout_width="wrap_content"
@ -41,6 +33,8 @@
android:layout_alignParentTop="true"
android:layout_toEndOf="@+id/imageView3"
android:layout_toRightOf="@+id/imageView3"
android:layout_toStartOf="@+id/btnReward"
android:layout_toLeftOf="@+id/btnReward"
android:padding="5dp"
android:text="@{reward.text}" />
@ -51,6 +45,8 @@
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/checkedTextView"
android:layout_alignStart="@+id/checkedTextView"
android:layout_alignRight="@+id/checkedTextView"
android:layout_alignEnd="@+id/checkedTextView"
android:layout_below="@+id/checkedTextView"
android:maxLines="3"
android:minLines="2"
@ -58,22 +54,13 @@
android:paddingRight="5dp"
android:text="@{reward.notes}" />
<View
android:id="@+id/separator"
android:layout_width="fill_parent"
android:layout_height="1dp"
android:layout_alignBottom="@+id/textView6"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:background="@android:color/darker_gray" />
<Button
android:id="@+id/btnReward"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_below="@+id/separator"
android:layout_centerVertical="true"
android:drawableLeft="@drawable/gold"
android:maxHeight="10dp"
android:text="@{String.valueOf(reward.value)}" />
@ -83,16 +70,16 @@
android:layout_width="65dp"
android:padding="5dp"
android:layout_height="wrap_content"
android:layout_above="@+id/separator"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_centerVertical="true"
android:layout_marginLeft="5dp"
android:layout_marginStart="5dp"
app:imageName="@{reward.id}"/>
</RelativeLayout>
</android.support.v7.widget.CardView>
</LinearLayout>
</FrameLayout>
</LinearLayout>
</layout>

View file

@ -3,46 +3,33 @@
<layout xmlns:android="http://schemas.android.com/apk/res/android">
<data>
<import type="com.magicmicky.habitrpgwrapper.lib.models.tasks.Task" />
<import type="android.view.View"/>
<variable
name="todo"
type="Task" />
</data>
<FrameLayout xmlns:app="http://schemas.android.com/apk/res-auto"
<LinearLayout xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.v7.widget.CardView
android:layout_height="wrap_content"
android:orientation="vertical"
android:background="@color/white">
<LinearLayout
android:id="@+id/card_view"
android:layout_width="match_parent"
android:layout_height="80dp"
android:layout_marginBottom="@dimen/cardMarginVertical"
android:layout_marginLeft="@dimen/cardMarginHorizontal"
android:layout_marginRight="@dimen/cardMarginHorizontal"
android:layout_marginTop="@dimen/cardMarginVertical"
app:cardCornerRadius="2dp"
app:cardElevation="2dp"
app:cardPreventCornerOverlap="false"
app:contentPadding="0dp"
app:cardColor="@{todo.getLightTaskColor}">
<LinearLayout
android:layout_height="match_parent">
<CheckBox
android:id="@+id/checkBox"
android:layout_width="@dimen/button_width"
android:layout_height="fill_parent"
android:checked="@{todo.completed}"
app:backgroundColor="@{todo.getLightTaskColor}"
android:gravity="center"/>
<RelativeLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@+id/textView6"
android:layout_alignLeft="@+id/checkedTextView"
android:layout_alignStart="@+id/checkedTextView">
<CheckBox
android:id="@+id/checkBox"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:checked="@{todo.completed}"
app:backgroundColor="@{todo.getDarkTaskColor}"
android:gravity="center"/>
android:layout_height="match_parent">
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
@ -62,10 +49,54 @@
android:layout_height="match_parent"
android:text="@{todo.notes}" />
</LinearLayout>
<RelativeLayout android:orientation="vertical"
android:id="@+id/checklistIndicatorWrapper"
android:layout_width="@dimen/checklist_wrapper_width"
android:layout_height="match_parent"
app:backgroundColor="@{todo.getLightTaskColor}"
android:visibility="@{todo.checklist.size > 0 ? View.VISIBLE : View.GONE}"
android:gravity="center"
android:layout_alignParentTop="true"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@{String.valueOf(todo.getCompletedChecklistCount)}"
android:textColor="@color/white"
android:gravity="center"
android:layout_above="@+id/checklistDivider"/>
<View
android:id="@+id/checklistDivider"
android:layout_width="@dimen/checklist_divider_width"
android:layout_height="@dimen/hairline_height"
android:background="@color/white"
android:layout_centerInParent="true"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@{String.valueOf(todo.checklist.size)}"
android:textColor="@color/white"
android:gravity="center"
android:layout_below="@+id/checklistDivider"/>
</RelativeLayout>
<View
android:id="@+id/rightBorderView"
android:layout_width="5dp"
android:layout_height="match_parent"
app:backgroundColor="@{todo.getLightTaskColor}"
android:gravity="center"
android:layout_alignParentTop="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true" />
</RelativeLayout>
</LinearLayout>
</android.support.v7.widget.CardView>
</FrameLayout>
</LinearLayout>
<View
android:id="@+id/bottomBorderView"
android:layout_width="match_parent"
android:layout_height="@dimen/hairline_height"
android:background="@color/cell_separator"/>
</LinearLayout>
</layout>

View file

@ -6,6 +6,9 @@
<variable
name="text"
type="String" />
<variable
name="description"
type="String" />
<variable
name="textColor"
@ -19,55 +22,60 @@
name="weightToHide"
type="float" />
<variable
name="barBackgroundColor"
type="int" />
<variable
name="barForegroundColor"
type="int" />
</data>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="@dimen/bar_size"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/bar_padding"
android:background="@{barBackgroundColor}">
android:orientation="vertical">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:background="@drawable/border"
android:layout_height="@dimen/bar_size"
android:orientation="horizontal"
android:background="@drawable/layout_rounded_bg_brand"
android:weightSum="1">
<View
android:id="@+id/V_HPBar"
android:id="@+id/bar"
android:layout_width="0dip"
android:layout_height="@dimen/bar_inner_size"
android:layout_margin="2dip"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@{barForegroundColor}"
app:rounded_background="@{barForegroundColor}"
app:layout_weight_anim="@{weightToShow}" />
<View
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_height="match_parent"
android:layout_weight="0"
android:padding="2dip"
app:layout_weight_anim="@{weightToHide}" />
</LinearLayout>
<TextView
android:id="@+id/TV_HP"
<LinearLayout
android:layout_width="match_parent"
android:layout_height="@dimen/bar_size"
android:background="@drawable/border"
android:gravity="center|right"
android:paddingRight="5dp"
android:textColor="@{textColor}"
android:text="@{text}" />
</FrameLayout>
android:layout_height="wrap_content">
<TextView
android:id="@+id/TV_value"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:textColor="@color/brand_500"
android:text="@{text}"
android:layout_weight="1"
/>
<TextView
android:id="@+id/TV_label"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:gravity="center|right"
android:textColor="@color/brand_500"
android:text="@{description}"
android:layout_weight="1" />
</LinearLayout>
</LinearLayout>
</layout>

View file

@ -1,40 +1,56 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="hpColor">#da5353</color>
<color name="hpColorBackground">#fcf0f0</color>
<color name="hpColorForeground">#250808</color>
<color name="xpColor">#ffcc35</color>
<color name="xpColorBackground">#fffbf0</color>
<color name="xpColorForeground">#2e2200</color>
<color name="mpColor">#4781e7</color>
<color name="mpColorBackground">#eff4fd</color>
<color name="mpColorForeground">#051228</color>
<color name="brand">#7a12f8</color>
<color name="brand_50">#36205D</color>
<color name="brand_100">#432874</color>
<color name="brand_200">#4F2A93</color>
<color name="brand_300">#6133B4</color>
<color name="brand_400">#9A62FF</color>
<color name="brand_500">#BDA8FF</color>
<color name="brand">@color/brand_100</color>
<!-- HabitRPG task color -->
<color name="worst">#E6B8AF</color>
<color name="worst_btn">#c96652</color>
<color name="worse">#F4CCCC</color>
<color name="worse_btn">#dc5d5d</color>
<color name="worst_100">#E6B8AF</color>
<color name="worst_50">#c96652</color>
<color name="worst_10">#c96652</color>
<color name="bad">#FCE5CD</color>
<color name="bad_btn">#f4a24c</color>
<color name="worse_100">#FF6165</color>
<color name="worse_50">#F74E52</color>
<color name="worse_10">#F23035</color>
<color name="neutral">#FFF2CC</color>
<color name="neutral_btn">#ffcf42</color>
<color name="bad_100">#FF944C</color>
<color name="bad_50">#FA8537</color>
<color name="bad_10">#F47825</color>
<color name="good">#D9EAD3</color>
<color name="good_btn">#8bbf79</color>
<color name="neutral_100">#FFBE5D</color>
<color name="neutral_50">#FFB445</color>
<color name="neutral_10">#FFA624</color>
<color name="better">#D0E0E3</color>
<color name="better_btn">#7eaab2</color>
<color name="good_100">#D9EAD3</color>
<color name="good_50">#8bbf79</color>
<color name="good_10">#8bbf79</color>
<color name="best">#C9DAF8</color>
<color name="best_btn">#5288e9</color>
<color name="better_100">#5AE4B2</color>
<color name="better_50">#3FDAA2</color>
<color name="better_10">#23CC8F</color>
<color name="best_100">#50B5E9</color>
<color name="best_50">#46A7D9</color>
<color name="best_10">#2995CD</color>
<color name="completed">#D9D9D9</color>
<color name="completed_btn">#989898</color>
<color name="hpColor">@color/worse_100</color>
<color name="hpColorBackground">#fcf0f0</color>
<color name="hpColorForeground">#250808</color>
<color name="xpColor">@color/neutral_100</color>
<color name="xpColorBackground">#fffbf0</color>
<color name="xpColorForeground">#2e2200</color>
<color name="mpColor">@color/best_100</color>
<color name="mpColorBackground">#eff4fd</color>
<color name="mpColorForeground">#051228</color>
<color name="changelog.note">#ffcf42</color>
<!-- Cards -->
@ -71,8 +87,10 @@
<color name="material_drawer_dark_divider">#1FFFFFFF</color>
<!-- MaterialDrawer DEFAULT DARK drawer colors -->
<color name="material_drawer_dark_selected">#202020</color>
<color name="material_drawer_dark_selected_text">@color/material_drawer_primary</color>
<color name="material_drawer_dark_selected_text">@color/brand</color>
<color name="material_drawer_dark_header_selection_text">#FFF</color>
<color name="checkbox_tint_color">#ffd8dcdd</color>
<color name="cell_separator">#c3c2c6</color>
</resources>

View file

@ -11,11 +11,11 @@
<dimen name="card_small_text">14.0sp</dimen>
<dimen name="card_padding">16.0dip</dimen>
<dimen name="bar_size">29dp</dimen>
<dimen name="bar_inner_size">25dp</dimen>
<dimen name="bar_size">15dp</dimen>
<dimen name="bar_padding">5dp</dimen>
<dimen name="avatar_width">140dp</dimen>
<dimen name="avatar_height">147dp</dimen>
<dimen name="bar_radius">5dp</dimen>
<dimen name="avatar_width">150dp</dimen>
<dimen name="avatar_height">120dp</dimen>
<dimen name="header_height">70dp</dimen>
<dimen name="new_task_bar_size">48dp</dimen>
@ -32,4 +32,10 @@
<!-- Widget -->
<dimen name="widget_bar_horizontal_margin">20dp</dimen>
<dimen name="button_width">60dp</dimen>
<dimen name="hairline_height">0.5dp</dimen>
<dimen name="checklist_divider_width">14dp</dimen>
<dimen name="checklist_wrapper_width">36dp</dimen>
</resources>

View file

@ -6,8 +6,9 @@
<string name="action_refresh">Refresh</string>
<string name="plus_sign">+</string>
<string name="minus_sign">-</string>
<string name="XP_default">XP</string>
<string name="HP_default">HP</string>
<string name="XP_default">Experience</string>
<string name="HP_default">Health</string>
<string name="MP_default">Mana</string>
<string name="format_todo_date">%1$d-%2$d-%3$d</string>
<string name="new_task_added_message">Task added</string>
<string name="lvlup">LVL UP!</string>
@ -106,7 +107,6 @@
    
<string name="close">Close</string>
<string name="SP_last_seen_version">SP_last_version</string>
<string name="MP_default">MP</string>
<string name="update_btn">Update</string>
<string name="about.title">About</string>

View file

@ -12,6 +12,7 @@ import com.google.gson.FieldAttributes;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.TypeAdapter;
import com.google.gson.reflect.TypeToken;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonToken;
import com.google.gson.stream.JsonWriter;
@ -25,10 +26,12 @@ import com.magicmicky.habitrpgwrapper.lib.models.TaskDirection;
import com.magicmicky.habitrpgwrapper.lib.models.UserAuth;
import com.magicmicky.habitrpgwrapper.lib.models.UserAuthResponse;
import com.magicmicky.habitrpgwrapper.lib.models.tasks.Task;
import com.magicmicky.habitrpgwrapper.lib.models.tasks.Reward;
import com.magicmicky.habitrpgwrapper.lib.models.tasks.TaskTag;
import com.raizlabs.android.dbflow.structure.ModelAdapter;
import java.io.IOException;
import java.lang.reflect.Type;
import java.util.List;
import retrofit.Callback;
import retrofit.ErrorHandler;
@ -59,7 +62,11 @@ public class APIHelper implements ErrorHandler, Profiler {
}
};
//Exclusion stratety needed for DBFlow https://github.com/Raizlabs/DBFlow/issues/121
Type taskTagClassListType = new TypeToken<List<TaskTag>>() {}.getType();
//Exclusion stratety needed for DBFlow https://github.com/Raizlabs/DBFlow/issues/121
Gson gson = new GsonBuilder()
.setExclusionStrategies(new ExclusionStrategy() {
@Override
@ -72,7 +79,7 @@ public class APIHelper implements ErrorHandler, Profiler {
return false;
}
})
.registerTypeAdapter(TagsAdapter.class, new TagsAdapter().nullSafe())
.registerTypeAdapter(taskTagClassListType, new TagsAdapter())
.registerTypeAdapter(Boolean.class, booleanAsIntAdapter)
.registerTypeAdapter(boolean.class, booleanAsIntAdapter)
.create();
@ -152,11 +159,7 @@ public class APIHelper implements ErrorHandler, Profiler {
}
public void updateTask(Task item, Callback cb) {
if(item instanceof Task) {
this.apiService.updateTask(item.getId(), item, cb);
} else if(item instanceof Reward) {
this.apiService.updateTask(item.getId(), item, cb);
}
}
//public void buyItem(Reward.SpecialReward itemBought, View btn) {

View file

@ -37,8 +37,6 @@ import com.magicmicky.habitrpgwrapper.lib.models.TaskDirection;
import com.magicmicky.habitrpgwrapper.lib.models.TaskDirectionData;
import com.magicmicky.habitrpgwrapper.lib.models.tasks.Task;
import com.magicmicky.habitrpgwrapper.lib.models.tasks.ItemData;
import com.magicmicky.habitrpgwrapper.lib.models.tasks.Reward;
import com.magicmicky.habitrpgwrapper.lib.models.tasks.RewardItem;
import com.mikepenz.materialdrawer.Drawer;
import com.mikepenz.materialdrawer.DrawerBuilder;
import com.mikepenz.materialdrawer.model.DividerDrawerItem;
@ -279,7 +277,7 @@ public class MainActivity extends InstabugAppCompatActivity implements HabitRPGU
}
public void onEvent(TaskTappedEvent event) {
if(event.Task instanceof RewardItem)
if(event.Task.type.equals("reward"))
return;
Bundle bundle = new Bundle();
@ -320,6 +318,9 @@ public class MainActivity extends InstabugAppCompatActivity implements HabitRPGU
return;
}
mAPIHelper.updateTaskDirection(rewardKey, TaskDirection.down, new TaskScoringCallback(this));
/*
if (event.Reward instanceof RewardItem) {
if (rewardKey.equals("potion")) {
int currentHp = User.getStats().getHp().intValue();
@ -356,8 +357,7 @@ public class MainActivity extends InstabugAppCompatActivity implements HabitRPGU
});
} else {
// User created Rewards
mAPIHelper.updateTaskDirection(rewardKey, TaskDirection.down, new TaskScoringCallback(this));
}
}*/
}
public void onEvent(final TaskSaveEvent event) {
@ -411,8 +411,6 @@ public class MainActivity extends InstabugAppCompatActivity implements HabitRPGU
}
private ObservableArrayList<RewardItem> GearRewards = new ObservableArrayList<>();
public void loadTaskLists() {
android.support.v4.app.FragmentManager fragmentManager = getSupportFragmentManager();
@ -440,7 +438,7 @@ public class MainActivity extends InstabugAppCompatActivity implements HabitRPGU
break;
case 3:
layoutOfType = R.layout.reward_item_card;
fragment = TaskRecyclerViewFragment.newInstance(new HabitItemRecyclerViewAdapter("reward", Reward.class, layoutOfType, HabitItemRecyclerViewAdapter.RewardViewHolder.class, context), Reward.class);
fragment = TaskRecyclerViewFragment.newInstance(new HabitItemRecyclerViewAdapter("reward", Task.class, layoutOfType, HabitItemRecyclerViewAdapter.RewardViewHolder.class, context), Task.class);
break;
default:
layoutOfType = R.layout.todo_item_card;
@ -577,7 +575,7 @@ public class MainActivity extends InstabugAppCompatActivity implements HabitRPGU
keyCondition = keyCondition.and(item.key);
}
/*
ConditionQueryBuilder<ItemData> queryBuilder = new ConditionQueryBuilder<ItemData>(ItemData.class,
keyCondition);
@ -597,6 +595,7 @@ public class MainActivity extends InstabugAppCompatActivity implements HabitRPGU
GearRewards.clear();
GearRewards.addAll(rewardList);
*/
}
@Override

View file

@ -1,10 +1,10 @@
package com.habitrpg.android.habitica.events;
import com.magicmicky.habitrpgwrapper.lib.models.tasks.Reward;
import com.magicmicky.habitrpgwrapper.lib.models.tasks.Task;
/**
* Created by Negue on 11.07.2015.
*/
public class BuyRewardTappedEvent {
public Reward Reward;
public Task Reward;
}

View file

@ -3,6 +3,9 @@ package com.habitrpg.android.habitica.ui;
import android.content.Context;
import android.databinding.BindingAdapter;
import android.databinding.DataBindingUtil;
import android.graphics.PorterDuff;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.util.Log;
import android.view.View;
import android.view.animation.Animation;
@ -52,31 +55,25 @@ public class AvatarWithBarsViewModel {
mpBar = DataBindingUtil.bind(v.findViewById(R.id.mpBar));
SetValueBar(hpBar, 50, 50, context.getString(R.string.HP_default),
res.getColor(R.color.hpColor), res.getColor(R.color.hpColorBackground), res.getColor(R.color.hpColorForeground));
SetValueBar(xpBar, 1, 1, context.getString(R.string.XP_default),
res.getColor(R.color.xpColor), res.getColor(R.color.xpColorBackground), res.getColor(R.color.xpColorForeground));
SetValueBar(mpBar, 100, 100, context.getString(R.string.MP_default),
res.getColor(R.color.mpColor), res.getColor(R.color.mpColorBackground),res.getColor(R.color.mpColorForeground));
SetValueBar(hpBar, 50, 50, context.getString(R.string.HP_default), R.color.hpColor);
SetValueBar(xpBar, 1, 1, context.getString(R.string.XP_default), R.color.xpColor);
SetValueBar(mpBar, 100, 100, context.getString(R.string.MP_default), R.color.mpColor);
}
public void UpdateData(HabitRPGUser user)
{
Stats stats = user.getStats();
SetValueBar(hpBar, stats.getHp().floatValue(), stats.getMaxHealth(), context.getString(R.string.HP_default),
res.getColor(R.color.hpColor), res.getColor(R.color.hpColorBackground), res.getColor(R.color.hpColorForeground));
SetValueBar(xpBar, stats.getExp().floatValue(), stats.getToNextLevel(), context.getString(R.string.XP_default),
res.getColor(R.color.xpColor), res.getColor(R.color.xpColorBackground), res.getColor(R.color.xpColorForeground));
SetValueBar(mpBar, stats.getMp().floatValue(), stats.getMaxMP(), context.getString(R.string.MP_default),
res.getColor(R.color.mpColor), res.getColor(R.color.mpColorBackground),res.getColor(R.color.mpColorForeground));
SetValueBar(hpBar, stats.getHp().floatValue(), stats.getMaxHealth(), context.getString(R.string.HP_default), context.getResources().getColor(R.color.hpColor));
SetValueBar(xpBar, stats.getExp().floatValue(), stats.getToNextLevel(), context.getString(R.string.XP_default), context.getResources().getColor(R.color.xpColor));
SetValueBar(mpBar, stats.getMp().floatValue(), stats.getMaxMP(), context.getString(R.string.MP_default), context.getResources().getColor(R.color.mpColor));
new UserPicture(user, this.context).setPictureOn(image);
}
// Layout_Weight don't accepts 0.7/0.3 to have 70% filled instead it shows the 30% , so I had to switch the values
// but on a 1.0/0.0 which switches to 0.0/1.0 it shows the blank part full size...
private void SetValueBar(ValueBarBinding valueBar, float value, float valueMax, String postString, int color, int colorBackground, int textColor)
private void SetValueBar(ValueBarBinding valueBar, float value, float valueMax, String description, int color)
{
double percent = Math.min(1, value / valueMax);
@ -91,17 +88,16 @@ public class AvatarWithBarsViewModel {
valueBar.setWeightToHide((float) percent);
}
valueBar.setText((int) value + "/" + (int) valueMax + " " + postString);
valueBar.setText((int) value + "/" + (int) valueMax);
valueBar.setDescription(description);
valueBar.setBarForegroundColor(color);
valueBar.setBarBackgroundColor(colorBackground);
valueBar.setTextColor(textColor);
}
@BindingAdapter("app:layout_weight")
public static void setLayoutWeight(View view, float weight) {
LinearLayout.LayoutParams layout = (LinearLayout.LayoutParams)view.getLayoutParams();
Log.d("setLayoutWeight", weight+"");
Log.d("setLayoutWeight", weight + "");
layout.weight = weight;
@ -116,6 +112,17 @@ public class AvatarWithBarsViewModel {
view.startAnimation(anim);
}
@BindingAdapter("app:rounded_background")
public static void setRoundedBackground(View view, int color) {
Drawable drawable = view.getResources().getDrawable(R.drawable.layout_rounded_bg);
drawable.setColorFilter(color, PorterDuff.Mode.MULTIPLY);
if(Build.VERSION.SDK_INT < 16) {
view.setBackgroundDrawable(drawable);
} else {
view.setBackground(drawable);
}
}
public static class LayoutWeightAnimation extends Animation {
float targetWeight;
float initializeWeight;

View file

@ -5,8 +5,6 @@ import android.databinding.BindingAdapter;
import android.databinding.DataBindingUtil;
import android.databinding.ObservableArrayList;
import android.databinding.ObservableList;
import android.graphics.Bitmap;
import android.graphics.drawable.Drawable;
import android.os.Handler;
import android.support.v7.widget.CardView;
import android.support.v7.widget.RecyclerView;
@ -32,15 +30,12 @@ import com.habitrpg.android.habitica.events.TaskTappedEvent;
import com.habitrpg.android.habitica.events.TodoCheckedEvent;
import com.habitrpg.android.habitica.ui.helpers.ViewHelper;
import com.magicmicky.habitrpgwrapper.lib.models.tasks.Task;
import com.magicmicky.habitrpgwrapper.lib.models.tasks.Reward;
import com.magicmicky.habitrpgwrapper.lib.models.tasks.RewardItem;
import com.raizlabs.android.dbflow.runtime.FlowContentObserver;
import com.raizlabs.android.dbflow.sql.builder.Condition;
import com.raizlabs.android.dbflow.sql.language.Select;
import com.raizlabs.android.dbflow.structure.BaseModel;
import com.raizlabs.android.dbflow.structure.Model;
import com.squareup.picasso.Picasso;
import com.squareup.picasso.Target;
import java.util.List;
@ -174,8 +169,6 @@ public class HabitItemRecyclerViewAdapter<THabitItem extends Task>
return new HabitItemRecyclerViewAdapter.TodoViewHolder(view);
case "RewardViewHolder":
return new HabitItemRecyclerViewAdapter.RewardViewHolder(view);
case "RewardItemViewHolder":
return new HabitItemRecyclerViewAdapter.RewardItemViewHolder(view);
}
}
}
@ -224,14 +217,13 @@ public class HabitItemRecyclerViewAdapter<THabitItem extends Task>
ViewHelper.SetBackgroundTint(view, view.getResources().getColor(color));
}
@BindingAdapter("app:backgroundColor")
public static void setBackgroundTintColor(View view, int color) {
view.setBackgroundColor(view.getResources().getColor(color));
}
public abstract class ViewHolder<THabitItem extends Task> extends RecyclerView.ViewHolder implements View.OnClickListener, View.OnLongClickListener {
@InjectView(R.id.card_view)
protected CardView cardView;
@InjectView(R.id.checkedTextView)
protected CheckedTextView checkedTextView;
protected android.content.res.Resources resources;
public THabitItem Item;
@ -376,7 +368,7 @@ public class HabitItemRecyclerViewAdapter<THabitItem extends Task>
}
}
public class RewardViewHolder extends ViewHolder<Reward> {
public class RewardViewHolder extends ViewHolder<Task> {
RewardItemCardBinding binding;
public RewardViewHolder(View itemView) {
@ -401,58 +393,14 @@ public class HabitItemRecyclerViewAdapter<THabitItem extends Task>
}
@Override
public void bindHolder(Reward habitItem, int position) {
super.bindHolder(habitItem, position);
public void bindHolder(Task reward, int position) {
super.bindHolder(reward, position);
binding.setReward(habitItem);
binding.setReward(reward);
}
}
public class RewardItemViewHolder extends ViewHolder<RewardItem> implements Target
{
RewardItemCardBinding binding;
public RewardItemViewHolder(View itemView) {
super(itemView);
binding = DataBindingUtil.bind(itemView);
binding.btnReward.setClickable(true);
binding.btnReward.setOnClickListener(this);
}
@Override
public void onClick(View v) {
BuyRewardTappedEvent event = new BuyRewardTappedEvent();
if (v == binding.btnReward) {
event.Reward = Item;
EventBus.getDefault().post(event);
} else super.onClick(v);
}
@Override
public void bindHolder(RewardItem habitItem, int position) {
super.bindHolder(habitItem, position);
binding.setReward(habitItem);
}
@Override
public void onBitmapLoaded(Bitmap bitmap, Picasso.LoadedFrom from) {
binding.imageView3.setImageBitmap(bitmap);
}
@Override
public void onBitmapFailed(Drawable errorDrawable) {
}
@Override
public void onPrepareLoad(Drawable placeHolderDrawable) {
}
}
public void loadContent() {
if(this.observableContent == null) {

View file

@ -1,202 +0,0 @@
package com.magicmicky.habitrpgwrapper.lib;
import com.google.gson.ExclusionStrategy;
import com.google.gson.FieldAttributes;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.magicmicky.habitrpgwrapper.lib.api.ApiService;
import com.magicmicky.habitrpgwrapper.lib.api.Server;
import com.magicmicky.habitrpgwrapper.lib.api.TypeAdapter.TagsAdapter;
import com.magicmicky.habitrpgwrapper.lib.models.HabitRPGUser;
import com.magicmicky.habitrpgwrapper.lib.models.Status;
import com.magicmicky.habitrpgwrapper.lib.models.Tag;
import com.magicmicky.habitrpgwrapper.lib.models.TaskDirection;
import com.magicmicky.habitrpgwrapper.lib.models.TaskDirectionData;
import com.magicmicky.habitrpgwrapper.lib.models.UserAuth;
import com.magicmicky.habitrpgwrapper.lib.models.UserAuthResponse;
import com.magicmicky.habitrpgwrapper.lib.models.tasks.Task;
import com.magicmicky.habitrpgwrapper.lib.models.tasks.Reward;
import com.raizlabs.android.dbflow.structure.ModelAdapter;
import java.util.List;
import retrofit.Callback;
import retrofit.RequestInterceptor;
import retrofit.RestAdapter;
import retrofit.converter.GsonConverter;
/**
* Created by MagicMicky on 13/06/2014.
*/
public class HabitRPGInteractor {
private ApiService apiService;
public HabitRPGInteractor(final String apiKey, final String userKey, final Server server) {
RequestInterceptor requestInterceptor = new RequestInterceptor() {
@Override
public void intercept(RequestInterceptor.RequestFacade request) {
request.addHeader("x-api-key", apiKey);
request.addHeader("x-api-user",userKey);
}
};
//Exclusion stratety needed for DBFlow https://github.com/Raizlabs/DBFlow/issues/121
Gson gson = new GsonBuilder()
.setExclusionStrategies(new ExclusionStrategy() {
@Override
public boolean shouldSkipField(FieldAttributes f) {
return f.getDeclaredClass().equals(ModelAdapter.class);
}
@Override
public boolean shouldSkipClass(Class<?> clazz) {
return false;
}
}).registerTypeAdapter(TagsAdapter.class, new TagsAdapter().nullSafe()).create();
RestAdapter adapter = new RestAdapter.Builder()
.setEndpoint(server.toString())
.setRequestInterceptor(requestInterceptor)
.setConverter(new GsonConverter(gson))
.build();
this.apiService = adapter.create(ApiService.class);
}
public HabitRPGInteractor(final String apiKey, final String userKey) {
this(apiKey, userKey, Server.NORMAL);
}
/**
* Retrieve the Status of habitrpg
* @see com.magicmicky.habitrpgwrapper.lib.models.Status
* @param statusCallback the callback called when status is retrieved
*/
public void getStatus(Callback<Status> statusCallback) {
this.apiService.getStatus(statusCallback);
}
/**
* Retrieve a User from HabitRPG's API.
* @see com.magicmicky.habitrpgwrapper.lib.models.HabitRPGUser
* @param callback The callback called when the user is retrieved
*/
public void getUser(Callback<HabitRPGUser> callback) {
this.apiService.getUser(callback);
}
/**
* Retrieve a daily from HabitRPG's API
* @param dailyId the id of the daily to retrieve
* @param dailyCallback the callback called when the daily is retrieved
* @see Task
*/
public void getTask(String dailyId, Callback<Task> dailyCallback) {
this.apiService.getTask(dailyId, dailyCallback);
}
/**
* Retrieve a Reward form HabitRPG's API
* @param rewardId the id of the reward to retrieve
* @param rewardCallback the callback called when the reward is retrieved.
* @see com.magicmicky.habitrpgwrapper.lib.models.tasks.Reward
*/
public void getReward(String rewardId, Callback<Reward> rewardCallback) {
this.apiService.getReward(rewardId, rewardCallback);
}
/**
* Update the task to "up" or "down", and check or uncheck dailies/todos.
* @param taskId the id of the task to update
* @param direction the direction of the task
* @param taskDirectionCallback the callback called when the direction is set.
* @see com.magicmicky.habitrpgwrapper.lib.models.TaskDirectionData
*/
public void postTaskDirection(String taskId, TaskDirection direction, Callback<TaskDirectionData> taskDirectionCallback) {
this.apiService.postTaskDirection(taskId, direction.toString(), taskDirectionCallback);
}
/**
* Create a daily on HabitRPG
* @param task the daily to create
* @param taskCallback the callback called when the daily is created
* @see Task
*/
public void createItem(Task task, Callback<Task> taskCallback) {
this.apiService.createItem(task, taskCallback);
}
/**
* Creates a reward
* @param reward the reward to create
* @param rewardCallback the callback called once the item is created
*/
public void createItem(Reward reward, Callback<Reward> rewardCallback) {
this.apiService.createItem(reward, rewardCallback);
}
/**
* Update an habit
* @param taskId the id of the habit to update
* @param task the habit to update, with updated field
* @param taskCallback the callback called once the habit is updated
*/
public void updateItem(String taskId, Task task, Callback<Task> taskCallback) {
this.apiService.updateTask(taskId, task, taskCallback);
}
/**
* Updates a Reward
* @param rewardId the id of the reward to update
* @param reward the reward to update, with updated field
* @param rewardCallback the callback called once the item is updated
*/
public void updateItem(String rewardId, Reward reward, Callback<Reward> rewardCallback) {
this.apiService.updateTask(rewardId, reward, rewardCallback);
}
/**
* Deletes a task.
* @param itemId the id of the task to delete
* @param voidCallback the callback (on void) called once the item is deleted
*/
public void deleteItem(String itemId, Callback<Void> voidCallback) {
this.apiService.deleteTask(itemId, voidCallback);
}
/**
* Creates a tag
* @param tag The tag to create
* @param multiTagCallback the callback called once the tag is created
*/
public void createTag(Tag tag, Callback<List<Tag>> multiTagCallback) {
this.apiService.createTag(tag, multiTagCallback);
}
/**
* Updates a tag
* @param tagId The id of the tag to udpate
* @param tag The tag to update, with updated field
* @param tagCallback The callback called once the tag is updated
*/
public void updateTag(String tagId, Tag tag, Callback<Tag> tagCallback) {
this.apiService.updateTag(tagId, tag, tagCallback);
}
/**
* Deletes a tag
* @param tagId the id of the tag to delete
* @param voidCallback the callback (on void) called once the item is deleted
*/
public void deleteTag(String tagId, Callback<Void> voidCallback) {
this.apiService.deleteTag(tagId, voidCallback);
}
/**
* Connects a user
* @param authData The username & password of the user
* @param responseCallback The callback called once the user is connected
*/
public void connectUser(UserAuth authData, Callback<UserAuthResponse> responseCallback) {
this.apiService.connectLocal(authData,responseCallback);
}
}

View file

@ -7,9 +7,8 @@ import com.magicmicky.habitrpgwrapper.lib.models.Tag;
import com.magicmicky.habitrpgwrapper.lib.models.TaskDirectionData;
import com.magicmicky.habitrpgwrapper.lib.models.UserAuth;
import com.magicmicky.habitrpgwrapper.lib.models.UserAuthResponse;
import com.magicmicky.habitrpgwrapper.lib.models.tasks.Task;
import com.magicmicky.habitrpgwrapper.lib.models.tasks.ItemData;
import com.magicmicky.habitrpgwrapper.lib.models.tasks.Reward;
import com.magicmicky.habitrpgwrapper.lib.models.tasks.Task;
import java.util.List;
@ -45,8 +44,6 @@ public interface ApiService {
// void revive(Callback<HabitRPGUser> habitRPGUserCallback);
@GET("/user/tasks/{id}")
void getReward(@Path("id") String id, Callback<Reward> habitItemCallback);
@GET("/user/tasks/{id}")
void getTask(@Path("id") String id, Callback<Task> habitItemCallback);
@ -55,14 +52,10 @@ public interface ApiService {
void postTaskDirection(@Path("id") String id, @Path("direction") String direction, Callback<TaskDirectionData> taskDirectionCallback);
@POST("/user/tasks")
void createItem(@Body Reward item, Callback<Reward> habitItemCallback);
@POST("/user/tasks")
void createItem(@Body Task item, Callback<Task> habitItemCallback);
@PUT("/user/tasks/{id}")
void updateTask(@Path("id") String id, @Body Reward item, Callback<Reward> habitItemCallback);
@PUT("/user/tasks/{id}")
void updateTask(@Path("id") String id, @Body Task item, Callback<Task> habitItemCallback);

View file

@ -2,7 +2,6 @@ package com.magicmicky.habitrpgwrapper.lib.models;
import com.habitrpg.android.habitica.HabitDatabase;
import com.magicmicky.habitrpgwrapper.lib.models.tasks.Task;
import com.magicmicky.habitrpgwrapper.lib.models.tasks.Reward;
import com.raizlabs.android.dbflow.annotation.Column;
import com.raizlabs.android.dbflow.annotation.ForeignKey;
import com.raizlabs.android.dbflow.annotation.ForeignKeyReference;
@ -29,7 +28,7 @@ public class HabitRPGUser extends BaseModel {
List<Task> dailys;
List<Task> todos;
List<Reward> rewards;
List<Task> rewards;
List<Task> habits;
List<Tag> tags;
@ -89,7 +88,7 @@ public class HabitRPGUser extends BaseModel {
this.todos = todos;
}
public void setRewards(List<Reward> rewards) {
public void setRewards(List<Task> rewards) {
this.rewards = rewards;
}
@ -167,10 +166,10 @@ public class HabitRPGUser extends BaseModel {
}
@OneToMany(methods = {OneToMany.Method.SAVE, OneToMany.Method.DELETE}, variableName = "rewards")
public List<Reward> getRewards() {
public List<Task> getRewards() {
if(rewards == null) {
rewards = new Select()
.from(Reward.class)
.from(Task.class)
.queryList();
}
return rewards;

View file

@ -3,6 +3,7 @@ package com.magicmicky.habitrpgwrapper.lib.models;
import com.habitrpg.android.habitica.HabitDatabase;
import com.magicmicky.habitrpgwrapper.lib.models.tasks.TaskTag;
import com.raizlabs.android.dbflow.annotation.Column;
import com.raizlabs.android.dbflow.annotation.ModelContainer;
import com.raizlabs.android.dbflow.annotation.OneToMany;
import com.raizlabs.android.dbflow.annotation.PrimaryKey;
import com.raizlabs.android.dbflow.annotation.Table;
@ -17,6 +18,7 @@ import java.util.List;
* Created by MagicMicky on 16/03/14.
*/
@ModelContainer
@Table(databaseName = HabitDatabase.NAME)
public class Tag extends BaseModel{
@ -42,6 +44,7 @@ public class Tag extends BaseModel{
if(tasks == null) {
tasks = new Select()
.from(TaskTag.class)
.where(Condition.column("tag_id").eq(this.id))
.queryList();
}
return tasks;

View file

@ -24,7 +24,7 @@ public class ChecklistItem extends BaseModel {
@Column
private boolean completed;
/*
@Column
@ForeignKey(
references = {@ForeignKeyReference(columnName = "task_id",
@ -32,7 +32,7 @@ public class ChecklistItem extends BaseModel {
foreignColumnName = "id")},
saveForeignKeyModel = false)
ForeignKeyContainer<Task> task;
*/
public ChecklistItem() {
this(null,null);
}
@ -70,4 +70,14 @@ public class ChecklistItem extends BaseModel {
public void setCompleted(boolean completed) {
this.completed = completed;
}
public Task getTask() {
return task.toModel();
}
public void setTask(Task task) {
this.task = new ForeignKeyContainer<>(Task.class);
this.task.setModel(task);
this.task.put("id", task.id);
}
}

View file

@ -1,31 +0,0 @@
package com.magicmicky.habitrpgwrapper.lib.models.tasks;
import com.habitrpg.android.habitica.HabitDatabase;
import com.raizlabs.android.dbflow.annotation.Table;
/**
* A reward. Contain a reward that you can see on the website
* @author MagicMicky
*
*/
@Table(databaseName = HabitDatabase.NAME, allFields = true)
public class Reward extends Task {
public Reward() {
super();
}
/**
* @return the id
*/
public String getId() {
return id;
}
/**
* @param id the id to set
*/
public void setId(String id) {
this.id = id;
}
}

View file

@ -1,8 +0,0 @@
package com.magicmicky.habitrpgwrapper.lib.models.tasks;
/**
* Created by Negue on 15.07.2015.
*/
public class RewardItem extends Reward {
}

View file

@ -5,9 +5,11 @@ import com.habitrpg.android.habitica.R;
import com.raizlabs.android.dbflow.annotation.Column;
import com.raizlabs.android.dbflow.annotation.ForeignKey;
import com.raizlabs.android.dbflow.annotation.ForeignKeyReference;
import com.raizlabs.android.dbflow.annotation.ModelContainer;
import com.raizlabs.android.dbflow.annotation.OneToMany;
import com.raizlabs.android.dbflow.annotation.PrimaryKey;
import com.raizlabs.android.dbflow.annotation.Table;
import com.raizlabs.android.dbflow.sql.builder.Condition;
import com.raizlabs.android.dbflow.sql.language.Select;
import com.raizlabs.android.dbflow.structure.BaseModel;
@ -16,6 +18,7 @@ import java.util.List;
/**
* Created by viirus on 10/08/15.
*/
@ModelContainer
@Table(databaseName = HabitDatabase.NAME)
public class Task extends BaseModel {
@ -31,13 +34,21 @@ public class Task extends BaseModel {
@Column
public Double value;
public List<TaskTag> tags;
//Habits
@Column
public Boolean up, down;
//todos/dailies
@Column
public Boolean completed;
public List<ChecklistItem> checklist;
//dailies
@Column
public String frequency;
@ -51,9 +62,12 @@ public class Task extends BaseModel {
public Days repeat;
//TODO: private String lastCompleted;
//todos
@Column
public String date;
/**
* @return the id
*/
@ -132,6 +146,24 @@ public class Task extends BaseModel {
public void setType(String type) {this.type = type;}
@OneToMany(methods = {OneToMany.Method.SAVE, OneToMany.Method.DELETE}, variableName = "tags")
public List<TaskTag> getTags() {
if(tags == null) {
tags = new Select()
.from(TaskTag.class)
.where(Condition.column("task_id").eq(this.id))
.queryList();
}
return tags;
}
public void setTags(List<TaskTag> tags) {
for (TaskTag tag : tags) {
tag.setTask(this);
}
this.tags = tags;
}
/**
* @return whether or not the habit can be "upped"
*/
@ -171,6 +203,35 @@ public class Task extends BaseModel {
this.completed = completed;
}
@OneToMany(methods = {OneToMany.Method.SAVE, OneToMany.Method.DELETE}, variableName = "checklist")
public List<ChecklistItem> getChecklist() {
if(this.checklist == null) {
this.checklist = new Select()
.from(ChecklistItem.class)
.where(Condition.column("task_id").eq(this.id))
.queryList();
}
return this.checklist;
}
public void setChecklist(List<ChecklistItem> checklist) {
for (ChecklistItem checklistItem : checklist) {
checklistItem.setTask(this);
}
this.checklist = checklist;
}
public Integer getCompletedChecklistCount() {
Integer count = 0;
for (ChecklistItem item : this.getChecklist()) {
if (item.getCompleted()) {
count++;
}
}
return count;
}
public String getFrequency() { return frequency; }
public void setFrequency(String frequency) { this.frequency = frequency; }
@ -190,20 +251,7 @@ public class Task extends BaseModel {
public void setRepeat(Days repeat) {
this.repeat = repeat;
}
/**
* Formated:
* SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");
* @return the lastCompleted
*/
/* public String getLastCompleted() {
return lastCompleted;
}
/**
* @param lastCompleted the lastCompleted to set
*/
/* public void setLastCompleted(String lastCompleted) {
this.lastCompleted = lastCompleted;
}
/**
* @return the streak
*/
@ -246,19 +294,56 @@ public class Task extends BaseModel {
this.attribute = attribute;
}
@Override
public void save() {
if (this.tags != null) {
for (TaskTag tag : this.tags) {
tag.setTask(this);
}
}
if (this.checklist != null) {
for (ChecklistItem item : this.checklist) {
item.setTask(this);
}
}
super.save();
}
public int getLightTaskColor()
{
if (this.value < -20)
return R.color.worst;
return R.color.worst_100;
if (this.value < -10)
return R.color.worse;
return R.color.worse_100;
if (this.value < -1)
return R.color.bad;
return R.color.bad_100;
if (this.value < 5)
return R.color.neutral;
return R.color.neutral_100;
if (this.value < 10)
return R.color.better;
return R.color.best;
return R.color.better_100;
return R.color.best_100;
}
/**
* Get the button color resources depending on a certain score
*
* @return the color resource id
*/
public int getMediumTaskColor()
{
if (this.value < -20)
return R.color.worst_50;
if (this.value < -10)
return R.color.worse_50;
if (this.value < -1)
return R.color.bad_50;
if (this.value < 5)
return R.color.neutral_50;
if (this.value < 10)
return R.color.better_50;
return R.color.best_50;
}
/**
@ -269,16 +354,16 @@ public class Task extends BaseModel {
public int getDarkTaskColor()
{
if (this.value < -20)
return R.color.worst_btn;
return R.color.worst_10;
if (this.value < -10)
return R.color.worse_btn;
return R.color.worse_10;
if (this.value < -1)
return R.color.bad_btn;
return R.color.bad_10;
if (this.value < 5)
return R.color.neutral_btn;
return R.color.neutral_10;
if (this.value < 10)
return R.color.better_btn;
return R.color.better_10;
return R.color.best_btn;
return R.color.best_10;
}
}

View file

@ -25,13 +25,15 @@ public class TaskTag extends BaseModel {
@Column
@ForeignKey(references = {@ForeignKeyReference(columnName = "tag_id",
columnType = String.class,
foreignColumnName = "id")})
foreignColumnName = "id")},
saveForeignKeyModel = false)
public ForeignKeyContainer<Tag> tag;
@Column
@ForeignKey(references = {@ForeignKeyReference(columnName = "task_id",
columnType = String.class,
foreignColumnName = "id")})
foreignColumnName = "id")},
saveForeignKeyModel = false)
public ForeignKeyContainer<Task> task;
public Tag getTag() {
@ -41,6 +43,7 @@ public class TaskTag extends BaseModel {
public void setTag(Tag tag) {
this.tag = new ForeignKeyContainer<>(Tag.class);
this.tag.setModel(tag);
this.tag.put("id", tag.id);
}
public Task getTask() {
@ -50,6 +53,7 @@ public class TaskTag extends BaseModel {
public void setTask(Task task) {
this.task = new ForeignKeyContainer<>(Task.class);
this.task.setModel(task);
this.task.put("id", task.id);
}
}