Merge branch 'develop' of https://github.com/HabitRPG/habitrpg-android into apply_tranformations
Conflicts: Habitica/res/values/strings.xml gradle/wrapper/gradle-wrapper.properties
|
|
@ -134,6 +134,8 @@
|
|||
<activity android:name=".ui.activities.MaintenanceActivity"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/Theme.AppCompat.Light.NoActionBar" />
|
||||
<activity android:name=".ui.activities.GemPurchaseActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
<receiver android:process=":remote" android:name=".NotificationPublisher" />
|
||||
|
||||
<receiver android:process=":remote" android:name=".receivers.TaskReceiver"></receiver>
|
||||
|
|
|
|||
BIN
Habitica/res/drawable-hdpi/gems_21.png
Normal file
|
After Width: | Height: | Size: 5.8 KiB |
BIN
Habitica/res/drawable-hdpi/gems_4.png
Normal file
|
After Width: | Height: | Size: 3.8 KiB |
BIN
Habitica/res/drawable-hdpi/gems_42.png
Normal file
|
After Width: | Height: | Size: 6.3 KiB |
BIN
Habitica/res/drawable-hdpi/gems_84.png
Normal file
|
After Width: | Height: | Size: 9.4 KiB |
BIN
Habitica/res/drawable-hdpi/support_habitica.png
Normal file
|
After Width: | Height: | Size: 17 KiB |
BIN
Habitica/res/drawable-mdpi/gems_21.png
Normal file
|
After Width: | Height: | Size: 3.6 KiB |
BIN
Habitica/res/drawable-mdpi/gems_4.png
Normal file
|
After Width: | Height: | Size: 2.6 KiB |
BIN
Habitica/res/drawable-mdpi/gems_42.png
Normal file
|
After Width: | Height: | Size: 3.7 KiB |
BIN
Habitica/res/drawable-mdpi/gems_84.png
Normal file
|
After Width: | Height: | Size: 5.6 KiB |
BIN
Habitica/res/drawable-mdpi/support_habitica.png
Normal file
|
After Width: | Height: | Size: 10 KiB |
BIN
Habitica/res/drawable-xhdpi/gems_21.png
Normal file
|
After Width: | Height: | Size: 8.1 KiB |
BIN
Habitica/res/drawable-xhdpi/gems_4.png
Normal file
|
After Width: | Height: | Size: 5.2 KiB |
BIN
Habitica/res/drawable-xhdpi/gems_42.png
Normal file
|
After Width: | Height: | Size: 9 KiB |
BIN
Habitica/res/drawable-xhdpi/gems_84.png
Normal file
|
After Width: | Height: | Size: 13 KiB |
BIN
Habitica/res/drawable-xhdpi/support_habitica.png
Normal file
|
After Width: | Height: | Size: 24 KiB |
BIN
Habitica/res/drawable-xxhdpi/gems_21.png
Normal file
|
After Width: | Height: | Size: 13 KiB |
BIN
Habitica/res/drawable-xxhdpi/gems_4.png
Normal file
|
After Width: | Height: | Size: 8.1 KiB |
BIN
Habitica/res/drawable-xxhdpi/gems_42.png
Normal file
|
After Width: | Height: | Size: 15 KiB |
BIN
Habitica/res/drawable-xxhdpi/gems_84.png
Normal file
|
After Width: | Height: | Size: 21 KiB |
BIN
Habitica/res/drawable-xxhdpi/support_habitica.png
Normal file
|
After Width: | Height: | Size: 39 KiB |
4
Habitica/res/drawable/ic_check_purple.xml
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:height="14dp" android:viewportHeight="24.0" android:viewportWidth="24.0" android:width="14dp">
|
||||
<path android:fillColor="#432874" android:pathData="M9,16.17L4.83,12l-1.42,1.41L9,19 21,7l-1.41,-1.41z"/>
|
||||
</vector>
|
||||
11
Habitica/res/drawable/purchase_button_background.xml
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<solid
|
||||
android:color="@color/brand_300" >
|
||||
</solid>
|
||||
<corners
|
||||
android:radius="8dp" >
|
||||
</corners>
|
||||
</shape>
|
||||
87
Habitica/res/layout/activity_gem_purchase.xml
Normal file
|
|
@ -0,0 +1,87 @@
|
|||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".ui.activities.MainActivity"
|
||||
android:id="@+id/overlayFrameLayout">
|
||||
<android.support.v4.widget.DrawerLayout
|
||||
android:id="@+id/drawer_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:fitsSystemWindows="true"
|
||||
android:gravity="center">
|
||||
|
||||
<android.support.design.widget.CoordinatorLayout
|
||||
android:id="@+id/main_content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:elevation="0dp"
|
||||
tools:context=".ui.activities.MainActivity">
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/fragment_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
|
||||
|
||||
<android.support.design.widget.AppBarLayout
|
||||
android:id="@+id/appbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:fitsSystemWindows="false">
|
||||
|
||||
<android.support.design.widget.CollapsingToolbarLayout
|
||||
android:id="@+id/collapsing_toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:fitsSystemWindows="false"
|
||||
app:titleEnabled="false"
|
||||
app:contentScrim="?attr/colorPrimary"
|
||||
app:expandedTitleMarginEnd="?attr/actionBarSize"
|
||||
app:expandedTitleMarginStart="0dp"
|
||||
app:layout_scrollFlags="scroll|exitUntilCollapsed">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/headerImage"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="?attr/actionBarSize"
|
||||
app:layout_collapseMode="parallax"
|
||||
android:src="@drawable/support_habitica"
|
||||
android:paddingBottom="21dp"
|
||||
android:contentDescription="@string/support_habitica"/>
|
||||
|
||||
<android.support.v7.widget.Toolbar
|
||||
android:id="@+id/toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:minHeight="?attr/actionBarSize"
|
||||
android:theme="@style/Toolbar"
|
||||
app:layout_collapseMode="pin"
|
||||
app:popupTheme="@style/Theme.AppCompat.Light" />
|
||||
</android.support.design.widget.CollapsingToolbarLayout>
|
||||
|
||||
<android.support.design.widget.TabLayout
|
||||
android:id="@+id/detail_tabs"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="54dp"
|
||||
android:layout_gravity="bottom"
|
||||
android:background="@color/brand_200"
|
||||
android:elevation="0dp"
|
||||
android:fillViewport="false"
|
||||
|
||||
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
|
||||
app:layout_anchor="@+id/collapsing_toolbar"
|
||||
app:layout_anchorGravity="bottom"
|
||||
|
||||
app:layout_collapseMode="pin"
|
||||
app:tabGravity="fill"
|
||||
app:tabIndicatorColor="@android:color/white"
|
||||
app:tabMode="fixed"
|
||||
android:visibility="gone"/>
|
||||
</android.support.design.widget.AppBarLayout>
|
||||
|
||||
</android.support.design.widget.CoordinatorLayout>
|
||||
</android.support.v4.widget.DrawerLayout>
|
||||
</FrameLayout>
|
||||
|
|
@ -318,7 +318,7 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_marginTop="30dp"
|
||||
android:layout_marginTop="20dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
|
|
@ -333,28 +333,14 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<LinearLayout
|
||||
<EditText
|
||||
android:id="@+id/new_reminder_edittext"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<EditText
|
||||
android:id="@+id/new_reminder_edittext"
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="1"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:hint="@string/start_date"
|
||||
android:textColor="@android:color/black"
|
||||
android:focusable="false" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/add_reminder_button"
|
||||
style="?android:attr/buttonStyleSmall"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/add_checklist_item" />
|
||||
</LinearLayout>
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:hint="@string/start_date"
|
||||
android:textColor="@android:color/black"
|
||||
android:focusable="false" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
|
@ -362,6 +348,7 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:layout_marginTop="20dp"
|
||||
android:id="@+id/task_tags_wrapper">
|
||||
|
||||
<TextView
|
||||
|
|
|
|||
|
|
@ -1,24 +1,116 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="vertical" android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<TextView android:layout_height="wrap_content"
|
||||
android:layout_width="wrap_content"
|
||||
|
||||
android:text="@string/gem.purchase.support"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_margin="5dp">
|
||||
|
||||
</TextView>
|
||||
|
||||
<Button
|
||||
android:layout_width="wrap_content"
|
||||
<android.support.v4.widget.NestedScrollView
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:scrollbarSize="3dp"
|
||||
android:scrollbarThumbVertical="@color/md_grey_500"
|
||||
android:scrollbars="vertical">
|
||||
<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="wrap_content"
|
||||
android:text="+ 21"
|
||||
android:id="@+id/btn.purchase.gems"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:drawableRight="@drawable/ic_header_gem"
|
||||
android:drawablePadding="5dp"
|
||||
android:textColor="@color/white"/>
|
||||
</LinearLayout>
|
||||
android:padding="20dp">
|
||||
|
||||
<TextView android:layout_height="wrap_content"
|
||||
android:layout_width="wrap_content"
|
||||
android:paddingLeft="16dp"
|
||||
android:paddingRight="16dp"
|
||||
android:paddingBottom="20dp"
|
||||
android:text="@string/gem.purchase.title"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:gravity="center"
|
||||
android:textColor="@color/best_10"
|
||||
android:drawableTop="@drawable/ic_header_heart"
|
||||
android:textSize="14sp"
|
||||
android:lineSpacingExtra="4dp" />
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:layout_marginBottom="16dp">
|
||||
<com.habitrpg.android.habitica.ui.GemPurchaseOptionsView
|
||||
android:id="@+id/gems_4_view"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
app:gemAmount="4"
|
||||
app:gemDrawable="@drawable/gems_4"
|
||||
android:layout_marginRight="16dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
/>
|
||||
<com.habitrpg.android.habitica.ui.GemPurchaseOptionsView
|
||||
android:id="@+id/gems_21_view"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
app:gemAmount="21"
|
||||
app:gemDrawable="@drawable/gems_21" />
|
||||
</LinearLayout>
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:dividerPadding="16dp"
|
||||
android:showDividers="middle"
|
||||
android:divider="@android:color/white">
|
||||
<com.habitrpg.android.habitica.ui.GemPurchaseOptionsView
|
||||
android:id="@+id/gems_42_view"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
app:gemAmount="42"
|
||||
app:gemDrawable="@drawable/gems_42"
|
||||
android:layout_marginRight="16dp"
|
||||
android:layout_marginEnd="16dp" />
|
||||
<com.habitrpg.android.habitica.ui.GemPurchaseOptionsView
|
||||
android:id="@+id/gems_84_view"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
app:gemAmount="84"
|
||||
app:gemDrawable="@drawable/gems_84" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/gem.purchase.subtitle"
|
||||
android:gravity="center"
|
||||
android:textStyle="normal|bold"
|
||||
android:textColor="@color/brand_100"
|
||||
android:textSize="16sp"
|
||||
android:lineSpacingExtra="4dp"
|
||||
android:layout_marginTop="23dp"
|
||||
android:layout_marginBottom="12dp"/>
|
||||
|
||||
<TextView
|
||||
android:text="@string/gem.purchase.listitem1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/GemPurchaseListItem"
|
||||
/>
|
||||
<TextView
|
||||
android:text="@string/gem.purchase.listitem2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/GemPurchaseListItem"
|
||||
/>
|
||||
<TextView
|
||||
android:text="@string/gem.purchase.listitem3"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/GemPurchaseListItem"
|
||||
/>
|
||||
<TextView
|
||||
android:text="@string/gem.purchase.listitem4"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/GemPurchaseListItem"
|
||||
/>
|
||||
</LinearLayout>
|
||||
</android.support.v4.widget.NestedScrollView>
|
||||
44
Habitica/res/layout/purchase_gem_view.xml
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:orientation="vertical" android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/gem_view_background"
|
||||
android:gravity="center">
|
||||
<ImageView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="65dp"
|
||||
android:scaleType="center"
|
||||
android:id="@+id/gem_image"
|
||||
tools:src="@drawable/gems_21"
|
||||
android:contentDescription="@string/gems"
|
||||
android:layout_marginTop="20dp"/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/gem_amount"
|
||||
android:textColor="@color/best_10"
|
||||
android:gravity="center"
|
||||
android:textSize="36sp"
|
||||
tools:text="21" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/gems"
|
||||
android:textColor="@color/best_10"
|
||||
android:gravity="center" />
|
||||
|
||||
<Button
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/purchase_button"
|
||||
android:background="@drawable/purchase_button_background"
|
||||
android:textColor="@color/white"
|
||||
android:layout_marginLeft="14dp"
|
||||
android:layout_marginRight="14dp"
|
||||
android:layout_marginBottom="14dp"
|
||||
android:layout_marginTop="13dp"
|
||||
tools:text="$ 4.99"/>
|
||||
</LinearLayout>
|
||||
|
|
@ -4,4 +4,10 @@
|
|||
<attr name="showMount" format="boolean" />
|
||||
<attr name="showPet" format="boolean" />
|
||||
</declare-styleable>
|
||||
|
||||
<declare-styleable name="GemPurchaseOptionsView">
|
||||
<attr name="gemAmount" format="integer" />
|
||||
<attr name="priceText" format="string" />
|
||||
<attr name="gemDrawable" format="integer" />
|
||||
</declare-styleable>
|
||||
</resources>
|
||||
|
|
|
|||
|
|
@ -3,10 +3,10 @@
|
|||
|
||||
<color name="brand_50">#36205D</color>
|
||||
<color name="brand_100">#432874</color>
|
||||
<color name="brand_200">#4F2A93</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_500">#bda8ff</color>
|
||||
<color name="brand_700">#ede7f6</color>
|
||||
<color name="brand">@color/brand_100</color>
|
||||
|
||||
|
|
@ -37,7 +37,7 @@
|
|||
|
||||
<color name="best_100">#50B5E9</color>
|
||||
<color name="best_50">#46A7D9</color>
|
||||
<color name="best_10">#2995CD</color>
|
||||
<color name="best_10">#2995cd</color>
|
||||
|
||||
<color name="completed">#D9D9D9</color>
|
||||
<color name="completed_btn">#989898</color>
|
||||
|
|
@ -96,10 +96,12 @@
|
|||
<!-- Preferences -->
|
||||
<color name="preference_fallback_accent_color">@color/colorAccent</color>
|
||||
<!-- buttons -->
|
||||
<color name="btn_success">#ff5cb85c</color>
|
||||
<color name="btn_warning">#fff0ad4e</color>
|
||||
<color name="btn_danger">#ffd9534f</color>
|
||||
<color name="btn_success">@color/good_10</color>
|
||||
<color name="btn_warning">@color/neutral_10</color>
|
||||
<color name="btn_danger">@color/worse_10</color>
|
||||
|
||||
<color name="widget_background">#c8432874</color>
|
||||
|
||||
<color name="gem_view_background">#10bda8ff</color>
|
||||
|
||||
</resources>
|
||||
|
|
|
|||
|
|
@ -16,6 +16,6 @@
|
|||
<string name="accept_quest_invite" translatable="false">ACCEPT_QUEST_INVITE</string>
|
||||
<string name="reject_quest_invite" translatable="false">REJECT_QUEST_INVITE</string>
|
||||
|
||||
<string name="qr_album_name">habitica</string>
|
||||
<string name="qr_file_name"> habitrpg-qr-code.jpg</string>
|
||||
<string name="qr_album_name" translatable="false">habitica</string>
|
||||
<string name="qr_file_name" translatable="false"> habitrpg-qr-code.jpg</string>
|
||||
</resources>
|
||||
|
|
@ -415,6 +415,14 @@ To start, which parts of your life do you want to improve?</string>
|
|||
<string name="widget_dailies">Habitica Dailies</string>
|
||||
<string name="widget_add_task">Habitica Add Task</string>
|
||||
<string name="google_services_missing">Google play services could not be found.</string>
|
||||
<string name="gem.purchase.toolbartitle">Purchase</string>
|
||||
<string name="gem.purchase.title">Buying gems supports the developers and helps keep Habitica running</string>
|
||||
<string name="gem.purchase.subtitle">Gems allow you to buy fun extras for you account, including:</string>
|
||||
<string name="gem.purchase.listitem1">Cool costumes for your avatar</string>
|
||||
<string name="gem.purchase.listitem2">Awesome backgrounds</string>
|
||||
<string name="gem.purchase.listitem3">Quests that reward you with pet eggs</string>
|
||||
<string name="gem.purchase.listitem4">The ability to change your class before level 100</string>
|
||||
<string name="support_habitica">Support Habitica</string>
|
||||
<string name="skill_transformation_use">use</string>
|
||||
|
||||
</resources>
|
||||
|
|
|
|||
|
|
@ -182,4 +182,13 @@
|
|||
<item name="android:layout_marginRight">8dp</item>
|
||||
<item name="android:layout_gravity">center</item>
|
||||
</style>
|
||||
|
||||
<style name="GemPurchaseListItem">
|
||||
<item name="android:textColor">@color/brand_100</item>
|
||||
<item name="android:gravity">center_horizontal</item>
|
||||
<item name="android:textSize">12sp</item>
|
||||
<item name="android:drawableLeft">@drawable/ic_check_purple</item>
|
||||
<item name="android:layout_gravity">center_horizontal</item>
|
||||
<item name="android:paddingTop">12dp</item>
|
||||
</style>
|
||||
</resources>
|
||||
|
|
@ -7,6 +7,7 @@ import com.facebook.FacebookSdk;
|
|||
import com.facebook.drawee.backends.pipeline.Fresco;
|
||||
import com.habitrpg.android.habitica.components.AppComponent;
|
||||
import com.habitrpg.android.habitica.components.DaggerAppComponent;
|
||||
import com.habitrpg.android.habitica.helpers.PurchaseTypes;
|
||||
import com.habitrpg.android.habitica.modules.AppModule;
|
||||
import com.habitrpg.android.habitica.ui.activities.IntroActivity;
|
||||
import com.habitrpg.android.habitica.ui.activities.LoginActivity;
|
||||
|
|
@ -49,7 +50,6 @@ import io.fabric.sdk.android.Fabric;
|
|||
|
||||
public class HabiticaApplication extends MultiDexApplication {
|
||||
|
||||
public static String Purchase20Gems = "com.habitrpg.android.habitica.iap.20.gems";
|
||||
public static HabitRPGUser User;
|
||||
public static Activity currentActivity = null;
|
||||
@Inject
|
||||
|
|
@ -338,7 +338,8 @@ public class HabiticaApplication extends MultiDexApplication {
|
|||
}
|
||||
});
|
||||
|
||||
checkout = Checkout.forApplication(billing, Products.create().add(ProductTypes.IN_APP, Arrays.asList(Purchase20Gems)));
|
||||
|
||||
checkout = Checkout.forApplication(billing, Products.create().add(ProductTypes.IN_APP, PurchaseTypes.allTypes));
|
||||
}
|
||||
|
||||
@NonNull
|
||||
|
|
|
|||
|
|
@ -0,0 +1,15 @@
|
|||
package com.habitrpg.android.habitica.helpers;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
public class PurchaseTypes {
|
||||
|
||||
public static String Purchase4Gems = "com.habitrpg.android.habitica.iap.4gems";
|
||||
public static String Purchase21Gems = "com.habitrpg.android.habitica.iap.21gems";
|
||||
public static String Purchase42Gems = "com.habitrpg.android.habitica.iap.42gems";
|
||||
public static String Purchase84Gems = "com.habitrpg.android.habitica.iap.84gems";
|
||||
|
||||
public static List<String> allTypes = Arrays.asList(Purchase4Gems, Purchase21Gems, Purchase42Gems, Purchase84Gems);
|
||||
}
|
||||
|
|
@ -5,6 +5,7 @@ import android.app.TimePickerDialog;
|
|||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.Build;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.v7.preference.PreferenceManager;
|
||||
import android.widget.Button;
|
||||
import android.widget.DatePicker;
|
||||
|
|
@ -26,7 +27,7 @@ import java.util.UUID;
|
|||
*/
|
||||
public class RemindersManager {
|
||||
|
||||
DateFormat dateFormater;
|
||||
private DateFormat dateFormater;
|
||||
|
||||
public RemindersManager(String taskType) {
|
||||
if (taskType.equals("todo")) {
|
||||
|
|
@ -56,7 +57,8 @@ public class RemindersManager {
|
|||
return dateFormater.format(time);
|
||||
}
|
||||
|
||||
public void createDialogeForEditText(EditText editText, String taskType, Context context, RemindersItem reminder) {
|
||||
public void createReminderTimeDialog(@Nullable ReminderTimeSelectedCallback callback, String taskType,
|
||||
Context context, @Nullable RemindersItem reminder) {
|
||||
Calendar currentTime = Calendar.getInstance();
|
||||
int hour = currentTime.get(Calendar.HOUR_OF_DAY);
|
||||
int minute = currentTime.get(Calendar.MINUTE);
|
||||
|
|
@ -92,11 +94,7 @@ public class RemindersManager {
|
|||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.set(year, month, day, hour1, minute1, 0);
|
||||
|
||||
if (reminder != null) {
|
||||
reminder.setTime(calendar.getTime());
|
||||
}
|
||||
|
||||
editText.setText(dateFormater.format(calendar.getTime()));
|
||||
onReminderTimeSelected(callback, reminder, calendar);
|
||||
dialog.hide();
|
||||
});
|
||||
dialog.show();
|
||||
|
|
@ -106,15 +104,26 @@ public class RemindersManager {
|
|||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.set(calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH), calendar.get(Calendar.DATE), selectedHour, selectedMinute, 0);
|
||||
|
||||
if (reminder != null) {
|
||||
reminder.setTime(calendar.getTime());
|
||||
}
|
||||
|
||||
editText.setText(dateFormater.format(calendar.getTime()));
|
||||
onReminderTimeSelected(callback, reminder, calendar);
|
||||
}, hour, minute, true);
|
||||
timePickerDialog.setTitle("Select Time");
|
||||
timePickerDialog.show();
|
||||
}
|
||||
}
|
||||
|
||||
private void onReminderTimeSelected(ReminderTimeSelectedCallback callback, RemindersItem reminder, Calendar calendar) {
|
||||
RemindersItem remindersItem = reminder;
|
||||
if (remindersItem == null) {
|
||||
remindersItem = createReminderFromDateString(dateFormater.format(calendar.getTime()));
|
||||
} else {
|
||||
remindersItem.setTime(calendar.getTime());
|
||||
}
|
||||
if (callback != null) {
|
||||
callback.onReminderTimeSelected(remindersItem);
|
||||
}
|
||||
}
|
||||
|
||||
public interface ReminderTimeSelectedCallback {
|
||||
void onReminderTimeSelected(RemindersItem remindersItem);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,65 @@
|
|||
package com.habitrpg.android.habitica.ui;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.TypedArray;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.util.AttributeSet;
|
||||
import android.widget.Button;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.habitrpg.android.habitica.R;
|
||||
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
|
||||
|
||||
public class GemPurchaseOptionsView extends FrameLayout {
|
||||
|
||||
@BindView(R.id.gem_image)
|
||||
ImageView gemImageView;
|
||||
|
||||
@BindView(R.id.gem_amount)
|
||||
TextView gemAmountTextView;
|
||||
|
||||
@BindView(R.id.purchase_button)
|
||||
Button purchaseButton;
|
||||
private String sku;
|
||||
|
||||
public GemPurchaseOptionsView(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
|
||||
inflate(context, R.layout.purchase_gem_view, this);
|
||||
|
||||
ButterKnife.bind(this);
|
||||
|
||||
TypedArray a = context.getTheme().obtainStyledAttributes(
|
||||
attrs,
|
||||
R.styleable.GemPurchaseOptionsView,
|
||||
0, 0);
|
||||
|
||||
gemAmountTextView.setText(a.getText(R.styleable.GemPurchaseOptionsView_gemAmount));
|
||||
|
||||
Drawable iconRes = a.getDrawable(R.styleable.GemPurchaseOptionsView_gemDrawable);
|
||||
if (iconRes != null) {
|
||||
gemImageView.setImageDrawable(iconRes);
|
||||
}
|
||||
}
|
||||
|
||||
public void setOnPurchaseClickListener(Button.OnClickListener listener) {
|
||||
purchaseButton.setOnClickListener(listener);
|
||||
}
|
||||
|
||||
public void setPurchaseButtonText(String price) {
|
||||
purchaseButton.setText(price);
|
||||
}
|
||||
|
||||
public void setSku(String sku) {
|
||||
this.sku = sku;
|
||||
}
|
||||
|
||||
public String getSku() {
|
||||
return sku;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,83 @@
|
|||
package com.habitrpg.android.habitica.ui.activities;
|
||||
|
||||
|
||||
import com.habitrpg.android.habitica.HabiticaApplication;
|
||||
import com.habitrpg.android.habitica.R;
|
||||
import com.habitrpg.android.habitica.components.AppComponent;
|
||||
import com.habitrpg.android.habitica.ui.fragments.GemsPurchaseFragment;
|
||||
|
||||
import org.solovyev.android.checkout.ActivityCheckout;
|
||||
import org.solovyev.android.checkout.Checkout;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
import android.view.MenuItem;
|
||||
|
||||
public class GemPurchaseActivity extends BaseActivity implements GemsPurchaseFragment.Listener {
|
||||
|
||||
private ActivityCheckout checkout;
|
||||
|
||||
@Override
|
||||
protected int getLayoutResId() {
|
||||
return R.layout.activity_gem_purchase;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void injectActivity(AppComponent component) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
checkout.onActivityResult(requestCode, resultCode, data);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
setupCheckout();
|
||||
|
||||
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
|
||||
setSupportActionBar(toolbar);
|
||||
|
||||
if (getSupportActionBar() != null) {
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
getSupportActionBar().setDisplayShowHomeEnabled(true);
|
||||
getSupportActionBar().setTitle(R.string.gem_purchase_toolbartitle);
|
||||
}
|
||||
|
||||
GemsPurchaseFragment firstFragment = new GemsPurchaseFragment();
|
||||
getSupportFragmentManager().beginTransaction()
|
||||
.add(R.id.fragment_container, firstFragment).commit();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
if (checkout != null) {
|
||||
checkout.stop();
|
||||
}
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
if (item.getItemId() == android.R.id.home) {
|
||||
finish();
|
||||
}
|
||||
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
|
||||
private void setupCheckout() {
|
||||
checkout = Checkout.forActivity(this, HabiticaApplication.getInstance(this).getCheckout());
|
||||
checkout.start();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActivityCheckout getActivityCheckout() {
|
||||
return checkout;
|
||||
}
|
||||
}
|
||||
|
|
@ -50,21 +50,27 @@ import com.habitrpg.android.habitica.R;
|
|||
import com.habitrpg.android.habitica.callbacks.HabitRPGUserCallback;
|
||||
import com.habitrpg.android.habitica.callbacks.ItemsCallback;
|
||||
import com.habitrpg.android.habitica.callbacks.MergeUserCallback;
|
||||
import com.habitrpg.android.habitica.callbacks.TaskCreationCallback;
|
||||
import com.habitrpg.android.habitica.callbacks.TaskScoringCallback;
|
||||
import com.habitrpg.android.habitica.callbacks.TaskUpdateCallback;
|
||||
import com.habitrpg.android.habitica.callbacks.UnlockCallback;
|
||||
import com.habitrpg.android.habitica.components.AppComponent;
|
||||
import com.habitrpg.android.habitica.databinding.ValueBarBinding;
|
||||
import com.habitrpg.android.habitica.events.ContentReloadedEvent;
|
||||
import com.habitrpg.android.habitica.events.DisplayFragmentEvent;
|
||||
import com.habitrpg.android.habitica.events.DisplayTutorialEvent;
|
||||
import com.habitrpg.android.habitica.events.HabitScoreEvent;
|
||||
import com.habitrpg.android.habitica.events.ReloadContentEvent;
|
||||
import com.habitrpg.android.habitica.events.SelectClassEvent;
|
||||
import com.habitrpg.android.habitica.events.ShareEvent;
|
||||
import com.habitrpg.android.habitica.events.TaskRemovedEvent;
|
||||
import com.habitrpg.android.habitica.events.TaskSaveEvent;
|
||||
import com.habitrpg.android.habitica.events.ToggledEditTagsEvent;
|
||||
import com.habitrpg.android.habitica.events.ToggledInnStateEvent;
|
||||
import com.habitrpg.android.habitica.events.commands.AddNewTaskCommand;
|
||||
import com.habitrpg.android.habitica.events.commands.BuyGemItemCommand;
|
||||
import com.habitrpg.android.habitica.events.commands.BuyRewardCommand;
|
||||
import com.habitrpg.android.habitica.events.commands.ChecklistCheckedCommand;
|
||||
import com.habitrpg.android.habitica.events.commands.DeleteTaskCommand;
|
||||
import com.habitrpg.android.habitica.events.commands.EquipCommand;
|
||||
import com.habitrpg.android.habitica.events.commands.FeedCommand;
|
||||
|
|
@ -73,6 +79,7 @@ import com.habitrpg.android.habitica.events.commands.OpenFullProfileCommand;
|
|||
import com.habitrpg.android.habitica.events.commands.OpenGemPurchaseFragmentCommand;
|
||||
import com.habitrpg.android.habitica.events.commands.OpenMenuItemCommand;
|
||||
import com.habitrpg.android.habitica.events.commands.SellItemCommand;
|
||||
import com.habitrpg.android.habitica.events.commands.TaskCheckedCommand;
|
||||
import com.habitrpg.android.habitica.events.commands.UnlockPathCommand;
|
||||
import com.habitrpg.android.habitica.events.commands.UpdateUserCommand;
|
||||
import com.habitrpg.android.habitica.helpers.AmplitudeManager;
|
||||
|
|
@ -163,13 +170,10 @@ import static com.habitrpg.android.habitica.ui.helpers.UiUtils.SnackbarDisplayTy
|
|||
import static com.habitrpg.android.habitica.ui.helpers.UiUtils.showSnackbar;
|
||||
|
||||
public class MainActivity extends BaseActivity implements Action1<Throwable>, HabitRPGUserCallback.OnUserReceived,
|
||||
TaskScoringCallback.OnTaskScored,
|
||||
GemsPurchaseFragment.Listener, TutorialView.OnTutorialReaction {
|
||||
TaskScoringCallback.OnTaskScored, TutorialView.OnTutorialReaction {
|
||||
|
||||
public static final int SELECT_CLASS_RESULT = 11;
|
||||
public static final int MIN_LEVEL_FOR_SKILLS = 11;
|
||||
// Checkout needs to be in the Activity..
|
||||
public ActivityCheckout checkout = null;
|
||||
@Inject
|
||||
public APIHelper apiHelper;
|
||||
@Inject
|
||||
|
|
@ -274,7 +278,6 @@ public class MainActivity extends BaseActivity implements Action1<Throwable>, Ha
|
|||
.append(this.drawer);
|
||||
}
|
||||
|
||||
setupCheckout();
|
||||
EventBus.getDefault().register(this);
|
||||
}
|
||||
|
||||
|
|
@ -324,15 +327,6 @@ public class MainActivity extends BaseActivity implements Action1<Throwable>, Ha
|
|||
sendBroadcast(intent);
|
||||
}
|
||||
|
||||
private void setupCheckout() {
|
||||
checkout = Checkout.forActivity(this, HabiticaApplication.getInstance(this).getCheckout());
|
||||
checkout.start();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActivityCheckout getActivityCheckout() {
|
||||
return checkout;
|
||||
}
|
||||
|
||||
private void saveLoginInformation() {
|
||||
HabiticaApplication.User = user;
|
||||
|
|
@ -875,17 +869,12 @@ public class MainActivity extends BaseActivity implements Action1<Throwable>, Ha
|
|||
}
|
||||
}
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
checkout.onActivityResult(requestCode, resultCode, data);
|
||||
}
|
||||
|
||||
// region Events
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
if (checkout != null) {
|
||||
checkout.stop();
|
||||
}
|
||||
|
||||
EventBus.getDefault().unregister(this);
|
||||
super.onDestroy();
|
||||
}
|
||||
|
|
@ -1462,6 +1451,46 @@ public class MainActivity extends BaseActivity implements Action1<Throwable>, Ha
|
|||
startActivity(Intent.createChooser(sharingIntent, getString(R.string.share_using)));
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onEvent(TaskCheckedCommand event) {
|
||||
apiHelper.apiService.postTaskDirection(event.Task.getId(), (event.Task.getCompleted() ? TaskDirection.down : TaskDirection.up).toString())
|
||||
.compose(apiHelper.configureApiCallObserver())
|
||||
.subscribe(new TaskScoringCallback(this, event.Task.getId()), throwable -> {
|
||||
});
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onEvent(ChecklistCheckedCommand event) {
|
||||
apiHelper.apiService.scoreChecklistItem(event.task.getId(), event.item.getId())
|
||||
.compose(apiHelper.configureApiCallObserver())
|
||||
.subscribe(new TaskUpdateCallback(), throwable -> {
|
||||
});
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onEvent(HabitScoreEvent event) {
|
||||
apiHelper.apiService.postTaskDirection(event.habit.getId(), (event.Up ? TaskDirection.up : TaskDirection.down).toString())
|
||||
.compose(apiHelper.configureApiCallObserver())
|
||||
.subscribe(new TaskScoringCallback(this, event.habit.getId()), throwable -> {
|
||||
});
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onEvent(final TaskSaveEvent event) {
|
||||
Task task = event.task;
|
||||
if (event.created) {
|
||||
this.apiHelper.apiService.createItem(task)
|
||||
.compose(apiHelper.configureApiCallObserver())
|
||||
.subscribe(new TaskCreationCallback(), throwable -> {
|
||||
});
|
||||
} else {
|
||||
this.apiHelper.apiService.updateTask(task.getId(), task)
|
||||
.compose(apiHelper.configureApiCallObserver())
|
||||
.subscribe(new TaskUpdateCallback(), throwable -> {
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private void checkMaintenance() {
|
||||
this.maintenanceService.getMaintenanceStatus()
|
||||
.compose(apiHelper.configureApiCallObserver())
|
||||
|
|
|
|||
|
|
@ -40,6 +40,7 @@ import com.habitrpg.android.habitica.events.TaskSaveEvent;
|
|||
import com.habitrpg.android.habitica.events.commands.DeleteTaskCommand;
|
||||
import com.habitrpg.android.habitica.helpers.FirstDayOfTheWeekHelper;
|
||||
import com.habitrpg.android.habitica.helpers.RemindersManager;
|
||||
import com.habitrpg.android.habitica.helpers.TagsHelper;
|
||||
import com.habitrpg.android.habitica.helpers.TaskAlarmManager;
|
||||
import com.habitrpg.android.habitica.ui.WrapContentRecyclerViewLayoutManager;
|
||||
import com.habitrpg.android.habitica.ui.adapter.tasks.CheckListAdapter;
|
||||
|
|
@ -73,13 +74,14 @@ import java.util.Date;
|
|||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import butterknife.BindView;
|
||||
import butterknife.OnClick;
|
||||
import rx.Observable;
|
||||
import rx.android.schedulers.AndroidSchedulers;
|
||||
import rx.schedulers.Schedulers;
|
||||
|
||||
|
||||
public class TaskFormActivity extends BaseActivity implements AdapterView.OnItemSelectedListener {
|
||||
public static final String TASK_ID_KEY = "taskId";
|
||||
public static final String USER_ID_KEY = "userId";
|
||||
|
|
@ -160,9 +162,6 @@ public class TaskFormActivity extends BaseActivity implements AdapterView.OnItem
|
|||
@BindView(R.id.reminders_recycler_view)
|
||||
RecyclerView remindersRecyclerView;
|
||||
|
||||
@BindView(R.id.add_reminder_button)
|
||||
Button addReminderButton;
|
||||
|
||||
@BindView(R.id.emoji_toggle_btn0)
|
||||
ImageButton emojiToggle0;
|
||||
|
||||
|
|
@ -192,6 +191,10 @@ public class TaskFormActivity extends BaseActivity implements AdapterView.OnItem
|
|||
|
||||
@BindView(R.id.task_tags_checklist)
|
||||
LinearLayout tagsContainerLinearLayout;
|
||||
|
||||
@Inject
|
||||
TagsHelper tagsHelper;
|
||||
|
||||
EmojiPopup popup;
|
||||
|
||||
private String taskType;
|
||||
|
|
@ -209,6 +212,7 @@ public class TaskFormActivity extends BaseActivity implements AdapterView.OnItem
|
|||
|
||||
private RemindersManager remindersManager;
|
||||
private TaskAlarmManager taskAlarmManager;
|
||||
private FirstDayOfTheWeekHelper firstDayOfTheWeekHelper;
|
||||
|
||||
@Override
|
||||
protected int getLayoutResId() {
|
||||
|
|
@ -364,8 +368,9 @@ public class TaskFormActivity extends BaseActivity implements AdapterView.OnItem
|
|||
|
||||
@Override
|
||||
public void onKeyboardClose() {
|
||||
if (popup.isShowing())
|
||||
if (popup.isShowing()) {
|
||||
popup.dismiss();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
|
@ -488,22 +493,13 @@ public class TaskFormActivity extends BaseActivity implements AdapterView.OnItem
|
|||
mItemTouchHelper.attachToRecyclerView(remindersRecyclerView);
|
||||
}
|
||||
|
||||
@OnClick(R.id.add_reminder_button)
|
||||
public void addReminder() {
|
||||
if (newRemindersEditText.getText().length() > 0) {
|
||||
RemindersItem item = remindersManager.createReminderFromDateString(newRemindersEditText.getText().toString());
|
||||
if (item == null) {
|
||||
return;
|
||||
}
|
||||
item.setType(taskType);
|
||||
remindersAdapter.addItem(item);
|
||||
newRemindersEditText.setText("");
|
||||
}
|
||||
private void addNewReminder(RemindersItem remindersItem) {
|
||||
remindersAdapter.addItem(remindersItem);
|
||||
}
|
||||
|
||||
@OnClick(R.id.new_reminder_edittext)
|
||||
public void changeNewReminderTime() {
|
||||
remindersManager.createDialogeForEditText(newRemindersEditText, taskType, this, null);
|
||||
public void selectNewReminderTime() {
|
||||
remindersManager.createReminderTimeDialog(this::addNewReminder, taskType, this, null);
|
||||
}
|
||||
|
||||
private void createTagsCheckBoxes() {
|
||||
|
|
@ -527,6 +523,7 @@ public class TaskFormActivity extends BaseActivity implements AdapterView.OnItem
|
|||
}
|
||||
}
|
||||
});
|
||||
checkbox.setChecked(tagsHelper.isTagChecked(tag.getId()));
|
||||
tagsContainerLinearLayout.addView(row);
|
||||
tagCheckBoxList.add(checkbox);
|
||||
position++;
|
||||
|
|
@ -574,7 +571,7 @@ public class TaskFormActivity extends BaseActivity implements AdapterView.OnItem
|
|||
SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);
|
||||
String dayOfTheWeek = sharedPreferences.getString("FirstDayOfTheWeek",
|
||||
Integer.toString(Calendar.getInstance().getFirstDayOfWeek()));
|
||||
FirstDayOfTheWeekHelper firstDayOfTheWeekHelper =
|
||||
firstDayOfTheWeekHelper =
|
||||
FirstDayOfTheWeekHelper.newInstance(Integer.parseInt(dayOfTheWeek));
|
||||
ArrayList<String> weekdaysTemp = new ArrayList<>(Arrays.asList(weekdays));
|
||||
Collections.rotate(weekdaysTemp, firstDayOfTheWeekHelper.getDailyTaskFormOffset());
|
||||
|
|
@ -601,13 +598,14 @@ public class TaskFormActivity extends BaseActivity implements AdapterView.OnItem
|
|||
if (this.task != null) {
|
||||
|
||||
if (this.dailyFrequencySpinner.getSelectedItemPosition() == 0) {
|
||||
this.weekdayCheckboxes.get(0).setChecked(this.task.getRepeat().getM());
|
||||
this.weekdayCheckboxes.get(1).setChecked(this.task.getRepeat().getT());
|
||||
this.weekdayCheckboxes.get(2).setChecked(this.task.getRepeat().getW());
|
||||
this.weekdayCheckboxes.get(3).setChecked(this.task.getRepeat().getTh());
|
||||
this.weekdayCheckboxes.get(4).setChecked(this.task.getRepeat().getF());
|
||||
this.weekdayCheckboxes.get(5).setChecked(this.task.getRepeat().getS());
|
||||
this.weekdayCheckboxes.get(6).setChecked(this.task.getRepeat().getSu());
|
||||
int offset = firstDayOfTheWeekHelper.getDailyTaskFormOffset();
|
||||
this.weekdayCheckboxes.get(offset).setChecked(this.task.getRepeat().getM());
|
||||
this.weekdayCheckboxes.get((offset+1) % 7).setChecked(this.task.getRepeat().getT());
|
||||
this.weekdayCheckboxes.get((offset+2) % 7).setChecked(this.task.getRepeat().getW());
|
||||
this.weekdayCheckboxes.get((offset+3) % 7).setChecked(this.task.getRepeat().getTh());
|
||||
this.weekdayCheckboxes.get((offset+4) % 7).setChecked(this.task.getRepeat().getF());
|
||||
this.weekdayCheckboxes.get((offset+5) % 7).setChecked(this.task.getRepeat().getS());
|
||||
this.weekdayCheckboxes.get((offset+6) % 7).setChecked(this.task.getRepeat().getSu());
|
||||
} else {
|
||||
this.frequencyPicker.setValue(this.task.getEveryX());
|
||||
}
|
||||
|
|
@ -631,7 +629,7 @@ public class TaskFormActivity extends BaseActivity implements AdapterView.OnItem
|
|||
|
||||
//noinspection SimplifiableIfStatement
|
||||
if (id == R.id.action_save_changes) {
|
||||
finishActivitySuccessfuly();
|
||||
finishActivitySuccessfully();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -694,13 +692,14 @@ public class TaskFormActivity extends BaseActivity implements AdapterView.OnItem
|
|||
if (task.getFrequency().equals("weekly")) {
|
||||
this.dailyFrequencySpinner.setSelection(0);
|
||||
if (weekdayCheckboxes.size() == 7) {
|
||||
this.weekdayCheckboxes.get(0).setChecked(task.getRepeat().getM());
|
||||
this.weekdayCheckboxes.get(1).setChecked(task.getRepeat().getT());
|
||||
this.weekdayCheckboxes.get(2).setChecked(task.getRepeat().getW());
|
||||
this.weekdayCheckboxes.get(3).setChecked(task.getRepeat().getTh());
|
||||
this.weekdayCheckboxes.get(4).setChecked(task.getRepeat().getF());
|
||||
this.weekdayCheckboxes.get(5).setChecked(task.getRepeat().getS());
|
||||
this.weekdayCheckboxes.get(6).setChecked(task.getRepeat().getSu());
|
||||
int offset = firstDayOfTheWeekHelper.getDailyTaskFormOffset();
|
||||
this.weekdayCheckboxes.get(offset).setChecked(this.task.getRepeat().getM());
|
||||
this.weekdayCheckboxes.get((offset+1) % 7).setChecked(this.task.getRepeat().getT());
|
||||
this.weekdayCheckboxes.get((offset+2) % 7).setChecked(this.task.getRepeat().getW());
|
||||
this.weekdayCheckboxes.get((offset+3) % 7).setChecked(this.task.getRepeat().getTh());
|
||||
this.weekdayCheckboxes.get((offset+4) % 7).setChecked(this.task.getRepeat().getF());
|
||||
this.weekdayCheckboxes.get((offset+5) % 7).setChecked(this.task.getRepeat().getS());
|
||||
this.weekdayCheckboxes.get((offset+6) % 7).setChecked(this.task.getRepeat().getSu());
|
||||
}
|
||||
} else {
|
||||
this.dailyFrequencySpinner.setSelection(1);
|
||||
|
|
@ -743,8 +742,9 @@ public class TaskFormActivity extends BaseActivity implements AdapterView.OnItem
|
|||
}
|
||||
}
|
||||
|
||||
if (task.text.isEmpty())
|
||||
if (task.text.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
task.notes = MarkdownParser.parseCompiled(taskNotes.getText());
|
||||
|
||||
|
|
@ -795,13 +795,14 @@ public class TaskFormActivity extends BaseActivity implements AdapterView.OnItem
|
|||
task.setRepeat(repeat);
|
||||
}
|
||||
|
||||
repeat.setM(this.weekdayCheckboxes.get(0).isChecked());
|
||||
repeat.setT(this.weekdayCheckboxes.get(1).isChecked());
|
||||
repeat.setW(this.weekdayCheckboxes.get(2).isChecked());
|
||||
repeat.setTh(this.weekdayCheckboxes.get(3).isChecked());
|
||||
repeat.setF(this.weekdayCheckboxes.get(4).isChecked());
|
||||
repeat.setS(this.weekdayCheckboxes.get(5).isChecked());
|
||||
repeat.setSu(this.weekdayCheckboxes.get(6).isChecked());
|
||||
int offset = firstDayOfTheWeekHelper.getDailyTaskFormOffset();
|
||||
repeat.setM(this.weekdayCheckboxes.get(offset).isChecked());
|
||||
repeat.setT(this.weekdayCheckboxes.get((offset+1) % 7).isChecked());
|
||||
repeat.setW(this.weekdayCheckboxes.get((offset+2) % 7).isChecked());
|
||||
repeat.setTh(this.weekdayCheckboxes.get((offset+3) % 7).isChecked());
|
||||
repeat.setF(this.weekdayCheckboxes.get((offset+4) % 7).isChecked());
|
||||
repeat.setS(this.weekdayCheckboxes.get((offset+5) % 7).isChecked());
|
||||
repeat.setSu(this.weekdayCheckboxes.get((offset+6) % 7).isChecked());
|
||||
} else {
|
||||
task.setFrequency("daily");
|
||||
task.setEveryX(this.frequencyPicker.getValue());
|
||||
|
|
@ -847,7 +848,6 @@ public class TaskFormActivity extends BaseActivity implements AdapterView.OnItem
|
|||
}
|
||||
|
||||
private void prepareSave() {
|
||||
|
||||
if (this.task == null) {
|
||||
this.task = new Task();
|
||||
this.task.setType(taskType);
|
||||
|
|
@ -888,12 +888,19 @@ public class TaskFormActivity extends BaseActivity implements AdapterView.OnItem
|
|||
dismissKeyboard();
|
||||
}
|
||||
|
||||
private void finishActivitySuccessfuly() {
|
||||
private void finishActivitySuccessfully() {
|
||||
this.prepareSave();
|
||||
finish();
|
||||
finishWithSuccess();
|
||||
dismissKeyboard();
|
||||
}
|
||||
|
||||
private void finishWithSuccess() {
|
||||
Intent resultIntent = new Intent();
|
||||
resultIntent.putExtra(TaskFormActivity.TASK_TYPE_KEY, taskType);
|
||||
setResult(RESULT_OK, resultIntent);
|
||||
finish();
|
||||
}
|
||||
|
||||
private void dismissKeyboard() {
|
||||
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||
View currentFocus = getCurrentFocus();
|
||||
|
|
@ -908,7 +915,6 @@ public class TaskFormActivity extends BaseActivity implements AdapterView.OnItem
|
|||
EditText datePickerText;
|
||||
DateFormat dateFormatter;
|
||||
|
||||
|
||||
public DateEditTextListener(EditText dateText) {
|
||||
calendar = Calendar.getInstance();
|
||||
|
||||
|
|
|
|||
|
|
@ -6,23 +6,15 @@ import com.habitrpg.android.habitica.ui.helpers.ItemTouchHelperAdapter;
|
|||
import com.habitrpg.android.habitica.ui.helpers.ItemTouchHelperViewHolder;
|
||||
import com.magicmicky.habitrpgwrapper.lib.models.tasks.RemindersItem;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.app.TimePickerDialog;
|
||||
import android.graphics.Color;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.Button;
|
||||
import android.widget.DatePicker;
|
||||
import android.widget.EditText;
|
||||
import android.widget.TimePicker;
|
||||
|
||||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
|
@ -115,7 +107,7 @@ public class RemindersAdapter extends RecyclerView.Adapter<RemindersAdapter.Item
|
|||
taskType = reminder.getTask().getType();
|
||||
}
|
||||
|
||||
remindersManager.createDialogeForEditText(reminderItemTextView, taskType, v.getContext(), reminder);
|
||||
remindersManager.createReminderTimeDialog(null, taskType, v.getContext(), reminder);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -33,7 +33,6 @@ public abstract class BaseFragment extends DialogFragment {
|
|||
public String tutorialStepIdentifier;
|
||||
public String tutorialText;
|
||||
public Unbinder unbinder;
|
||||
private boolean registerEventBus = false;
|
||||
private TransactionListener<TutorialStep> tutorialStepTransactionListener = new TransactionListener<TutorialStep>() {
|
||||
@Override
|
||||
public void onResultReceived(TutorialStep step) {
|
||||
|
|
@ -87,7 +86,6 @@ public abstract class BaseFragment extends DialogFragment {
|
|||
// Receive Events
|
||||
try {
|
||||
EventBus.getDefault().register(this);
|
||||
registerEventBus = true;
|
||||
} catch (EventBusException ignored) {
|
||||
|
||||
}
|
||||
|
|
@ -109,7 +107,7 @@ public abstract class BaseFragment extends DialogFragment {
|
|||
|
||||
@Override
|
||||
public void onDestroyView() {
|
||||
if (registerEventBus) {
|
||||
if (EventBus.getDefault().isRegistered(this)) {
|
||||
EventBus.getDefault().unregister(this);
|
||||
}
|
||||
if (unbinder != null) {
|
||||
|
|
|
|||
|
|
@ -4,6 +4,8 @@ import com.habitrpg.android.habitica.HabiticaApplication;
|
|||
import com.habitrpg.android.habitica.R;
|
||||
import com.habitrpg.android.habitica.components.AppComponent;
|
||||
import com.habitrpg.android.habitica.events.BoughtGemsEvent;
|
||||
import com.habitrpg.android.habitica.helpers.PurchaseTypes;
|
||||
import com.habitrpg.android.habitica.ui.GemPurchaseOptionsView;
|
||||
import com.habitrpg.android.habitica.ui.helpers.ViewHelper;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
|
|
@ -27,14 +29,26 @@ import android.view.View;
|
|||
import android.view.ViewGroup;
|
||||
import android.widget.Button;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import butterknife.BindView;
|
||||
import butterknife.OnClick;
|
||||
import io.fabric.sdk.android.Fabric;
|
||||
|
||||
public class GemsPurchaseFragment extends BaseMainFragment {
|
||||
public class GemsPurchaseFragment extends BaseFragment {
|
||||
|
||||
@BindView(R.id.gems_4_view)
|
||||
GemPurchaseOptionsView gems4View;
|
||||
@BindView(R.id.gems_21_view)
|
||||
GemPurchaseOptionsView gems21View;
|
||||
@BindView(R.id.gems_42_view)
|
||||
GemPurchaseOptionsView gems42View;
|
||||
@BindView(R.id.gems_84_view)
|
||||
GemPurchaseOptionsView gems84View;
|
||||
|
||||
private HashMap<String, String> priceMap;
|
||||
|
||||
private static final int GEMS_TO_ADD = 21;
|
||||
@BindView(R.id.btn_purchase_gems)
|
||||
Button btnPurchaseGems;
|
||||
private Listener listener;
|
||||
private BillingRequests billingRequests;
|
||||
|
|
@ -52,6 +66,8 @@ public class GemsPurchaseFragment extends BaseMainFragment {
|
|||
|
||||
super.onCreateView(inflater, container, savedInstanceState);
|
||||
|
||||
priceMap = new HashMap<>();
|
||||
|
||||
return inflater.inflate(R.layout.fragment_gem_purchase, container, false);
|
||||
}
|
||||
|
||||
|
|
@ -64,8 +80,10 @@ public class GemsPurchaseFragment extends BaseMainFragment {
|
|||
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
|
||||
btnPurchaseGems.setEnabled(false);
|
||||
ViewHelper.SetBackgroundTint(btnPurchaseGems, ContextCompat.getColor(getContext(), R.color.brand));
|
||||
gems4View.setOnPurchaseClickListener(v -> purchaseGems(PurchaseTypes.Purchase4Gems));
|
||||
gems21View.setOnPurchaseClickListener(v -> purchaseGems(PurchaseTypes.Purchase21Gems));
|
||||
gems42View.setOnPurchaseClickListener(v -> purchaseGems(PurchaseTypes.Purchase42Gems));
|
||||
gems84View.setOnPurchaseClickListener(v -> purchaseGems(PurchaseTypes.Purchase84Gems));
|
||||
|
||||
final ActivityCheckout checkout = listener.getActivityCheckout();
|
||||
|
||||
|
|
@ -75,7 +93,7 @@ public class GemsPurchaseFragment extends BaseMainFragment {
|
|||
checkout.createPurchaseFlow(new RequestListener<Purchase>() {
|
||||
@Override
|
||||
public void onSuccess(@NonNull Purchase purchase) {
|
||||
if (purchase.sku.equals(HabiticaApplication.Purchase20Gems)) {
|
||||
if (PurchaseTypes.allTypes.contains(purchase.sku)) {
|
||||
billingRequests.consume(purchase.token, new RequestListener<Object>() {
|
||||
@Override
|
||||
public void onSuccess(@NonNull Object o) {
|
||||
|
|
@ -120,7 +138,8 @@ public class GemsPurchaseFragment extends BaseMainFragment {
|
|||
java.util.List<Sku> skus = gems.getSkus();
|
||||
|
||||
for (Sku sku : skus) {
|
||||
updateBuyButtonText(sku.price);
|
||||
priceMap.put(sku.id, sku.price);
|
||||
updateButtonLabel(sku.id, sku.price);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
@ -129,12 +148,21 @@ public class GemsPurchaseFragment extends BaseMainFragment {
|
|||
}
|
||||
}
|
||||
|
||||
private void updateBuyButtonText(String price) {
|
||||
if (price == null || price.isEmpty()) {
|
||||
btnPurchaseGems.setText("+" + GEMS_TO_ADD);
|
||||
private void updateButtonLabel(String sku, String price) {
|
||||
GemPurchaseOptionsView matchingView;
|
||||
if (sku.equals(PurchaseTypes.Purchase4Gems)) {
|
||||
matchingView = gems4View;
|
||||
} else if (sku.equals(PurchaseTypes.Purchase21Gems)) {
|
||||
matchingView = gems21View;
|
||||
} else if (sku.equals(PurchaseTypes.Purchase42Gems)) {
|
||||
matchingView = gems42View;
|
||||
} else if (sku.equals(PurchaseTypes.Purchase84Gems)) {
|
||||
matchingView = gems84View;
|
||||
} else {
|
||||
btnPurchaseGems.setText(price + " = " + "+" + GEMS_TO_ADD);
|
||||
return;
|
||||
}
|
||||
matchingView.setPurchaseButtonText(price);
|
||||
matchingView.setSku(sku);
|
||||
}
|
||||
|
||||
private void checkIfPendingPurchases() {
|
||||
|
|
@ -142,7 +170,7 @@ public class GemsPurchaseFragment extends BaseMainFragment {
|
|||
@Override
|
||||
public void onSuccess(@NonNull Purchases purchases) {
|
||||
for (Purchase purchase : purchases.list) {
|
||||
if (purchase.sku.equals(HabiticaApplication.Purchase20Gems)) {
|
||||
if (PurchaseTypes.allTypes.contains(purchase.sku)) {
|
||||
billingRequests.consume(purchase.token, new RequestListener<Object>() {
|
||||
@Override
|
||||
public void onSuccess(@NonNull Object o) {
|
||||
|
|
@ -165,16 +193,15 @@ public class GemsPurchaseFragment extends BaseMainFragment {
|
|||
});
|
||||
}
|
||||
|
||||
@OnClick(R.id.btn_purchase_gems)
|
||||
public void doPurchaseGems(Button button) {
|
||||
public void purchaseGems(String sku) {
|
||||
// check if the user already bought and if it hasn't validated yet
|
||||
billingRequests.isPurchased(ProductTypes.IN_APP, HabiticaApplication.Purchase20Gems, new RequestListener<Boolean>() {
|
||||
billingRequests.isPurchased(ProductTypes.IN_APP, sku, new RequestListener<Boolean>() {
|
||||
@Override
|
||||
public void onSuccess(@NonNull Boolean aBoolean) {
|
||||
if (!aBoolean) {
|
||||
// no current product exist
|
||||
final ActivityCheckout checkout = listener.getActivityCheckout();
|
||||
billingRequests.purchase(ProductTypes.IN_APP, HabiticaApplication.Purchase20Gems, null, checkout.getPurchaseFlow());
|
||||
billingRequests.purchase(ProductTypes.IN_APP, sku, null, checkout.getPurchaseFlow());
|
||||
} else {
|
||||
checkIfPendingPurchases();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,8 +1,17 @@
|
|||
package com.habitrpg.android.habitica.ui.fragments.tasks;
|
||||
|
||||
import android.graphics.Color;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.v7.widget.LinearLayoutManager;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.support.v7.widget.helper.ItemTouchHelper;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import com.habitrpg.android.habitica.APIHelper;
|
||||
import com.habitrpg.android.habitica.R;
|
||||
import com.habitrpg.android.habitica.callbacks.HabitRPGUserCallback;
|
||||
import com.habitrpg.android.habitica.components.AppComponent;
|
||||
import com.habitrpg.android.habitica.events.commands.AddNewTaskCommand;
|
||||
import com.habitrpg.android.habitica.helpers.TagsHelper;
|
||||
|
|
@ -21,21 +30,6 @@ import com.magicmicky.habitrpgwrapper.lib.models.tasks.Task;
|
|||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
|
||||
import android.graphics.Color;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.v7.widget.LinearLayoutManager;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.support.v7.widget.helper.ItemTouchHelper;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Named;
|
||||
|
||||
|
|
@ -229,4 +223,8 @@ public class TaskRecyclerViewFragment extends BaseFragment implements View.OnCli
|
|||
public String getDisplayedClassName() {
|
||||
return this.classType + super.getDisplayedClassName();
|
||||
}
|
||||
|
||||
String getClassName() {
|
||||
return classType;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -47,6 +47,7 @@ import com.mikepenz.materialdrawer.model.interfaces.IDrawerItem;
|
|||
import org.greenrobot.eventbus.EventBus;
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.AsyncTask;
|
||||
|
|
@ -414,30 +415,6 @@ public class TasksFragment extends BaseMainFragment implements OnCheckedChangeLi
|
|||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onEvent(TaskCheckedCommand event) {
|
||||
apiHelper.apiService.postTaskDirection(event.Task.getId(), (event.Task.getCompleted() ? TaskDirection.down : TaskDirection.up).toString())
|
||||
.compose(apiHelper.configureApiCallObserver())
|
||||
.subscribe(new TaskScoringCallback(activity, event.Task.getId()), throwable -> {
|
||||
});
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onEvent(ChecklistCheckedCommand event) {
|
||||
apiHelper.apiService.scoreChecklistItem(event.task.getId(), event.item.getId())
|
||||
.compose(apiHelper.configureApiCallObserver())
|
||||
.subscribe(new TaskUpdateCallback(), throwable -> {
|
||||
});
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onEvent(HabitScoreEvent event) {
|
||||
apiHelper.apiService.postTaskDirection(event.habit.getId(), (event.Up ? TaskDirection.up : TaskDirection.down).toString())
|
||||
.compose(apiHelper.configureApiCallObserver())
|
||||
.subscribe(new TaskScoringCallback(activity, event.habit.getId()), throwable -> {
|
||||
});
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onEvent(AddNewTaskCommand event) {
|
||||
openNewTaskActivity(event.ClassType.toLowerCase());
|
||||
|
|
@ -445,36 +422,9 @@ public class TasksFragment extends BaseMainFragment implements OnCheckedChangeLi
|
|||
|
||||
@Subscribe
|
||||
public void onEvent(final TaskSaveEvent event) {
|
||||
Task task = event.task;
|
||||
if (event.created) {
|
||||
this.apiHelper.apiService.createItem(task)
|
||||
.compose(apiHelper.configureApiCallObserver())
|
||||
.subscribe(new TaskCreationCallback(), throwable -> {
|
||||
});
|
||||
floatingMenu.close(true);
|
||||
} else {
|
||||
this.apiHelper.apiService.updateTask(task.getId(), task)
|
||||
.compose(apiHelper.configureApiCallObserver())
|
||||
.subscribe(new TaskUpdateCallback(), throwable -> {
|
||||
});
|
||||
}
|
||||
floatingMenu.close(true);
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onEvent(ToggledInnStateEvent event) {
|
||||
user.getPreferences().setSleep(event.Inn);
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onEvent(ToggledEditTagsEvent event) {
|
||||
if(user != null) {
|
||||
if(this.editingTags == event.editing) {
|
||||
return;
|
||||
}
|
||||
this.editingTags = event.editing;
|
||||
fillTagFilterDrawer(tags);
|
||||
}
|
||||
}
|
||||
//endregion Events
|
||||
|
||||
public void fillTagFilterDrawer(List<Tag> tagList) {
|
||||
|
|
@ -582,14 +532,33 @@ public class TasksFragment extends BaseMainFragment implements OnCheckedChangeLi
|
|||
@Override
|
||||
public void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
|
||||
switch (requestCode) {
|
||||
case (TASK_CREATED_RESULT):
|
||||
this.displayingTaskForm = false;
|
||||
onTaskCreatedResult(resultCode, data);
|
||||
break;
|
||||
case (TASK_UPDATED_RESULT):
|
||||
this.displayingTaskForm = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void onTaskCreatedResult(int resultCode, Intent data) {
|
||||
if (resultCode == Activity.RESULT_OK) {
|
||||
String taskType = data.getStringExtra(TaskFormActivity.TASK_TYPE_KEY);
|
||||
switchToTaskTab(taskType);
|
||||
}
|
||||
}
|
||||
|
||||
private void switchToTaskTab(String taskType) {
|
||||
for (Map.Entry<Integer, TaskRecyclerViewFragment> tabEntry : ViewFragmentsDictionary.entrySet()) {
|
||||
if (tabEntry.getValue().getClassName().equals(taskType)) {
|
||||
viewPager.setCurrentItem(tabEntry.getKey());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDisplayedClassName() {
|
||||
return null;
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package com.habitrpg.android.habitica.ui.menu;
|
|||
|
||||
import com.habitrpg.android.habitica.R;
|
||||
import com.habitrpg.android.habitica.ui.activities.AboutActivity;
|
||||
import com.habitrpg.android.habitica.ui.activities.GemPurchaseActivity;
|
||||
import com.habitrpg.android.habitica.ui.activities.MainActivity;
|
||||
import com.habitrpg.android.habitica.ui.activities.PrefsActivity;
|
||||
import com.habitrpg.android.habitica.ui.fragments.BaseMainFragment;
|
||||
|
|
@ -148,7 +149,7 @@ public class MainDrawerBuilder {
|
|||
break;
|
||||
}
|
||||
case SIDEBAR_PURCHASE: {
|
||||
fragment = new GemsPurchaseFragment();
|
||||
newActivityClass = GemPurchaseActivity.class;
|
||||
break;
|
||||
}
|
||||
case SIDEBAR_NEWS: {
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ import com.raizlabs.android.dbflow.runtime.transaction.TransactionListener;
|
|||
import com.raizlabs.android.dbflow.sql.builder.Condition;
|
||||
import com.raizlabs.android.dbflow.sql.language.Select;
|
||||
|
||||
import android.annotation.TargetApi;
|
||||
import android.app.PendingIntent;
|
||||
import android.appwidget.AppWidgetManager;
|
||||
import android.content.ComponentName;
|
||||
|
|
@ -51,6 +52,9 @@ public class AvatarStatsWidgetProvider extends BaseWidgetProvider {
|
|||
this.setUp(context);
|
||||
this.appWidgetManager = appWidgetManager;
|
||||
this.context = context;
|
||||
ComponentName thisWidget = new ComponentName(context,
|
||||
AvatarStatsWidgetProvider.class);
|
||||
int[] allWidgetIds = appWidgetManager.getAppWidgetIds(thisWidget);
|
||||
|
||||
new Select().from(HabitRPGUser.class).where(Condition.column("id").eq(hostConfig.getUser())).async().querySingle(userTransactionListener);
|
||||
}
|
||||
|
|
|
|||
2
gradle/wrapper/gradle-wrapper.properties
vendored
|
|
@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
|
|||
distributionPath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-3.1-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-3.1-all.zip
|
||||
|
|
|
|||