Use if instead of switch for resources
Converting to Soong will move some code from directly compiled into the app to compiled into an Android library and then shared between the app and the tests. This will cause resource IDs in the library to become non-final, which means they can no longer be used in case statements. Convert affect case statements to if blocks. Test: m RunSettingsRoboTests Change-Id: I25742a374f06d3fa4decbfc0d223a350acc50881
This commit is contained in:
@@ -94,22 +94,22 @@ public class AddNetworkFragment extends InstrumentedFragment implements WifiConf
|
||||
public void onClick(View view) {
|
||||
String ssid = null;
|
||||
|
||||
switch (view.getId()) {
|
||||
case SUBMIT_BUTTON_ID:
|
||||
handleSubmitAction();
|
||||
break;
|
||||
case CANCEL_BUTTON_ID:
|
||||
handleCancelAction();
|
||||
break;
|
||||
case SSID_SCANNER_BUTTON_ID:
|
||||
final TextView ssidEditText = getView().findViewById(R.id.ssid);
|
||||
ssid = ssidEditText.getText().toString();
|
||||
// No break and flows to case PASSWORD_SCANNER_BUTTON_ID
|
||||
case PASSWORD_SCANNER_BUTTON_ID:
|
||||
// Launch QR code scanner to join a network.
|
||||
startActivityForResult(WifiDppUtils.getEnrolleeQrCodeScannerIntent(ssid),
|
||||
REQUEST_CODE_WIFI_DPP_ENROLLEE_QR_CODE_SCANNER);
|
||||
break;
|
||||
if (view.getId() == SUBMIT_BUTTON_ID) {
|
||||
handleSubmitAction();
|
||||
} else if (view.getId() == CANCEL_BUTTON_ID) {
|
||||
handleCancelAction();
|
||||
} else if (view.getId() == SSID_SCANNER_BUTTON_ID) {
|
||||
final TextView ssidEditText = getView().findViewById(R.id.ssid);
|
||||
ssid = ssidEditText.getText().toString();
|
||||
// No break and flows to case PASSWORD_SCANNER_BUTTON_ID
|
||||
|
||||
// Launch QR code scanner to join a network.
|
||||
startActivityForResult(WifiDppUtils.getEnrolleeQrCodeScannerIntent(ssid),
|
||||
REQUEST_CODE_WIFI_DPP_ENROLLEE_QR_CODE_SCANNER);
|
||||
} else if (view.getId()
|
||||
== PASSWORD_SCANNER_BUTTON_ID) {// Launch QR code scanner to join a network.
|
||||
startActivityForResult(WifiDppUtils.getEnrolleeQrCodeScannerIntent(ssid),
|
||||
REQUEST_CODE_WIFI_DPP_ENROLLEE_QR_CODE_SCANNER);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user