mirror of
https://github.com/sudoxnym/habitica-android.git
synced 2026-07-13 01:38:21 +00:00
camelCase all the things
This commit is contained in:
parent
19a738e91d
commit
ce566a4cd2
5 changed files with 24 additions and 23 deletions
|
|
@ -517,7 +517,7 @@ public class MainActivity extends AvatarActivityBase implements HabitRPGUserCall
|
|||
}
|
||||
|
||||
private void updateUserAvatars() {
|
||||
avatarInHeader.UpdateData(User);
|
||||
avatarInHeader.updateData(User);
|
||||
}
|
||||
|
||||
private void updateHeader() {
|
||||
|
|
|
|||
|
|
@ -164,7 +164,7 @@ public class PartyActivity extends AvatarActivityBase implements AppBarLayout.On
|
|||
|
||||
|
||||
private void updateUserAvatars() {
|
||||
avatarInHeader.UpdateData(User);
|
||||
avatarInHeader.updateData(User);
|
||||
}
|
||||
|
||||
//region Events
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ public class TavernActivity extends AppCompatActivity {
|
|||
HostConfig hostConfig = PrefsActivity.fromContext(this);
|
||||
User = new Select().from(HabitRPGUser.class).where(Condition.column("id").eq(hostConfig.getUser())).querySingle();
|
||||
|
||||
avatarInHeader.UpdateData(User);
|
||||
avatarInHeader.updateData(User);
|
||||
|
||||
mAPIHelper = new APIHelper(this, hostConfig);
|
||||
|
||||
|
|
@ -87,7 +87,7 @@ public class TavernActivity extends AppCompatActivity {
|
|||
}
|
||||
|
||||
public void onEvent(ToggledInnStateEvent evt){
|
||||
avatarInHeader.UpdateData(User);
|
||||
avatarInHeader.updateData(User);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -16,14 +16,15 @@ import com.magicmicky.habitrpgwrapper.lib.models.Stats;
|
|||
* Created by Negue on 14.06.2015.
|
||||
*/
|
||||
public class AvatarWithBarsViewModel {
|
||||
ValueBarBinding hpBar;
|
||||
ValueBarBinding xpBar;
|
||||
ValueBarBinding mpBar;
|
||||
private ValueBarBinding hpBar;
|
||||
private ValueBarBinding xpBar;
|
||||
private ValueBarBinding mpBar;
|
||||
|
||||
ImageView image;
|
||||
UserPicture userPicture;
|
||||
private ImageView image;
|
||||
private UserPicture userPicture;
|
||||
private ImageView classIcon;
|
||||
|
||||
android.content.res.Resources res;
|
||||
private android.content.res.Resources res;
|
||||
|
||||
private Context context;
|
||||
|
||||
|
|
@ -48,23 +49,24 @@ public class AvatarWithBarsViewModel {
|
|||
mpBar = DataBindingUtil.bind(v.findViewById(R.id.mpBar));
|
||||
|
||||
|
||||
SetValueBar(hpBar, 50, 50, context.getString(R.string.HP_default), R.color.hpColor, R.drawable.ic_header_heart);
|
||||
SetValueBar(xpBar, 1, 1, context.getString(R.string.XP_default), R.color.xpColor, R.drawable.ic_header_exp);
|
||||
SetValueBar(mpBar, 100, 100, context.getString(R.string.MP_default), R.color.mpColor, R.drawable.ic_header_magic);
|
||||
setValueBar(hpBar, 50, 50, context.getString(R.string.HP_default), R.color.hpColor, R.drawable.ic_header_heart);
|
||||
setValueBar(xpBar, 1, 1, context.getString(R.string.XP_default), R.color.xpColor, R.drawable.ic_header_exp);
|
||||
setValueBar(mpBar, 100, 100, context.getString(R.string.MP_default), R.color.mpColor, R.drawable.ic_header_magic);
|
||||
}
|
||||
|
||||
public void UpdateData(HabitRPGUser user)
|
||||
public void updateData(HabitRPGUser user)
|
||||
{
|
||||
Stats stats = user.getStats();
|
||||
|
||||
SetHpBarData(hpBar, stats, context);
|
||||
SetValueBar(xpBar, stats.getExp().floatValue(), stats.getToNextLevel(), context.getString(R.string.XP_default), context.getResources().getColor(R.color.xpColor), R.drawable.ic_header_exp);
|
||||
SetValueBar(mpBar, stats.getMp().floatValue(), stats.getMaxMP(), context.getString(R.string.MP_default), context.getResources().getColor(R.color.mpColor), R.drawable.ic_header_magic);
|
||||
|
||||
setHpBarData(hpBar, stats, context);
|
||||
setValueBar(xpBar, stats.getExp().floatValue(), stats.getToNextLevel(), context.getString(R.string.XP_default), context.getResources().getColor(R.color.xpColor), R.drawable.ic_header_exp);
|
||||
setValueBar(mpBar, stats.getMp().floatValue(), stats.getMaxMP(), context.getString(R.string.MP_default), context.getResources().getColor(R.color.mpColor), R.drawable.ic_header_magic);
|
||||
new UserPicture(user, this.context).setPictureOn(image);
|
||||
|
||||
|
||||
}
|
||||
|
||||
public static void SetHpBarData(ValueBarBinding valueBar, Stats stats, Context ctx)
|
||||
public static void setHpBarData(ValueBarBinding valueBar, Stats stats, Context ctx)
|
||||
{
|
||||
int maxHP = stats.getMaxHealth();
|
||||
if(maxHP == 0)
|
||||
|
|
@ -72,12 +74,12 @@ public class AvatarWithBarsViewModel {
|
|||
maxHP = 50;
|
||||
}
|
||||
|
||||
SetValueBar(valueBar, stats.getHp().floatValue(), maxHP, ctx.getString(R.string.HP_default), ctx.getResources().getColor(R.color.hpColor), R.drawable.ic_header_heart);
|
||||
setValueBar(valueBar, stats.getHp().floatValue(), maxHP, ctx.getString(R.string.HP_default), ctx.getResources().getColor(R.color.hpColor), R.drawable.ic_header_heart);
|
||||
}
|
||||
|
||||
// Layout_Weight don't accepts 0.7/0.3 to have 70% filled instead it shows the 30% , so I had to switch the values
|
||||
// but on a 1.0/0.0 which switches to 0.0/1.0 it shows the blank part full size...
|
||||
private static void SetValueBar(ValueBarBinding valueBar, float value, float valueMax, String description, int color, int icon)
|
||||
private static void setValueBar(ValueBarBinding valueBar, float value, float valueMax, String description, int color, int icon)
|
||||
{
|
||||
double percent = Math.min(1, value / valueMax);
|
||||
|
||||
|
|
|
|||
|
|
@ -16,7 +16,6 @@ import com.habitrpg.android.habitica.ui.helpers.ViewHelper;
|
|||
import com.habitrpg.android.habitica.userpicture.UserPicture;
|
||||
import com.magicmicky.habitrpgwrapper.lib.models.HabitRPGUser;
|
||||
|
||||
import java.lang.annotation.Inherited;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import butterknife.ButterKnife;
|
||||
|
|
@ -94,7 +93,7 @@ public class PartyMemberRecyclerViewAdapter extends RecyclerView.Adapter<PartyMe
|
|||
UserPicture userPicture = new UserPicture(user, ctx);
|
||||
userPicture.setPictureOn(imageView);
|
||||
|
||||
AvatarWithBarsViewModel.SetHpBarData(hpBar, user.getStats(), ctx);
|
||||
AvatarWithBarsViewModel.setHpBarData(hpBar, user.getStats(), ctx);
|
||||
|
||||
lvl.setText("LVL " + user.getStats().getLvl());
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue