Adds AdvantagePicker and ProficiencyPicker components.
This commit is contained in:
@@ -33,9 +33,9 @@ public class AdvantagePicker extends ConstraintLayout {
|
|||||||
|
|
||||||
setValue(AdvantageType.NONE);
|
setValue(AdvantageType.NONE);
|
||||||
mHolder.group.setOnCheckedChangeListener((group, checkedId) -> {
|
mHolder.group.setOnCheckedChangeListener((group, checkedId) -> {
|
||||||
if (R.id.hasAdvantage == checkedId) {
|
if (R.id.advantage == checkedId) {
|
||||||
setValue(AdvantageType.ADVANTAGE);
|
setValue(AdvantageType.ADVANTAGE);
|
||||||
} else if (R.id.hasDisadvantage == checkedId) {
|
} else if (R.id.disadvantage == checkedId) {
|
||||||
setValue(AdvantageType.DISADVANTAGE);
|
setValue(AdvantageType.DISADVANTAGE);
|
||||||
} else {
|
} else {
|
||||||
setValue(AdvantageType.NONE);
|
setValue(AdvantageType.NONE);
|
||||||
@@ -60,11 +60,11 @@ public class AdvantagePicker extends ConstraintLayout {
|
|||||||
}
|
}
|
||||||
final int checkedId = mHolder.group.getCheckedRadioButtonId();
|
final int checkedId = mHolder.group.getCheckedRadioButtonId();
|
||||||
if (mSelectedValue == AdvantageType.ADVANTAGE) {
|
if (mSelectedValue == AdvantageType.ADVANTAGE) {
|
||||||
if (checkedId != R.id.hasAdvantage) {
|
if (checkedId != R.id.advantage) {
|
||||||
mHolder.advantage.setChecked(true);
|
mHolder.advantage.setChecked(true);
|
||||||
}
|
}
|
||||||
} else if (mSelectedValue == AdvantageType.DISADVANTAGE) {
|
} else if (mSelectedValue == AdvantageType.DISADVANTAGE) {
|
||||||
if (checkedId != R.id.hasDisadvantage) {
|
if (checkedId != R.id.disadvantage) {
|
||||||
mHolder.disadvantage.setChecked(true);
|
mHolder.disadvantage.setChecked(true);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -88,11 +88,11 @@ public class AdvantagePicker extends ConstraintLayout {
|
|||||||
final MaterialRadioButton advantage;
|
final MaterialRadioButton advantage;
|
||||||
final MaterialRadioButton disadvantage;
|
final MaterialRadioButton disadvantage;
|
||||||
|
|
||||||
ViewHolder(@NonNull View root) {
|
ViewHolder(View root) {
|
||||||
group = root.findViewById(R.id.group);
|
group = root.findViewById(R.id.group);
|
||||||
none = root.findViewById(R.id.hasNoAdvantage);
|
none = root.findViewById(R.id.none);
|
||||||
advantage = root.findViewById(R.id.hasAdvantage);
|
advantage = root.findViewById(R.id.advantage);
|
||||||
disadvantage = root.findViewById(R.id.hasDisadvantage);
|
disadvantage = root.findViewById(R.id.disadvantage);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -88,7 +88,7 @@ public class ProficiencyPicker extends ConstraintLayout {
|
|||||||
final MaterialRadioButton proficient;
|
final MaterialRadioButton proficient;
|
||||||
final MaterialRadioButton expertise;
|
final MaterialRadioButton expertise;
|
||||||
|
|
||||||
ViewHolder(@NonNull View root) {
|
ViewHolder(View root) {
|
||||||
group = root.findViewById(R.id.group);
|
group = root.findViewById(R.id.group);
|
||||||
none = root.findViewById(R.id.none);
|
none = root.findViewById(R.id.none);
|
||||||
proficient = root.findViewById(R.id.proficient);
|
proficient = root.findViewById(R.id.proficient);
|
||||||
|
|||||||
@@ -11,12 +11,10 @@
|
|||||||
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"
|
||||||
@@ -27,51 +25,24 @@
|
|||||||
app:layout_constraintTop_toBottomOf="@id/label">
|
app:layout_constraintTop_toBottomOf="@id/label">
|
||||||
|
|
||||||
<com.google.android.material.radiobutton.MaterialRadioButton
|
<com.google.android.material.radiobutton.MaterialRadioButton
|
||||||
android:id="@+id/hasNoAdvantage"
|
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:background="@drawable/radio_button_selector"
|
android:text="@string/label_advantage_none" />
|
||||||
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/advantage"
|
||||||
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:background="@drawable/radio_button_selector"
|
android:text="@string/label_advantage_advantage" />
|
||||||
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/disadvantage"
|
||||||
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:background="@drawable/radio_button_selector"
|
android:text="@string/label_advantage_disadvantage" />
|
||||||
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>
|
||||||
@@ -11,12 +11,10 @@
|
|||||||
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"
|
||||||
@@ -30,48 +28,21 @@
|
|||||||
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:background="@drawable/radio_button_selector"
|
android:text="@string/label_proficiency_none" />
|
||||||
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:background="@drawable/radio_button_selector"
|
android:text="@string/label_proficiency_proficient" />
|
||||||
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:background="@drawable/radio_button_selector"
|
android:text="@string/label_proficiency_expertise" />
|
||||||
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>
|
||||||
@@ -12,6 +12,10 @@
|
|||||||
<string name="label_ability_scores">Ability Scores</string>
|
<string name="label_ability_scores">Ability Scores</string>
|
||||||
<string name="label_abilities">Abilities</string>
|
<string name="label_abilities">Abilities</string>
|
||||||
<string name="label_actions">Actions</string>
|
<string name="label_actions">Actions</string>
|
||||||
|
<string name="label_advantage">Advantage</string>
|
||||||
|
<string name="label_advantage_advantage">Advantage</string>
|
||||||
|
<string name="label_advantage_disadvantage">Disadvantage</string>
|
||||||
|
<string name="label_advantage_none">None</string>
|
||||||
<string name="label_alignment">Alignment</string>
|
<string name="label_alignment">Alignment</string>
|
||||||
<string name="label_armor">Armor</string>
|
<string name="label_armor">Armor</string>
|
||||||
<string name="label_base_speed">Base Speed</string>
|
<string name="label_base_speed">Base Speed</string>
|
||||||
@@ -42,6 +46,10 @@
|
|||||||
<string name="label_legendary_actions">Legendary Actions</string>
|
<string name="label_legendary_actions">Legendary Actions</string>
|
||||||
<string name="label_natural_armor_bonus">Natural Armor Bonus</string>
|
<string name="label_natural_armor_bonus">Natural Armor Bonus</string>
|
||||||
<string name="label_name">Name</string>
|
<string name="label_name">Name</string>
|
||||||
|
<string name="label_proficiency">Proficiency</string>
|
||||||
|
<string name="label_proficiency_expertise">Expertise</string>
|
||||||
|
<string name="label_proficiency_none">None</string>
|
||||||
|
<string name="label_proficiency_proficient">Proficient</string>
|
||||||
<string name="label_reactions">Reactions</string>
|
<string name="label_reactions">Reactions</string>
|
||||||
<string name="label_regional_actions">Regional Actions</string>
|
<string name="label_regional_actions">Regional Actions</string>
|
||||||
<string name="label_saving_throws">Saving Throws</string>
|
<string name="label_saving_throws">Saving Throws</string>
|
||||||
|
|||||||
Reference in New Issue
Block a user