mirror of
https://github.com/sudoxnym/habitica-android.git
synced 2026-04-14 19:56:32 +00:00
remove databinding
This commit is contained in:
parent
76ff959824
commit
2720c4457b
25 changed files with 798 additions and 1277 deletions
|
|
@ -59,8 +59,8 @@ dependencies {
|
|||
implementation 'com.jakewharton:butterknife:8.8.1'
|
||||
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
|
||||
//Dependency Injection
|
||||
implementation 'com.google.dagger:dagger:2.11'
|
||||
annotationProcessor 'com.google.dagger:dagger-compiler:2.11'
|
||||
implementation 'com.google.dagger:dagger:2.12'
|
||||
annotationProcessor 'com.google.dagger:dagger-compiler:2.12'
|
||||
compileOnly 'org.glassfish:javax.annotation:10.0-b28'
|
||||
//App Compatibility and Material Design
|
||||
implementation('com.mikepenz:materialdrawer:5.8.3@aar') {
|
||||
|
|
@ -236,10 +236,6 @@ android {
|
|||
universalApk true
|
||||
}
|
||||
}
|
||||
|
||||
dataBinding {
|
||||
enabled = true
|
||||
}
|
||||
}
|
||||
|
||||
Properties props = new Properties()
|
||||
|
|
|
|||
|
|
@ -1,44 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:bind="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools">
|
||||
<data>
|
||||
<variable name="text" type="String"/>
|
||||
<variable name="notes" type="String"/>
|
||||
<variable name="imageNamed" type="String"/>
|
||||
</data>
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:minHeight="60dp"
|
||||
android:padding="5dp"
|
||||
android:paddingTop="8dp"
|
||||
android:paddingBottom="8dp"
|
||||
android:clickable="true"
|
||||
android:background="@drawable/selection_highlight">
|
||||
<com.facebook.drawee.view.SimpleDraweeView
|
||||
android:layout_width="@dimen/avatar_width"
|
||||
android:layout_height="@dimen/avatar_height"
|
||||
bind:imageName='@{imageNamed == null ? "head_0" : imageNamed}'
|
||||
android:contentDescription="@{imageNamed}"
|
||||
android:alpha="@{imageNamed == null ? 0.4f : 1.0f}"
|
||||
android:scaleType="fitEnd"/>
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
<TextView android:layout_margin="5dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@{text != null ? text : @string/avatar_nothing}"
|
||||
tools:text="Text"
|
||||
android:textStyle="bold"/>
|
||||
<TextView android:layout_margin="5dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@android:color/darker_gray"
|
||||
tools:text="Value"
|
||||
android:text="@{notes}" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</layout>
|
||||
|
|
@ -1,66 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:bind="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools">
|
||||
<data>
|
||||
<import type="java.util.Map"/>
|
||||
<import type="com.habitrpg.android.habitica.models.user.Outfit" />
|
||||
<variable name="categorytitle" type="String"/>
|
||||
<variable name="outfit" type="Outfit"/>
|
||||
<variable
|
||||
name="equipmentNames"
|
||||
type="Map<String, String>" />
|
||||
</data>
|
||||
<android.support.v7.widget.CardView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/CardView.Default">
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:divider="?android:listDivider"
|
||||
android:showDividers="middle">
|
||||
<include layout="@layout/item_image_row"
|
||||
android:id="@+id/outfit_head"
|
||||
bind:title="@{@string/outfit_head}"
|
||||
bind:value="@{equipmentNames.get(outfit.getHead)}"
|
||||
bind:imageNamed='@{"shop_"+outfit.getHead}'/>
|
||||
<include layout="@layout/item_image_row"
|
||||
android:id="@+id/outfit_head_accessory"
|
||||
bind:title="@{@string/outfit_headAccessory}"
|
||||
bind:value="@{equipmentNames.get(outfit.getHeadAccessory)}"
|
||||
bind:imageNamed='@{"shop_"+outfit.getHeadAccessory}'/>
|
||||
<include layout="@layout/item_image_row"
|
||||
android:id="@+id/outfit_Eyewear"
|
||||
bind:title="@{@string/outfit_eyewear}"
|
||||
bind:value="@{equipmentNames.get(outfit.getEyeWear)}"
|
||||
bind:imageNamed='@{"shop_"+outfit.getEyeWear}'/>
|
||||
<include layout="@layout/item_image_row"
|
||||
android:id="@+id/outfit_Armor"
|
||||
bind:title="@{@string/outfit_armor}"
|
||||
bind:value='@{equipmentNames.get(outfit.getArmor)}'
|
||||
bind:imageNamed='@{"shop_"+outfit.getArmor}'/>
|
||||
<include layout="@layout/item_image_row"
|
||||
android:id="@+id/outfit_back"
|
||||
bind:title="@{@string/outfit_back}"
|
||||
bind:value="@{equipmentNames.get(outfit.getBack)}"
|
||||
bind:imageNamed='@{"shop_"+outfit.getBack}'/>
|
||||
<include layout="@layout/item_image_row"
|
||||
android:id="@+id/outfit_Body"
|
||||
bind:title="@{@string/outfit_body}"
|
||||
bind:value="@{equipmentNames.get(outfit.getBody)}"
|
||||
bind:imageNamed='@{"shop_"+outfit.getBody}'/>
|
||||
<include layout="@layout/item_image_row"
|
||||
android:id="@+id/outfit_weapon"
|
||||
bind:title="@{@string/outfit_weapon}"
|
||||
bind:value="@{equipmentNames.get(outfit.getWeapon)}"
|
||||
bind:imageNamed='@{"shop_"+outfit.getWeapon}'/>
|
||||
<include layout="@layout/item_image_row"
|
||||
android:id="@+id/outfit_shield"
|
||||
bind:title="@{@string/outfit_shield}"
|
||||
bind:value="@{equipmentNames.get(outfit.getShield)}"
|
||||
bind:imageNamed='@{"shop_"+outfit.getShield}'/>
|
||||
</LinearLayout>
|
||||
</android.support.v7.widget.CardView>
|
||||
</layout>
|
||||
|
|
@ -1,134 +1,123 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layout xmlns:bind="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<android.support.v4.widget.NestedScrollView
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:scrollbarSize="3dp"
|
||||
android:scrollbarThumbVertical="@color/md_grey_500"
|
||||
|
||||
<data>
|
||||
<import type="com.habitrpg.android.habitica.models.user.Preferences" />
|
||||
<import type="android.view.View" />
|
||||
android:scrollbars="vertical">
|
||||
|
||||
<variable
|
||||
name="preferences"
|
||||
type="Preferences" />
|
||||
</data>
|
||||
|
||||
|
||||
<android.support.v4.widget.NestedScrollView
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:scrollbarSize="3dp"
|
||||
android:scrollbarThumbVertical="@color/md_grey_500"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
android:scrollbars="vertical">
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/SectionTitle"
|
||||
android:text="@string/avatar_body"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||
|
||||
<LinearLayout
|
||||
<android.support.v7.widget.CardView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/SectionTitle"
|
||||
android:text="@string/avatar_body"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||
|
||||
<android.support.v7.widget.CardView
|
||||
style="@style/CardView.Default">
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/CardView.Default">
|
||||
android:orientation="vertical"
|
||||
android:divider="?android:listDivider"
|
||||
android:showDividers="middle">
|
||||
<LinearLayout
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="50dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:id="@+id/textView3"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:layout_marginRight="8dp"
|
||||
android:text="@string/avatar_size"
|
||||
android:gravity="center_vertical"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<Spinner
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:id="@+id/avatarSizeSpinner"
|
||||
android:spinnerMode="dropdown"
|
||||
android:layout_marginRight="8dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:entries="@array/avatar_sizes"/>
|
||||
</LinearLayout>
|
||||
<com.habitrpg.android.habitica.ui.views.EquipmentItemRow
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:divider="?android:listDivider"
|
||||
android:showDividers="middle">
|
||||
<LinearLayout
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="50dp">
|
||||
android:id="@+id/avatarShirtView"
|
||||
app:equipmentTitle="@string/avatar_shirt"/>
|
||||
<com.habitrpg.android.habitica.ui.views.EquipmentItemRow
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/avatarSkinView"
|
||||
app:equipmentTitle="@string/avatar_skin"/>
|
||||
</LinearLayout>
|
||||
</android.support.v7.widget.CardView>
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/avatar_hair"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
style="@style/SectionTitle"/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:id="@+id/textView3"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:layout_marginRight="8dp"
|
||||
android:text="@string/avatar_size"
|
||||
android:gravity="center_vertical"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<Spinner
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:id="@+id/avatar_size_spinner"
|
||||
android:spinnerMode="dropdown"
|
||||
android:layout_marginRight="8dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:entries="@array/avatar_sizes"/>
|
||||
</LinearLayout>
|
||||
<include layout="@layout/item_image_row"
|
||||
android:id="@+id/avatar_shirt"
|
||||
bind:title="@{@string/avatar_shirt}"
|
||||
bind:value="@{preferences.getShirt}"
|
||||
bind:imageNamed='@{preferences.getSize + "_shirt_" + preferences.getShirt}'/>
|
||||
<include layout="@layout/item_image_row"
|
||||
android:id="@+id/avatar_skin"
|
||||
bind:title="@{@string/avatar_skin}"
|
||||
bind:value="@{preferences.getSkin}"
|
||||
bind:imageNamed='@{"skin_" + preferences.getSkin}' />
|
||||
</LinearLayout>
|
||||
</android.support.v7.widget.CardView>
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/avatar_hair"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
style="@style/SectionTitle"/>
|
||||
|
||||
<android.support.v7.widget.CardView
|
||||
<android.support.v7.widget.CardView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/CardView.Default">
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/CardView.Default">
|
||||
<LinearLayout
|
||||
android:orientation="vertical"
|
||||
android:divider="?android:listDivider"
|
||||
android:showDividers="middle">
|
||||
<com.habitrpg.android.habitica.ui.views.EquipmentItemRow
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:divider="?android:listDivider"
|
||||
android:showDividers="middle">
|
||||
<include layout="@layout/item_image_row"
|
||||
android:id="@+id/avatar_hair_color"
|
||||
bind:title="@{@string/avatar_color}"
|
||||
bind:value="@{preferences.getHair.getColor}"
|
||||
bind:imageNamed='@{"hair_bangs_1_" + preferences.getHair.getColor}' />
|
||||
<include layout="@layout/item_image_row"
|
||||
android:id="@+id/avatar_hair_base"
|
||||
bind:title="@{@string/avatar_base}"
|
||||
bind:valueInt="@{preferences.getHair.getBase}"
|
||||
bind:imageNamed='@{preferences.getHair.getBase == 0 ? null : "hair_base_" + preferences.getHair.getBase + "_" + preferences.getHair.getColor}' />
|
||||
<include layout="@layout/item_image_row"
|
||||
android:id="@+id/avatar_hair_bangs"
|
||||
bind:title="@{@string/avatar_bangs}"
|
||||
bind:valueInt="@{preferences.getHair.getBangs}"
|
||||
bind:imageNamed='@{preferences.getHair.getBangs == 0 ? null : "hair_bangs_" + preferences.getHair.getBangs + "_" + preferences.getHair.getColor}' />
|
||||
<include layout="@layout/item_image_row"
|
||||
android:id="@+id/avatar_hair_flower"
|
||||
bind:title="@{@string/avatar_flower}"
|
||||
bind:valueInt="@{preferences.getHair.getFlower}"
|
||||
bind:imageNamed='@{preferences.getHair.getFlower == 0 ? null : "hair_flower_" + preferences.getHair.getFlower}' />
|
||||
<include layout="@layout/item_image_row"
|
||||
android:id="@+id/avatar_hair_beard"
|
||||
bind:title="@{@string/avatar_beard}"
|
||||
bind:valueInt="@{preferences.getHair.getBeard}"
|
||||
bind:imageNamed='@{preferences.getHair.getBeard == 0 ? null : "hair_beard_" + preferences.getHair.getBeard + "_" + preferences.getHair.getColor}' />
|
||||
<include layout="@layout/item_image_row"
|
||||
android:id="@+id/avatar_hair_mustache"
|
||||
bind:title="@{@string/avatar_mustache}"
|
||||
bind:valueInt="@{preferences.getHair.getMustache}"
|
||||
bind:imageNamed='@{preferences.getHair.getMustache == 0 ? null : "hair_mustache_" + preferences.getHair.getMustache + "_" + preferences.getHair.getColor}' />
|
||||
</LinearLayout>
|
||||
android:id="@+id/avatarHairColorView"
|
||||
app:equipmentTitle="@string/avatar_color" />
|
||||
<com.habitrpg.android.habitica.ui.views.EquipmentItemRow
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/avatarHairBaseView"
|
||||
app:equipmentTitle="@string/avatar_base" />
|
||||
<com.habitrpg.android.habitica.ui.views.EquipmentItemRow
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/avatarHairBangsView"
|
||||
app:equipmentTitle="@string/avatar_bangs" />
|
||||
<com.habitrpg.android.habitica.ui.views.EquipmentItemRow
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/avatarHairFlowerView"
|
||||
app:equipmentTitle="@string/avatar_flower" />
|
||||
<com.habitrpg.android.habitica.ui.views.EquipmentItemRow
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/avatarHairBeardView"
|
||||
app:equipmentTitle="@string/avatar_beard" />
|
||||
<com.habitrpg.android.habitica.ui.views.EquipmentItemRow
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/avatarHairMustacheView"
|
||||
app:equipmentTitle="@string/avatar_mustache" />
|
||||
</LinearLayout>
|
||||
</android.support.v7.widget.CardView>
|
||||
|
||||
<TextView
|
||||
|
|
@ -146,12 +135,12 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
<include layout="@layout/avatar_background_overview_card"
|
||||
android:id="@+id/avatar_background"
|
||||
bind:text="@{preferences.getBackground}"
|
||||
bind:imageNamed='@{"background_" + preferences.getBackground}' />
|
||||
<com.habitrpg.android.habitica.ui.views.EquipmentItemRow
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/avatarBackgroundView"
|
||||
app:equipmentTitle="@string/avatar_background" />
|
||||
</LinearLayout>
|
||||
</android.support.v7.widget.CardView>
|
||||
</LinearLayout>
|
||||
</android.support.v4.widget.NestedScrollView>
|
||||
</layout>
|
||||
</android.support.v4.widget.NestedScrollView>
|
||||
|
|
|
|||
|
|
@ -1,77 +1,149 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layout xmlns:bind="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<android.support.v4.widget.NestedScrollView
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:scrollbarSize="3dp"
|
||||
android:scrollbarThumbVertical="@color/md_grey_500"
|
||||
android:scrollbars="vertical"
|
||||
android:paddingTop="@dimen/row_padding">
|
||||
|
||||
<data>
|
||||
<import type="java.util.Map"/>
|
||||
<import type="com.habitrpg.android.habitica.models.user.Outfit" />
|
||||
<import type="android.view.View" />
|
||||
|
||||
<variable
|
||||
name="currentBattleGear"
|
||||
type="Outfit" />
|
||||
<variable
|
||||
name="currentCostume"
|
||||
type="Outfit" />
|
||||
<variable
|
||||
name="usingCostume"
|
||||
type="Boolean" />
|
||||
<variable
|
||||
name="equipmentNames"
|
||||
type="Map<String, String>" />
|
||||
</data>
|
||||
|
||||
|
||||
<android.support.v4.widget.NestedScrollView
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:scrollbarSize="3dp"
|
||||
android:scrollbarThumbVertical="@color/md_grey_500"
|
||||
android:scrollbars="vertical"
|
||||
android:paddingTop="@dimen/row_padding">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:paddingBottom="?attr/actionBarSize">
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/SectionTitle"
|
||||
android:text="@string/battle_gear"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||
<android.support.v7.widget.CardView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:paddingBottom="?attr/actionBarSize">
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/SectionTitle"
|
||||
android:text="@string/battle_gear"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||
<include layout="@layout/equipment_overview_list"
|
||||
android:id="@+id/battle_gear_group"
|
||||
bind:outfit="@{currentBattleGear}"
|
||||
bind:equipmentNames="@{equipmentNames}" />
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/SectionTitle"
|
||||
android:text="@string/costume"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||
style="@style/CardView.Default">
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="@dimen/row_padding">
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:orientation="vertical"
|
||||
android:divider="?android:listDivider"
|
||||
android:showDividers="middle">
|
||||
<com.habitrpg.android.habitica.ui.views.EquipmentItemRow
|
||||
android:id="@+id/battleGearHeadView"
|
||||
app:equipmentTitle="@string/outfit_head"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/wear_costume"/>
|
||||
|
||||
<Switch
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_width="match_parent"/>
|
||||
<com.habitrpg.android.habitica.ui.views.EquipmentItemRow
|
||||
android:id="@+id/battleGearHeadAccessoryView"
|
||||
app:equipmentTitle="@string/outfit_headAccessory"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="match_parent"/>
|
||||
<com.habitrpg.android.habitica.ui.views.EquipmentItemRow
|
||||
android:id="@+id/battleGearEyewearView"
|
||||
app:equipmentTitle="@string/outfit_eyewear"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="match_parent"/>
|
||||
<com.habitrpg.android.habitica.ui.views.EquipmentItemRow
|
||||
android:id="@+id/battleGearArmorView"
|
||||
app:equipmentTitle="@string/outfit_armor"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="match_parent"/>
|
||||
<com.habitrpg.android.habitica.ui.views.EquipmentItemRow
|
||||
android:id="@+id/battleGearBackView"
|
||||
app:equipmentTitle="@string/outfit_back"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="match_parent"/>
|
||||
<com.habitrpg.android.habitica.ui.views.EquipmentItemRow
|
||||
android:id="@+id/battleGearBodyView"
|
||||
app:equipmentTitle="@string/outfit_body"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="match_parent"/>
|
||||
<com.habitrpg.android.habitica.ui.views.EquipmentItemRow
|
||||
android:id="@+id/battleGearWeaponView"
|
||||
app:equipmentTitle="@string/outfit_weapon"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="match_parent"/>
|
||||
<com.habitrpg.android.habitica.ui.views.EquipmentItemRow
|
||||
android:id="@+id/battleGearShieldView"
|
||||
app:equipmentTitle="@string/outfit_shield"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/costume_switch"
|
||||
android:checked="@{usingCostume}"/>
|
||||
|
||||
android:layout_width="match_parent"/>
|
||||
</LinearLayout>
|
||||
<include layout="@layout/equipment_overview_list"
|
||||
android:id="@+id/costume_group"
|
||||
bind:outfit="@{currentCostume}"
|
||||
bind:equipmentNames="@{equipmentNames}" />
|
||||
</android.support.v7.widget.CardView>
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/SectionTitle"
|
||||
android:text="@string/costume"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="@dimen/row_padding">
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/wear_costume"/>
|
||||
<Switch
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/costumeSwitch"/>
|
||||
|
||||
</LinearLayout>
|
||||
</android.support.v4.widget.NestedScrollView>
|
||||
</layout>
|
||||
<android.support.v7.widget.CardView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/CardView.Default">
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:divider="?android:listDivider"
|
||||
android:showDividers="middle">
|
||||
<com.habitrpg.android.habitica.ui.views.EquipmentItemRow
|
||||
android:id="@+id/costumeHeadView"
|
||||
app:equipmentTitle="@string/outfit_head"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="match_parent"/>
|
||||
<com.habitrpg.android.habitica.ui.views.EquipmentItemRow
|
||||
android:id="@+id/costumeHeadAccessoryView"
|
||||
app:equipmentTitle="@string/outfit_headAccessory"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="match_parent"/>
|
||||
<com.habitrpg.android.habitica.ui.views.EquipmentItemRow
|
||||
android:id="@+id/costumeEyewearView"
|
||||
app:equipmentTitle="@string/outfit_eyewear"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="match_parent"/>
|
||||
<com.habitrpg.android.habitica.ui.views.EquipmentItemRow
|
||||
android:id="@+id/costumeArmorView"
|
||||
app:equipmentTitle="@string/outfit_armor"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="match_parent"/>
|
||||
<com.habitrpg.android.habitica.ui.views.EquipmentItemRow
|
||||
android:id="@+id/costumeBackView"
|
||||
app:equipmentTitle="@string/outfit_back"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="match_parent"/>
|
||||
<com.habitrpg.android.habitica.ui.views.EquipmentItemRow
|
||||
android:id="@+id/costumeBodyView"
|
||||
app:equipmentTitle="@string/outfit_body"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="match_parent"/>
|
||||
<com.habitrpg.android.habitica.ui.views.EquipmentItemRow
|
||||
android:id="@+id/costumeWeaponView"
|
||||
app:equipmentTitle="@string/outfit_weapon"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="match_parent"/>
|
||||
<com.habitrpg.android.habitica.ui.views.EquipmentItemRow
|
||||
android:id="@+id/costumeShieldView"
|
||||
app:equipmentTitle="@string/outfit_shield"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="match_parent"/>
|
||||
</LinearLayout>
|
||||
</android.support.v7.widget.CardView>
|
||||
</LinearLayout>
|
||||
</android.support.v4.widget.NestedScrollView>
|
||||
|
|
@ -1,335 +1,131 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layout xmlns:bind="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<android.support.v4.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:scrollbarSize="3dp"
|
||||
android:scrollbarThumbVertical="@color/md_grey_500"
|
||||
android:scrollbars="vertical">
|
||||
|
||||
<data>
|
||||
<import type="com.habitrpg.android.habitica.models.social.Group" />
|
||||
<import type="com.habitrpg.android.habitica.models.inventory.QuestContent" />
|
||||
<import type="com.habitrpg.android.habitica.models.invitations.PartyInvite" />
|
||||
<import type="com.habitrpg.android.habitica.models.user.User" />
|
||||
<import type="android.view.View" />
|
||||
<import type="android.text.Html"/>
|
||||
|
||||
<variable
|
||||
name="group"
|
||||
type="Group" />
|
||||
|
||||
<variable
|
||||
name="quest"
|
||||
type="QuestContent" />
|
||||
|
||||
<variable
|
||||
name="user"
|
||||
type="User" />
|
||||
|
||||
<variable
|
||||
name="hideParticipantCard"
|
||||
type="Boolean" />
|
||||
|
||||
<variable
|
||||
name="invitation"
|
||||
type="PartyInvite" />
|
||||
|
||||
</data>
|
||||
|
||||
|
||||
<android.support.v4.widget.NestedScrollView
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:scrollbarSize="3dp"
|
||||
android:scrollbarThumbVertical="@color/md_grey_500"
|
||||
android:scrollbars="vertical">
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:paddingBottom="?android:actionBarSize">
|
||||
|
||||
<LinearLayout
|
||||
<android.support.v7.widget.CardView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:paddingBottom="?android:actionBarSize">
|
||||
style="@style/CardView.Default"
|
||||
android:id="@+id/invitationWrapper">
|
||||
|
||||
<android.support.v7.widget.CardView
|
||||
<LinearLayout
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
style="@style/CardContent">
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/CardView.Default"
|
||||
android:id="@+id/invitationWrapper"
|
||||
android:visibility="@{invitation == null ? View.GONE : View.VISIBLE}">
|
||||
android:text="@string/invited_to_party" />
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:layout_gravity="right">
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
style="@style/CardContent">
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/invited_to_party" />
|
||||
<LinearLayout
|
||||
<Button
|
||||
android:id="@+id/buttonPartyInviteAccept"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:layout_gravity="right">
|
||||
android:text="@string/quest.accept"
|
||||
android:textColor="@color/btn_success"
|
||||
style="?android:buttonBarButtonStyle" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnPartyInviteAccept"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/quest.accept"
|
||||
android:textColor="@color/btn_success"
|
||||
style="?android:buttonBarButtonStyle" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnPartyInviteReject"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/quest.reject"
|
||||
android:textColor="@color/btn_danger"
|
||||
style="?android:buttonBarButtonStyle" />
|
||||
</LinearLayout>
|
||||
android:id="@+id/buttonPartyInviteReject"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/quest.reject"
|
||||
android:textColor="@color/btn_danger"
|
||||
style="?android:buttonBarButtonStyle" />
|
||||
</LinearLayout>
|
||||
</android.support.v7.widget.CardView>
|
||||
</LinearLayout>
|
||||
</android.support.v7.widget.CardView>
|
||||
|
||||
<android.support.v7.widget.CardView
|
||||
<android.support.v7.widget.CardView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/CardView.Default"
|
||||
android:id="@+id/qrWrapper">
|
||||
<LinearLayout
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
style="@style/CardContent">
|
||||
|
||||
<include layout="@layout/qr_code" />
|
||||
</LinearLayout>
|
||||
</android.support.v7.widget.CardView>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/groupNameView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/SectionTitle"/>
|
||||
|
||||
<android.support.v7.widget.CardView
|
||||
android:id="@+id/groupDescriptionWrapper"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/CardView.Default">
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/CardView.Default"
|
||||
android:id="@+id/qrWrapper"
|
||||
android:visibility="@{group == null ? View.VISIBLE : View.GONE}"
|
||||
>
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
style="@style/CardContent">
|
||||
|
||||
<include layout="@layout/qr_code" />
|
||||
</LinearLayout>
|
||||
</android.support.v7.widget.CardView>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@{group.name}"
|
||||
style="@style/SectionTitle"
|
||||
android:visibility="@{group.description.length() == 0 && group.balance == 0 ? View.GONE : View.VISIBLE}"/>
|
||||
|
||||
<android.support.v7.widget.CardView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/CardView.Default"
|
||||
android:visibility="@{group.description.length() == 0 && group.leaderMessage.length() == 0 && group.balance == 0 ? View.GONE : View.VISIBLE}">
|
||||
style="@style/CardContent"
|
||||
android:divider="?android:listDivider"
|
||||
android:showDividers="middle"
|
||||
android:orientation="vertical">
|
||||
<net.pherth.android.emoji_library.EmojiTextView
|
||||
android:id="@+id/groupDescriptionView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
<LinearLayout
|
||||
android:id="@+id/leadernameWrapper"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
<TextView
|
||||
android:id="@+id/leadernameTextView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
</LinearLayout>
|
||||
<LinearLayout
|
||||
android:id="@+id/leaderMessageWrapper"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/CardContent"
|
||||
android:divider="?android:listDivider"
|
||||
android:showDividers="middle"
|
||||
android:orientation="vertical">
|
||||
<net.pherth.android.emoji_library.EmojiTextView
|
||||
android:id="@+id/leaderMessageTextView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
bind:parsemarkdown="@{group.description}" />
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:visibility="@{group.leaderName.length() == 0 ? View.GONE : View.VISIBLE}">
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@{@string/leaderName(group.leaderName)}" />
|
||||
</LinearLayout>
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:visibility="@{group.leaderMessage.length() == 0 ? View.GONE : View.VISIBLE}">
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@{@string/leaderMessage(group.leaderName)}" />
|
||||
<net.pherth.android.emoji_library.EmojiTextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
bind:parsemarkdown="@{group.leaderMessage}"/>
|
||||
</LinearLayout>
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:visibility='@{group.type.equals("guild") ? View.VISIBLE : View.GONE}' >
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/gems"/>
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@{String.valueOf(group.balance * 4)}"/>
|
||||
</LinearLayout>
|
||||
android:layout_height="wrap_content"/>
|
||||
</LinearLayout>
|
||||
|
||||
</android.support.v7.widget.CardView>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/quest"
|
||||
style="@style/SectionTitle"
|
||||
android:visibility="@{quest != null ? View.VISIBLE : View.GONE}" />
|
||||
|
||||
<android.support.v7.widget.CardView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/CardView.Default"
|
||||
android:visibility="@{quest != null && !group.quest.active ? View.VISIBLE : View.GONE}">
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
style="@style/CardContent">
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/quest.invitation"
|
||||
style="@style/CardTitle" />
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/quest.invitation.text"
|
||||
style="@style/CardText"
|
||||
android:visibility="@{user.getParty().getQuest().RSVPNeeded? View.VISIBLE : View.GONE}"/>
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:layout_gravity="right">
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnQuestAccept"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/quest.accept"
|
||||
android:textColor="@color/btn_success"
|
||||
style="?android:buttonBarButtonStyle"
|
||||
android:visibility="@{user.getParty().getQuest().RSVPNeeded? View.VISIBLE : View.GONE}" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnQuestReject"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/quest.reject"
|
||||
android:textColor="@color/btn_danger"
|
||||
style="?android:buttonBarButtonStyle"
|
||||
android:visibility="@{user.getParty().getQuest().RSVPNeeded? View.VISIBLE : View.GONE}" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnQuestBegin"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/quest.begin"
|
||||
android:textColor="@color/btn_warning"
|
||||
style="?android:buttonBarButtonStyle"
|
||||
android:visibility="@{user.getId().equals(group.quest.leader) ? View.VISIBLE : View.GONE}" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnQuestCancel"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/quest.cancel"
|
||||
android:textColor="@color/btn_danger"
|
||||
style="?android:buttonBarButtonStyle"
|
||||
android:visibility="@{user.getId().equals(group.quest.leader) ? View.VISIBLE : View.GONE}" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
</android.support.v7.widget.CardView>
|
||||
|
||||
<android.support.v7.widget.CardView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/CardView.Default"
|
||||
android:visibility="@{quest != null ? View.VISIBLE : View.GONE}">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/gemCountWrapper"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
style="@style/CardContent">
|
||||
|
||||
android:orientation="horizontal">
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:text="@{quest.text}"
|
||||
style="@style/CardTitle"
|
||||
/>
|
||||
|
||||
<com.facebook.drawee.view.SimpleDraweeView
|
||||
android:layout_width="@dimen/quest_image_width"
|
||||
android:layout_height="@dimen/quest_image_height"
|
||||
android:layout_marginBottom="8dp"
|
||||
bind:imageName='@{"quest_"+ quest.key}'
|
||||
/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
style="?android:buttonBarStyle"
|
||||
android:visibility="@{group.quest.active ? View.VISIBLE : View.GONE}">
|
||||
|
||||
<android.support.v7.widget.RecyclerView
|
||||
android:id="@+id/collectionStats"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:layout_margin="@dimen/row_padding"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
android:layout_weight="1"
|
||||
android:text="@string/gems"/>
|
||||
<TextView
|
||||
android:id="@+id/gemCountTextView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/CardText"
|
||||
/>
|
||||
|
||||
android:layout_height="wrap_content"/>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
</android.support.v7.widget.CardView>
|
||||
|
||||
<android.support.v7.widget.CardView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/CardView.Default"
|
||||
android:visibility="@{quest != null && !hideParticipantCard ? View.VISIBLE : View.GONE}">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
style="@style/CardContent">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/quest.participants"
|
||||
android:id="@+id/textView12"
|
||||
style="@style/CardTitle" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/questMemberView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:divider="?android:listDivider"
|
||||
android:showDividers="middle"
|
||||
style="@style/CardContent"/>
|
||||
</LinearLayout>
|
||||
|
||||
</android.support.v7.widget.CardView>
|
||||
</LinearLayout>
|
||||
</android.support.v4.widget.NestedScrollView>
|
||||
</layout>
|
||||
</android.support.v7.widget.CardView>
|
||||
</LinearLayout>
|
||||
</android.support.v4.widget.NestedScrollView>
|
||||
|
|
|
|||
|
|
@ -1,43 +1,34 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:bind="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools">
|
||||
<data>
|
||||
<variable name="title" type="String"/>
|
||||
<variable name="value" type="String"/>
|
||||
<variable name="valueInt" type="int"/>
|
||||
<variable name="imageNamed" type="String"/>
|
||||
</data>
|
||||
<LinearLayout
|
||||
<LinearLayout
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/RowWrapper"
|
||||
android:clickable="true"
|
||||
android:focusable="true">
|
||||
<com.facebook.drawee.view.SimpleDraweeView
|
||||
android:id="@+id/imageView"
|
||||
android:layout_width="@dimen/gear_image_size"
|
||||
android:layout_height="@dimen/gear_image_size"
|
||||
actualImageScaleType="fitCenter"
|
||||
android:layout_marginRight="@dimen/row_padding"/>
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:layout_gravity="center_vertical">
|
||||
<TextView
|
||||
android:id="@+id/titleTextView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/RowWrapper"
|
||||
android:clickable="true">
|
||||
<com.facebook.drawee.view.SimpleDraweeView
|
||||
android:layout_width="@dimen/gear_image_size"
|
||||
android:layout_height="@dimen/gear_image_size"
|
||||
bind:imageName='@{imageNamed == null ? "head_0" : imageNamed}'
|
||||
android:contentDescription="@{imageNamed}"
|
||||
android:alpha="@{imageNamed == null ? 0.4f : 1.0f}"
|
||||
bind:actualImageScaleType="fitCenter"
|
||||
android:layout_marginRight="@dimen/row_padding"/>
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:layout_gravity="center_vertical">
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@{title}"
|
||||
tools:text="Title"
|
||||
style="@style/RowTitle"/>
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
tools:text="Value"
|
||||
android:text="@{value != null ? value : (valueInt != 0 ? String.valueOf(valueInt) : @string/avatar_nothing)}"
|
||||
style="@style/RowText"/>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</layout>
|
||||
tools:text="Title"
|
||||
style="@style/RowTitle"/>
|
||||
<TextView
|
||||
android:id="@+id/valueTextView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
tools:text="Value"
|
||||
style="@style/RowText"/>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
|
|
|||
|
|
@ -53,4 +53,7 @@
|
|||
<attr name="statsTitle" format="string" />
|
||||
<attr name="statsColor" format="color" />
|
||||
</declare-styleable>
|
||||
<declare-styleable name="EquipmentItemRow">
|
||||
<attr name="equipmentTitle" format="string" />
|
||||
</declare-styleable>
|
||||
</resources>
|
||||
|
|
|
|||
|
|
@ -2,8 +2,6 @@ package com.habitrpg.android.habitica.ui.activities;
|
|||
|
||||
import android.app.AlertDialog;
|
||||
import android.content.Intent;
|
||||
import android.databinding.ObservableArrayList;
|
||||
import android.databinding.ObservableList;
|
||||
import android.graphics.drawable.BitmapDrawable;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Bundle;
|
||||
|
|
@ -55,6 +53,7 @@ import org.greenrobot.eventbus.EventBus;
|
|||
import org.greenrobot.eventbus.Subscribe;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
|
@ -147,7 +146,7 @@ public class ChallengeDetailActivity extends BaseActivity {
|
|||
|
||||
String challengeId = extras.getString(CHALLENGE_ID);
|
||||
|
||||
ObservableList<Task> fullList = new ObservableArrayList<>();
|
||||
List<Task> fullList = new ArrayList<>();
|
||||
|
||||
userRepository.getUser(userId).first().subscribe(user -> {
|
||||
ChallengeDetailActivity.this.user = user;
|
||||
|
|
@ -242,7 +241,7 @@ public class ChallengeDetailActivity extends BaseActivity {
|
|||
}
|
||||
}
|
||||
|
||||
private void createTaskRecyclerFragment(ObservableList<Task> fullList) {
|
||||
private void createTaskRecyclerFragment(List<Task> fullList) {
|
||||
ChallengeTasksRecyclerViewFragment fragment = ChallengeTasksRecyclerViewFragment.newInstance(user, fullList);
|
||||
|
||||
if (getSupportFragmentManager().getFragments() == null) {
|
||||
|
|
|
|||
|
|
@ -258,8 +258,8 @@ public class MainActivity extends BaseActivity implements TutorialView.OnTutoria
|
|||
setupToolbar(toolbar);
|
||||
|
||||
avatarInHeader = new AvatarWithBarsViewModel(this, avatar_with_bars);
|
||||
accountHeader = MainDrawerBuilder.INSTANCE.CreateDefaultAccountHeader(this).build();
|
||||
drawer = MainDrawerBuilder.INSTANCE.CreateDefaultBuilderSettings(this, sharedPreferences, toolbar, accountHeader)
|
||||
accountHeader = MainDrawerBuilder.INSTANCE.createDefaultAccountHeader(this).build();
|
||||
drawer = MainDrawerBuilder.INSTANCE.createDefaultBuilderSettings(this, sharedPreferences, toolbar, accountHeader)
|
||||
.build();
|
||||
drawer.setSelectionAtPosition(1, false);
|
||||
sideAvatarView = new AvatarView(this, true, false, false);
|
||||
|
|
|
|||
|
|
@ -1,17 +1,15 @@
|
|||
package com.habitrpg.android.habitica.ui.adapter;
|
||||
|
||||
import com.habitrpg.android.habitica.R;
|
||||
import com.habitrpg.android.habitica.models.tasks.Task;
|
||||
|
||||
import android.databinding.DataBindingUtil;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.habitrpg.android.habitica.R;
|
||||
import com.habitrpg.android.habitica.models.tasks.Task;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import butterknife.BindView;
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
package com.habitrpg.android.habitica.ui.adapter.tasks;
|
||||
|
||||
import android.content.Context;
|
||||
import android.databinding.ObservableArrayList;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.view.LayoutInflater;
|
||||
|
|
@ -109,7 +108,7 @@ public abstract class BaseTasksRecyclerViewAdapter<VH extends BaseTaskViewHolder
|
|||
if (this.taskFilterHelper == null || this.taskFilterHelper.howMany(taskType) == 0) {
|
||||
filteredContent = content;
|
||||
} else {
|
||||
filteredContent = new ObservableArrayList<>();
|
||||
filteredContent = new ArrayList<>();
|
||||
filteredContent.addAll(this.taskFilterHelper.filter(content));
|
||||
}
|
||||
|
||||
|
|
@ -132,7 +131,7 @@ public abstract class BaseTasksRecyclerViewAdapter<VH extends BaseTaskViewHolder
|
|||
}
|
||||
|
||||
public void setTasks(List<Task> tasks) {
|
||||
this.content = new ObservableArrayList<>();
|
||||
this.content = new ArrayList<>();
|
||||
this.content.addAll(tasks);
|
||||
filter();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,173 +0,0 @@
|
|||
package com.habitrpg.android.habitica.ui.fragments.inventory.customization;
|
||||
|
||||
import android.databinding.DataBindingUtil;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.Spinner;
|
||||
|
||||
import com.habitrpg.android.habitica.R;
|
||||
import com.habitrpg.android.habitica.components.AppComponent;
|
||||
import com.habitrpg.android.habitica.data.UserRepository;
|
||||
import com.habitrpg.android.habitica.databinding.FragmentAvatarOverviewBinding;
|
||||
import com.habitrpg.android.habitica.helpers.RxErrorHandler;
|
||||
import com.habitrpg.android.habitica.models.user.User;
|
||||
import com.habitrpg.android.habitica.ui.fragments.BaseMainFragment;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
|
||||
public class AvatarOverviewFragment extends BaseMainFragment implements AdapterView.OnItemSelectedListener {
|
||||
|
||||
@Inject
|
||||
UserRepository userRepository;
|
||||
|
||||
FragmentAvatarOverviewBinding viewBinding;
|
||||
|
||||
@BindView(R.id.avatar_size_spinner)
|
||||
Spinner avatarSizeSpinner;
|
||||
|
||||
@BindView(R.id.avatar_shirt)
|
||||
View avatarShirtView;
|
||||
|
||||
@BindView(R.id.avatar_skin)
|
||||
View avatarSkinView;
|
||||
|
||||
@BindView(R.id.avatar_hair_color)
|
||||
View avatarHairColorView;
|
||||
|
||||
@BindView(R.id.avatar_hair_base)
|
||||
View avatarHairBaseView;
|
||||
|
||||
@BindView(R.id.avatar_hair_bangs)
|
||||
View avatarHairBangsView;
|
||||
|
||||
@BindView(R.id.avatar_hair_flower)
|
||||
View avatarHairFlowerView;
|
||||
|
||||
@BindView(R.id.avatar_hair_beard)
|
||||
View avatarHairBeardView;
|
||||
|
||||
@BindView(R.id.avatar_hair_mustache)
|
||||
View avatarHairMustacheView;
|
||||
|
||||
@BindView(R.id.avatar_background)
|
||||
View avatarBackgroundView;
|
||||
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
if (apiClient != null) {
|
||||
apiClient.getContent()
|
||||
.subscribe(contentResult -> {}, RxErrorHandler.handleEmptyError());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
super.onCreateView(inflater, container, savedInstanceState);
|
||||
View view = inflater.inflate(R.layout.fragment_avatar_overview, container, false);
|
||||
|
||||
if (this.user == null) {
|
||||
return view;
|
||||
}
|
||||
|
||||
viewBinding = DataBindingUtil.bind(view);
|
||||
viewBinding.setPreferences(this.user.getPreferences());
|
||||
|
||||
unbinder = ButterKnife.bind(this, view);
|
||||
|
||||
this.setSize(this.user.getPreferences().getSize());
|
||||
avatarSizeSpinner.setOnItemSelectedListener(this);
|
||||
|
||||
avatarShirtView.setOnClickListener(v1 -> displayCustomizationFragment("shirt", null));
|
||||
|
||||
avatarSkinView.setOnClickListener(v1 -> displayCustomizationFragment("skin", null));
|
||||
|
||||
avatarHairColorView.setOnClickListener(v1 -> displayCustomizationFragment("hair", "color"));
|
||||
avatarHairBangsView.setOnClickListener(v1 -> displayCustomizationFragment("hair", "bangs"));
|
||||
avatarHairBaseView.setOnClickListener(v1 -> displayCustomizationFragment("hair", "base"));
|
||||
avatarHairFlowerView.setOnClickListener(v1 -> displayCustomizationFragment("hair", "flower"));
|
||||
avatarHairBeardView.setOnClickListener(v1 -> displayCustomizationFragment("hair", "beard"));
|
||||
avatarHairMustacheView.setOnClickListener(v1 -> displayCustomizationFragment("hair", "mustache"));
|
||||
avatarBackgroundView.setOnClickListener(v1 -> displayCustomizationFragment("background", null));
|
||||
|
||||
return view;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
userRepository.close();
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void injectFragment(AppComponent component) {
|
||||
component.inject(this);
|
||||
}
|
||||
|
||||
private void displayCustomizationFragment(String type, @Nullable String category) {
|
||||
AvatarCustomizationFragment fragment = new AvatarCustomizationFragment();
|
||||
fragment.type = type;
|
||||
fragment.category = category;
|
||||
if (activity != null) {
|
||||
activity.displayFragment(fragment);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateUserData(User user) {
|
||||
super.updateUserData(user);
|
||||
if (user != null && viewBinding != null) {
|
||||
viewBinding.setPreferences(user.getPreferences());
|
||||
this.setSize(user.getPreferences().getSize());
|
||||
}
|
||||
}
|
||||
|
||||
private void setSize(String size) {
|
||||
if (avatarSizeSpinner == null) {
|
||||
return;
|
||||
}
|
||||
if (size.equals("slim")) {
|
||||
avatarSizeSpinner.setSelection(0, false);
|
||||
} else {
|
||||
avatarSizeSpinner.setSelection(1, false);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
|
||||
String newSize;
|
||||
if (position == 0) {
|
||||
newSize = "slim";
|
||||
} else {
|
||||
newSize = "broad";
|
||||
}
|
||||
|
||||
if (this.user != null && !this.user.getPreferences().getSize().equals(newSize)) {
|
||||
userRepository.updateUser(user, "preferences.size", newSize)
|
||||
.subscribe(user1 -> {}, RxErrorHandler.handleEmptyError());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNothingSelected(AdapterView<?> parent) {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String customTitle() {
|
||||
if (!isAdded()) {
|
||||
return "";
|
||||
}
|
||||
return getString(R.string.sidebar_avatar);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,98 @@
|
|||
package com.habitrpg.android.habitica.ui.fragments.inventory.customization
|
||||
|
||||
import android.os.Bundle
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.AdapterView
|
||||
import com.habitrpg.android.habitica.R
|
||||
import com.habitrpg.android.habitica.components.AppComponent
|
||||
import com.habitrpg.android.habitica.helpers.RxErrorHandler
|
||||
import com.habitrpg.android.habitica.models.user.User
|
||||
import com.habitrpg.android.habitica.ui.fragments.BaseMainFragment
|
||||
import kotlinx.android.synthetic.main.fragment_avatar_overview.*
|
||||
import rx.functions.Action1
|
||||
|
||||
class AvatarOverviewFragment : BaseMainFragment(), AdapterView.OnItemSelectedListener {
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
|
||||
if (apiClient != null) {
|
||||
apiClient.content
|
||||
.subscribe(Action1 { }, RxErrorHandler.handleEmptyError())
|
||||
}
|
||||
}
|
||||
|
||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
|
||||
savedInstanceState: Bundle?): View? {
|
||||
super.onCreateView(inflater, container, savedInstanceState)
|
||||
val view = inflater.inflate(R.layout.fragment_avatar_overview, container, false)
|
||||
|
||||
if (this.user == null) {
|
||||
return view
|
||||
}
|
||||
|
||||
this.setSize(this.user?.preferences?.size)
|
||||
avatarSizeSpinner.onItemSelectedListener = this
|
||||
|
||||
avatarShirtView.setOnClickListener { displayCustomizationFragment("shirt", null) }
|
||||
|
||||
avatarSkinView.setOnClickListener { displayCustomizationFragment("skin", null) }
|
||||
|
||||
avatarHairColorView.setOnClickListener { displayCustomizationFragment("hair", "color") }
|
||||
avatarHairBangsView.setOnClickListener { displayCustomizationFragment("hair", "bangs") }
|
||||
avatarHairBaseView.setOnClickListener { displayCustomizationFragment("hair", "base") }
|
||||
avatarHairFlowerView.setOnClickListener { displayCustomizationFragment("hair", "flower") }
|
||||
avatarHairBeardView.setOnClickListener { displayCustomizationFragment("hair", "beard") }
|
||||
avatarHairMustacheView.setOnClickListener { displayCustomizationFragment("hair", "mustache") }
|
||||
avatarBackgroundView.setOnClickListener { displayCustomizationFragment("background", null) }
|
||||
|
||||
return view
|
||||
}
|
||||
|
||||
override fun injectFragment(component: AppComponent) {
|
||||
component.inject(this)
|
||||
}
|
||||
|
||||
private fun displayCustomizationFragment(type: String, category: String?) {
|
||||
val fragment = AvatarCustomizationFragment()
|
||||
fragment.type = type
|
||||
fragment.category = category
|
||||
activity?.displayFragment(fragment)
|
||||
}
|
||||
|
||||
override fun updateUserData(user: User?) {
|
||||
super.updateUserData(user)
|
||||
this.setSize(user?.preferences?.size)
|
||||
}
|
||||
|
||||
private fun setSize(size: String?) {
|
||||
if (avatarSizeSpinner == null || size == null) {
|
||||
return
|
||||
}
|
||||
if (size == "slim") {
|
||||
avatarSizeSpinner.setSelection(0, false)
|
||||
} else {
|
||||
avatarSizeSpinner.setSelection(1, false)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onItemSelected(parent: AdapterView<*>, view: View, position: Int, id: Long) {
|
||||
val newSize: String = if (position == 0) "slim" else "broad"
|
||||
|
||||
if (this.user != null && this.user!!.preferences.size != newSize) {
|
||||
userRepository.updateUser(user, "preferences.size", newSize)
|
||||
.subscribe(Action1 { }, RxErrorHandler.handleEmptyError())
|
||||
}
|
||||
}
|
||||
|
||||
override fun onNothingSelected(parent: AdapterView<*>) {}
|
||||
|
||||
|
||||
override fun customTitle(): String {
|
||||
return if (!isAdded) {
|
||||
""
|
||||
} else getString(R.string.sidebar_avatar)
|
||||
}
|
||||
}
|
||||
|
|
@ -1,163 +0,0 @@
|
|||
package com.habitrpg.android.habitica.ui.fragments.inventory.equipment;
|
||||
|
||||
import android.databinding.DataBindingUtil;
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.Switch;
|
||||
|
||||
import com.habitrpg.android.habitica.R;
|
||||
import com.habitrpg.android.habitica.components.AppComponent;
|
||||
import com.habitrpg.android.habitica.data.InventoryRepository;
|
||||
import com.habitrpg.android.habitica.databinding.FragmentEquipmentOverviewBinding;
|
||||
import com.habitrpg.android.habitica.helpers.RxErrorHandler;
|
||||
import com.habitrpg.android.habitica.models.inventory.Equipment;
|
||||
import com.habitrpg.android.habitica.ui.fragments.BaseMainFragment;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
|
||||
public class EquipmentOverviewFragment extends BaseMainFragment {
|
||||
|
||||
@Inject
|
||||
InventoryRepository inventoryRepository;
|
||||
|
||||
FragmentEquipmentOverviewBinding viewBinding;
|
||||
|
||||
@BindView(R.id.battle_gear_group)
|
||||
View battleGearGroupView;
|
||||
|
||||
@BindView(R.id.costume_group)
|
||||
View costumeGroupView;
|
||||
|
||||
View battleGearHeadView;
|
||||
View battleGearHeadAccessoryView;
|
||||
View battleGearEyewearView;
|
||||
View battleGearArmorView;
|
||||
View battleGearBackView;
|
||||
View battleGearBodyView;
|
||||
View battleGearWeaponView;
|
||||
View battleGearShieldView;
|
||||
|
||||
View costumeHeadView;
|
||||
View costumeHeadAccessoryView;
|
||||
View costumeEyewearView;
|
||||
View costumeArmorView;
|
||||
View costumeBackView;
|
||||
View costumeBodyView;
|
||||
View costumeWeaponView;
|
||||
View costumeShieldView;
|
||||
|
||||
@BindView(R.id.costume_switch)
|
||||
Switch costumeSwitch;
|
||||
|
||||
HashMap<String, String> nameMapping;
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
super.onCreateView(inflater, container, savedInstanceState);
|
||||
View v = inflater.inflate(R.layout.fragment_equipment_overview, container, false);
|
||||
|
||||
if (this.user == null || !this.user.isManaged()) {
|
||||
return v;
|
||||
}
|
||||
|
||||
viewBinding = DataBindingUtil.bind(v);
|
||||
viewBinding.setCurrentBattleGear(this.user.getItems().getGear().getEquipped());
|
||||
viewBinding.setCurrentCostume(this.user.getItems().getGear().getCostume());
|
||||
viewBinding.setUsingCostume(this.user.getPreferences().getCostume());
|
||||
|
||||
unbinder = ButterKnife.bind(this, v);
|
||||
|
||||
battleGearHeadView = battleGearGroupView.findViewById(R.id.outfit_head);
|
||||
battleGearHeadAccessoryView = battleGearGroupView.findViewById(R.id.outfit_head_accessory);
|
||||
battleGearEyewearView = battleGearGroupView.findViewById(R.id.outfit_Eyewear);
|
||||
battleGearArmorView = battleGearGroupView.findViewById(R.id.outfit_Armor);
|
||||
battleGearBackView = battleGearGroupView.findViewById(R.id.outfit_back);
|
||||
battleGearBodyView = battleGearGroupView.findViewById(R.id.outfit_Body);
|
||||
battleGearWeaponView = battleGearGroupView.findViewById(R.id.outfit_weapon);
|
||||
battleGearShieldView = battleGearGroupView.findViewById(R.id.outfit_shield);
|
||||
|
||||
costumeHeadView = costumeGroupView.findViewById(R.id.outfit_head);
|
||||
costumeHeadAccessoryView = costumeGroupView.findViewById(R.id.outfit_head_accessory);
|
||||
costumeEyewearView = costumeGroupView.findViewById(R.id.outfit_Eyewear);
|
||||
costumeArmorView = costumeGroupView.findViewById(R.id.outfit_Armor);
|
||||
costumeBackView = costumeGroupView.findViewById(R.id.outfit_back);
|
||||
costumeBodyView = costumeGroupView.findViewById(R.id.outfit_Body);
|
||||
costumeWeaponView = costumeGroupView.findViewById(R.id.outfit_weapon);
|
||||
costumeShieldView = costumeGroupView.findViewById(R.id.outfit_shield);
|
||||
|
||||
battleGearHeadView.setOnClickListener(v1 -> displayEquipmentDetailList("head", user.getItems().getGear().getEquipped().getHead(), false));
|
||||
battleGearHeadAccessoryView.setOnClickListener(v1 -> displayEquipmentDetailList("headAccessory", user.getItems().getGear().getEquipped().getHeadAccessory(), false));
|
||||
battleGearEyewearView.setOnClickListener(v1 -> displayEquipmentDetailList("eyewear", user.getItems().getGear().getEquipped().getEyeWear(), false));
|
||||
battleGearArmorView.setOnClickListener(v1 -> displayEquipmentDetailList("armor", user.getItems().getGear().getEquipped().getArmor(), false));
|
||||
battleGearBackView.setOnClickListener(v1 -> displayEquipmentDetailList("back", user.getItems().getGear().getEquipped().getBack(), false));
|
||||
battleGearBodyView.setOnClickListener(v1 -> displayEquipmentDetailList("body", user.getItems().getGear().getEquipped().getBody(), false));
|
||||
battleGearWeaponView.setOnClickListener(v1 -> displayEquipmentDetailList("weapon", user.getItems().getGear().getEquipped().getWeapon(), false));
|
||||
battleGearShieldView.setOnClickListener(v1 -> displayEquipmentDetailList("shield", user.getItems().getGear().getEquipped().getShield(), false));
|
||||
|
||||
|
||||
costumeHeadView.setOnClickListener(v1 -> displayEquipmentDetailList("head", user.getItems().getGear().getCostume().getHead(), true));
|
||||
costumeHeadAccessoryView.setOnClickListener(v1 -> displayEquipmentDetailList("headAccessory", user.getItems().getGear().getCostume().getHeadAccessory(), true));
|
||||
costumeEyewearView.setOnClickListener(v1 -> displayEquipmentDetailList("eyewear", user.getItems().getGear().getCostume().getEyeWear(), true));
|
||||
costumeArmorView.setOnClickListener(v1 -> displayEquipmentDetailList("armor", user.getItems().getGear().getCostume().getArmor(), true));
|
||||
costumeBackView.setOnClickListener(v1 -> displayEquipmentDetailList("back", user.getItems().getGear().getCostume().getBack(), true));
|
||||
costumeBodyView.setOnClickListener(v1 -> displayEquipmentDetailList("body", user.getItems().getGear().getCostume().getBody(), true));
|
||||
costumeWeaponView.setOnClickListener(v1 -> displayEquipmentDetailList("weapon", user.getItems().getGear().getCostume().getWeapon(), true));
|
||||
costumeShieldView.setOnClickListener(v1 -> displayEquipmentDetailList("shield", user.getItems().getGear().getCostume().getShield(), true));
|
||||
|
||||
this.costumeSwitch.setOnCheckedChangeListener((buttonView, isChecked) -> userRepository.updateUser(user, "preferences.costume", isChecked).subscribe(user1 -> {}, RxErrorHandler.handleEmptyError()));
|
||||
|
||||
if (this.nameMapping == null) {
|
||||
inventoryRepository.getOwnedEquipment().subscribe(items -> {
|
||||
this.nameMapping = new HashMap<>();
|
||||
|
||||
for (Equipment gear : items) {
|
||||
this.nameMapping.put(gear.key, gear.text);
|
||||
}
|
||||
|
||||
this.viewBinding.setEquipmentNames(this.nameMapping);
|
||||
}, RxErrorHandler.handleEmptyError());
|
||||
} else {
|
||||
this.viewBinding.setEquipmentNames(this.nameMapping);
|
||||
}
|
||||
|
||||
return v;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
inventoryRepository.close();
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void injectFragment(AppComponent component) {
|
||||
component.inject(this);
|
||||
}
|
||||
|
||||
private void displayEquipmentDetailList(String type, String equipped, Boolean isCostume) {
|
||||
EquipmentDetailFragment fragment = new EquipmentDetailFragment();
|
||||
fragment.type = type;
|
||||
fragment.isCostume = isCostume;
|
||||
fragment.equippedGear = equipped;
|
||||
if (activity != null) {
|
||||
activity.displayFragment(fragment);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String customTitle() {
|
||||
if (!isAdded()) {
|
||||
return "";
|
||||
}
|
||||
return getString(R.string.sidebar_equipment);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,136 @@
|
|||
package com.habitrpg.android.habitica.ui.fragments.inventory.equipment
|
||||
|
||||
import android.os.Bundle
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import com.habitrpg.android.habitica.R
|
||||
import com.habitrpg.android.habitica.components.AppComponent
|
||||
import com.habitrpg.android.habitica.data.InventoryRepository
|
||||
import com.habitrpg.android.habitica.helpers.RxErrorHandler
|
||||
import com.habitrpg.android.habitica.ui.fragments.BaseMainFragment
|
||||
import kotlinx.android.synthetic.main.fragment_equipment_overview.*
|
||||
import rx.functions.Action1
|
||||
import java.util.*
|
||||
import javax.inject.Inject
|
||||
import kotlin.collections.HashMap
|
||||
|
||||
class EquipmentOverviewFragment : BaseMainFragment() {
|
||||
|
||||
@Inject
|
||||
internal var inventoryRepository: InventoryRepository? = null
|
||||
|
||||
private var nameMapping: MutableMap<String, String> = HashMap()
|
||||
|
||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
|
||||
savedInstanceState: Bundle?): View? {
|
||||
super.onCreateView(inflater, container, savedInstanceState)
|
||||
val v = inflater.inflate(R.layout.fragment_equipment_overview, container, false)
|
||||
|
||||
if (this.user == null || !this.user!!.isManaged) {
|
||||
return v
|
||||
}
|
||||
|
||||
battleGearHeadView.setOnClickListener { displayEquipmentDetailList("head", user?.items?.gear?.equipped?.head, false) }
|
||||
battleGearHeadAccessoryView.setOnClickListener { displayEquipmentDetailList("headAccessory", user?.items?.gear?.equipped?.headAccessory, false) }
|
||||
battleGearEyewearView.setOnClickListener { displayEquipmentDetailList("eyewear", user?.items?.gear?.equipped?.eyeWear, false) }
|
||||
battleGearArmorView.setOnClickListener { displayEquipmentDetailList("armor", user?.items?.gear?.equipped?.armor, false) }
|
||||
battleGearBackView.setOnClickListener { displayEquipmentDetailList("back", user?.items?.gear?.equipped?.back, false) }
|
||||
battleGearBodyView.setOnClickListener { displayEquipmentDetailList("body", user?.items?.gear?.equipped?.body, false) }
|
||||
battleGearWeaponView.setOnClickListener { displayEquipmentDetailList("weapon", user?.items?.gear?.equipped?.weapon, false) }
|
||||
battleGearShieldView.setOnClickListener { displayEquipmentDetailList("shield", user?.items?.gear?.equipped?.shield, false) }
|
||||
|
||||
costumeHeadView.setOnClickListener { displayEquipmentDetailList("head", user?.items?.gear?.costume?.head, true) }
|
||||
costumeHeadAccessoryView.setOnClickListener { displayEquipmentDetailList("headAccessory", user?.items?.gear?.costume?.headAccessory, true) }
|
||||
costumeEyewearView.setOnClickListener { displayEquipmentDetailList("eyewear", user?.items?.gear?.costume?.eyeWear, true) }
|
||||
costumeArmorView.setOnClickListener { displayEquipmentDetailList("armor", user?.items?.gear?.costume?.armor, true) }
|
||||
costumeBackView.setOnClickListener { displayEquipmentDetailList("back", user?.items?.gear?.costume?.back, true) }
|
||||
costumeBodyView.setOnClickListener { displayEquipmentDetailList("body", user?.items?.gear?.costume?.body, true) }
|
||||
costumeWeaponView.setOnClickListener { displayEquipmentDetailList("weapon", user?.items?.gear?.costume?.weapon, true) }
|
||||
costumeShieldView.setOnClickListener { displayEquipmentDetailList("shield", user?.items?.gear?.costume?.shield, true) }
|
||||
|
||||
costumeSwitch.setOnCheckedChangeListener { _, isChecked -> userRepository.updateUser(user, "preferences.costume", isChecked).subscribe(Action1 { }, RxErrorHandler.handleEmptyError()) }
|
||||
|
||||
setImageNames()
|
||||
|
||||
if (this.nameMapping.isEmpty()) {
|
||||
inventoryRepository!!.ownedEquipment.subscribe(Action1 {
|
||||
for (gear in it) {
|
||||
this.nameMapping.put(gear.key, gear.text)
|
||||
}
|
||||
|
||||
setEquipmentNames()
|
||||
}, RxErrorHandler.handleEmptyError())
|
||||
} else {
|
||||
setEquipmentNames()
|
||||
}
|
||||
|
||||
return v
|
||||
}
|
||||
|
||||
private fun setEquipmentNames() {
|
||||
battleGearHeadView.equipmentName = nameMapping[user?.items?.gear?.equipped?.head ?: ""]
|
||||
battleGearHeadAccessoryView.equipmentName = nameMapping[user?.items?.gear?.equipped?.headAccessory ?: ""]
|
||||
battleGearEyewearView.equipmentName = nameMapping[user?.items?.gear?.equipped?.eyeWear ?: ""]
|
||||
battleGearArmorView.equipmentName = nameMapping[user?.items?.gear?.equipped?.armor ?: ""]
|
||||
battleGearBackView.equipmentName = nameMapping[user?.items?.gear?.equipped?.back ?: ""]
|
||||
battleGearBodyView.equipmentName = nameMapping[user?.items?.gear?.equipped?.body ?: ""]
|
||||
battleGearWeaponView.equipmentName = nameMapping[user?.items?.gear?.equipped?.weapon ?: ""]
|
||||
battleGearShieldView.equipmentName = nameMapping[user?.items?.gear?.equipped?.shield ?: ""]
|
||||
|
||||
costumeHeadView.equipmentName = nameMapping[user?.items?.gear?.costume?.head ?: ""]
|
||||
costumeHeadAccessoryView.equipmentName = nameMapping[user?.items?.gear?.costume?.headAccessory ?: ""]
|
||||
costumeEyewearView.equipmentName = nameMapping[user?.items?.gear?.costume?.eyeWear ?: ""]
|
||||
costumeArmorView.equipmentName = nameMapping[user?.items?.gear?.costume?.armor ?: ""]
|
||||
costumeBackView.equipmentName = nameMapping[user?.items?.gear?.costume?.back ?: ""]
|
||||
costumeBodyView.equipmentName = nameMapping[user?.items?.gear?.costume?.body ?: ""]
|
||||
costumeWeaponView.equipmentName = nameMapping[user?.items?.gear?.costume?.weapon ?: ""]
|
||||
costumeShieldView.equipmentName = nameMapping[user?.items?.gear?.costume?.shield ?: ""]
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
inventoryRepository!!.close()
|
||||
super.onDestroy()
|
||||
}
|
||||
|
||||
override fun injectFragment(component: AppComponent) {
|
||||
component.inject(this)
|
||||
}
|
||||
|
||||
private fun setImageNames() {
|
||||
battleGearHeadView.equipmentIdentifier = user?.items?.gear?.equipped?.head
|
||||
battleGearHeadAccessoryView.equipmentIdentifier = user?.items?.gear?.equipped?.headAccessory
|
||||
battleGearEyewearView.equipmentIdentifier = user?.items?.gear?.equipped?.eyeWear
|
||||
battleGearArmorView.equipmentIdentifier = user?.items?.gear?.equipped?.armor
|
||||
battleGearBackView.equipmentIdentifier = user?.items?.gear?.equipped?.back
|
||||
battleGearBodyView.equipmentIdentifier = user?.items?.gear?.equipped?.body
|
||||
battleGearWeaponView.equipmentIdentifier = user?.items?.gear?.equipped?.weapon
|
||||
battleGearShieldView.equipmentIdentifier = user?.items?.gear?.equipped?.shield
|
||||
|
||||
costumeHeadView.equipmentIdentifier = user?.items?.gear?.costume?.head
|
||||
costumeHeadAccessoryView.equipmentIdentifier = user?.items?.gear?.costume?.headAccessory
|
||||
costumeEyewearView.equipmentIdentifier = user?.items?.gear?.costume?.eyeWear
|
||||
costumeArmorView.equipmentIdentifier = user?.items?.gear?.costume?.armor
|
||||
costumeBackView.equipmentIdentifier = user?.items?.gear?.costume?.back
|
||||
costumeBodyView.equipmentIdentifier = user?.items?.gear?.costume?.body
|
||||
costumeWeaponView.equipmentIdentifier = user?.items?.gear?.costume?.weapon
|
||||
costumeShieldView.equipmentIdentifier = user?.items?.gear?.costume?.shield
|
||||
}
|
||||
|
||||
private fun displayEquipmentDetailList(type: String, equipped: String?, isCostume: Boolean?) {
|
||||
val fragment = EquipmentDetailFragment()
|
||||
fragment.type = type
|
||||
fragment.isCostume = isCostume
|
||||
fragment.equippedGear = equipped
|
||||
if (activity != null) {
|
||||
activity!!.displayFragment(fragment)
|
||||
}
|
||||
}
|
||||
|
||||
override fun customTitle(): String {
|
||||
return if (!isAdded) {
|
||||
""
|
||||
} else getString(R.string.sidebar_equipment)
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,193 +0,0 @@
|
|||
package com.habitrpg.android.habitica.ui.fragments.social;
|
||||
|
||||
import android.databinding.DataBindingUtil;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.v7.widget.CardView;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.LinearLayout;
|
||||
|
||||
import com.habitrpg.android.habitica.R;
|
||||
import com.habitrpg.android.habitica.components.AppComponent;
|
||||
import com.habitrpg.android.habitica.data.ApiClient;
|
||||
import com.habitrpg.android.habitica.data.SocialRepository;
|
||||
import com.habitrpg.android.habitica.data.UserRepository;
|
||||
import com.habitrpg.android.habitica.databinding.FragmentGroupInfoBinding;
|
||||
import com.habitrpg.android.habitica.helpers.QrCodeManager;
|
||||
import com.habitrpg.android.habitica.helpers.RxErrorHandler;
|
||||
import com.habitrpg.android.habitica.models.inventory.QuestContent;
|
||||
import com.habitrpg.android.habitica.models.social.Group;
|
||||
import com.habitrpg.android.habitica.models.user.User;
|
||||
import com.habitrpg.android.habitica.ui.fragments.BaseFragment;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
import butterknife.OnClick;
|
||||
|
||||
public class GroupInformationFragment extends BaseFragment {
|
||||
|
||||
|
||||
FragmentGroupInfoBinding viewBinding;
|
||||
|
||||
@Inject
|
||||
ApiClient apiClient;
|
||||
@Inject
|
||||
SocialRepository socialRepository;
|
||||
@Inject
|
||||
UserRepository userRepository;
|
||||
|
||||
@BindView(R.id.qrLayout)
|
||||
@Nullable
|
||||
LinearLayout qrLayout;
|
||||
|
||||
@BindView(R.id.qrWrapper)
|
||||
@Nullable
|
||||
CardView qrWrapper;
|
||||
|
||||
private View view;
|
||||
@Nullable
|
||||
private Group group;
|
||||
@Nullable
|
||||
private User user;
|
||||
private QuestContent quest;
|
||||
|
||||
public GroupInformationFragment() {
|
||||
|
||||
}
|
||||
|
||||
public static GroupInformationFragment newInstance(@Nullable Group group, @Nullable User user) {
|
||||
Bundle args = new Bundle();
|
||||
|
||||
GroupInformationFragment fragment = new GroupInformationFragment();
|
||||
fragment.setArguments(args);
|
||||
fragment.group = group;
|
||||
fragment.user = user;
|
||||
return fragment;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
if (view == null) {
|
||||
view = inflater.inflate(R.layout.fragment_group_info, container, false);
|
||||
}
|
||||
|
||||
viewBinding = DataBindingUtil.bind(view);
|
||||
viewBinding.setHideParticipantCard(false);
|
||||
|
||||
if (user != null) {
|
||||
setUser(user);
|
||||
} else {
|
||||
compositeSubscription.add(userRepository.getUser().subscribe(user1 -> {
|
||||
user = user1;
|
||||
setUser(user);
|
||||
}, RxErrorHandler.handleEmptyError()));
|
||||
}
|
||||
|
||||
if (group != null) {
|
||||
setGroup(group);
|
||||
}
|
||||
|
||||
unbinder = ButterKnife.bind(this, view);
|
||||
|
||||
if (this.group == null) {
|
||||
QrCodeManager qrCodeManager = new QrCodeManager(userRepository, this.getContext());
|
||||
qrCodeManager.setUpView(qrLayout);
|
||||
}
|
||||
|
||||
return view;
|
||||
}
|
||||
|
||||
private void setUser(@Nullable User user) {
|
||||
viewBinding.setUser(user);
|
||||
if (group == null && user != null && user.getInvitations() != null && user.getInvitations().getParty().getId() != null) {
|
||||
viewBinding.setInvitation(user.getInvitations().getParty());
|
||||
} else {
|
||||
viewBinding.setInvitation(null);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
userRepository.close();
|
||||
socialRepository.close();
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void injectFragment(AppComponent component) {
|
||||
component.inject(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
}
|
||||
|
||||
public void setGroup(@Nullable Group group) {
|
||||
if (group == null) {
|
||||
this.group = null;
|
||||
return;
|
||||
}
|
||||
if (viewBinding != null) {
|
||||
viewBinding.setGroup(group);
|
||||
}
|
||||
|
||||
this.group = group;
|
||||
|
||||
if (isAdded()) {
|
||||
updateQuestProgress(group, quest);
|
||||
}
|
||||
}
|
||||
|
||||
public void setQuestContent(@Nullable QuestContent quest) {
|
||||
if (quest == null) {
|
||||
return;
|
||||
}
|
||||
if (viewBinding != null) {
|
||||
viewBinding.setQuest(quest);
|
||||
}
|
||||
|
||||
updateQuestProgress(group, quest);
|
||||
|
||||
this.quest = quest;
|
||||
}
|
||||
|
||||
private void updateQuestProgress(@Nullable Group group, QuestContent quest) {
|
||||
if (group == null || quest == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (group.quest.members == null) {
|
||||
viewBinding.setHideParticipantCard(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@OnClick(R.id.btnPartyInviteAccept)
|
||||
public void onPartyInviteAccepted() {
|
||||
if (user != null) {
|
||||
socialRepository.joinGroup(user.getInvitations().getParty().getId())
|
||||
.doOnNext(group1 -> viewBinding.setInvitation(null))
|
||||
.flatMap(group1 -> userRepository.retrieveUser(false))
|
||||
.flatMap(user -> socialRepository.retrieveGroup("party"))
|
||||
.flatMap(group1 -> socialRepository.retrieveGroupMembers(group1.id, true))
|
||||
.subscribe(members -> {}, RxErrorHandler.handleEmptyError());
|
||||
}
|
||||
}
|
||||
|
||||
@OnClick(R.id.btnPartyInviteReject)
|
||||
public void onPartyInviteRejected() {
|
||||
if (user != null) {
|
||||
socialRepository.rejectGroupInvite(user.getInvitations().getParty().getId())
|
||||
.subscribe(aVoid -> {
|
||||
viewBinding.setInvitation(null);
|
||||
}, RxErrorHandler.handleEmptyError());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,128 @@
|
|||
package com.habitrpg.android.habitica.ui.fragments.social
|
||||
|
||||
import android.os.Bundle
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import com.habitrpg.android.habitica.R
|
||||
import com.habitrpg.android.habitica.components.AppComponent
|
||||
import com.habitrpg.android.habitica.data.SocialRepository
|
||||
import com.habitrpg.android.habitica.data.UserRepository
|
||||
import com.habitrpg.android.habitica.helpers.QrCodeManager
|
||||
import com.habitrpg.android.habitica.helpers.RxErrorHandler
|
||||
import com.habitrpg.android.habitica.models.invitations.PartyInvite
|
||||
import com.habitrpg.android.habitica.models.members.Member
|
||||
import com.habitrpg.android.habitica.models.social.Group
|
||||
import com.habitrpg.android.habitica.models.user.User
|
||||
import com.habitrpg.android.habitica.ui.fragments.BaseFragment
|
||||
import kotlinx.android.synthetic.main.fragment_group_info.*
|
||||
import kotlinx.android.synthetic.main.qr_code.*
|
||||
import rx.functions.Action1
|
||||
import javax.inject.Inject
|
||||
|
||||
class GroupInformationFragment : BaseFragment() {
|
||||
|
||||
@Inject
|
||||
lateinit var socialRepository: SocialRepository
|
||||
@Inject
|
||||
lateinit var userRepository: UserRepository
|
||||
|
||||
private var group: Group? = null
|
||||
private var user: User? = null
|
||||
|
||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
|
||||
val view = inflater.inflate(R.layout.fragment_group_info, container, false)
|
||||
|
||||
if (user != null) {
|
||||
setUser(user)
|
||||
} else {
|
||||
compositeSubscription.add(userRepository.user.subscribe(Action1 {
|
||||
user = it
|
||||
setUser(user)
|
||||
}, RxErrorHandler.handleEmptyError()))
|
||||
}
|
||||
|
||||
if (group != null) {
|
||||
setGroup(group)
|
||||
}
|
||||
|
||||
if (this.group == null) {
|
||||
val qrCodeManager = QrCodeManager(userRepository, this.context)
|
||||
qrCodeManager.setUpView(qrLayout)
|
||||
}
|
||||
|
||||
buttonPartyInviteAccept.setOnClickListener({
|
||||
if (user != null) {
|
||||
socialRepository.joinGroup(user?.invitations?.party?.id)
|
||||
.doOnNext { setInvitation(null) }
|
||||
.flatMap { userRepository.retrieveUser(false) }
|
||||
.flatMap { socialRepository.retrieveGroup("party") }
|
||||
.flatMap<List<Member>> { group1 -> socialRepository.retrieveGroupMembers(group1.id, true) }
|
||||
.subscribe(Action1 { }, RxErrorHandler.handleEmptyError())
|
||||
}
|
||||
})
|
||||
|
||||
buttonPartyInviteReject.setOnClickListener({
|
||||
if (user != null) {
|
||||
socialRepository.rejectGroupInvite(user?.invitations?.party?.id)
|
||||
.subscribe(Action1 { setInvitation(null) }, RxErrorHandler.handleEmptyError())
|
||||
}
|
||||
})
|
||||
|
||||
return view
|
||||
}
|
||||
|
||||
private fun setUser(user: User?) {
|
||||
if (group == null && user != null && user.invitations != null && user.invitations.party.id != null) {
|
||||
setInvitation(user.invitations.party)
|
||||
} else {
|
||||
setInvitation(null)
|
||||
}
|
||||
}
|
||||
|
||||
private fun setInvitation(invitation: PartyInvite?) {
|
||||
invitationWrapper.visibility = if (invitation == null) View.GONE else View.VISIBLE
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
userRepository.close()
|
||||
socialRepository.close()
|
||||
super.onDestroy()
|
||||
}
|
||||
|
||||
override fun injectFragment(component: AppComponent) {
|
||||
component.inject(this)
|
||||
}
|
||||
|
||||
fun setGroup(group: Group?) {
|
||||
this.group = group
|
||||
|
||||
val hasGroup = group != null
|
||||
val groupItemVisibility = if (hasGroup) View.VISIBLE else View.GONE
|
||||
qrWrapper.visibility = if (hasGroup) View.GONE else View.VISIBLE
|
||||
groupNameView.visibility = groupItemVisibility
|
||||
groupDescriptionView.visibility = groupItemVisibility
|
||||
|
||||
groupDescriptionView.text = group?.description
|
||||
leadernameWrapper.visibility = if (group?.leaderName != null) View.VISIBLE else View.GONE
|
||||
leadernameTextView.text = group?.leaderName
|
||||
leaderMessageWrapper.visibility = if (group?.leaderMessage != null) View.VISIBLE else View.GONE
|
||||
leaderMessageTextView.text = group?.leaderMessage
|
||||
leadernameWrapper.visibility = if (group?.balance != null && group.balance > 0) View.VISIBLE else View.GONE
|
||||
leadernameTextView.text = (group?.balance ?: 0 * 4.0).toString()
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
||||
fun newInstance(group: Group?, user: User?): GroupInformationFragment {
|
||||
val args = Bundle()
|
||||
|
||||
val fragment = GroupInformationFragment()
|
||||
fragment.arguments = args
|
||||
fragment.group = group
|
||||
fragment.user = user
|
||||
return fragment
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -146,7 +146,7 @@ public class GuildFragment extends BaseMainFragment implements Action1<Group> {
|
|||
|
||||
switch (position) {
|
||||
case 0: {
|
||||
fragment = guildInformationFragment = GroupInformationFragment.newInstance(GuildFragment.this.guild, user);
|
||||
fragment = guildInformationFragment = GroupInformationFragment.Companion.newInstance(GuildFragment.this.guild, user);
|
||||
break;
|
||||
}
|
||||
case 1: {
|
||||
|
|
|
|||
|
|
@ -84,12 +84,6 @@ public class TavernFragment extends BaseMainFragment {
|
|||
TavernFragment.this.tabLayout.setVisibility(View.VISIBLE);
|
||||
TavernFragment.this.tabLayout.setupWithViewPager(TavernFragment.this.viewPager);
|
||||
}
|
||||
|
||||
inventoryRepository.getQuestContent(group.quest.key).first().subscribe(content -> {
|
||||
if (questInfoFragment != null) {
|
||||
questInfoFragment.setQuestContent(content);
|
||||
}
|
||||
}, RxErrorHandler.handleEmptyError());
|
||||
}
|
||||
}, RxErrorHandler.handleEmptyError()));
|
||||
}
|
||||
|
|
@ -120,7 +114,7 @@ public class TavernFragment extends BaseMainFragment {
|
|||
break;
|
||||
}
|
||||
case 2: {
|
||||
fragment = questInfoFragment = GroupInformationFragment.newInstance(tavern, user);
|
||||
fragment = questInfoFragment = GroupInformationFragment.Companion.newInstance(tavern, user);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
package com.habitrpg.android.habitica.ui.fragments.social.challenges;
|
||||
|
||||
|
||||
import android.databinding.ObservableList;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.v7.widget.LinearLayoutManager;
|
||||
|
|
@ -20,6 +19,8 @@ import com.habitrpg.android.habitica.ui.adapter.tasks.BaseTasksRecyclerViewAdapt
|
|||
import com.habitrpg.android.habitica.ui.fragments.BaseFragment;
|
||||
import com.habitrpg.android.habitica.ui.helpers.SafeDefaultItemAnimator;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Named;
|
||||
|
||||
|
|
@ -30,13 +31,13 @@ public class ChallengeTasksRecyclerViewFragment extends BaseFragment {
|
|||
@Named(AppModule.NAMED_USER_ID)
|
||||
String userID;
|
||||
|
||||
ObservableList<Task> tasksOnInitialize;
|
||||
List<Task> tasksOnInitialize;
|
||||
|
||||
LinearLayoutManager layoutManager = null;
|
||||
private User user;
|
||||
private View view;
|
||||
|
||||
public static ChallengeTasksRecyclerViewFragment newInstance(User user, ObservableList<Task> tasks) {
|
||||
public static ChallengeTasksRecyclerViewFragment newInstance(User user, List<Task> tasks) {
|
||||
ChallengeTasksRecyclerViewFragment fragment = new ChallengeTasksRecyclerViewFragment();
|
||||
fragment.setRetainInstance(true);
|
||||
fragment.user = user;
|
||||
|
|
@ -46,33 +47,6 @@ public class ChallengeTasksRecyclerViewFragment extends BaseFragment {
|
|||
fragment.recyclerAdapter.setTasks(tasks);
|
||||
}
|
||||
|
||||
tasks.addOnListChangedCallback(new ObservableList.OnListChangedCallback<ObservableList<Task>>() {
|
||||
@Override
|
||||
public void onChanged(ObservableList<Task> tasks) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onItemRangeChanged(ObservableList<Task> tasks, int i, int i1) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onItemRangeInserted(ObservableList<Task> tasks, int i, int i1) {
|
||||
fragment.recyclerAdapter.setTasks(tasks);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onItemRangeMoved(ObservableList<Task> tasks, int i, int i1, int i2) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onItemRangeRemoved(ObservableList<Task> tasks, int i, int i1) {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
return fragment;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -266,7 +266,7 @@ public class PartyFragment extends BaseMainFragment {
|
|||
detailFragment.partyId = user.getParty().id;
|
||||
fragment = detailFragment;
|
||||
} else {
|
||||
fragment = GroupInformationFragment.newInstance(null, user);
|
||||
fragment = GroupInformationFragment.Companion.newInstance(null, user);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,20 +1,14 @@
|
|||
package com.habitrpg.android.habitica.ui.helpers;
|
||||
|
||||
import android.databinding.BindingAdapter;
|
||||
import android.databinding.DataBindingUtil;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
import android.support.v4.content.res.ResourcesCompat;
|
||||
import android.support.v7.widget.CardView;
|
||||
import android.view.View;
|
||||
import android.view.animation.Animation;
|
||||
import android.view.animation.Transformation;
|
||||
import android.widget.Button;
|
||||
import android.widget.CheckBox;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
|
|
@ -25,46 +19,12 @@ import net.pherth.android.emoji_library.EmojiTextView;
|
|||
|
||||
public class DataBindingUtils {
|
||||
|
||||
@BindingAdapter("bind:imageName")
|
||||
public static void loadImage(SimpleDraweeView view, String imageName) {
|
||||
if (view != null && view.getVisibility() == View.VISIBLE) {
|
||||
view.setImageURI(Uri.parse("https://habitica-assets.s3.amazonaws.com/mobileApp/images/" + imageName + ".png"));
|
||||
}
|
||||
}
|
||||
|
||||
@BindingAdapter("bind:cardColor")
|
||||
public static void setCardColor(CardView cardView, int color) {
|
||||
if (color > 0) {
|
||||
color = ContextCompat.getColor(cardView.getContext(), color);
|
||||
}
|
||||
cardView.setCardBackgroundColor(color);
|
||||
}
|
||||
|
||||
@BindingAdapter("app:backgroundColor")
|
||||
public static void setBackgroundTintColor(CheckBox view, int color) {
|
||||
if (color > 0) {
|
||||
color = ContextCompat.getColor(view.getContext(), color);
|
||||
}
|
||||
ViewHelper.SetBackgroundTint(view, color);
|
||||
}
|
||||
|
||||
@BindingAdapter("app:backgroundColor")
|
||||
public static void setBackgroundTintColor(Button view, int color) {
|
||||
if (color > 0) {
|
||||
color = ContextCompat.getColor(view.getContext(), color);
|
||||
}
|
||||
ViewHelper.SetBackgroundTint(view, color);
|
||||
}
|
||||
|
||||
@BindingAdapter("app:backgroundColor")
|
||||
public static void setBackgroundTintColor(View view, int color) {
|
||||
if (color > 0) {
|
||||
color = ContextCompat.getColor(view.getContext(), color);
|
||||
}
|
||||
view.setBackgroundColor(color);
|
||||
}
|
||||
|
||||
@BindingAdapter("app:foregroundColor")
|
||||
public static void setForegroundTintColor(TextView view, int color) {
|
||||
if (color > 0) {
|
||||
color = ContextCompat.getColor(view.getContext(), color);
|
||||
|
|
@ -72,7 +32,6 @@ public class DataBindingUtils {
|
|||
view.setTextColor(color);
|
||||
}
|
||||
|
||||
@BindingAdapter("app:rounded_background")
|
||||
public static void setRoundedBackground(View view, int color) {
|
||||
Drawable drawable = ResourcesCompat.getDrawable(view.getResources(), R.drawable.layout_rounded_bg, null);
|
||||
if (drawable != null) {
|
||||
|
|
@ -85,14 +44,12 @@ public class DataBindingUtils {
|
|||
}
|
||||
}
|
||||
|
||||
@BindingAdapter("app:rounded_background_int")
|
||||
public static void setRoundedBackgroundInt(View view, int color) {
|
||||
if (color != 0) {
|
||||
setRoundedBackground(view, ContextCompat.getColor(view.getContext(), color));
|
||||
}
|
||||
}
|
||||
|
||||
@BindingAdapter("parsemarkdown")
|
||||
public static void bindEmojiconTextView(EmojiTextView textView, CharSequence value) {
|
||||
if (value != null) {
|
||||
textView.setText(MarkdownParser.parseMarkdown(value.toString()));
|
||||
|
|
|
|||
|
|
@ -4,15 +4,15 @@ import android.app.Activity
|
|||
import android.content.Intent
|
||||
import android.content.SharedPreferences
|
||||
import android.support.v7.widget.Toolbar
|
||||
|
||||
import com.habitrpg.android.habitica.R
|
||||
import com.habitrpg.android.habitica.ui.activities.AboutActivity
|
||||
import com.habitrpg.android.habitica.ui.activities.BaseActivity
|
||||
import com.habitrpg.android.habitica.ui.activities.GemPurchaseActivity
|
||||
import com.habitrpg.android.habitica.ui.activities.MainActivity
|
||||
import com.habitrpg.android.habitica.ui.activities.MainActivity.GEM_PURCHASE_REQUEST
|
||||
import com.habitrpg.android.habitica.ui.activities.PrefsActivity
|
||||
import com.habitrpg.android.habitica.ui.fragments.BaseMainFragment
|
||||
import com.habitrpg.android.habitica.ui.fragments.NewsFragment
|
||||
import com.habitrpg.android.habitica.ui.fragments.StatsFragment
|
||||
import com.habitrpg.android.habitica.ui.fragments.faq.FAQOverviewFragment
|
||||
import com.habitrpg.android.habitica.ui.fragments.inventory.customization.AvatarOverviewFragment
|
||||
import com.habitrpg.android.habitica.ui.fragments.inventory.equipment.EquipmentOverviewFragment
|
||||
|
|
@ -31,11 +31,7 @@ import com.mikepenz.materialdrawer.AccountHeaderBuilder
|
|||
import com.mikepenz.materialdrawer.DrawerBuilder
|
||||
import com.mikepenz.materialdrawer.model.PrimaryDrawerItem
|
||||
import com.mikepenz.materialdrawer.model.ProfileDrawerItem
|
||||
|
||||
import java.util.Locale
|
||||
|
||||
import com.habitrpg.android.habitica.ui.activities.MainActivity.GEM_PURCHASE_REQUEST
|
||||
import com.habitrpg.android.habitica.ui.fragments.StatsFragment
|
||||
import java.util.*
|
||||
|
||||
object MainDrawerBuilder {
|
||||
|
||||
|
|
@ -59,19 +55,19 @@ object MainDrawerBuilder {
|
|||
val SIDEBAR_HELP = 16
|
||||
val SIDEBAR_ABOUT = 17
|
||||
|
||||
fun CreateDefaultAccountHeader(activity: Activity): AccountHeaderBuilder {
|
||||
fun createDefaultAccountHeader(activity: Activity): AccountHeaderBuilder {
|
||||
return AccountHeaderBuilder()
|
||||
.withActivity(activity)
|
||||
.withHeaderBackground(R.drawable.sidebar_background)
|
||||
.addProfiles(
|
||||
ProfileDrawerItem()
|
||||
)
|
||||
.withOnAccountHeaderListener { view, profile, currentProfile -> false }
|
||||
.withOnAccountHeaderListener { _, _, _ -> false }
|
||||
.withSelectionListEnabledForSingleProfile(false)
|
||||
}
|
||||
|
||||
|
||||
fun CreateDefaultBuilderSettings(activity: MainActivity, sharedPreferences: SharedPreferences, toolbar: Toolbar?, accountHeader: AccountHeader): DrawerBuilder {
|
||||
fun createDefaultBuilderSettings(activity: MainActivity, sharedPreferences: SharedPreferences, toolbar: Toolbar?, accountHeader: AccountHeader): DrawerBuilder {
|
||||
val builder = DrawerBuilder()
|
||||
.withActivity(activity)
|
||||
.withFullscreen(true)
|
||||
|
|
@ -109,7 +105,7 @@ object MainDrawerBuilder {
|
|||
PrimaryDrawerItem().withName(activity.getString(R.string.sidebar_about)).withIdentifier(SIDEBAR_ABOUT.toLong()).withSelectable(false)
|
||||
)
|
||||
.withStickyFooterDivider(false)
|
||||
.withOnDrawerItemClickListener { view, position, drawerItem ->
|
||||
.withOnDrawerItemClickListener { _, position, drawerItem ->
|
||||
var fragment: BaseMainFragment? = null
|
||||
var newActivityClass: Class<*>? = null
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,34 @@
|
|||
package com.habitrpg.android.habitica.ui.views
|
||||
|
||||
import android.content.Context
|
||||
import android.util.AttributeSet
|
||||
import android.view.View
|
||||
import android.widget.LinearLayout
|
||||
import com.habitrpg.android.habitica.R
|
||||
import com.habitrpg.android.habitica.ui.helpers.DataBindingUtils
|
||||
import kotlinx.android.synthetic.main.item_image_row.view.*
|
||||
|
||||
class EquipmentItemRow(context: Context?, attrs: AttributeSet?) : LinearLayout(context, attrs) {
|
||||
|
||||
var equipmentIdentifier: String? = null
|
||||
set(value) {
|
||||
val imageName = if (equipmentIdentifier != null) "shop_"+equipmentIdentifier else "head_0"
|
||||
DataBindingUtils.loadImage(imageView, imageName)
|
||||
}
|
||||
|
||||
var equipmentName: String? = ""
|
||||
set(value) {
|
||||
valueTextView.text = equipmentName
|
||||
}
|
||||
|
||||
init {
|
||||
View.inflate(context, R.layout.item_image_row, this)
|
||||
|
||||
val attributes = context?.theme?.obtainStyledAttributes(
|
||||
attrs,
|
||||
R.styleable.EquipmentItemRow,
|
||||
0, 0)
|
||||
|
||||
titleTextView.text = attributes?.getString(R.styleable.EquipmentItemRow_equipmentTitle)
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue