gem purchase screen improvements

This commit is contained in:
Phillip Thelen 2016-10-13 14:17:48 +02:00
parent d64b89ef4c
commit 93dcaf9f99
3 changed files with 15 additions and 3 deletions

View file

@ -2,8 +2,8 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.habitrpg.android.habitica"
android:versionCode="125"
android:versionName="0.0.34.1"
android:versionCode="128"
android:versionName="0.0.34.2"
android:screenOrientation="portrait"
android:installLocation="auto" >

View file

@ -173,6 +173,7 @@ public class MainActivity extends BaseActivity implements Action1<Throwable>, Ha
TaskScoringCallback.OnTaskScored, TutorialView.OnTutorialReaction {
public static final int SELECT_CLASS_RESULT = 11;
public static final int GEM_PURCHASE_REQUEST = 111;
public static final int MIN_LEVEL_FOR_SKILLS = 11;
@Inject
public APIHelper apiHelper;
@ -867,6 +868,11 @@ public class MainActivity extends BaseActivity implements Action1<Throwable>, Ha
.subscribe(new HabitRPGUserCallback(this), throwable -> {
});
}
} else if (requestCode == GEM_PURCHASE_REQUEST) {
this.apiHelper.retrieveUser(true)
.compose(apiHelper.configureApiCallObserver())
.subscribe(new HabitRPGUserCallback(this), throwable -> {
});
}
super.onActivityResult(requestCode, resultCode, data);
}

View file

@ -30,6 +30,8 @@ import android.app.Activity;
import android.content.Intent;
import android.support.v7.widget.Toolbar;
import static com.habitrpg.android.habitica.ui.activities.MainActivity.GEM_PURCHASE_REQUEST;
public class MainDrawerBuilder {
// Change the identificationIDs to the position IDs so that its easier to set the selected entry
@ -178,7 +180,11 @@ public class MainDrawerBuilder {
if (newActivityClass != null) {
Intent passUserId = new Intent(activity, newActivityClass);
passUserId.putExtra("userId", activity.getUserID());
activity.startActivity(passUserId);
if (identifier == SIDEBAR_PURCHASE) {
activity.startActivityForResult(passUserId, GEM_PURCHASE_REQUEST);
} else {
activity.startActivity(passUserId);
}
return false;
}