View cleanup.

Makes more numeric fields Steppers.
Sets titles for fragments.
Sets focus on the first EditText on most edit pages.
Makes Checkbox be a SwitchCompat
Fixes monster list item view.
This commit is contained in:
Tom Hicks
2021-06-26 02:37:37 -07:00
parent 36c26e4c42
commit 2427f69da9
28 changed files with 258 additions and 124 deletions

View File

@@ -5,6 +5,7 @@
android:layout_height="match_parent"
android:orientation="horizontal"
tools:context=".ui.components.AbilityScorePicker">
<!-- // TODO: style this control to look less awful by default -->
<TextView
android:id="@+id/label"
@@ -16,4 +17,4 @@
android:id="@+id/spinner"
android:layout_width="wrap_content"
android:layout_height="match_parent" />
</merge>
</merge>

View File

@@ -6,6 +6,7 @@
android:layout_height="wrap_content"
android:layout_margin="@dimen/text_margin"
tools:context=".ui.components.AdvantagePicker">
<!-- // TODO: style this control to look less awful by default -->
<TextView
android:id="@+id/label"
@@ -45,4 +46,4 @@
android:layout_weight="1"
android:text="@string/label_advantage_disadvantage" />
</RadioGroup>
</merge>
</merge>

View File

@@ -6,6 +6,7 @@
android:layout_height="wrap_content"
android:layout_margin="@dimen/text_margin"
tools:context=".ui.components.ProficiencyPicker">
<!-- // TODO: style this control to look less awful by default -->
<TextView
android:id="@+id/label"
@@ -45,4 +46,4 @@
android:layout_weight="1"
android:text="@string/label_proficiency_expertise" />
</RadioGroup>
</merge>
</merge>

View File

@@ -7,13 +7,19 @@
android:layout_margin="@dimen/text_margin"
tools:context=".ui.components.Stepper">
<!-- // TODO: Make these text views use the size and appearance of the material text input -->
<TextView
android:id="@+id/text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingHorizontal="4dp"
android:paddingTop="4dp"
android:paddingBottom="11dp"
android:textAppearance="@android:style/TextAppearance.Material.Medium"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintTop_toBottomOf="@id/label"
tools:text="20 (+5)" />
<TextView
@@ -21,15 +27,39 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=""
android:textAppearance="?attr/textAppearanceSubtitle1"
android:textAppearance="@android:style/TextAppearance.Material.Caption"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:text="Strength" />
<!--
<TextView
android:id="@+id/text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="@android:style/TextAppearance.Material.Body1"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:text="20 (+5)" />
<TextView
android:id="@+id/label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=""
android:textAppearance="@android:style/TextAppearance.Material.Caption"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:text="Strength" />
android:layout_marginTop="8dp"
-->
<Button
android:id="@+id/decrement"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingVertical="8dp"
android:text="@string/label_decrement_field"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@id/increment"
@@ -39,8 +69,9 @@
android:id="@+id/increment"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingVertical="8dp"
android:text="@string/label_increment_field"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</merge>
</merge>

View File

@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<ScrollView 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"
@@ -15,21 +16,15 @@
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<!-- // TODO: Make this a stepper instead of a text field -->
<com.google.android.material.textfield.TextInputLayout
<com.majinnaibu.monstercards.ui.components.Stepper
android:id="@+id/naturalArmorBonus"
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/naturalArmorBonus"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/label_natural_armor_bonus"
android:importantForAutofill="no"
android:inputType="numberSigned"
tools:text="+2" />
</com.google.android.material.textfield.TextInputLayout>
android:layout_margin="@dimen/text_margin"
app:label="@string/label_natural_armor_bonus"
app:maxValue="99"
app:minValue="0"
app:stepAmount="1" />
<com.google.android.material.switchmaterial.SwitchMaterial
android:id="@+id/hasShield"
@@ -37,23 +32,17 @@
android:layout_height="wrap_content"
android:layout_margin="@dimen/text_margin"
android:text="@string/label_has_a_shield"
android:textSize="20sp" />
android:textAppearance="@android:style/TextAppearance.Material.Medium" />
<!-- // TODO: Make this a stepper instead of a text field -->
<com.google.android.material.textfield.TextInputLayout
<com.majinnaibu.monstercards.ui.components.Stepper
android:id="@+id/shieldBonus"
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/shieldBonus"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/label_shield_bonus"
android:importantForAutofill="no"
android:inputType="numberSigned"
tools:text="4" />
</com.google.android.material.textfield.TextInputLayout>
android:layout_margin="@dimen/text_margin"
app:label="@string/label_shield_bonus"
app:maxValue="99"
app:minValue="0"
app:stepAmount="1" />
<com.google.android.material.textfield.TextInputLayout
android:layout_width="match_parent"

View File

@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<ScrollView 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"
@@ -19,6 +20,8 @@
android:id="@+id/name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:focusable="true"
android:focusableInTouchMode="true"
android:hint="@string/label_name"
android:importantForAutofill="no"
android:inputType="textCapWords"
@@ -86,21 +89,15 @@
</com.google.android.material.textfield.TextInputLayout>
<!-- Hit Dice (int) -->
<!-- // TODO: Make this a stepper instead of a text field -->
<com.google.android.material.textfield.TextInputLayout
<com.majinnaibu.monstercards.ui.components.Stepper
android:id="@+id/hitDice"
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/hitDice"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:digits="0123456789"
android:hint="@string/label_hit_dice"
android:importantForAutofill="no"
android:inputType="number" />
</com.google.android.material.textfield.TextInputLayout>
android:layout_margin="@dimen/text_margin"
app:label="@string/label_hit_dice"
app:maxValue="99"
app:minValue="1"
app:stepAmount="1" />
<com.google.android.material.switchmaterial.SwitchMaterial
android:id="@+id/hasCustomHitPoints"
@@ -108,7 +105,7 @@
android:layout_height="wrap_content"
android:layout_margin="@dimen/text_margin"
android:text="@string/label_has_custom_hp"
android:textSize="@dimen/text_h4_size" />
android:textAppearance="@android:style/TextAppearance.Material.Medium" />
<com.google.android.material.textfield.TextInputLayout
android:layout_width="match_parent"

View File

@@ -25,11 +25,12 @@
tools:text="Medicine" />
</com.google.android.material.textfield.TextInputLayout>
<CheckBox
<com.google.android.material.switchmaterial.SwitchMaterial
android:id="@+id/canSpeak"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/label_can_speak_language" />
android:layout_margin="@dimen/text_margin"
android:text="@string/label_can_speak_language"
android:textAppearance="@android:style/TextAppearance.Material.Medium" />
</LinearLayout>
</ScrollView>

View File

@@ -67,7 +67,7 @@
android:layout_height="wrap_content"
android:layout_margin="@dimen/text_margin"
android:text="@string/label_can_hover"
android:textSize="@dimen/text_h4_size" />
android:textAppearance="@android:style/TextAppearance.Material.Medium" />
<com.google.android.material.switchmaterial.SwitchMaterial
android:id="@+id/hasCustomSpeed"
@@ -75,7 +75,7 @@
android:layout_height="wrap_content"
android:layout_margin="@dimen/text_margin"
android:text="@string/label_has_custom_speed"
android:textSize="@dimen/text_h4_size" />
android:textAppearance="@android:style/TextAppearance.Material.Medium" />
<com.google.android.material.textfield.TextInputLayout
android:layout_width="match_parent"

View File

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

View File

@@ -86,7 +86,39 @@
<string name="strength_abbreviation">STR</string>
<string name="title_collections">Collections</string>
<string name="title_dashboard">Dashboard</string>
<string name="title_edit_abilities">Ability</string>
<string name="title_edit_ability">Abilities</string>
<string name="title_edit_ability_scores">Ability Scores</string>
<string name="title_edit_action">Action</string>
<string name="title_edit_actions">Actions</string>
<string name="title_edit_armor">Armor</string>
<string name="title_edit_basic_info">Basic Info</string>
<string name="title_edit_challenge_rating">Challenge Rating</string>
<string name="title_edit_condition_immunities">Condition Immunities</string>
<string name="title_edit_condition_immunity">Condition Immunity</string>
<string name="title_edit_damage_immunities">Damage Immunities</string>
<string name="title_edit_damage_immunity">Damage Immunity</string>
<string name="title_edit_damage_resistance">Damage Resistance</string>
<string name="title_edit_damage_resistances">Damage Resistances</string>
<string name="title_edit_damage_vulnerabilities">Damage Vulnerabilities</string>
<string name="title_edit_damage_vulnerability">Damage Vulnerability</string>
<string name="title_edit_lair_action">Lair Action</string>
<string name="title_edit_lair_actions">Lair Actions</string>
<string name="title_edit_language">Language</string>
<string name="title_edit_languages">Languages</string>
<string name="title_edit_legendary_action">Legendary Action</string>
<string name="title_edit_legendary_actions">Legendary Actions</string>
<string name="title_edit_monster">Edit %1$s</string>
<string name="title_edit_reaction">Reaction</string>
<string name="title_edit_reactions">Reactions</string>
<string name="title_edit_regional_action">Regional Action</string>
<string name="title_edit_regional_actions">Regional Actions</string>
<string name="title_edit_speed">Speed</string>
<string name="title_edit_saving_throws">Saving Throws</string>
<string name="title_edit_sense">Senses</string>
<string name="title_edit_senses">Senses</string>
<string name="title_edit_skill">Skill</string>
<string name="title_edit_skills">Skills</string>
<string name="title_library">Library</string>
<string name="title_search">Search</string>
<string name="wisdom_abbreviation">WIS</string>

View File

@@ -7,4 +7,4 @@
<item name="colorAccent">@color/colorAccent</item>
</style>
</resources>
</resources>