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

This commit is contained in:
Phillip Thelen 2017-04-17 18:38:26 +02:00
commit e3e6bdc439
62 changed files with 201 additions and 125 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 687 B

After

Width:  |  Height:  |  Size: 830 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 751 B

After

Width:  |  Height:  |  Size: 921 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 990 B

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 869 B

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 181 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 278 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 387 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 243 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 512 B

After

Width:  |  Height:  |  Size: 603 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 561 B

After

Width:  |  Height:  |  Size: 687 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 644 B

After

Width:  |  Height:  |  Size: 793 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 589 B

After

Width:  |  Height:  |  Size: 776 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 802 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 159 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 212 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 278 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 208 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 901 B

After

Width:  |  Height:  |  Size: 1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 917 B

After

Width:  |  Height:  |  Size: 1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 184 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 334 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 464 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 295 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 314 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 464 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 650 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 386 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 430 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 878 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 463 B

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

View file

@ -33,7 +33,7 @@
android:layout_height="0dp"
android:layout_centerHorizontal="true"
android:visibility="invisible"
android:layout_below="@id/city_view" />
android:layout_above="@id/city_view" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
@ -41,10 +41,9 @@
android:id="@+id/left_cloud_view"
android:layout_toLeftOf="@id/cloud_anchor"
android:layout_marginRight="150dp"
android:layout_below="@id/cloud_anchor"
android:layout_alignParentLeft="false"
android:layout_alignParentBottom="true"
android:scaleType="centerCrop"
android:layout_marginTop="150dp"
android:paddingBottom="460dp"
/>
<ImageView
android:layout_width="wrap_content"
@ -53,10 +52,9 @@
android:id="@+id/right_cloud_view"
android:layout_toRightOf="@id/cloud_anchor"
android:layout_marginLeft="170dp"
android:layout_below="@id/cloud_anchor"
android:layout_alignParentLeft="false"
android:layout_alignParentBottom="true"
android:scaleType="centerCrop"
android:layout_marginTop="240dp"
android:paddingBottom="400dp"
/>

View file

@ -82,7 +82,6 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom|right"
android:layout_marginBottom="-5dp"
/>
<com.roughike.bottombar.BottomBar
android:id="@+id/bottom_navigation"

View file

@ -8,12 +8,15 @@
android:layout_width="match_parent"
android:layout_height="2dp"
android:background="@color/pill_gray"
android:layout_marginTop="6dp"/>
android:layout_marginTop="16dp"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="24dp"
android:layout_marginTop="24dp"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:layout_marginBottom="16dp"
android:orientation="vertical">
<TextView
android:id="@+id/task_type_title"
@ -80,7 +83,9 @@
android:layout_gravity="right"
android:text="@string/edit_tag_btn_edit"
android:textColor="#6133b4"
android:textSize="16sp" />
android:textSize="16sp"
android:gravity="right|center_vertical"
android:paddingRight="0dp"/>
</LinearLayout>
<ScrollView
android:layout_width="match_parent"
@ -93,7 +98,7 @@
android:orientation="vertical"
android:showDividers="middle"
android:divider="@color/transparent"
android:dividerPadding="8dp"/>
android:dividerPadding="12dp"/>
</ScrollView>
</LinearLayout>

View file

@ -1,17 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal" android:layout_width="match_parent"
android:layout_height="match_parent">
<EditText
android:id="@+id/edit_text"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"/>
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center_vertical">
<Button
android:id="@+id/delete_button"
android:layout_width="45dp"
android:layout_height="wrap_content"
android:drawableRight="@drawable/ic_delete_black_24dp"
android:padding="0dp"
android:drawableLeft="@drawable/ic_close_purple_300_36dp"
style="@style/Base.Widget.AppCompat.Button.Borderless"/>
<EditText
android:id="@+id/edit_text"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_marginLeft="8dp"
android:drawableRight="@drawable/ic_create_grey_400_18dp"
tools:text="hello"
style="@style/TagEditTextTheme"
android:paddingBottom="14dp"
/>
</LinearLayout>

View file

@ -1,90 +1,86 @@
<?xml version="1.0" encoding="utf-8"?>
<com.github.clans.fab.FloatingActionMenu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:fab="http://schemas.android.com/apk/res-auto"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/fab.menu"
app:layout_behavior="com.habitrpg.android.habitica.ui.helpers.FloatingActionMenuBehavior"
<com.github.clans.fab.FloatingActionMenu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:fab="http://schemas.android.com/apk/res-auto"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/fab.menu"
app:layout_behavior="com.habitrpg.android.habitica.ui.helpers.FloatingActionMenuBehavior"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|right"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_marginBottom="16dp"
android:layout_marginRight="8dp"
fab:menu_fab_size="normal"
fab:menu_colorNormal="@color/brand_400"
fab:menu_colorPressed="@color/brand_500"
fab:menu_colorRipple="#FFFFFF"
fab:menu_animationDelayPerItem="50"
fab:menu_icon="@drawable/fab_add"
fab:menu_buttonSpacing="2dp"
fab:menu_labels_margin="4dp">
<com.github.clans.fab.FloatingActionButton
android:id="@+id/fab.new.habit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|right"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_marginBottom="16dp"
android:layout_marginRight="8dp"
fab:menu_fab_size="normal"
fab:menu_labels_paddingTop="8dp"
fab:menu_labels_paddingRight="8dp"
fab:menu_labels_paddingBottom="8dp"
fab:menu_labels_paddingLeft="8dp"
fab:menu_colorNormal="@color/brand_400"
fab:menu_colorPressed="@color/brand_500"
fab:menu_colorRipple="#FFFFFF"
fab:menu_animationDelayPerItem="50"
fab:menu_icon="@drawable/fab_add"
fab:menu_buttonSpacing="4dp">
fab:fab_colorNormal="@color/white"
fab:fab_colorPressed="@color/brand_500"
fab:fab_colorRipple="#FFFFFF"
<com.github.clans.fab.FloatingActionButton
android:id="@+id/fab.new.habit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
fab:fab_shadowColor="#000"
fab:fab_elevationCompat="4dp"
android:src="@drawable/add_habit"
fab:fab_size="mini"
fab:fab_label="@string/new_habit" />
fab:fab_colorNormal="@color/white"
fab:fab_colorPressed="@color/brand_500"
fab:fab_colorRipple="#FFFFFF"
<com.github.clans.fab.FloatingActionButton
android:id="@+id/fab.new.daily"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
fab:fab_shadowColor="#000"
fab:fab_elevationCompat="4dp"
android:src="@drawable/add_habit"
fab:fab_size="mini"
fab:fab_label="@string/new_habit" />
fab:fab_colorNormal="@color/white"
fab:fab_colorPressed="@color/brand_500"
fab:fab_colorRipple="#FFFFFF"
<com.github.clans.fab.FloatingActionButton
android:id="@+id/fab.new.daily"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
fab:fab_shadowColor="#000"
fab:fab_elevationCompat="4dp"
fab:fab_colorNormal="@color/white"
fab:fab_colorPressed="@color/brand_500"
fab:fab_colorRipple="#FFFFFF"
android:src="@drawable/add_daily"
fab:fab_size="mini"
fab:fab_label="@string/new_daily" />
fab:fab_shadowColor="#000"
fab:fab_elevationCompat="4dp"
<com.github.clans.fab.FloatingActionButton
android:id="@+id/fab.new.todo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/add_daily"
fab:fab_size="mini"
fab:fab_label="@string/new_daily" />
fab:fab_colorNormal="@color/white"
fab:fab_colorPressed="@color/brand_500"
fab:fab_colorRipple="#FFFFFF"
<com.github.clans.fab.FloatingActionButton
android:id="@+id/fab.new.todo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
fab:fab_shadowColor="#000"
fab:fab_elevationCompat="4dp"
fab:fab_colorNormal="@color/white"
fab:fab_colorPressed="@color/brand_500"
fab:fab_colorRipple="#FFFFFF"
android:src="@drawable/add_todo"
fab:fab_size="mini"
fab:fab_label="@string/new_todo" />
fab:fab_shadowColor="#000"
fab:fab_elevationCompat="4dp"
<com.github.clans.fab.FloatingActionButton
android:id="@+id/fab.new.reward"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/add_todo"
fab:fab_size="mini"
fab:fab_label="@string/new_todo" />
fab:fab_colorNormal="@color/white"
fab:fab_colorPressed="@color/brand_500"
fab:fab_colorRipple="#FFFFFF"
<com.github.clans.fab.FloatingActionButton
android:id="@+id/fab.new.reward"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
fab:fab_shadowColor="#000"
fab:fab_elevationCompat="4dp"
fab:fab_colorNormal="@color/white"
fab:fab_colorPressed="@color/brand_500"
fab:fab_colorRipple="#FFFFFF"
android:src="@drawable/add_rewards"
fab:fab_size="mini"
fab:fab_label="@string/new_reward" />
fab:fab_shadowColor="#000"
fab:fab_elevationCompat="4dp"
android:src="@drawable/add_rewards"
fab:fab_size="mini"
fab:fab_label="@string/new_reward" />
</com.github.clans.fab.FloatingActionMenu>
</com.github.clans.fab.FloatingActionMenu>

View file

@ -45,10 +45,10 @@
/>
<com.habitrpg.android.habitica.ui.SpeechBubbleView
android:id="@+id/speech_bubble"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:namePlate="Justin"
app:text="@string/avatar_setup_description"
app:npcDrawable="@drawable/justin_textbox"
android:layout_marginLeft="@dimen/content_inset"
android:layout_marginRight="@dimen/content_inset"

View file

@ -43,10 +43,10 @@
android:padding="17dp"/>
<com.habitrpg.android.habitica.ui.SpeechBubbleView
android:id="@+id/speech_bubble"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:namePlate="Justin"
app:text="@string/task_setup_description"
app:npcDrawable="@drawable/justin_textbox"
android:layout_marginLeft="@dimen/content_inset"
android:layout_marginRight="@dimen/content_inset"

View file

@ -1,11 +1,12 @@
<?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"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/light_gray_bg"
android:gravity="center_vertical">
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/light_gray_bg"
android:gravity="center_vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
@ -54,10 +55,10 @@
android:layout_marginTop="18dp"/>
</RelativeLayout>
<com.habitrpg.android.habitica.ui.SpeechBubbleView
android:id="@+id/speech_bubble"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:namePlate="Justin"
app:text="@string/welcome_text"
android:layout_marginLeft="@dimen/content_inset"
android:layout_marginRight="@dimen/content_inset"/>
</LinearLayout>

View file

@ -2,7 +2,8 @@
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content">
android:layout_height="wrap_content"
android:background="@color/white">
<LinearLayout
android:id="@+id/gearElementsLayout"
@ -16,7 +17,9 @@
android:layout_width="60dp"
android:layout_height="60dp"
android:layout_gravity="center_vertical"
android:padding="5dp" />
android:layout_margin="12dp"
android:scaleType="center"
tools:src="@drawable/custom_reward"/>
<LinearLayout
android:id="@+id/textReward"
@ -27,9 +30,8 @@
android:orientation="vertical"
android:paddingBottom="@dimen/task_top_bottom_padding"
android:paddingEnd="@dimen/reward_spacing"
android:paddingLeft="@dimen/task_text_padding"
android:paddingRight="@dimen/reward_spacing"
android:paddingStart="@dimen/task_text_padding"
android:paddingStart="12dp"
android:paddingTop="@dimen/task_top_bottom_padding">
<net.pherth.android.emoji_library.EmojiTextView

View file

@ -264,7 +264,7 @@
<string name="delete">Delete</string>
<string name="name">Name</string>
<string name="description">Description</string>
<string name="add_tag">Add Tag</string>
<string name="add_tag">Add new Tag</string>
<string name="privacy">Privacy</string>
<string name="write_message">Write Message</string>
<string name="post">Post</string>

View file

@ -351,4 +351,10 @@
<item name="android:padding">8dp</item>
<item name="android:textColor">@drawable/radio_button_text_color</item>
</style>
<style name="TagEditTextTheme">
<item name="colorAccent">@color/black_20_alpha</item>
<item name="colorControlNormal">@color/black_20_alpha</item>
<item name="android:drawablePadding">@dimen/spacing_large</item>
</style>
</resources>

View file

@ -13,6 +13,7 @@ import com.habitrpg.android.habitica.models.tasks.Task;
import com.habitrpg.android.habitica.models.tasks.TaskList;
import com.habitrpg.android.habitica.models.tasks.TaskTag;
import com.habitrpg.android.habitica.models.tasks.TasksOrder;
import com.playseeds.android.sdk.inappmessaging.Log;
import org.greenrobot.eventbus.EventBus;
@ -69,6 +70,7 @@ public class TaskRepositoryImpl extends BaseRepositoryImpl<TaskLocalRepository>
if (lastTaskAction > now-500) {
return Observable.empty();
}
lastTaskAction = now;
return apiClient.createItem(task)
.doOnNext(task1 -> {
localRepository.saveTask(task1);
@ -82,6 +84,7 @@ public class TaskRepositoryImpl extends BaseRepositoryImpl<TaskLocalRepository>
if (lastTaskAction > now-500) {
return Observable.empty();
}
lastTaskAction = now;
return apiClient.updateTask(task.getId(), task)
.doOnNext(task1 -> {
localRepository.saveTask(task1);

View file

@ -133,6 +133,10 @@ public class Flags extends BaseModel {
@Override
public void save() {
if (user_id == null) {
return;
}
for (TutorialStep step : this.getTutorial()) {
step.user_id = user_id;
}

View file

@ -87,7 +87,7 @@ public class MountDetailRecyclerAdapter extends RecyclerView.Adapter<MountDetail
itemView.setOnClickListener(this);
}
public Boolean isOwned() {
Boolean isOwned() {
if (ownedMapping != null && animal != null) {
if (ownedMapping.containsKey(animal.getKey()) && ownedMapping.get(animal.getKey())) {
return true;

View file

@ -6,6 +6,7 @@ import com.habitrpg.android.habitica.components.AppComponent;
import com.habitrpg.android.habitica.data.SetupCustomizationRepository;
import com.habitrpg.android.habitica.events.commands.UpdateUserCommand;
import com.habitrpg.android.habitica.ui.AvatarView;
import com.habitrpg.android.habitica.ui.SpeechBubbleView;
import com.habitrpg.android.habitica.ui.activities.SetupActivity;
import com.habitrpg.android.habitica.ui.adapter.setup.CustomizationSetupAdapter;
import com.habitrpg.android.habitica.ui.fragments.BaseFragment;
@ -63,6 +64,8 @@ public class AvatarSetupFragment extends BaseFragment {
AvatarCategoryView extrasButton;
@BindView(R.id.caret_view)
ImageView caretView;
@BindView(R.id.speech_bubble)
SpeechBubbleView speechBubbleView;
CustomizationSetupAdapter adapter;
LinearLayoutManager layoutManager;
@ -131,6 +134,14 @@ public class AvatarSetupFragment extends BaseFragment {
return view;
}
@Override
public void setUserVisibleHint(boolean isVisibleToUser) {
super.setUserVisibleHint(isVisibleToUser);
if (isVisibleToUser && getContext() != null) {
speechBubbleView.animateText(getContext().getString(R.string.avatar_setup_description));
}
}
@Override
public void injectFragment(AppComponent component) {
component.inject(this);

View file

@ -11,6 +11,7 @@ import android.view.ViewGroup;
import com.habitrpg.android.habitica.R;
import com.habitrpg.android.habitica.components.AppComponent;
import com.habitrpg.android.habitica.ui.AvatarView;
import com.habitrpg.android.habitica.ui.SpeechBubbleView;
import com.habitrpg.android.habitica.ui.activities.SetupActivity;
import com.habitrpg.android.habitica.ui.adapter.setup.TaskSetupAdapter;
import com.habitrpg.android.habitica.ui.fragments.BaseFragment;
@ -35,6 +36,8 @@ public class TaskSetupFragment extends BaseFragment {
RecyclerView recyclerView;
@BindView(R.id.avatarView)
AvatarView avatarView;
@BindView(R.id.speech_bubble)
SpeechBubbleView speechBubbleView;
TaskSetupAdapter adapter;
private String[][] taskGroups;
private Object[][] tasks;
@ -62,6 +65,14 @@ public class TaskSetupFragment extends BaseFragment {
return view;
}
@Override
public void setUserVisibleHint(boolean isVisibleToUser) {
super.setUserVisibleHint(isVisibleToUser);
if (isVisibleToUser && getContext() != null) {
speechBubbleView.animateText(getContext().getString(R.string.task_setup_description));
}
}
public void setUser(@Nullable HabitRPGUser user) {
this.user = user;
if (avatarView != null) {

View file

@ -2,18 +2,25 @@ package com.habitrpg.android.habitica.ui.fragments.setup;
import com.habitrpg.android.habitica.R;
import com.habitrpg.android.habitica.components.AppComponent;
import com.habitrpg.android.habitica.ui.SpeechBubbleView;
import com.habitrpg.android.habitica.ui.fragments.BaseFragment;
import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import butterknife.BindView;
import butterknife.ButterKnife;
public class WelcomeFragment extends BaseFragment {
@BindView(R.id.speech_bubble)
SpeechBubbleView speechBubbleView;
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
@ -22,6 +29,8 @@ public class WelcomeFragment extends BaseFragment {
unbinder = ButterKnife.bind(this, v);
speechBubbleView.animateText(getContext().getString(R.string.welcome_text));
return v;
}

View file

@ -181,7 +181,7 @@ public class TaskRecyclerViewFragment extends BaseFragment implements View.OnCli
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
super.onCreateView(inflater, container, savedInstanceState);
if (classType.equals(Task.TYPE_DAILY)) {
if (Task.TYPE_DAILY.equals(classType)) {
if (user != null && user.getPreferences().getDailyDueDefaultView()) {
taskFilterHelper.setActiveFilter(Task.TYPE_DAILY, Task.FILTER_ACTIVE);
}

View file

@ -29,8 +29,10 @@ import com.habitrpg.android.habitica.events.TaskSaveEvent;
import com.habitrpg.android.habitica.events.TaskTappedEvent;
import com.habitrpg.android.habitica.events.commands.AddNewTaskCommand;
import com.habitrpg.android.habitica.events.commands.RefreshUserCommand;
import com.habitrpg.android.habitica.events.commands.UpdateUserCommand;
import com.habitrpg.android.habitica.helpers.TaskFilterHelper;
import com.habitrpg.android.habitica.models.TutorialStep;
import com.habitrpg.android.habitica.models.tasks.Task;
import com.habitrpg.android.habitica.models.user.HabitRPGUser;
import com.habitrpg.android.habitica.ui.activities.MainActivity;
import com.habitrpg.android.habitica.ui.activities.TaskFormActivity;
import com.habitrpg.android.habitica.ui.adapter.tasks.BaseTasksRecyclerViewAdapter;
@ -38,21 +40,15 @@ import com.habitrpg.android.habitica.ui.adapter.tasks.DailiesRecyclerViewHolder;
import com.habitrpg.android.habitica.ui.adapter.tasks.SortableTasksRecyclerViewAdapter;
import com.habitrpg.android.habitica.ui.fragments.BaseMainFragment;
import com.habitrpg.android.habitica.ui.views.tasks.TaskFilterDialog;
import com.habitrpg.android.habitica.models.user.HabitRPGUser;
import com.habitrpg.android.habitica.models.TutorialStep;
import com.habitrpg.android.habitica.models.tasks.Task;
import com.raizlabs.android.dbflow.sql.builder.Condition;
import com.raizlabs.android.dbflow.sql.language.Select;
import com.roughike.bottombar.BottomBarTab;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import javax.inject.Inject;
@ -181,7 +177,7 @@ public class TasksFragment extends BaseMainFragment {
if (activePos >= 1 && viewFragmentsDictionary.get(activePos-1).recyclerAdapter != null) {
viewFragmentsDictionary.get(activePos-1).recyclerAdapter.filter();
}
if (activePos < viewPager.getAdapter().getCount() && viewFragmentsDictionary.get(activePos+1).recyclerAdapter != null) {
if (activePos < viewPager.getAdapter().getCount()-1 && viewFragmentsDictionary.get(activePos+1).recyclerAdapter != null) {
viewFragmentsDictionary.get(activePos+1).recyclerAdapter.filter();
}
if (getActiveFragment() != null) {

View file

@ -10,6 +10,8 @@ import com.habitrpg.android.habitica.models.tasks.Task;
import org.greenrobot.eventbus.EventBus;
import android.graphics.drawable.Drawable;
import android.support.v4.content.ContextCompat;
import android.view.View;
import android.widget.Button;
@ -27,10 +29,13 @@ public class RewardViewHolder extends BaseTaskViewHolder {
@BindView(R.id.btnReward)
Button rewardButton;
private Drawable customRewardIcon;
public RewardViewHolder(View itemView) {
super(itemView);
priceFormat = new DecimalFormat("0.##");
customRewardIcon = ContextCompat.getDrawable(itemView.getContext(), R.drawable.custom_reward);
}
@Override
@ -40,10 +45,9 @@ public class RewardViewHolder extends BaseTaskViewHolder {
this.rewardButton.setText(this.priceFormat.format(this.task.value));
if (this.isItem()) {
this.rewardImageView.setVisibility(View.VISIBLE);
DataBindingUtils.loadImage(this.rewardImageView, "shop_" + this.task.getId());
} else {
this.rewardImageView.setVisibility(View.GONE);
this.rewardImageView.setImageDrawable(customRewardIcon);
}
}
@ -57,7 +61,7 @@ public class RewardViewHolder extends BaseTaskViewHolder {
}
@OnClick(R.id.btnReward)
public void buyReward() {
void buyReward() {
BuyRewardCommand event = new BuyRewardCommand();
event.Reward = task;
EventBus.getDefault().post(event);

View file

@ -39,6 +39,7 @@ public class LoginBackgroundView extends RelativeLayout {
private int width;
private int height;
private boolean didLayoutStars = false;
private FrameLayout.LayoutParams params;
public LoginBackgroundView(Context context, @Nullable AttributeSet attrs) {
super(context, attrs);
@ -50,6 +51,7 @@ public class LoginBackgroundView extends RelativeLayout {
super.onFinishInflate();
ButterKnife.bind(this, this);
starViews = new ArrayList<>();
params = new FrameLayout.LayoutParams(0, 0);
generateStars();
animateClouds();
}
@ -72,7 +74,9 @@ public class LoginBackgroundView extends RelativeLayout {
this.width = parentWidth;
this.height = (int)(parentHeight*SIZE_FACTOR);
this.setMeasuredDimension(width, height);
this.setLayoutParams(new FrameLayout.LayoutParams(width, height));
params.width = width;
params.height = height;
this.setLayoutParams(params);
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
}
@ -83,7 +87,7 @@ public class LoginBackgroundView extends RelativeLayout {
}
public void generateStars() {
generateStars(1, 10, 20);
generateStars(1, 12, 25);
}
private void generateStars(int largeCount, int mediumCount, int smallCount) {

View file

@ -3,8 +3,10 @@ package com.habitrpg.android.habitica.ui.views.tasks;
import android.content.Context;
import android.content.res.ColorStateList;
import android.graphics.Color;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.support.annotation.IdRes;
import android.support.annotation.Nullable;
import android.support.v4.content.ContextCompat;
import android.support.v4.widget.CompoundButtonCompat;
import android.support.v7.app.AlertDialog;
@ -74,11 +76,13 @@ public class TaskFilterDialog extends AlertDialog implements RadioGroup.OnChecke
private Map<String, Tag> createdTags = new HashMap<>();
private List<String> deletedTags = new ArrayList<>();
private Drawable addIcon;
private boolean isEditing;
public TaskFilterDialog(Context context, AppComponent component) {
super(context);
component.inject(this);
addIcon = ContextCompat.getDrawable(context, R.drawable.ic_add_purple_300_36dp);
LayoutInflater inflater = LayoutInflater.from(context);
View view = inflater.inflate(R.layout.dialog_task_filter, null);
@ -117,7 +121,6 @@ public class TaskFilterDialog extends AlertDialog implements RadioGroup.OnChecke
});
clearButton.setEnabled(hasActiveFilters());
}
}
@Override
@ -147,10 +150,16 @@ public class TaskFilterDialog extends AlertDialog implements RadioGroup.OnChecke
}
);
int leftPadding = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 16, getContext().getResources().getDisplayMetrics());
int verticalPadding = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 12, getContext().getResources().getDisplayMetrics());
for (Tag tag : tags) {
AppCompatCheckBox tagCheckbox = new AppCompatCheckBox(getContext());
tagCheckbox.setText(tag.getName());
tagCheckbox.setTextSize(TypedValue.COMPLEX_UNIT_SP,14);
tagCheckbox.setTextSize(TypedValue.COMPLEX_UNIT_SP,20);
tagCheckbox.setPadding(tagCheckbox.getPaddingLeft()+ leftPadding,
verticalPadding,
tagCheckbox.getPaddingRight(),
verticalPadding);
CompoundButtonCompat.setButtonTintList(tagCheckbox, colorStateList);
tagCheckbox.setOnCheckedChangeListener((buttonView, isChecked) -> {
if (isChecked) {
@ -173,6 +182,8 @@ public class TaskFilterDialog extends AlertDialog implements RadioGroup.OnChecke
Button button = new Button(getContext());
button.setText(R.string.add_tag);
button.setOnClickListener(v -> createTag());
button.setCompoundDrawablesWithIntrinsicBounds(addIcon, null, null, null);
button.setBackgroundResource(R.drawable.layout_rounded_bg_lighter_gray);
tagsList.addView(button);
}
@ -258,7 +269,7 @@ public class TaskFilterDialog extends AlertDialog implements RadioGroup.OnChecke
tagsList.addView(wrapper);
}
public void setActiveTags(List<String> tagIds) {
public void setActiveTags(@Nullable List<String> tagIds) {
if (tagIds == null) {
this.activeTags.clear();
} else {
@ -313,7 +324,7 @@ public class TaskFilterDialog extends AlertDialog implements RadioGroup.OnChecke
setActiveFilter(activeFilter);
}
private void setActiveFilter(String activeFilter) {
private void setActiveFilter(@Nullable String activeFilter) {
filterType = activeFilter;
int checkedId = -1;
if (activeFilter == null) {