Adds edit basic info screen with most string fields.
Cleans up fonts/margins on edit screens. Makes the EditMonsterViewModel shared between edit monster fragments.
This commit is contained in:
106
app/src/main/res/layout/fragment_edit_basic_info.xml
Normal file
106
app/src/main/res/layout/fragment_edit_basic_info.xml
Normal file
@@ -0,0 +1,106 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".ui.editmonster.EditBasicInfoFragment">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="@dimen/text_margin">
|
||||
|
||||
<com.google.android.material.textfield.TextInputEditText
|
||||
android:id="@+id/name"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="@string/label_name"
|
||||
android:importantForAutofill="no"
|
||||
android:inputType="textCapWords"
|
||||
tools:text="John Doe" />
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="@dimen/text_margin">
|
||||
|
||||
<com.google.android.material.textfield.TextInputEditText
|
||||
android:id="@+id/size"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="@string/label_size"
|
||||
android:importantForAutofill="no"
|
||||
android:inputType="text"
|
||||
tools:text="big" />
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="@dimen/text_margin">
|
||||
|
||||
<com.google.android.material.textfield.TextInputEditText
|
||||
android:id="@+id/type"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="@string/label_type"
|
||||
android:importantForAutofill="no"
|
||||
android:inputType="text"
|
||||
tools:text="fiend" />
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="@dimen/text_margin">
|
||||
|
||||
<com.google.android.material.textfield.TextInputEditText
|
||||
android:id="@+id/subtype"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="@string/label_subtype"
|
||||
android:importantForAutofill="no"
|
||||
android:inputType="text"
|
||||
tools:text="any race" />
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="@dimen/text_margin">
|
||||
|
||||
<com.google.android.material.textfield.TextInputEditText
|
||||
android:id="@+id/alignment"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="@string/label_alignment"
|
||||
android:importantForAutofill="no"
|
||||
android:inputType="text"
|
||||
tools:text="Chaotic Stupid" />
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
|
||||
<!-- Hit Dice (int) -->
|
||||
|
||||
<!-- Has ustom HP (boolean) -->
|
||||
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="@dimen/text_margin">
|
||||
|
||||
<com.google.android.material.textfield.TextInputEditText
|
||||
android:id="@+id/customHitPoints"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="@string/label_custom_hp"
|
||||
android:importantForAutofill="no"
|
||||
android:inputType="text" />
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
@@ -6,7 +6,6 @@
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/list"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:divider="?android:attr/dividerVertical"
|
||||
@@ -21,6 +20,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="@dimen/text_margin"
|
||||
android:text="@string/label_basic_info"
|
||||
android:textSize="@dimen/text_h4_size"
|
||||
app:drawableEndCompat="@drawable/ic_chevron_right_24" />
|
||||
|
||||
<TextView
|
||||
@@ -29,6 +29,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="@dimen/text_margin"
|
||||
android:text="@string/label_armor"
|
||||
android:textSize="@dimen/text_h4_size"
|
||||
app:drawableEndCompat="@drawable/ic_chevron_right_24" />
|
||||
|
||||
<TextView
|
||||
@@ -37,6 +38,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="@dimen/text_margin"
|
||||
android:text="@string/label_speed"
|
||||
android:textSize="@dimen/text_h4_size"
|
||||
app:drawableEndCompat="@drawable/ic_chevron_right_24" />
|
||||
|
||||
<TextView
|
||||
@@ -45,6 +47,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="@dimen/text_margin"
|
||||
android:text="@string/label_ability_scores"
|
||||
android:textSize="@dimen/text_h4_size"
|
||||
app:drawableEndCompat="@drawable/ic_chevron_right_24" />
|
||||
|
||||
<TextView
|
||||
@@ -53,6 +56,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="@dimen/text_margin"
|
||||
android:text="@string/label_saving_throws"
|
||||
android:textSize="@dimen/text_h4_size"
|
||||
app:drawableEndCompat="@drawable/ic_chevron_right_24" />
|
||||
|
||||
<TextView
|
||||
@@ -61,6 +65,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="@dimen/text_margin"
|
||||
android:text="@string/label_skills"
|
||||
android:textSize="@dimen/text_h4_size"
|
||||
app:drawableEndCompat="@drawable/ic_chevron_right_24" />
|
||||
|
||||
<TextView
|
||||
@@ -69,6 +74,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="@dimen/text_margin"
|
||||
android:text="@string/label_condition_immunities"
|
||||
android:textSize="@dimen/text_h4_size"
|
||||
app:drawableEndCompat="@drawable/ic_chevron_right_24" />
|
||||
|
||||
<TextView
|
||||
@@ -77,6 +83,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="@dimen/text_margin"
|
||||
android:text="@string/label_damage_immunities"
|
||||
android:textSize="@dimen/text_h4_size"
|
||||
app:drawableEndCompat="@drawable/ic_chevron_right_24" />
|
||||
|
||||
<TextView
|
||||
@@ -85,6 +92,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="@dimen/text_margin"
|
||||
android:text="@string/label_damage_resistances"
|
||||
android:textSize="@dimen/text_h4_size"
|
||||
app:drawableEndCompat="@drawable/ic_chevron_right_24" />
|
||||
|
||||
<TextView
|
||||
@@ -93,6 +101,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="@dimen/text_margin"
|
||||
android:text="@string/label_damage_vulnerabilities"
|
||||
android:textSize="@dimen/text_h4_size"
|
||||
app:drawableEndCompat="@drawable/ic_chevron_right_24" />
|
||||
|
||||
<TextView
|
||||
@@ -101,6 +110,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="@dimen/text_margin"
|
||||
android:text="@string/label_senses"
|
||||
android:textSize="@dimen/text_h4_size"
|
||||
app:drawableEndCompat="@drawable/ic_chevron_right_24" />
|
||||
|
||||
<TextView
|
||||
@@ -109,6 +119,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="@dimen/text_margin"
|
||||
android:text="@string/label_languages"
|
||||
android:textSize="@dimen/text_h4_size"
|
||||
app:drawableEndCompat="@drawable/ic_chevron_right_24" />
|
||||
|
||||
<TextView
|
||||
@@ -117,6 +128,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="@dimen/text_margin"
|
||||
android:text="@string/label_challenge_rating"
|
||||
android:textSize="@dimen/text_h4_size"
|
||||
app:drawableEndCompat="@drawable/ic_chevron_right_24" />
|
||||
|
||||
<TextView
|
||||
@@ -125,6 +137,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="@dimen/text_margin"
|
||||
android:text="@string/label_abilities"
|
||||
android:textSize="@dimen/text_h4_size"
|
||||
app:drawableEndCompat="@drawable/ic_chevron_right_24" />
|
||||
|
||||
<TextView
|
||||
@@ -133,6 +146,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="@dimen/text_margin"
|
||||
android:text="@string/label_actions"
|
||||
android:textSize="@dimen/text_h4_size"
|
||||
app:drawableEndCompat="@drawable/ic_chevron_right_24" />
|
||||
|
||||
<TextView
|
||||
@@ -141,6 +155,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="@dimen/text_margin"
|
||||
android:text="@string/label_reactions"
|
||||
android:textSize="@dimen/text_h4_size"
|
||||
app:drawableEndCompat="@drawable/ic_chevron_right_24" />
|
||||
|
||||
<TextView
|
||||
@@ -149,6 +164,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="@dimen/text_margin"
|
||||
android:text="@string/label_legendary_actions"
|
||||
android:textSize="@dimen/text_h4_size"
|
||||
app:drawableEndCompat="@drawable/ic_chevron_right_24" />
|
||||
|
||||
<TextView
|
||||
@@ -157,6 +173,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="@dimen/text_margin"
|
||||
android:text="@string/label_lair_actions"
|
||||
android:textSize="@dimen/text_h4_size"
|
||||
app:drawableEndCompat="@drawable/ic_chevron_right_24" />
|
||||
|
||||
<TextView
|
||||
@@ -165,6 +182,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="@dimen/text_margin"
|
||||
android:text="@string/label_regional_actions"
|
||||
android:textSize="@dimen/text_h4_size"
|
||||
app:drawableEndCompat="@drawable/ic_chevron_right_24" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
@@ -55,16 +55,32 @@
|
||||
app:argType="string" />
|
||||
<action
|
||||
android:id="@+id/action_navigation_monster_to_editMonsterFragment"
|
||||
app:destination="@id/editMonsterFragment" />
|
||||
app:destination="@id/edit_monster_navigation" />
|
||||
</fragment>
|
||||
<fragment
|
||||
android:id="@+id/editMonsterFragment"
|
||||
android:name="com.majinnaibu.monstercards.ui.editmonster.EditMonsterFragment"
|
||||
android:label="Edit Monster"
|
||||
tools:layout="@layout/fragment_edit_monster">
|
||||
<navigation
|
||||
android:id="@+id/edit_monster_navigation"
|
||||
app:startDestination="@id/editMonsterFragment">
|
||||
<argument
|
||||
android:name="monster_id"
|
||||
app:argType="string" />
|
||||
</fragment>
|
||||
|
||||
<fragment
|
||||
android:id="@+id/editMonsterFragment"
|
||||
android:name="com.majinnaibu.monstercards.ui.editmonster.EditMonsterFragment"
|
||||
android:label="Edit Monster"
|
||||
tools:layout="@layout/fragment_edit_monster">
|
||||
<argument
|
||||
android:name="monster_id"
|
||||
app:argType="string" />
|
||||
<action
|
||||
android:id="@+id/action_editMonsterFragment_to_editBasicInfoFragment"
|
||||
app:destination="@id/editBasicInfoFragment" />
|
||||
</fragment>
|
||||
<fragment
|
||||
android:id="@+id/editBasicInfoFragment"
|
||||
android:name="com.majinnaibu.monstercards.ui.editmonster.EditBasicInfoFragment"
|
||||
android:label="fragment_edit_basic_info"
|
||||
tools:layout="@layout/fragment_edit_basic_info" />
|
||||
</navigation>
|
||||
|
||||
</navigation>
|
||||
@@ -2,5 +2,6 @@
|
||||
<!-- Default screen margins, per the Android Design guidelines. -->
|
||||
<dimen name="text_margin">16dp</dimen>
|
||||
<dimen name="fab_margin">16dp</dimen>
|
||||
<dimen name="text_h4_size">20sp</dimen>
|
||||
|
||||
</resources>
|
||||
@@ -38,4 +38,10 @@
|
||||
<string name="default_monster_name">Unnamed Monster</string>
|
||||
<string name="snackbar_failed_to_create_monster">Failed to create monster</string>
|
||||
<string name="snackbar_monster_created">%1$s created</string>
|
||||
<string name="label_name">Name</string>
|
||||
<string name="label_size">Size</string>
|
||||
<string name="label_type">Type</string>
|
||||
<string name="label_subtype">Subtype</string>
|
||||
<string name="label_alignment">Alignment</string>
|
||||
<string name="label_custom_hp">Custom HP</string>
|
||||
</resources>
|
||||
Reference in New Issue
Block a user