mirror of
https://github.com/sudoxnym/habitica-android.git
synced 2026-05-24 06:35:46 +00:00
Cleanup / fixes / set title on TaskForm / Version 0.0.5
This commit is contained in:
parent
8027959364
commit
94af661353
13 changed files with 248 additions and 214 deletions
|
|
@ -1,8 +1,8 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.habitrpg.android.habitica"
|
||||
android:versionCode="4"
|
||||
android:versionName="0.0.4"
|
||||
android:versionCode="5"
|
||||
android:versionName="0.0.5"
|
||||
android:screenOrientation="portrait" >
|
||||
|
||||
<uses-sdk
|
||||
|
|
@ -34,8 +34,7 @@
|
|||
</activity>
|
||||
<activity
|
||||
android:name=".prefs.PrefsActivity"
|
||||
android:label="@string/PS_param_title"
|
||||
android:theme="@style/AppThemeWithActionBar" >
|
||||
android:label="@string/PS_param_title">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
</intent-filter>
|
||||
|
|
@ -74,7 +73,6 @@
|
|||
android:theme="@style/AppThemeWithActionBarBlackText" />
|
||||
<activity
|
||||
android:name=".TaskFormActivity"
|
||||
android:label="@string/title_activity_task_form"
|
||||
android:parentActivityName=".MainActivity"
|
||||
android:theme="@style/AppThemeWithActionBarBlackText" >
|
||||
<meta-data
|
||||
|
|
@ -101,8 +99,7 @@
|
|||
<activity
|
||||
android:name=".GemPurchaseActivity"
|
||||
android:label="@string/title_activity_gem_purchase"
|
||||
android:parentActivityName=".MainActivity"
|
||||
android:theme="@style/AppThemeWithOwnActionBar" >
|
||||
android:parentActivityName=".MainActivity" >
|
||||
<meta-data
|
||||
android:name="android.support.PARENT_ACTIVITY"
|
||||
android:value="com.habitrpg.android.habitica.MainActivity" />
|
||||
|
|
|
|||
|
|
@ -69,12 +69,12 @@
|
|||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dex" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dex-cache" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.databinding/library/1.0-rc1/jars" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/appcompat-v7/23.0.1/jars" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/appcompat-v7/23.1.0/jars" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/cardview-v7/22.2.0/jars" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/design/23.0.1/jars" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/gridlayout-v7/23.0.1/jars" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/recyclerview-v7/23.0.1/jars" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/support-v4/23.0.1/jars" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/recyclerview-v7/23.1.0/jars" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/support-v4/23.1.0/jars" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.crashlytics.sdk.android/answers/1.2.0/jars" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.crashlytics.sdk.android/beta/1.1.2/jars" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.crashlytics.sdk.android/crashlytics-core/2.3.0/jars" />
|
||||
|
|
@ -85,8 +85,10 @@
|
|||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.instabug.library/instabugcore/1.8-SNAPSHOT/jars" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.instabug.library/instabugsupport/1.8-SNAPSHOT/jars" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.mikepenz/aboutlibraries/5.0.5/jars" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.mikepenz/iconics/1.1.0/jars" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.mikepenz/materialdrawer/3.0.8/jars" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.mikepenz/fontawesome-typeface/4.4.0.1/jars" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.mikepenz/iconics-core/1.7.9/jars" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.mikepenz/materialdrawer/4.3.8/jars" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.mikepenz/materialize/0.2.7/jars" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.raizlabs.android/DBFlow/2.2.1/jars" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.rengwuxian.materialedittext/library/2.1.4/jars" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/io.fabric.sdk.android/fabric/1.3.1/jars" />
|
||||
|
|
@ -109,13 +111,14 @@
|
|||
</content>
|
||||
<orderEntry type="jdk" jdkName="Android API 23 Platform" jdkType="Android SDK" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="library" exported="" name="gson-2.3.1" level="project" />
|
||||
<orderEntry type="library" exported="" name="library-1.0.19" level="project" />
|
||||
<orderEntry type="library" exported="" name="gson-2.3.1" level="project" />
|
||||
<orderEntry type="library" exported="" name="commons-io-2.4" level="project" />
|
||||
<orderEntry type="library" exported="" name="okhttp-2.3.0" level="project" />
|
||||
<orderEntry type="library" exported="" name="rxjava-1.0.10" level="project" />
|
||||
<orderEntry type="library" exported="" name="antlr4-4.5" level="project" />
|
||||
<orderEntry type="library" exported="" name="crashlytics-core-2.3.0" level="project" />
|
||||
<orderEntry type="library" exported="" name="recyclerview-v7-23.1.0" level="project" />
|
||||
<orderEntry type="library" exported="" name="aboutlibraries-5.0.5" level="project" />
|
||||
<orderEntry type="library" exported="" name="antlr4-runtime-4.5" level="project" />
|
||||
<orderEntry type="library" exported="" name="antlr4-annotations-4.5" level="project" />
|
||||
|
|
@ -123,22 +126,25 @@
|
|||
<orderEntry type="library" exported="" name="library-1.1.4" level="project" />
|
||||
<orderEntry type="library" exported="" name="org.abego.treelayout.core-1.0.1" level="project" />
|
||||
<orderEntry type="library" exported="" name="DBFlow-2.2.1" level="project" />
|
||||
<orderEntry type="library" exported="" name="support-v4-23.0.1" level="project" />
|
||||
<orderEntry type="library" exported="" name="materialdrawer-4.3.8" level="project" />
|
||||
<orderEntry type="library" exported="" name="appcompat-v7-23.1.0" level="project" />
|
||||
<orderEntry type="library" exported="" name="checkout-0.7.4" level="project" />
|
||||
<orderEntry type="library" exported="" name="compilerCommon-1.0-rc1" level="project" />
|
||||
<orderEntry type="library" exported="" name="support-annotations-23.1.0" level="project" />
|
||||
<orderEntry type="library" exported="" name="compiler-1.0-rc1" level="project" />
|
||||
<orderEntry type="library" exported="" name="library-2.4.0" level="project" />
|
||||
<orderEntry type="library" exported="" name="mimecraft-1.1.1" level="project" />
|
||||
<orderEntry type="library" exported="" name="guava-18.0" level="project" />
|
||||
<orderEntry type="library" exported="" name="iconics-1.1.0" level="project" />
|
||||
<orderEntry type="library" exported="" name="materialize-0.2.7" level="project" />
|
||||
<orderEntry type="library" exported="" name="gridlayout-v7-23.0.1" level="project" />
|
||||
<orderEntry type="library" exported="" name="auto-service-1.0-rc2" level="project" />
|
||||
<orderEntry type="library" exported="" name="baseLibrary-1.0-rc1" level="project" />
|
||||
<orderEntry type="library" exported="" name="design-23.0.1" level="project" />
|
||||
<orderEntry type="library" exported="" name="fabric-1.3.1" level="project" />
|
||||
<orderEntry type="library" exported="" name="beta-1.1.2" level="project" />
|
||||
<orderEntry type="library" exported="" name="javawriter-2.5.0" level="project" />
|
||||
<orderEntry type="library" exported="" name="iconics-core-1.7.9" level="project" />
|
||||
<orderEntry type="library" exported="" name="commons-codec-1.10" level="project" />
|
||||
<orderEntry type="library" exported="" name="javawriter-2.5.0" level="project" />
|
||||
<orderEntry type="library" exported="" name="kotlin-stdlib-0.12.613" level="project" />
|
||||
<orderEntry type="library" exported="" name="commons-lang3-3.3.2" level="project" />
|
||||
<orderEntry type="library" exported="" name="fab-1.6.1" level="project" />
|
||||
|
|
@ -150,15 +156,13 @@
|
|||
<orderEntry type="library" exported="" name="picasso-2.5.2" level="project" />
|
||||
<orderEntry type="library" exported="" name="retrofit-1.9.0" level="project" />
|
||||
<orderEntry type="library" exported="" name="DBFlow-Core-2.2.1" level="project" />
|
||||
<orderEntry type="library" exported="" name="materialdrawer-3.0.8" level="project" />
|
||||
<orderEntry type="library" exported="" name="auto-common-0.3" level="project" />
|
||||
<orderEntry type="library" exported="" name="recyclerview-v7-23.0.1" level="project" />
|
||||
<orderEntry type="library" exported="" name="antlr-runtime-3.5.2" level="project" />
|
||||
<orderEntry type="library" exported="" name="butterknife-6.1.0" level="project" />
|
||||
<orderEntry type="library" exported="" name="instabugsupport-1.8-SNAPSHOT" level="project" />
|
||||
<orderEntry type="library" exported="" name="appcompat-v7-23.0.1" level="project" />
|
||||
<orderEntry type="library" exported="" name="fontawesome-typeface-4.4.0.1" level="project" />
|
||||
<orderEntry type="library" exported="" name="support-v4-23.1.0" level="project" />
|
||||
<orderEntry type="library" exported="" name="okio-1.3.0" level="project" />
|
||||
<orderEntry type="library" exported="" name="support-annotations-23.0.1" level="project" />
|
||||
<orderEntry type="library" exported="" name="adapters-1.0-rc1" level="project" />
|
||||
<orderEntry type="library" exported="" name="okhttp-urlconnection-2.3.0" level="project" />
|
||||
<orderEntry type="library" exported="" name="eventbus-2.4.0" level="project" />
|
||||
|
|
|
|||
|
|
@ -22,9 +22,6 @@
|
|||
app:layout_collapseMode="pin"
|
||||
app:popupTheme="@style/ThemeOverlay.AppCompat.Dark" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/hello_world" />
|
||||
|
||||
</LinearLayout>
|
||||
</android.support.v4.widget.DrawerLayout>
|
||||
|
|
|
|||
|
|
@ -8,9 +8,7 @@
|
|||
android:gravity="center"
|
||||
tools:context=".PartyActivity">
|
||||
|
||||
<android.support.design.widget.CoordinatorLayout 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.support.design.widget.CoordinatorLayout
|
||||
android:id="@+id/main_content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
|
|
|
|||
|
|
@ -19,13 +19,6 @@
|
|||
android:layout_marginTop="@dimen/abc_action_bar_content_inset_material"
|
||||
android:layout_marginBottom="@dimen/abc_action_bar_content_inset_material">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="?android:attr/textAppearanceLarge"
|
||||
android:text="@string/task"
|
||||
android:id="@+id/task_text_textview" />
|
||||
|
||||
<android.support.design.widget.TextInputLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="72dp"
|
||||
|
|
|
|||
|
|
@ -1,158 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@android:color/background_light"
|
||||
android:orientation="vertical">
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="@dimen/activity_vertical_margin"
|
||||
android:paddingRight="@dimen/activity_vertical_margin">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/TV_taskText"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/task_text"
|
||||
android:textColor="@android:color/black"
|
||||
android:textAppearance="?android:attr/textAppearanceLarge" />
|
||||
|
||||
|
||||
<com.rengwuxian.materialedittext.MaterialEditText
|
||||
android:id="@+id/ET_taskText"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
|
||||
android:ems="10"
|
||||
|
||||
android:hint="@string/create_task_hint"
|
||||
android:inputType="textCapSentences|textNoSuggestions"
|
||||
android:singleLine="true"
|
||||
|
||||
app:met_floatingLabel="normal" />
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/BT_checklist"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_gravity="right"
|
||||
android:background="@color/transparent"
|
||||
android:visibility="gone"
|
||||
android:src="@drawable/ic_action_list" />
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="@dimen/activity_vertical_margin"
|
||||
android:paddingRight="@dimen/activity_vertical_margin">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/TV_taskNote"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/task_note"
|
||||
android:textColor="@android:color/black"
|
||||
android:textAppearance="?android:attr/textAppearanceLarge" />
|
||||
|
||||
<com.rengwuxian.materialedittext.MaterialEditText
|
||||
android:id="@+id/ET_taskNote"
|
||||
android:layout_width="0dip"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
|
||||
android:ems="10"
|
||||
|
||||
android:hint="@string/task_note_hint"
|
||||
android:inputType="textCapSentences|textMultiLine"
|
||||
android:minLines="2"
|
||||
|
||||
app:met_floatingLabel="normal" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/repeat_days"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="48dp"
|
||||
android:layout_gravity="top"
|
||||
android:orientation="horizontal"
|
||||
android:paddingLeft="@dimen/activity_vertical_margin"
|
||||
android:paddingRight="@dimen/activity_vertical_margin"
|
||||
android:visibility="gone">
|
||||
<!-- Day buttons are put here programatically -->
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/value"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="48dp"
|
||||
android:layout_gravity="top"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginRight="10dp"
|
||||
android:orientation="horizontal"
|
||||
android:paddingLeft="@dimen/activity_vertical_margin"
|
||||
android:paddingRight="@dimen/activity_vertical_margin"
|
||||
android:visibility="gone">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/TV_value"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/task_value"
|
||||
android:textColor="@android:color/black"
|
||||
android:textAppearance="?android:attr/textAppearanceLarge" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/ET_taskValue"
|
||||
android:layout_width="0dip"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:digits="1234567890"
|
||||
android:ems="10"
|
||||
android:hint="@string/task_value_hint"
|
||||
android:inputType="number|phone"
|
||||
android:singleLine="true" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/due_date"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginBottom="@dimen/activity_horizontal_margin"
|
||||
android:orientation="horizontal"
|
||||
android:paddingLeft="@dimen/activity_vertical_margin"
|
||||
android:paddingRight="@dimen/activity_vertical_margin"
|
||||
android:visibility="gone">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/TV_due_date"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/task_duedate"
|
||||
android:textColor="@android:color/black"
|
||||
android:textAppearance="?android:attr/textAppearanceLarge" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/due_date_spinner"
|
||||
style="?android:attr/spinnerStyle"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
|
|
@ -63,11 +63,10 @@
|
|||
start the scanning mode, use the button in the menu.
|
||||
</string>
|
||||
<string name="SP_acknowledge_qrcode">acknowledge_qrcode_omg</string>
|
||||
<string name="create_todo_hint">New todo</string>
|
||||
<string name="create_reward_hint">New reward</string>
|
||||
<string name="create_daily_hint">New daily</string>
|
||||
<string name="create_habit_hint">New habit</string>
|
||||
<string name="create_task_hint">New task</string>
|
||||
<string name="new_todo">New todo</string>
|
||||
<string name="new_reward">New reward</string>
|
||||
<string name="new_daily">New daily</string>
|
||||
<string name="new_habit">New habit</string>
|
||||
<string name="task_deleted">The task %s was deleted successfully</string>
|
||||
<string name="action_edit">Edit</string>
|
||||
<string name="action_delete">Delete</string>
|
||||
|
|
@ -149,6 +148,4 @@
|
|||
<string name="title_activity_tavern">Tavern</string>
|
||||
<string name="title_activity_party">Party</string>
|
||||
<string name="title_activity_gem_purchase">Purchase Gems</string>
|
||||
|
||||
<string name="hello_world">Hello world!</string>
|
||||
</resources>
|
||||
|
|
@ -21,6 +21,9 @@
|
|||
<item name="colorPrimary">@color/brand</item>
|
||||
<item name="colorPrimaryDark">@color/brand</item>
|
||||
<item name="colorAccent">@color/brand</item>
|
||||
<item name="android:colorPrimaryDark" tools:targetApi="21">@color/brand</item>
|
||||
<item name="android:statusBarColor" tools:targetApi="21">@color/brand</item>
|
||||
|
||||
|
||||
<!-- MaterialDrawer specific values -->
|
||||
<item name="material_drawer_background">@color/material_drawer_background</item>
|
||||
|
|
@ -55,6 +58,10 @@
|
|||
<item name="android:textColorPrimary">@android:color/black</item>
|
||||
</style>
|
||||
|
||||
<style name="AppThemeWithBlackText" parent="AppTheme">
|
||||
<item name="android:textColorPrimary">@android:color/black</item>
|
||||
</style>
|
||||
|
||||
|
||||
<style name="PopupTheme" parent="Widget.AppCompat.PopupMenu.Overflow">
|
||||
<item name="android:popupBackground">@color/brand_500</item>
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
package com.habitrpg.android.habitica;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.v7.app.ActionBar;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
|
|
@ -8,16 +10,35 @@ import android.support.v7.widget.Toolbar;
|
|||
import com.habitrpg.android.habitica.ui.MainDrawerBuilder;
|
||||
import com.mikepenz.materialdrawer.Drawer;
|
||||
|
||||
import org.solovyev.android.checkout.ActivityCheckout;
|
||||
import org.solovyev.android.checkout.BillingRequests;
|
||||
import org.solovyev.android.checkout.Checkout;
|
||||
import org.solovyev.android.checkout.Inventory;
|
||||
import org.solovyev.android.checkout.ProductTypes;
|
||||
import org.solovyev.android.checkout.Purchase;
|
||||
import org.solovyev.android.checkout.RequestListener;
|
||||
|
||||
import butterknife.ButterKnife;
|
||||
import butterknife.InjectView;
|
||||
|
||||
public class GemPurchaseActivity extends AppCompatActivity {
|
||||
|
||||
// region View Elements
|
||||
|
||||
@InjectView(R.id.toolbar)
|
||||
Toolbar toolbar;
|
||||
|
||||
Drawer drawer;
|
||||
|
||||
// endregion
|
||||
|
||||
// region IAP
|
||||
|
||||
@NonNull
|
||||
private final ActivityCheckout checkout = Checkout.forActivity(this, HabiticaApplication.Instance.getCheckout());
|
||||
|
||||
// endregion
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
|
@ -40,14 +61,51 @@ public class GemPurchaseActivity extends AppCompatActivity {
|
|||
actionBar.setHomeButtonEnabled(false);
|
||||
}
|
||||
|
||||
toolbar.setPadding(0, getResources().getDimensionPixelSize(R.dimen.tool_bar_top_padding), 0, 0);
|
||||
toolbar.setTitle("Purchase Gems");
|
||||
actionBar.setTitle("Purchase Gems 2");
|
||||
}
|
||||
|
||||
|
||||
drawer = MainDrawerBuilder.CreateDefaultBuilderSettings(this, toolbar)
|
||||
|
||||
.build();
|
||||
|
||||
|
||||
checkout.start();
|
||||
// you only need this if this activity starts purchase process
|
||||
checkout.createPurchaseFlow(new RequestListener<Purchase>() {
|
||||
@Override
|
||||
public void onSuccess(Purchase purchase) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(int i, Exception e) {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
checkout.whenReady(new Checkout.Listener() {
|
||||
@Override
|
||||
public void onReady(BillingRequests billingRequests) {
|
||||
billingRequests.purchase(ProductTypes.IN_APP, HabiticaApplication.Purchase20Gems, null, checkout.getPurchaseFlow());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onReady(BillingRequests billingRequests, String s, boolean b) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
checkout.onActivityResult(requestCode, resultCode, data);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
checkout.stop();
|
||||
super.onDestroy();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,27 +3,50 @@ package com.habitrpg.android.habitica;
|
|||
import android.app.Application;
|
||||
import android.database.DatabaseErrorHandler;
|
||||
import android.database.sqlite.SQLiteDatabase;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
|
||||
import com.instabug.library.Instabug;
|
||||
import com.raizlabs.android.dbflow.config.FlowManager;
|
||||
|
||||
import org.solovyev.android.checkout.Billing;
|
||||
import org.solovyev.android.checkout.Cache;
|
||||
import org.solovyev.android.checkout.Checkout;
|
||||
import org.solovyev.android.checkout.Inventory;
|
||||
import org.solovyev.android.checkout.ProductTypes;
|
||||
import org.solovyev.android.checkout.Products;
|
||||
import org.solovyev.android.checkout.Purchase;
|
||||
import org.solovyev.android.checkout.PurchaseVerifier;
|
||||
import org.solovyev.android.checkout.RequestListener;
|
||||
|
||||
import java.io.File;
|
||||
import java.security.Security;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.Executor;
|
||||
|
||||
/**
|
||||
* Created by Negue on 14.06.2015.
|
||||
*/
|
||||
public class HabiticaApplication extends Application {
|
||||
|
||||
public static HabiticaApplication Instance;
|
||||
|
||||
@Override
|
||||
public void onCreate() {
|
||||
super.onCreate();
|
||||
|
||||
Instance = this;
|
||||
|
||||
FlowManager.init(this);
|
||||
|
||||
Instabug.DEBUG = BuildConfig.DEBUG;
|
||||
Instabug.initialize(this, "a5aa5f471a9cd8a958c0c55181172655");
|
||||
}
|
||||
|
||||
// region SQLite overrides
|
||||
|
||||
@Override
|
||||
public SQLiteDatabase openOrCreateDatabase(String name,
|
||||
int mode, SQLiteDatabase.CursorFactory factory) {
|
||||
|
|
@ -45,4 +68,74 @@ public class HabiticaApplication extends Application {
|
|||
public File getDatabasePath(String name) {
|
||||
return new File(getExternalFilesDir(null), "HabiticaDatabase/"+name);
|
||||
}
|
||||
|
||||
// endregion
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* For better performance billing class should be used as singleton
|
||||
*/
|
||||
@NonNull
|
||||
private final Billing billing = new Billing(this, new Billing.Configuration() {
|
||||
@NonNull
|
||||
@Override
|
||||
public String getPublicKey() {
|
||||
return "sdfsdfdfsd";
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public Cache getCache() {
|
||||
return Billing.newCache();
|
||||
}
|
||||
|
||||
@Override
|
||||
public PurchaseVerifier getPurchaseVerifier() {
|
||||
return new PurchaseVerifier() {
|
||||
@Override
|
||||
public void verify(List<Purchase> purchases, RequestListener<List<Purchase>> requestListener) {
|
||||
final List<Purchase> verifiedPurchases = new ArrayList<Purchase>(purchases.size());
|
||||
/* for (Purchase purchase : purchases) {
|
||||
if (Security.verifyPurchase(publicKey, purchase.data, purchase.signature)) {
|
||||
verifiedPurchases.add(purchase);
|
||||
} else {
|
||||
if (isEmpty(purchase.signature)) {
|
||||
Billing.error("Cannot verify purchase: " + purchase + ". Signature is empty");
|
||||
} else {
|
||||
Billing.error("Cannot verify purchase: " + purchase + ". Wrong signature");
|
||||
}
|
||||
}
|
||||
}*/
|
||||
//requestListener.onSuccess(verifiedPurchases);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public Inventory getFallbackInventory(Checkout checkout, Executor executor) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAutoConnect() {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
public static String Purchase20Gems = "com.habitrpg.android.habitica.buy20gems";
|
||||
|
||||
/**
|
||||
* Application wide {@link org.solovyev.android.checkout.Checkout} instance (can be used anywhere in the app).
|
||||
* This instance contains all available products in the app.
|
||||
*/
|
||||
@NonNull
|
||||
private final Checkout checkout = Checkout.forApplication(billing, Products.create().add(ProductTypes.IN_APP, Arrays.asList(Purchase20Gems)));
|
||||
|
||||
|
||||
@NonNull
|
||||
public Checkout getCheckout() {
|
||||
return checkout;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ import android.widget.TextView;
|
|||
|
||||
import com.habitrpg.android.habitica.events.TaskSaveEvent;
|
||||
import com.magicmicky.habitrpgwrapper.lib.models.Tag;
|
||||
import com.magicmicky.habitrpgwrapper.lib.models.tasks.Days;
|
||||
import com.magicmicky.habitrpgwrapper.lib.models.tasks.Task;
|
||||
import com.magicmicky.habitrpgwrapper.lib.models.tasks.TaskTag;
|
||||
import com.raizlabs.android.dbflow.runtime.transaction.BaseTransaction;
|
||||
|
|
@ -44,6 +45,7 @@ public class TaskFormActivity extends AppCompatActivity implements AdapterView.O
|
|||
private NumberPicker frequencyPicker;
|
||||
private LinearLayout frequencyContainer;
|
||||
private List<String> tags;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
|
@ -83,7 +85,7 @@ public class TaskFormActivity extends AppCompatActivity implements AdapterView.O
|
|||
mainWrapper.removeView(actionsLayout);
|
||||
}
|
||||
|
||||
LinearLayout weekdayWrapper = (LinearLayout)findViewById(R.id.task_weekdays_wrapper);
|
||||
LinearLayout weekdayWrapper = (LinearLayout) findViewById(R.id.task_weekdays_wrapper);
|
||||
if (taskType.equals("daily")) {
|
||||
this.dailyFrequencySpinner = (Spinner) weekdayWrapper.findViewById(R.id.task_frequency_spinner);
|
||||
|
||||
|
|
@ -98,10 +100,44 @@ public class TaskFormActivity extends AppCompatActivity implements AdapterView.O
|
|||
mainWrapper.removeView(weekdayWrapper);
|
||||
}
|
||||
|
||||
|
||||
if (taskId != null) {
|
||||
Task task = new Select().from(Task.class).byIds(taskId).querySingle();
|
||||
this.task = task;
|
||||
this.populate(task);
|
||||
setTitle(task);
|
||||
} else{
|
||||
setTitle((Task)null);
|
||||
}
|
||||
}
|
||||
|
||||
private void setTitle(Task task) {
|
||||
android.support.v7.app.ActionBar actionBar = getSupportActionBar();
|
||||
|
||||
if (actionBar != null) {
|
||||
|
||||
String title = "";
|
||||
|
||||
if (task != null) {
|
||||
title = getResources().getString(R.string.action_edit)+ " " + task.getText();
|
||||
} else {
|
||||
switch (taskType) {
|
||||
case "todo":
|
||||
title = getResources().getString(R.string.new_todo);
|
||||
break;
|
||||
case "daily":
|
||||
title = getResources().getString(R.string.new_daily);
|
||||
break;
|
||||
case "habit":
|
||||
title = getResources().getString(R.string.new_habit);
|
||||
break;
|
||||
case "reward":
|
||||
title = getResources().getString(R.string.new_reward);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
actionBar.setTitle(title);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -213,7 +249,7 @@ public class TaskFormActivity extends AppCompatActivity implements AdapterView.O
|
|||
private boolean saveTask(Task task) {
|
||||
task.text = taskText.getText().toString();
|
||||
|
||||
if(task.text.isEmpty())
|
||||
if (task.text.isEmpty())
|
||||
return false;
|
||||
|
||||
task.notes = taskNotes.getText().toString();
|
||||
|
|
@ -236,13 +272,19 @@ public class TaskFormActivity extends AppCompatActivity implements AdapterView.O
|
|||
if (task.type.equals("daily")) {
|
||||
if (this.dailyFrequencySpinner.getSelectedItemPosition() == 0) {
|
||||
task.setFrequency("weekly");
|
||||
task.getRepeat().setM(this.weekdayCheckboxes.get(0).isChecked());
|
||||
task.getRepeat().setT(this.weekdayCheckboxes.get(1).isChecked());
|
||||
task.getRepeat().setW(this.weekdayCheckboxes.get(2).isChecked());
|
||||
task.getRepeat().setTh(this.weekdayCheckboxes.get(3).isChecked());
|
||||
task.getRepeat().setF(this.weekdayCheckboxes.get(4).isChecked());
|
||||
task.getRepeat().setS(this.weekdayCheckboxes.get(5).isChecked());
|
||||
task.getRepeat().setSu(this.weekdayCheckboxes.get(6).isChecked());
|
||||
Days repeat = task.getRepeat();
|
||||
if(repeat == null){
|
||||
repeat = new Days();
|
||||
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());
|
||||
} else {
|
||||
task.setFrequency("daily");
|
||||
task.setEveryX(this.frequencyPicker.getValue());
|
||||
|
|
@ -266,7 +308,7 @@ public class TaskFormActivity extends AppCompatActivity implements AdapterView.O
|
|||
this.task = new Task();
|
||||
this.task.setType(taskType);
|
||||
}
|
||||
if(this.saveTask(this.task)) {
|
||||
if (this.saveTask(this.task)) {
|
||||
this.task.save();
|
||||
List<TaskTag> taskTags = new ArrayList<TaskTag>();
|
||||
new Select()
|
||||
|
|
@ -288,6 +330,7 @@ public class TaskFormActivity extends AppCompatActivity implements AdapterView.O
|
|||
finish();
|
||||
super.onBackPressed();
|
||||
}
|
||||
|
||||
private TransactionListener<List<Tag>> tagsSearchingListener = new TransactionListener<List<Tag>>() {
|
||||
@Override
|
||||
public void onResultReceived(List<Tag> tags) {
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import android.util.Log;
|
|||
|
||||
import com.crashlytics.android.Crashlytics;
|
||||
import com.habitrpg.android.habitica.events.TaskCreatedEvent;
|
||||
import com.habitrpg.android.habitica.events.TaskUpdatedEvent;
|
||||
import com.magicmicky.habitrpgwrapper.lib.models.tasks.Task;
|
||||
|
||||
import de.greenrobot.event.EventBus;
|
||||
|
|
@ -20,7 +21,7 @@ public class TaskUpdateCallback implements Callback<Task> {
|
|||
public void success(Task task, Response response) {
|
||||
task.save();
|
||||
|
||||
EventBus.getDefault().post(new TaskCreatedEvent(task));
|
||||
EventBus.getDefault().post(new TaskUpdatedEvent(task));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -143,7 +143,11 @@ public class HabitItemRecyclerViewAdapter<THabitItem extends Task>
|
|||
}
|
||||
|
||||
public void onEvent(TaskUpdatedEvent evnt){
|
||||
// TODO Update Entry
|
||||
if(!taskType.equals(evnt.task.getType()))
|
||||
return;
|
||||
|
||||
this.filter();
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
public void onEvent(TaskCreatedEvent evnt){
|
||||
|
|
|
|||
Loading…
Reference in a new issue