Correct confirmation message for changing class, and add a warning relative to the gear

This commit is contained in:
Pandhariix 2016-12-06 00:54:53 +01:00
parent 6702379725
commit 0c4d534d4d
4 changed files with 12 additions and 3 deletions

View file

@ -346,7 +346,8 @@ To start, which parts of your life do you want to improve?</string>
<string name="opt_out_class">Opt Out</string>
<string name="opt_out_description">Can\'t be bothered with classes? Want to choose later? Opt out - you\'ll be a warrior with no special abilities. You can read about the class system later on the wiki and enable classes at any time.</string>
<string name="class_confirmation" formatted="false">Are you sure you want to be a %s?</string>
<string name="class_changed">You are now a %s, and you have a new default battle gear !</string>
<string name="class_changed">You are now a %s !</string>
<string name="class_changed_description"> You have a new default Battle Gear that you can change under Equipment !</string>
<string name="choose_class">Choose Class</string>
<string name="dialog_go_back">Go Back</string>
<string name="opt_out_confirmation">Are you sure you want to Opt Out?</string>
@ -369,7 +370,8 @@ To start, which parts of your life do you want to improve?</string>
<string name="share_hatched" formatted="false">I just hatched a %1$s %2$s pet in Habitica by completing my real-life tasks!</string>
<string name="share_raised" formatted="false">I just gained a %1$s %2$s mount in Habitica by completing my real-life tasks!</string>
<string name="open_in_store">Open in play store</string>
<string name="change_class_confirmation">Are you sure you want to change your class? This will cost 3 gems</string>
<string name="change_class_confirmation">Are you sure you want to change your class? This will cost 3 gems.</string>
<string name="change_class_equipment_warning">Warning : You will no longer be able to buy equipment from the %s class.</string>
<string name="leaderMessage" formatted="false">Message from %1$s</string>
<string name="confirm">Confirm</string>
<string name="market">Market</string>

View file

@ -2,4 +2,5 @@ package com.habitrpg.android.habitica.events;
public class SelectClassEvent {
public boolean isInitialSelection;
public String currentClass;
}

View file

@ -24,6 +24,7 @@ import rx.functions.Action1;
public class ClassSelectionActivity extends BaseActivity implements Action1<HabitRPGUser> {
String currentClass;
Boolean isInitialSelection;
Boolean classWasUnset = false;
Boolean shouldFinish = false;
@ -54,6 +55,7 @@ public class ClassSelectionActivity extends BaseActivity implements Action1<Habi
Intent intent = getIntent();
Bundle bundle = intent.getExtras();
isInitialSelection = bundle.getBoolean("isInitialSelection");
currentClass = bundle.getString("currentClass");
Preferences preferences = new Preferences();
preferences.setHair(new Hair());
@ -164,6 +166,7 @@ public class ClassSelectionActivity extends BaseActivity implements Action1<Habi
if (!this.isInitialSelection && !this.classWasUnset) {
AlertDialog.Builder builder = new AlertDialog.Builder(this)
.setTitle(getString(R.string.change_class_confirmation))
.setMessage(getString(R.string.change_class_equipment_warning, currentClass))
.setNegativeButton(getString(R.string.dialog_go_back), (dialog, which) -> {
dialog.dismiss();
})
@ -191,7 +194,8 @@ public class ClassSelectionActivity extends BaseActivity implements Action1<Habi
private void displayClassChanged(String newClassName) {
AlertDialog.Builder changeConfirmedBuilder = new AlertDialog.Builder(this)
.setTitle(getString(R.string.class_changed, newClassName))
.setPositiveButton(getString(R.string.yes), (dialog, which) -> {
.setMessage(getString(R.string.class_changed_description))
.setPositiveButton(getString(R.string.complete_tutorial), (dialog, which) -> {
dialog.dismiss();
});
AlertDialog changeDoneAlert = changeConfirmedBuilder.create();

View file

@ -1355,6 +1355,7 @@ public class MainActivity extends BaseActivity implements Action1<Throwable>, Ha
!user.getFlags().getClassSelected()) {
SelectClassEvent event = new SelectClassEvent();
event.isInitialSelection = true;
event.currentClass = user.getStats().get_class().toString();
displayClassSelectionActivity(event);
}
}
@ -1385,6 +1386,7 @@ public class MainActivity extends BaseActivity implements Action1<Throwable>, Ha
bundle.putInt("hairMustache", user.getPreferences().getHair().getMustache());
bundle.putInt("hairBeard", user.getPreferences().getHair().getBeard());
bundle.putBoolean("isInitialSelection", event.isInitialSelection);
bundle.putString("currentClass", event.currentClass);
Intent intent = new Intent(this, ClassSelectionActivity.class);
intent.putExtras(bundle);