summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/src/main/java/de/danoeh/antennapod/activity/gpoddernet/GpodnetAuthenticationActivity.java18
-rw-r--r--core/src/main/res/values/strings.xml1
2 files changed, 11 insertions, 8 deletions
diff --git a/app/src/main/java/de/danoeh/antennapod/activity/gpoddernet/GpodnetAuthenticationActivity.java b/app/src/main/java/de/danoeh/antennapod/activity/gpoddernet/GpodnetAuthenticationActivity.java
index 7ca73fa92..738fefb24 100644
--- a/app/src/main/java/de/danoeh/antennapod/activity/gpoddernet/GpodnetAuthenticationActivity.java
+++ b/app/src/main/java/de/danoeh/antennapod/activity/gpoddernet/GpodnetAuthenticationActivity.java
@@ -225,7 +225,7 @@ public class GpodnetAuthenticationActivity extends ActionBarActivity {
createNewDevice.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
- if (checkDeviceIDText(deviceID, txtvError, devices.get())) {
+ if (checkDeviceIDText(deviceID, caption, txtvError, devices.get())) {
final String deviceStr = deviceID.getText().toString();
final String captionStr = caption.getText().toString();
@@ -311,20 +311,22 @@ public class GpodnetAuthenticationActivity extends ActionBarActivity {
return false;
}
- private boolean checkDeviceIDText(EditText deviceID, TextView txtvError, List<GpodnetDevice> devices) {
+ private boolean checkDeviceIDText(EditText deviceID, EditText caption, TextView txtvError, List<GpodnetDevice> devices) {
String text = deviceID.getText().toString();
if (text.length() == 0) {
txtvError.setText(R.string.gpodnetauth_device_errorEmpty);
txtvError.setVisibility(View.VISIBLE);
return false;
+ } else if (caption.length() == 0) {
+ txtvError.setText(R.string.gpodnetauth_device_caption_errorEmpty);
+ txtvError.setVisibility(View.VISIBLE);
+ return false;
} else {
if (devices != null) {
- for (GpodnetDevice device : devices) {
- if (device.getId().equals(text)) {
- txtvError.setText(R.string.gpodnetauth_device_errorAlreadyUsed);
- txtvError.setVisibility(View.VISIBLE);
- return false;
- }
+ if (isDeviceWithIdInList(text, devices)) {
+ txtvError.setText(R.string.gpodnetauth_device_errorAlreadyUsed);
+ txtvError.setVisibility(View.VISIBLE);
+ return false;
}
txtvError.setVisibility(View.GONE);
return true;
diff --git a/core/src/main/res/values/strings.xml b/core/src/main/res/values/strings.xml
index 6e2848c20..d268de3da 100644
--- a/core/src/main/res/values/strings.xml
+++ b/core/src/main/res/values/strings.xml
@@ -485,6 +485,7 @@
<string name="gpodnetauth_device_chooseExistingDevice">Choose existing device:</string>
<string name="gpodnetauth_device_errorEmpty">Device ID must not be empty</string>
<string name="gpodnetauth_device_errorAlreadyUsed">Device ID already in use</string>
+ <string name="gpodnetauth_device_caption_errorEmpty">Caption must not be empty</string>
<string name="gpodnetauth_device_butChoose">Choose</string>
<string name="gpodnetauth_finish_title">Login successful!</string>