Android: Show patch code categories in list

This commit is contained in:
Connor McLaughlin
2021-05-29 20:51:53 +10:00
parent 1b0b88f60b
commit 0229f25fc3
3 changed files with 22 additions and 4 deletions

View File

@ -581,7 +581,7 @@ public class EmulationActivity extends AppCompatActivity implements SurfaceHolde
boolean[] itemsChecked = new boolean[codes.length];
for (int i = 0; i < codes.length; i++) {
final PatchCode cc = codes[i];
items[i] = cc.getDescription();
items[i] = cc.getDisplayText();
itemsChecked[i] = cc.isEnabled();
}

View File

@ -1,12 +1,16 @@
package com.github.stenzek.duckstation;
public class PatchCode {
private static final String UNGROUPED_NAME = "Ungrouped";
private int mIndex;
private String mGroup;
private String mDescription;
private boolean mEnabled;
public PatchCode(int index, String description, boolean enabled) {
public PatchCode(int index, String group, String description, boolean enabled) {
mIndex = index;
mGroup = group;
mDescription = description;
mEnabled = enabled;
}
@ -15,6 +19,10 @@ public class PatchCode {
return mIndex;
}
public String getGroup() {
return mGroup;
}
public String getDescription() {
return mDescription;
}
@ -22,4 +30,11 @@ public class PatchCode {
public boolean isEnabled() {
return mEnabled;
}
public String getDisplayText() {
if (mGroup == null || mGroup.equals(UNGROUPED_NAME))
return mDescription;
else
return String.format("(%s) %s", mGroup, mDescription);
}
}