Skip to content
This repository has been archived by the owner on Dec 29, 2022. It is now read-only.

Commit

Permalink
Enable ui if passwords fails
Browse files Browse the repository at this point in the history
  • Loading branch information
g-ortuno committed Dec 2, 2014
1 parent a6b372c commit 470ddff
Showing 1 changed file with 12 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -94,21 +94,21 @@ public void onUriBeaconWrite(int status) {
} else {
Toast.makeText(ConfigActivity.this, getString(R.string.failed_with_code) + status, Toast.LENGTH_SHORT).show();
}
enableUi(true);
}
};

private void blockUi() {
mSchema.setEnabled(false);
mUriValue.setEnabled(false);
mFlagsValue.setEnabled(false);
private void enableUi(boolean block) {
mSchema.setEnabled(block);
mUriValue.setEnabled(block);
mFlagsValue.setEnabled(block);
for (EditText txCal : mAdvertisedTxPowerLevels) {
txCal.setEnabled(false);
txCal.setEnabled(block);
}
mTxPowerMode.setEnabled(false);
mBeaconPeriod.setEnabled(false);
mLockState.setEnabled(false);
mTxPowerMode.setEnabled(block);
mBeaconPeriod.setEnabled(block);
mLockState.setEnabled(block);
}

public void saveConfigBeacon(MenuItem menu) {
try {
if (mUriBeaconConfig.getVersion().equals(ProtocolV2.CONFIG_SERVICE_UUID)) {
Expand All @@ -120,7 +120,7 @@ public void saveConfigBeacon(MenuItem menu) {
}
}
else {
blockUi();
enableUi(false);
ConfigUriBeacon configUriBeacon = new ConfigUriBeacon.Builder()
.uriString(mUriValue.getText().toString())
.txPowerLevel(DEFAULT_TX_POWER)
Expand All @@ -142,6 +142,7 @@ public void onResetClicked(MenuItem menu) {
}
private void resetConfigBeacon(byte[] key) {
try {
enableUi(false);
ConfigUriBeacon configUriBeacon = new ConfigUriBeacon.Builder()
.key(key)
.reset(true)
Expand All @@ -152,7 +153,7 @@ private void resetConfigBeacon(byte[] key) {
}
}
private void writeUriBeaconV2(byte[] key) throws URISyntaxException {
blockUi();
enableUi(false);
ConfigUriBeacon.Builder builder = new ConfigUriBeacon.Builder()
.key(key)
.lockState(mLockState.isChecked())
Expand Down

0 comments on commit 470ddff

Please sign in to comment.