mirror of
https://github.com/sudoxnym/habitica-android.git
synced 2026-05-18 11:49:01 +00:00
improve creator view
This commit is contained in:
parent
95359dfbc5
commit
368608693a
21 changed files with 85 additions and 48 deletions
Binary file not shown.
|
Before Width: | Height: | Size: 29 KiB After Width: | Height: | Size: 31 KiB |
|
|
@ -1,8 +1,8 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:top="5dp" android:left="5dp" android:right="5dp" android:bottom="5dp">
|
||||
<item android:top="4dp" android:left="4dp" android:right="4dp" android:bottom="4dp">
|
||||
<shape android:shape="oval">
|
||||
<size android:height="48dp" android:width="48dp" />
|
||||
<size android:height="50dp" android:width="50dp" />
|
||||
<solid android:color="@color/white" />
|
||||
</shape>
|
||||
</item>
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
<item>
|
||||
<shape android:shape="oval">
|
||||
<padding android:bottom="5dp" android:left="5dp" android:right="5dp" android:top="5dp" />
|
||||
<padding android:bottom="4dp" android:left="4dp" android:right="4dp" android:top="4dp" />
|
||||
<solid android:color="@color/brand_400" />
|
||||
</shape>
|
||||
</item>
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="oval">
|
||||
<size android:width="36dp" android:height="36dp" />
|
||||
<size android:width="40dp" android:height="40dp" />
|
||||
<solid android:color="@color/white" />
|
||||
</shape>
|
||||
5
Habitica/res/drawable/white_rounded_bg.xml
Normal file
5
Habitica/res/drawable/white_rounded_bg.xml
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
|
||||
<corners android:radius="5dp" />
|
||||
<solid android:color="@color/white" />
|
||||
</shape>
|
||||
|
|
@ -2,7 +2,7 @@
|
|||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent" android:layout_height="match_parent">
|
||||
|
||||
<android.support.v4.view.ViewPager
|
||||
<com.habitrpg.android.habitica.ui.views.FadingViewPager
|
||||
android:id="@+id/view_pager"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
|
|
|
|||
|
|
@ -22,8 +22,8 @@
|
|||
app:tabTextColor="@color/white_50_alpha"
|
||||
app:tabSelectedTextColor="@color/white"
|
||||
app:tabGravity="center"
|
||||
app:tabPaddingEnd="16dp"
|
||||
app:tabPaddingStart="16dp"
|
||||
app:tabPaddingEnd="24dp"
|
||||
app:tabPaddingStart="24dp"
|
||||
/>
|
||||
|
||||
<android.support.v7.widget.RecyclerView
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/randomize_button"
|
||||
android:src="@drawable/creator_purple_bg"
|
||||
android:src="@drawable/creator_hills_bg"
|
||||
android:layout_centerHorizontal="true" />
|
||||
|
||||
<com.habitrpg.android.habitica.ui.AvatarView
|
||||
|
|
@ -30,9 +30,11 @@
|
|||
app:showBackground="false"
|
||||
app:showMount="false"
|
||||
app:showPet="false"
|
||||
app:showSleeping="false"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_alignTop="@id/avatar_background"
|
||||
android:layout_marginTop="6dp"/>
|
||||
android:layout_marginTop="6dp"
|
||||
/>
|
||||
|
||||
|
||||
<com.habitrpg.android.habitica.ui.views.setup.AvatarCustomizationDrawer
|
||||
|
|
|
|||
|
|
@ -30,12 +30,13 @@
|
|||
app:showBackground="false"
|
||||
app:showMount="false"
|
||||
app:showPet="false"
|
||||
app:showSleeping="false"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_alignTop="@id/avatar_background"
|
||||
android:layout_marginTop="6dp"/>
|
||||
<android.support.v7.widget.RecyclerView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_height="230dp"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:background="@drawable/avatar_customization_category_bg"
|
||||
android:id="@+id/recyclerView"
|
||||
|
|
@ -45,7 +46,7 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:namePlate="Justin"
|
||||
app:text="@string/avatar_setup_description"
|
||||
app:text="@string/task_setup_description"
|
||||
app:npcDrawable="@drawable/npc_justin_only"
|
||||
android:layout_marginLeft="@dimen/content_inset"
|
||||
android:layout_marginRight="@dimen/content_inset"
|
||||
|
|
|
|||
|
|
@ -4,15 +4,15 @@
|
|||
android:layout_height="match_parent"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:gravity="center_vertical"
|
||||
android:paddingLeft="12dp"
|
||||
android:paddingRight="12dp"
|
||||
android:paddingLeft="6dp"
|
||||
android:paddingRight="6dp"
|
||||
tools:background="@color/brand_200">
|
||||
<ImageView
|
||||
android:id="@+id/imageView"
|
||||
android:layout_width="@dimen/setup_customization_size"
|
||||
android:layout_height="@dimen/setup_customization_size"
|
||||
android:background="@drawable/setup_customization_bg"
|
||||
tools:src="@drawable/creator_slim_shirt_black"
|
||||
tools:src="@drawable/creator_chair_black"
|
||||
android:scaleType="center"
|
||||
/>
|
||||
<TextView
|
||||
|
|
@ -20,7 +20,7 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
tools:text="Slim"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:layout_marginLeft="6dp"
|
||||
android:textColor="@color/white_50_alpha"
|
||||
android:textSize="16sp"/>
|
||||
</LinearLayout>
|
||||
|
|
@ -7,8 +7,8 @@
|
|||
android:background="@color/transparent">
|
||||
<ImageView
|
||||
android:id="@+id/npc_image_view"
|
||||
android:layout_width="80dp"
|
||||
android:layout_height="105dp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
tools:src="@drawable/npc_justin_only"
|
||||
android:layout_gravity="right"
|
||||
android:layout_marginRight="30dp"/>
|
||||
|
|
@ -17,12 +17,13 @@
|
|||
android:id="@+id/textView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/white"
|
||||
android:background="@drawable/white_rounded_bg"
|
||||
android:paddingLeft="21dp"
|
||||
android:paddingTop="16dp"
|
||||
android:paddingRight="21dp"
|
||||
android:paddingBottom="14dp"
|
||||
android:layout_marginTop="74dp"
|
||||
style="@style/Body1"
|
||||
tools:text="@string/welcome_text"/>
|
||||
<TextView
|
||||
android:id="@+id/name_plate"
|
||||
|
|
|
|||
|
|
@ -6,7 +6,9 @@ import com.magicmicky.habitrpgwrapper.lib.models.HabitRPGUser;
|
|||
import com.magicmicky.habitrpgwrapper.lib.models.SetupCustomization;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.drawable.Drawable;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
|
@ -44,9 +46,9 @@ public class SetupCustomizationRepositoryImpl implements SetupCustomizationRepos
|
|||
case "hair": {
|
||||
switch (subcategory) {
|
||||
case "bangs":
|
||||
return getBangs();
|
||||
return getBangs(user.getPreferences().getHair().getColor());
|
||||
case "ponytail":
|
||||
return getHairBases();
|
||||
return getHairBases(user.getPreferences().getHair().getColor());
|
||||
case "color":
|
||||
return getHairColors();
|
||||
}
|
||||
|
|
@ -79,7 +81,7 @@ public class SetupCustomizationRepositoryImpl implements SetupCustomizationRepos
|
|||
|
||||
private List<SetupCustomization> getGlasses() {
|
||||
return Arrays.asList(
|
||||
SetupCustomization.createGlasses("", 0),
|
||||
SetupCustomization.createGlasses("eyewear_base_0", R.drawable.creator_blank_face),
|
||||
SetupCustomization.createGlasses("eyewear_special_blackTopFrame", R.drawable.creator_eyewear_special_blacktopframe),
|
||||
SetupCustomization.createGlasses("eyewear_special_blueTopFrame", R.drawable.creator_eyewear_special_bluetopframe),
|
||||
SetupCustomization.createGlasses("eyewear_special_greenTopFrame", R.drawable.creator_eyewear_special_greentopframe),
|
||||
|
|
@ -111,20 +113,20 @@ public class SetupCustomizationRepositoryImpl implements SetupCustomizationRepos
|
|||
);
|
||||
}
|
||||
|
||||
private List<SetupCustomization> getHairBases() {
|
||||
private List<SetupCustomization> getHairBases(String color) {
|
||||
return Arrays.asList(
|
||||
SetupCustomization.createHairPonytail("0", R.drawable.creator_blank_face),
|
||||
SetupCustomization.createHairPonytail("1", R.drawable.creator_hair_base_1_red),
|
||||
SetupCustomization.createHairPonytail("3", R.drawable.creator_hair_base_3_red)
|
||||
SetupCustomization.createHairPonytail("1", getResId("creator_hair_base_1_"+color)),
|
||||
SetupCustomization.createHairPonytail("3", getResId("creator_hair_base_3_"+color))
|
||||
);
|
||||
}
|
||||
|
||||
private List<SetupCustomization> getBangs() {
|
||||
private List<SetupCustomization> getBangs(String color) {
|
||||
return Arrays.asList(
|
||||
SetupCustomization.createHairBangs("0", R.drawable.creator_blank_face),
|
||||
SetupCustomization.createHairBangs("1", R.drawable.creator_hair_bangs_1_red),
|
||||
SetupCustomization.createHairBangs("2", R.drawable.creator_hair_bangs_2_red),
|
||||
SetupCustomization.createHairBangs("3", R.drawable.creator_hair_bangs_3_red)
|
||||
SetupCustomization.createHairBangs("1", getResId("creator_hair_bangs_1_"+color)),
|
||||
SetupCustomization.createHairBangs("2", getResId("creator_hair_bangs_2_"+color)),
|
||||
SetupCustomization.createHairBangs("3", getResId("creator_hair_bangs_3_"+color))
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -169,4 +171,14 @@ public class SetupCustomizationRepositoryImpl implements SetupCustomizationRepos
|
|||
SetupCustomization.createSkin("6bd049", R.color.skin_6bd049)
|
||||
);
|
||||
}
|
||||
|
||||
private int getResId(String resName) {
|
||||
|
||||
try {
|
||||
return context.getResources().getIdentifier(resName, "drawable", context.getPackageName());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -54,6 +54,7 @@ public class AvatarView extends View {
|
|||
private boolean showBackground = true;
|
||||
private boolean showMount = true;
|
||||
private boolean showPet = true;
|
||||
private boolean showSleeping = true;
|
||||
private boolean hasBackground;
|
||||
private boolean hasMount;
|
||||
private boolean hasPet;
|
||||
|
|
@ -107,6 +108,7 @@ public class AvatarView extends View {
|
|||
showBackground = a.getBoolean(R.styleable.AvatarView_showBackground, true);
|
||||
showMount = a.getBoolean(R.styleable.AvatarView_showMount, true);
|
||||
showPet = a.getBoolean(R.styleable.AvatarView_showPet, true);
|
||||
showSleeping = a.getBoolean(R.styleable.AvatarView_showSleeping, true);
|
||||
} finally {
|
||||
a.recycle();
|
||||
}
|
||||
|
|
@ -191,6 +193,11 @@ public class AvatarView extends View {
|
|||
layerMap.put(LayerType.BACKGROUND, "background_" + backgroundName);
|
||||
if (resetHasAttributes) hasBackground = true;
|
||||
}
|
||||
|
||||
if (showSleeping && user.getPreferences().getSleep()) {
|
||||
layerMap.put(AvatarView.LayerType.ZZZ, "zzz");
|
||||
}
|
||||
|
||||
return layerMap;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ import android.support.v7.preference.PreferenceManager;
|
|||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
|
||||
import com.habitrpg.android.habitica.ui.views.FadingViewPager;
|
||||
import com.magicmicky.habitrpgwrapper.lib.api.ApiClient;
|
||||
import com.habitrpg.android.habitica.HostConfig;
|
||||
import com.habitrpg.android.habitica.R;
|
||||
|
|
@ -68,7 +69,7 @@ public class SetupActivity extends BaseActivity implements ViewPager.OnPageChang
|
|||
@Inject
|
||||
protected HostConfig hostConfig;
|
||||
@BindView(R.id.view_pager)
|
||||
ViewPager pager;
|
||||
FadingViewPager pager;
|
||||
@BindView(R.id.nextButton)
|
||||
Button nextButton;
|
||||
@BindView(R.id.previousButton)
|
||||
|
|
@ -107,8 +108,16 @@ public class SetupActivity extends BaseActivity implements ViewPager.OnPageChang
|
|||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||
Window window = getWindow();
|
||||
window.setStatusBarColor(ContextCompat.getColor(this, R.color.days_gray));
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
View decor = getWindow().getDecorView();
|
||||
decor.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
|
||||
window.setStatusBarColor(ContextCompat.getColor(this, R.color.light_gray_bg));
|
||||
} else {
|
||||
window.setStatusBarColor(ContextCompat.getColor(this, R.color.days_gray));
|
||||
}
|
||||
}
|
||||
|
||||
pager.disableFading = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -58,7 +58,6 @@ public class CustomizationSetupAdapter extends RecyclerView.Adapter<RecyclerView
|
|||
|
||||
@Override
|
||||
public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
|
||||
Object obj = customizationList.get(position);
|
||||
((CustomizationViewHolder) holder).bind(customizationList.get(position));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,14 +1,5 @@
|
|||
package com.habitrpg.android.habitica.ui.fragments;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.design.widget.TabLayout;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.FrameLayout;
|
||||
|
||||
import com.habitrpg.android.habitica.helpers.SoundManager;
|
||||
import com.habitrpg.android.habitica.ui.activities.MainActivity;
|
||||
import com.magicmicky.habitrpgwrapper.lib.api.ApiClient;
|
||||
|
|
@ -16,7 +7,14 @@ import com.magicmicky.habitrpgwrapper.lib.models.HabitRPGUser;
|
|||
import com.raizlabs.android.dbflow.sql.builder.Condition;
|
||||
import com.raizlabs.android.dbflow.sql.language.Select;
|
||||
import com.roughike.bottombar.BottomBar;
|
||||
import com.squareup.haha.perflib.Main;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.design.widget.TabLayout;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
|
|
|
|||
|
|
@ -82,7 +82,7 @@ public class TaskSetupFragment extends BaseFragment {
|
|||
this.taskGroups = new String[][]{
|
||||
{getString(R.string.setup_group_work), "work"},
|
||||
{getString(R.string.setup_group_exercise), "exercise"},
|
||||
{getString(R.string.setup_group_heathWellness), "healthWellness"},
|
||||
{getString(R.string.setup_group_health), "healthWellness"},
|
||||
{getString(R.string.setup_group_school), "school"},
|
||||
{getString(R.string.setup_group_teams), "teams"},
|
||||
{getString(R.string.setup_group_chores), "chores"},
|
||||
|
|
|
|||
|
|
@ -9,6 +9,8 @@ import android.view.View;
|
|||
|
||||
|
||||
public class FadingViewPager extends ViewPager {
|
||||
public boolean disableFading;
|
||||
|
||||
public FadingViewPager(Context context) {
|
||||
super(context);
|
||||
|
||||
|
|
@ -31,6 +33,9 @@ public class FadingViewPager extends ViewPager {
|
|||
page.setVisibility(View.VISIBLE);
|
||||
page.setAlpha(1.0F);
|
||||
} else {
|
||||
if (disableFading) {
|
||||
return;
|
||||
}
|
||||
page.setVisibility(View.VISIBLE);
|
||||
// position is between -1.0F & 0.0F OR 0.0F & 1.0F
|
||||
page.setAlpha(1.0F - Math.abs(position));
|
||||
|
|
|
|||
|
|
@ -28,6 +28,8 @@ import com.magicmicky.habitrpgwrapper.lib.models.tasks.ItemData;
|
|||
import com.magicmicky.habitrpgwrapper.lib.models.tasks.Task;
|
||||
import com.magicmicky.habitrpgwrapper.lib.models.tasks.TaskList;
|
||||
|
||||
import android.support.annotation.Nullable;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
|
@ -208,7 +210,7 @@ public interface ApiClient {
|
|||
|
||||
ErrorResponse getErrorResponse(HttpException throwable);
|
||||
|
||||
void updateAuthenticationCredentials(String userID, String apiToken);
|
||||
void updateAuthenticationCredentials(@Nullable String userID, @Nullable String apiToken);
|
||||
|
||||
boolean hasAuthenticationKeys();
|
||||
|
||||
|
|
|
|||
|
|
@ -612,10 +612,6 @@ public class HabitRPGUser extends BaseModel {
|
|||
}
|
||||
}
|
||||
|
||||
if (prefs.getSleep()) {
|
||||
layerMap.put(AvatarView.LayerType.ZZZ, "zzz");
|
||||
}
|
||||
|
||||
return layerMap;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
Se på livet ditt som et spill for å holde deg motivert og organiset! Habitica gjør det lett å ha det gøy samtidig som du når målene dine.
|
||||
|
||||
Sett inn dine Vaner, dine Daglige Gjøremål, og din Gjøremålsliste, for å så lage en tilpasset figur. Kryss av gjøremål for å øke nivået på figuren din og lås opp funksjoner som rustning, kjæledyr, ferdigheter, og til og med oppdrag! Slåss mot monstre med venner for å holde hverandre ansvarlige, og bruk gullet ditt på belønninger i spillet, som utstyr eller egendefinerte belønninger, som å se en episode av det TV-programmet du liker best. Fleksibelt, sosialt og moro, Habitica er den perfekte måten å motivere deg selv til å oppnå hva som helst.
|
||||
Sett inn dine Vaner, dine Daglige Gjøremål, og din Gjøremålsliste, for å så lage en tilpasset avatar. Kryss av gjøremål for å øke nivået på avataren din og lås opp funksjoner som rustning, kjæledyr, ferdigheter, og til og med oppdrag! Slåss mot monstre med venner for å holde hverandre ansvarlige, og bruk gullet ditt på belønninger i spillet, som utstyr eller egendefinerte belønninger, som å se en episode av det TV-programmet du liker best. Fleksibelt, sosialt og moro, Habitica er den perfekte måten å motivere deg selv til å oppnå hva som helst.
|
||||
|
||||
Vi er for øyeblikket i beta-stadiet, så føl deg fri til å gi tilbakemeldinger via mobile@habitica.com! Hvis du liker appen vår hadde vi virkelig satt pris på om du skrev en anmeldelse.</string>
|
||||
</resources>
|
||||
|
|
|
|||
Loading…
Reference in a new issue