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);
|
||||
mHolder.group.setOnCheckedChangeListener((group, checkedId) -> {
|
||||
if (R.id.advantage == checkedId) {
|
||||
if (R.id.hasAdvantage == checkedId) {
|
||||
setValue(AdvantageType.ADVANTAGE);
|
||||
} else if (R.id.disadvantage == checkedId) {
|
||||
} else if (R.id.hasDisadvantage == checkedId) {
|
||||
setValue(AdvantageType.DISADVANTAGE);
|
||||
} else {
|
||||
setValue(AdvantageType.NONE);
|
||||
@@ -60,11 +60,11 @@ public class AdvantagePicker extends ConstraintLayout {
|
||||
}
|
||||
final int checkedId = mHolder.group.getCheckedRadioButtonId();
|
||||
if (mSelectedValue == AdvantageType.ADVANTAGE) {
|
||||
if (checkedId != R.id.advantage) {
|
||||
if (checkedId != R.id.hasAdvantage) {
|
||||
mHolder.advantage.setChecked(true);
|
||||
}
|
||||
} else if (mSelectedValue == AdvantageType.DISADVANTAGE) {
|
||||
if (checkedId != R.id.disadvantage) {
|
||||
if (checkedId != R.id.hasDisadvantage) {
|
||||
mHolder.disadvantage.setChecked(true);
|
||||
}
|
||||
} else {
|
||||
@@ -90,9 +90,9 @@ public class AdvantagePicker extends ConstraintLayout {
|
||||
|
||||
ViewHolder(View root) {
|
||||
group = root.findViewById(R.id.group);
|
||||
none = root.findViewById(R.id.none);
|
||||
advantage = root.findViewById(R.id.advantage);
|
||||
disadvantage = root.findViewById(R.id.disadvantage);
|
||||
none = root.findViewById(R.id.hasNoAdvantage);
|
||||
advantage = root.findViewById(R.id.hasAdvantage);
|
||||
disadvantage = root.findViewById(R.id.hasDisadvantage);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,21 +25,21 @@
|
||||
app:layout_constraintTop_toBottomOf="@id/label">
|
||||
|
||||
<com.google.android.material.radiobutton.MaterialRadioButton
|
||||
android:id="@+id/none"
|
||||
android:id="@+id/hasNoAdvantage"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/label_advantage_none" />
|
||||
|
||||
<com.google.android.material.radiobutton.MaterialRadioButton
|
||||
android:id="@+id/advantage"
|
||||
android:id="@+id/hasAdvantage"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/label_advantage_advantage" />
|
||||
|
||||
<com.google.android.material.radiobutton.MaterialRadioButton
|
||||
android:id="@+id/disadvantage"
|
||||
android:id="@+id/hasDisadvantage"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
|
||||
Reference in New Issue
Block a user