summaryrefslogtreecommitdiff
path: root/app/src/main
diff options
context:
space:
mode:
authorTom Hennen <tom.hennen@gmail.com>2016-03-25 09:44:49 -0400
committerTom Hennen <tom.hennen@gmail.com>2016-03-25 09:44:49 -0400
commit1d8d04fecb8f5104e161c551d970f30029df7a23 (patch)
tree21db6b4e0e9b31a1ddf3c56769a1f555f19fd8c1 /app/src/main
parente413d85c210ad5435381ebea678b914f69b59d3e (diff)
downloadAntennaPod-1d8d04fecb8f5104e161c551d970f30029df7a23.zip
check if caption is empty too
Diffstat (limited to 'app/src/main')
-rw-r--r--app/src/main/java/de/danoeh/antennapod/activity/gpoddernet/GpodnetAuthenticationActivity.java18
1 files changed, 10 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;