mirror of
https://github.com/sudoxnym/habitica-android.git
synced 2026-05-20 20:59:00 +00:00
This commit is contained in:
parent
09a99ab367
commit
ecb10bf5d6
4 changed files with 36 additions and 26 deletions
|
|
@ -53,13 +53,12 @@ public class ContentCache {
|
|||
|
||||
public void GetItemDataList(final List<String> keysToSearch, GotContentEntryCallback<List<ItemData>> gotEntries) {
|
||||
|
||||
Condition.In keyCondition = Condition.column("key").in("potion");
|
||||
Condition.In keyCondition = Condition.column("key").in("");
|
||||
|
||||
for (String item : keysToSearch) {
|
||||
keyCondition = keyCondition.and(item);
|
||||
}
|
||||
|
||||
|
||||
Where<ItemData> query = new Select().from(ItemData.class).where(keyCondition);
|
||||
|
||||
List<ItemData> items = query.queryList();
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@ package com.habitrpg.android.habitica.ui.activities;
|
|||
|
||||
import android.content.Intent;
|
||||
import android.graphics.Typeface;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Bundle;
|
||||
import android.support.v7.app.AlertDialog;
|
||||
import android.support.v7.widget.CardView;
|
||||
|
|
@ -228,6 +227,9 @@ public class FullProfileActivity extends BaseActivity {
|
|||
}
|
||||
|
||||
private int countEntries(HashMap<String, ?> hashMap) {
|
||||
if(hashMap == null)
|
||||
return 0;
|
||||
|
||||
int _count = 0;
|
||||
|
||||
for (Map.Entry<String, ?> e : hashMap.entrySet()) {
|
||||
|
|
@ -247,8 +249,16 @@ public class FullProfileActivity extends BaseActivity {
|
|||
bar.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
private String getCeiledValue(float val) {
|
||||
return ((int) Math.ceil(val)) + "";
|
||||
private String getFloorValueString(float val, boolean roundDown) {
|
||||
return roundDown
|
||||
? ((int) Math.floor(val)) + ""
|
||||
: (val == 0.0 ? "0" : val + "");
|
||||
}
|
||||
|
||||
private float getFloorValue(float val, boolean roundDown) {
|
||||
return roundDown
|
||||
? ((int) Math.floor(val))
|
||||
: val;
|
||||
}
|
||||
|
||||
private TableRow addEquipmentRow(TableLayout table, String gearKey, String text, String stats) {
|
||||
|
|
@ -292,9 +302,9 @@ public class FullProfileActivity extends BaseActivity {
|
|||
private float attributePerSum = 0;
|
||||
|
||||
private void addLevelAttributes(Stats stats, HabitRPGUser user) {
|
||||
float byLevelStat = stats.getLvl() / 2.0f;
|
||||
float byLevelStat = Math.min(stats.getLvl() / 2.0f, 50f);
|
||||
|
||||
addAttributeRow(getString(R.string.profile_level), byLevelStat, byLevelStat, byLevelStat, byLevelStat, false);
|
||||
addAttributeRow(getString(R.string.profile_level), byLevelStat, byLevelStat, byLevelStat, byLevelStat, true, false);
|
||||
|
||||
loadItemDataByOutfit(user.getItems().getGear().getEquipped(), obj -> {
|
||||
gotGear(obj, user);
|
||||
|
|
@ -370,7 +380,7 @@ public class FullProfileActivity extends BaseActivity {
|
|||
stopAndHideProgress(equipmentProgress);
|
||||
equipmentTableLayout.setVisibility(View.VISIBLE);
|
||||
|
||||
addAttributeRow(getString(R.string.battle_gear) + ": ", strAttributes, intAttributes, conAttributes, perAttributes, false);
|
||||
addAttributeRow(getString(R.string.battle_gear) + ": ", strAttributes, intAttributes, conAttributes, perAttributes, true, false);
|
||||
|
||||
if (!user.getPreferences().isDisableClasses()) {
|
||||
float strClassBonus = 0;
|
||||
|
|
@ -397,7 +407,7 @@ public class FullProfileActivity extends BaseActivity {
|
|||
break;
|
||||
}
|
||||
|
||||
addAttributeRow(getString(R.string.profile_class_bonus), strClassBonus, intClassBonus, conClassBonus, perClassBonus, false);
|
||||
addAttributeRow(getString(R.string.profile_class_bonus), strClassBonus, intClassBonus, conClassBonus, perClassBonus, false, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -413,29 +423,29 @@ public class FullProfileActivity extends BaseActivity {
|
|||
private void addNormalAddBuffAttributes(Stats stats) {
|
||||
Buffs buffs = stats.getBuffs();
|
||||
|
||||
addAttributeRow(getString(R.string.profile_allocated), stats.getStr(), stats.get_int(), stats.getCon(), stats.getPer(), false);
|
||||
addAttributeRow(getString(R.string.profile_boosts), buffs.getStr(), buffs.get_int(), buffs.getCon(), buffs.getPer(), false);
|
||||
addAttributeRow(getString(R.string.profile_allocated), stats.getStr(), stats.get_int(), stats.getCon(), stats.getPer(), true, false);
|
||||
addAttributeRow(getString(R.string.profile_boosts), buffs.getStr(), buffs.get_int(), buffs.getCon(), buffs.getPer(), true, false);
|
||||
|
||||
// Summary row
|
||||
addAttributeRow("", attributeStrSum, attributeIntSum, attributeConSum, attributePerSum, true);
|
||||
addAttributeRow("", attributeStrSum, attributeIntSum, attributeConSum, attributePerSum, false, true);
|
||||
}
|
||||
|
||||
private TableRow addAttributeRow(String label, float strVal, float intVal, float conVal, float perVal, boolean isSummary) {
|
||||
private TableRow addAttributeRow(String label, float strVal, float intVal, float conVal, float perVal, boolean roundDown, boolean isSummary) {
|
||||
TableRow tableRow = (TableRow) getLayoutInflater().inflate(R.layout.profile_attributetablerow, null);
|
||||
TextView keyTextView = (TextView) tableRow.findViewById(R.id.tv_attribute_type);
|
||||
keyTextView.setText(label);
|
||||
|
||||
TextView strTextView = (TextView) tableRow.findViewById(R.id.tv_attribute_str);
|
||||
strTextView.setText(getCeiledValue(strVal));
|
||||
strTextView.setText(getFloorValueString(strVal, roundDown));
|
||||
|
||||
TextView intTextView = (TextView) tableRow.findViewById(R.id.tv_attribute_int);
|
||||
intTextView.setText(getCeiledValue(intVal));
|
||||
intTextView.setText(getFloorValueString(intVal, roundDown));
|
||||
|
||||
TextView conTextView = (TextView) tableRow.findViewById(R.id.tv_attribute_con);
|
||||
conTextView.setText(getCeiledValue(conVal));
|
||||
conTextView.setText(getFloorValueString(conVal, roundDown));
|
||||
|
||||
TextView perTextView = (TextView) tableRow.findViewById(R.id.tv_attribute_per);
|
||||
perTextView.setText(getCeiledValue(perVal));
|
||||
perTextView.setText(getFloorValueString(perVal, roundDown));
|
||||
|
||||
|
||||
if (isSummary) {
|
||||
|
|
@ -444,13 +454,13 @@ public class FullProfileActivity extends BaseActivity {
|
|||
conTextView.setTypeface(null, Typeface.BOLD);
|
||||
perTextView.setTypeface(null, Typeface.BOLD);
|
||||
} else {
|
||||
attributeStrSum += strVal;
|
||||
attributeIntSum += intVal;
|
||||
attributeConSum += conVal;
|
||||
attributePerSum += perVal;
|
||||
attributeStrSum += getFloorValue(strVal, roundDown);
|
||||
attributeIntSum += getFloorValue(intVal, roundDown);
|
||||
attributeConSum += getFloorValue(conVal, roundDown);
|
||||
attributePerSum += getFloorValue(perVal, roundDown);
|
||||
|
||||
attributeRows.add(tableRow);
|
||||
tableRow.setVisibility(View.GONE);
|
||||
tableRow.setVisibility(attributeDetailsHidden ? View.GONE : View.VISIBLE);
|
||||
}
|
||||
|
||||
attributesTableLayout.addView(tableRow);
|
||||
|
|
@ -465,7 +475,9 @@ public class FullProfileActivity extends BaseActivity {
|
|||
private void toggleAttributeDetails() {
|
||||
attributeDetailsHidden = !attributeDetailsHidden;
|
||||
|
||||
attributesCollapseIcon.setImageDrawable(getResources().getDrawable(attributeDetailsHidden ? R.drawable.ic_keyboard_arrow_right_black_24dp : R.drawable.ic_keyboard_arrow_down_black_24dp));
|
||||
attributesCollapseIcon.setImageDrawable(getResources().getDrawable(attributeDetailsHidden
|
||||
? R.drawable.ic_keyboard_arrow_right_black_24dp
|
||||
: R.drawable.ic_keyboard_arrow_down_black_24dp));
|
||||
|
||||
for (TableRow row : attributeRows) {
|
||||
row.setVisibility(attributeDetailsHidden ? View.GONE : View.VISIBLE);
|
||||
|
|
|
|||
|
|
@ -123,7 +123,7 @@ public class PetDetailRecyclerAdapter extends RecyclerView.Adapter<PetDetailRecy
|
|||
public void bind(Pet item) {
|
||||
this.animal = item;
|
||||
this.titleView.setText(item.getColorText());
|
||||
this.trainedProgressbar.setVisibility(View.VISIBLE);
|
||||
this.trainedProgressbar.setVisibility(animal.getAnimalGroup().equals("specialPets") ? View.GONE : View.VISIBLE);
|
||||
this.imageView.setAlpha(1.0f);
|
||||
if (this.getOwnedStatus() > 0) {
|
||||
if (this.isMountOwned()) {
|
||||
|
|
@ -150,7 +150,7 @@ public class PetDetailRecyclerAdapter extends RecyclerView.Adapter<PetDetailRecy
|
|||
}
|
||||
BottomSheetMenu menu = new BottomSheetMenu(context);
|
||||
menu.addMenuItem(new BottomSheetMenuItem(resources.getString(R.string.use_animal)));
|
||||
if (!this.isMountOwned()) {
|
||||
if (!animal.getAnimalGroup().equals("specialPets") && !this.isMountOwned()) {
|
||||
menu.addMenuItem(new BottomSheetMenuItem(resources.getString(R.string.feed)));
|
||||
}
|
||||
menu.setSelectionRunnable(index -> {
|
||||
|
|
|
|||
|
|
@ -16,7 +16,6 @@ import android.view.ViewGroup;
|
|||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
import rx.Observable;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue