Adds ability to edit languages.

This commit is contained in:
Tom Hicks
2021-06-25 10:57:25 -07:00
parent 47d67861e2
commit b14fe3ad69
12 changed files with 524 additions and 0 deletions

View File

@@ -0,0 +1,35 @@
<?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.EditLanguageFragment">
<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="Medicine" />
</com.google.android.material.textfield.TextInputLayout>
<CheckBox
android:id="@+id/canSpeak"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/label_can_speak_language" />
</LinearLayout>
</ScrollView>

View File

@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".ui.editmonster.EditLanguagesFragment">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:divider="?android:attr/dividerVertical"
android:dividerPadding="@dimen/text_margin"
app:layoutManager="LinearLayoutManager"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:listitem="@layout/fragment_edit_languages_list_item" />
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/add_language"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:layout_margin="@dimen/fab_margin"
android:contentDescription="@string/action_add_language"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:srcCompat="@android:drawable/ic_input_add"
app:tint="@android:color/white" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -0,0 +1,36 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<!-- understands but textbox -->
<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/understandsBut"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/label_understands_but"
android:importantForAutofill="no"
android:inputType="text"
tools:text="pretends not to speak" />
</com.google.android.material.textfield.TextInputLayout>
<!-- TODO: add a divider here -->
<com.majinnaibu.monstercards.ui.components.Stepper
android:id="@+id/telepathy"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="@dimen/text_margin"
app:label="Telepathy"
app:maxValue="1000"
app:minValue="0"
app:stepAmount="5" />
</LinearLayout>

View File

@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="@+id/content"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="@dimen/text_margin"
android:textAppearance="?attr/textAppearanceListItem" />
</LinearLayout>

View File

@@ -108,6 +108,9 @@
<action
android:id="@+id/action_editMonsterFragment_to_editDamageImmunitiesFragment"
app:destination="@id/editDamageImmunitiesFragment" />
<action
android:id="@+id/action_editMonsterFragment_to_editLanguagesFragment"
app:destination="@id/editLanguagesFragment" />
</fragment>
<fragment
android:id="@+id/editBasicInfoFragment"
@@ -251,5 +254,26 @@
android:id="@+id/action_editDamageVulnerabilitiesFragment_to_editDamageVulnerabilityFragment"
app:destination="@id/editDamageVulnerabilityFragment" />
</fragment>
<fragment
android:id="@+id/editLanguagesFragment"
android:name="com.majinnaibu.monstercards.ui.editmonster.EditLanguagesFragment"
android:label="fragment_edit_languages_list"
tools:layout="@layout/fragment_edit_languages_list">
<action
android:id="@+id/action_editLanguagesFragment_to_editLanguageFragment"
app:destination="@id/editLanguageFragment" />
</fragment>
<fragment
android:id="@+id/editLanguageFragment"
android:name="com.majinnaibu.monstercards.ui.editmonster.EditLanguageFragment"
android:label="fragment_edit_language"
tools:layout="@layout/fragment_edit_language">
<argument
android:name="name"
app:argType="string" />
<argument
android:name="canSpeak"
app:argType="boolean" />
</fragment>
</navigation>
</navigation>

View File

@@ -2,6 +2,7 @@
<string name="action_add_monster">Add monster</string>
<string name="action_add_sense">Add Sense</string>
<string name="action_add_skill">Add Skill</string>
<string name="action_add_language">Add Language</string>
<string name="action_add_condition_immunity">Add Condition</string>
<string name="action_edit">Edit</string>
<string name="actions_label">Actions</string>
@@ -52,6 +53,7 @@
<string name="label_legendary_actions">Legendary Actions</string>
<string name="label_natural_armor_bonus">Natural Armor Bonus</string>
<string name="label_name">Name</string>
<string name="label_understands_but">Understands But</string>
<string name="label_proficiency">Proficiency</string>
<string name="label_proficiency_expertise">Expertise</string>
<string name="label_proficiency_none">None</string>
@@ -68,6 +70,7 @@
<string name="label_strength">Strength</string>
<string name="label_subtype">Subtype</string>
<string name="label_swim_speed">Swim Speed</string>
<string name="label_telepathy">Telepathy</string>
<string name="label_type">Type</string>
<string name="label_wisdom">Wisdom</string>
<string name="section_divider">section divider</string>
@@ -83,4 +86,5 @@
<string name="label_description">Description</string>
<string name="label_damage_type">Damage Type</string>
<string name="add_damage_type">Add Damage Type</string>
<string name="label_can_speak_language">Can Speak</string>
</resources>