Makes AdvantagePicker work if you set the id of the advantage picker to advantage.
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.advantage == checkedId) {
|
if (R.id.hasAdvantage == checkedId) {
|
||||||
setValue(AdvantageType.ADVANTAGE);
|
setValue(AdvantageType.ADVANTAGE);
|
||||||
} else if (R.id.disadvantage == checkedId) {
|
} else if (R.id.hasDisadvantage == 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.advantage) {
|
if (checkedId != R.id.hasAdvantage) {
|
||||||
mHolder.advantage.setChecked(true);
|
mHolder.advantage.setChecked(true);
|
||||||
}
|
}
|
||||||
} else if (mSelectedValue == AdvantageType.DISADVANTAGE) {
|
} else if (mSelectedValue == AdvantageType.DISADVANTAGE) {
|
||||||
if (checkedId != R.id.disadvantage) {
|
if (checkedId != R.id.hasDisadvantage) {
|
||||||
mHolder.disadvantage.setChecked(true);
|
mHolder.disadvantage.setChecked(true);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -90,9 +90,9 @@ public class AdvantagePicker extends ConstraintLayout {
|
|||||||
|
|
||||||
ViewHolder(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.hasNoAdvantage);
|
||||||
advantage = root.findViewById(R.id.advantage);
|
advantage = root.findViewById(R.id.hasAdvantage);
|
||||||
disadvantage = root.findViewById(R.id.disadvantage);
|
disadvantage = root.findViewById(R.id.hasDisadvantage);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,21 +25,21 @@
|
|||||||
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/none"
|
android:id="@+id/hasNoAdvantage"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:text="@string/label_advantage_none" />
|
android:text="@string/label_advantage_none" />
|
||||||
|
|
||||||
<com.google.android.material.radiobutton.MaterialRadioButton
|
<com.google.android.material.radiobutton.MaterialRadioButton
|
||||||
android:id="@+id/advantage"
|
android:id="@+id/hasAdvantage"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:text="@string/label_advantage_advantage" />
|
android:text="@string/label_advantage_advantage" />
|
||||||
|
|
||||||
<com.google.android.material.radiobutton.MaterialRadioButton
|
<com.google.android.material.radiobutton.MaterialRadioButton
|
||||||
android:id="@+id/disadvantage"
|
android:id="@+id/hasDisadvantage"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
|
|||||||
Reference in New Issue
Block a user