Makes radio buttons suck less.

Styles the advantage picker and proficiency picker.
Makes the saving throws screen nicer.
This commit is contained in:
Tom Hicks
2021-07-01 02:21:41 -07:00
parent 02f2888817
commit 053a640631
10 changed files with 315 additions and 86 deletions

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:color="@color/colorOnPrimary" android:state_checked="true"/>
<item android:color="@color/colorPrimary" android:state_checked="false"/>
</selector>

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@color/colorPrimary" />
<corners android:radius="@dimen/corner_radius" />
</shape>

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/radio_button_checked" android:state_checked="true" />
<item android:drawable="@drawable/radio_button_unchecked" android:state_checked="false" />
</selector>

View File

@@ -0,0 +1,6 @@
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@android:color/background_light" />
<corners android:radius="@dimen/corner_radius" />
<stroke android:color="@color/colorPrimary" android:width="1dp"/>
</shape>

View File

@@ -6,16 +6,17 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_margin="@dimen/text_margin" android:layout_margin="@dimen/text_margin"
tools:context=".ui.components.AdvantagePicker"> tools:context=".ui.components.AdvantagePicker">
<!-- // TODO: style this control to look less awful by default -->
<TextView <TextView
android:id="@+id/label" android:id="@+id/label"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginHorizontal="@dimen/padding_normal"
android:layout_marginTop="@dimen/padding_small"
android:text="@string/label_advantage" android:text="@string/label_advantage"
android:textAppearance="@android:style/TextAppearance.Material.Medium"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent" />
tools:text="Proficiency" />
<RadioGroup <RadioGroup
android:id="@+id/group" android:id="@+id/group"
@@ -29,21 +30,48 @@
android:id="@+id/hasNoAdvantage" android:id="@+id/hasNoAdvantage"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginHorizontal="@dimen/padding_small"
android:layout_marginVertical="@dimen/padding_normal"
android:layout_weight="1" android:layout_weight="1"
android:text="@string/label_advantage_none" /> android:background="@drawable/radio_button_selector"
android:button="@android:color/transparent"
android:gravity="center"
android:padding="@dimen/padding_normal"
android:text="@string/label_advantage_none"
android:textAppearance="@android:style/TextAppearance.Material.Button"
android:textColor="@color/radio_button_text"
tools:checked="true" />
<com.google.android.material.radiobutton.MaterialRadioButton <com.google.android.material.radiobutton.MaterialRadioButton
android:id="@+id/hasAdvantage" android:id="@+id/hasAdvantage"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginHorizontal="@dimen/padding_small"
android:layout_marginVertical="@dimen/padding_normal"
android:layout_weight="1" android:layout_weight="1"
android:text="@string/label_advantage_advantage" /> android:background="@drawable/radio_button_selector"
android:button="@android:color/transparent"
android:gravity="center"
android:padding="@dimen/padding_normal"
android:text="@string/label_advantage_advantage"
android:textAppearance="@android:style/TextAppearance.Material.Button"
android:textColor="@color/radio_button_text"
tools:checked="false" />
<com.google.android.material.radiobutton.MaterialRadioButton <com.google.android.material.radiobutton.MaterialRadioButton
android:id="@+id/hasDisadvantage" android:id="@+id/hasDisadvantage"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginHorizontal="@dimen/padding_small"
android:layout_marginVertical="@dimen/padding_normal"
android:layout_weight="1" android:layout_weight="1"
android:text="@string/label_advantage_disadvantage" /> android:background="@drawable/radio_button_selector"
android:button="@android:color/transparent"
android:gravity="center"
android:padding="@dimen/padding_normal"
android:text="@string/label_advantage_disadvantage"
android:textAppearance="@android:style/TextAppearance.Material.Button"
android:textColor="@color/radio_button_text"
tools:checked="false" />
</RadioGroup> </RadioGroup>
</merge> </merge>

View File

@@ -0,0 +1,78 @@
<?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="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"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginHorizontal="@dimen/padding_normal"
android:layout_marginTop="@dimen/padding_small"
android:text="@string/label_advantage"
android:textAppearance="@android:style/TextAppearance.Material.Body1"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<RadioGroup
android:id="@+id/group"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toBottomOf="@id/label">
<com.google.android.material.radiobutton.MaterialRadioButton
android:id="@+id/hasNoAdvantage"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginHorizontal="4dp"
android:layout_marginVertical="8dp"
android:layout_weight="1"
android:background="@drawable/radio_button_selector"
android:button="@android:color/transparent"
android:gravity="center"
android:padding="8dp"
android:text="@string/label_advantage_none"
android:textAppearance="@android:style/TextAppearance.Material.Button"
android:textColor="@color/radio_button_text"
tools:checked="true" />
<com.google.android.material.radiobutton.MaterialRadioButton
android:id="@+id/hasAdvantage"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginHorizontal="4dp"
android:layout_marginVertical="8dp"
android:layout_weight="1"
android:background="@drawable/radio_button_selector"
android:button="@android:color/transparent"
android:gravity="center"
android:padding="8dp"
android:text="@string/label_advantage_advantage"
android:textAppearance="@android:style/TextAppearance.Material.Button"
android:textColor="@color/radio_button_text"
tools:checked="false" />
<com.google.android.material.radiobutton.MaterialRadioButton
android:id="@+id/hasDisadvantage"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginHorizontal="4dp"
android:layout_marginVertical="8dp"
android:layout_weight="1"
android:background="@drawable/radio_button_selector"
android:button="@android:color/transparent"
android:gravity="center"
android:padding="8dp"
android:text="@string/label_advantage_disadvantage"
android:textAppearance="@android:style/TextAppearance.Material.Button"
android:textColor="@color/radio_button_text"
tools:checked="false" />
</RadioGroup>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -6,16 +6,17 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_margin="@dimen/text_margin" android:layout_margin="@dimen/text_margin"
tools:context=".ui.components.ProficiencyPicker"> tools:context=".ui.components.ProficiencyPicker">
<!-- // TODO: style this control to look less awful by default -->
<TextView <TextView
android:id="@+id/label" android:id="@+id/label"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginHorizontal="@dimen/padding_normal"
android:layout_marginTop="@dimen/padding_small"
android:text="@string/label_proficiency" android:text="@string/label_proficiency"
android:textAppearance="@android:style/TextAppearance.Material.Medium"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent" />
tools:text="Proficiency" />
<RadioGroup <RadioGroup
android:id="@+id/group" android:id="@+id/group"
@@ -29,21 +30,48 @@
android:id="@+id/none" android:id="@+id/none"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginHorizontal="@dimen/padding_small"
android:layout_marginVertical="@dimen/padding_normal"
android:layout_weight="1" android:layout_weight="1"
android:text="@string/label_proficiency_none" /> android:background="@drawable/radio_button_selector"
android:button="@android:color/transparent"
android:gravity="center"
android:padding="@dimen/padding_normal"
android:text="@string/label_proficiency_none"
android:textAppearance="@android:style/TextAppearance.Material.Button"
android:textColor="@color/radio_button_text"
tools:checked="true" />
<com.google.android.material.radiobutton.MaterialRadioButton <com.google.android.material.radiobutton.MaterialRadioButton
android:id="@+id/proficient" android:id="@+id/proficient"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginHorizontal="@dimen/padding_small"
android:layout_marginVertical="@dimen/padding_normal"
android:layout_weight="1" android:layout_weight="1"
android:text="@string/label_proficiency_proficient" /> android:background="@drawable/radio_button_selector"
android:button="@android:color/transparent"
android:gravity="center"
android:padding="@dimen/padding_normal"
android:text="@string/label_proficiency_proficient"
android:textAppearance="@android:style/TextAppearance.Material.Button"
android:textColor="@color/radio_button_text"
tools:checked="false" />
<com.google.android.material.radiobutton.MaterialRadioButton <com.google.android.material.radiobutton.MaterialRadioButton
android:id="@+id/expertise" android:id="@+id/expertise"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginHorizontal="@dimen/padding_small"
android:layout_marginVertical="@dimen/padding_normal"
android:layout_weight="1" android:layout_weight="1"
android:text="@string/label_proficiency_expertise" /> android:background="@drawable/radio_button_selector"
android:button="@android:color/transparent"
android:gravity="center"
android:padding="@dimen/padding_normal"
android:text="@string/label_proficiency_expertise"
android:textAppearance="@android:style/TextAppearance.Material.Button"
android:textColor="@color/radio_button_text"
tools:checked="false" />
</RadioGroup> </RadioGroup>
</merge> </merge>

View File

@@ -3,109 +3,169 @@
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
tools:context=".ui.editmonster.EditSavingThrowsFragment"> tools:context=".ui.editmonster.EditSavingThrowsFragment">
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical"> android:divider="?android:attr/dividerVertical"
android:orientation="vertical"
android:showDividers="middle">
<TextView <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="start" android:layout_marginTop="@dimen/padding_large"
android:text="@string/label_strength" /> android:layout_marginBottom="@dimen/padding_normal"
android:orientation="vertical">
<com.majinnaibu.monstercards.ui.components.ProficiencyPicker <TextView
android:id="@+id/strengthProficiency" android:layout_width="match_parent"
android:layout_width="match_parent" android:layout_height="wrap_content"
android:layout_height="wrap_content" /> android:gravity="center_horizontal"
android:text="@string/label_strength"
android:textAppearance="@android:style/TextAppearance.Material.Title" />
<com.majinnaibu.monstercards.ui.components.AdvantagePicker <com.majinnaibu.monstercards.ui.components.ProficiencyPicker
android:id="@+id/strengthAdvantage" android:id="@+id/strengthProficiency"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" /> android:layout_height="wrap_content" />
<TextView <com.majinnaibu.monstercards.ui.components.AdvantagePicker
android:id="@+id/strengthAdvantage"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="start" android:layout_marginTop="@dimen/padding_large"
android:text="@string/label_dexterity" /> android:layout_marginBottom="@dimen/padding_normal"
android:orientation="vertical">
<com.majinnaibu.monstercards.ui.components.ProficiencyPicker <TextView
android:id="@+id/dexterityProficiency" android:layout_width="match_parent"
android:layout_width="match_parent" android:layout_height="wrap_content"
android:layout_height="wrap_content" /> android:gravity="center_horizontal"
android:text="@string/label_dexterity"
android:textAppearance="@android:style/TextAppearance.Material.Title" />
<com.majinnaibu.monstercards.ui.components.AdvantagePicker <com.majinnaibu.monstercards.ui.components.ProficiencyPicker
android:id="@+id/dexterityAdvantage" android:id="@+id/dexterityProficiency"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" /> android:layout_height="wrap_content" />
<TextView <com.majinnaibu.monstercards.ui.components.AdvantagePicker
android:id="@+id/dexterityAdvantage"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="start" android:layout_marginTop="@dimen/padding_large"
android:text="@string/label_constitution" /> android:layout_marginBottom="@dimen/padding_normal"
android:orientation="vertical">
<com.majinnaibu.monstercards.ui.components.ProficiencyPicker <TextView
android:id="@+id/constitutionProficiency" android:layout_width="match_parent"
android:layout_width="match_parent" android:layout_height="wrap_content"
android:layout_height="wrap_content" /> android:gravity="center_horizontal"
android:text="@string/label_constitution"
android:textAppearance="@android:style/TextAppearance.Material.Title" />
<com.majinnaibu.monstercards.ui.components.AdvantagePicker <com.majinnaibu.monstercards.ui.components.ProficiencyPicker
android:id="@+id/constitutionAdvantage" android:id="@+id/constitutionProficiency"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" /> android:layout_height="wrap_content" />
<TextView <com.majinnaibu.monstercards.ui.components.AdvantagePicker
android:id="@+id/constitutionAdvantage"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="start" android:layout_marginTop="@dimen/padding_large"
android:text="@string/label_intelligence" /> android:layout_marginBottom="@dimen/padding_normal"
android:orientation="vertical">
<com.majinnaibu.monstercards.ui.components.ProficiencyPicker <TextView
android:id="@+id/intelligenceProficiency" android:layout_width="match_parent"
android:layout_width="match_parent" android:layout_height="wrap_content"
android:layout_height="wrap_content" /> android:gravity="center_horizontal"
android:text="@string/label_intelligence"
android:textAppearance="@android:style/TextAppearance.Material.Title" />
<com.majinnaibu.monstercards.ui.components.AdvantagePicker <com.majinnaibu.monstercards.ui.components.ProficiencyPicker
android:id="@+id/intelligenceAdvantage" android:id="@+id/intelligenceProficiency"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" /> android:layout_height="wrap_content" />
<TextView <com.majinnaibu.monstercards.ui.components.AdvantagePicker
android:id="@+id/intelligenceAdvantage"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="start" android:layout_marginTop="@dimen/padding_large"
android:text="@string/label_wisdom" /> android:layout_marginBottom="@dimen/padding_normal"
android:orientation="vertical">
<com.majinnaibu.monstercards.ui.components.ProficiencyPicker <TextView
android:id="@+id/wisdomProficiency" android:layout_width="match_parent"
android:layout_width="match_parent" android:layout_height="wrap_content"
android:layout_height="wrap_content" /> android:gravity="center_horizontal"
android:text="@string/label_wisdom"
android:textAppearance="@android:style/TextAppearance.Material.Title" />
<com.majinnaibu.monstercards.ui.components.AdvantagePicker <com.majinnaibu.monstercards.ui.components.ProficiencyPicker
android:id="@+id/wisdomAdvantage" android:id="@+id/wisdomProficiency"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" /> android:layout_height="wrap_content" />
<TextView <com.majinnaibu.monstercards.ui.components.AdvantagePicker
android:id="@+id/wisdomAdvantage"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="start" android:layout_marginTop="@dimen/padding_large"
android:text="@string/label_charisma" /> android:layout_marginBottom="@dimen/padding_normal"
android:orientation="vertical">
<com.majinnaibu.monstercards.ui.components.ProficiencyPicker <TextView
android:id="@+id/charismaProficiency" android:layout_width="match_parent"
android:layout_width="match_parent" android:layout_height="wrap_content"
android:layout_height="wrap_content" /> android:gravity="center_horizontal"
android:text="@string/label_charisma"
android:textAppearance="@android:style/TextAppearance.Material.Title" />
<com.majinnaibu.monstercards.ui.components.AdvantagePicker <com.majinnaibu.monstercards.ui.components.ProficiencyPicker
android:id="@+id/charismaAdvantage" android:id="@+id/charismaProficiency"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" /> android:layout_height="wrap_content" />
<com.majinnaibu.monstercards.ui.components.AdvantagePicker
android:id="@+id/charismaAdvantage"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
</LinearLayout> </LinearLayout>
</ScrollView> </ScrollView>

View File

@@ -1,8 +1,17 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources> <resources>
<color name="colorPrimary">#9B2818</color> <!-- From palette here https://material.io/resources/color/#!/?view.left=1&view.right=1&primary.color=9b2818&secondary.color=ea7e00 -->
<color name="colorPrimaryDark">#661A10</color> <color name="colorPrimary">#9b2818</color>
<!-- <color name="colorAccent">#188B9B</color>--> <color name="colorPrimaryLight">#d25941</color>
<color name="colorPrimaryDark">#660000</color>
<color name="colorSecondary">#ea7e00</color>
<color name="colorSecondaryLight">#ffae41</color>
<color name="colorSecondaryDark">#b15000</color>
<color name="colorOnPrimary">#ffffff</color>
<color name="colorOnSecondary">#000000</color>
<color name="colorOnLight">#ffffff</color>
<color name="colorOnDark">#000000</color>
<color name="colorAccent">#995500</color> <color name="colorAccent">#995500</color>
<!-- fruit system colors --> <!-- fruit system colors -->
@@ -14,4 +23,4 @@
<color name="blue">#007AFF</color> <color name="blue">#007AFF</color>
<color name="purple">#5855D6</color> <color name="purple">#5855D6</color>
<color name="pink">#FF2D55</color> <color name="pink">#FF2D55</color>
</resources> </resources>

View File

@@ -3,5 +3,9 @@
<dimen name="text_margin">16dp</dimen> <dimen name="text_margin">16dp</dimen>
<dimen name="fab_margin">16dp</dimen> <dimen name="fab_margin">16dp</dimen>
<dimen name="text_h4_size">20sp</dimen> <dimen name="text_h4_size">20sp</dimen>
<dimen name="corner_radius">4dp</dimen>
</resources> <dimen name="padding_small">4dp</dimen>
<dimen name="padding_normal">8dp</dimen>
<dimen name="padding_large">16dp</dimen>
<dimen name="padding_huge">32dp</dimen>
</resources>