get SP value and check if it is already set
This commit is contained in:
parent
67ed699ca5
commit
ef171dbccd
2 changed files with 5 additions and 4 deletions
|
@ -46,7 +46,8 @@ public class SWRadioButton extends SWItem {
|
|||
layout.removeAllViews();
|
||||
String[] labels = context.getResources().getStringArray(labelsArray);
|
||||
String[] values = context.getResources().getStringArray(valuesArray);
|
||||
|
||||
// Get if there is already value in SP
|
||||
String previousValue = SP.getString(preferenceId, "unset");
|
||||
|
||||
radioGroup = new RadioGroup(context);
|
||||
radioGroup.clearCheck();
|
||||
|
@ -60,6 +61,8 @@ public class SWRadioButton extends SWItem {
|
|||
RadioButton rdbtn = new RadioButton(context);
|
||||
rdbtn.setId((row * 2) + i);
|
||||
rdbtn.setText(labels[i]);
|
||||
if(previousValue.equals(values[i]))
|
||||
rdbtn.setChecked(true);
|
||||
// log.debug("Button ["+labels[i]+"]="+rdbtn.getId()+" value is "+values[rdbtn.getId()]);
|
||||
radioGroup.addView(rdbtn);
|
||||
}
|
||||
|
|
|
@ -180,9 +180,7 @@ public class SetupWizardActivity extends AppCompatActivity {
|
|||
radioGroupItems.getRadioGroup().setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(RadioGroup group, int checkedId) {
|
||||
log.debug("Validate radio input:" +currentScreen.validator.isValid());
|
||||
radioGroupItems.save();
|
||||
log.debug("Preference value after save is:"+ SP.getString(radioGroupItems.preferenceId, "unset"));
|
||||
radioGroupItems.save(radioGroupItems.getCheckedValue());
|
||||
nextAllowed = currentScreen.validator.isValid();
|
||||
if(showPage == screens.size() - 1 && nextAllowed) {
|
||||
((Button) findViewById(R.id.finish_button)).setVisibility(View.VISIBLE);
|
||||
|
|
Loading…
Reference in a new issue