forked from github/Toast-PhoneGap-Plugin
On Android a Toast was shown when an invalid option was passed. Trivial issue.
This commit is contained in:
parent
388979b909
commit
daba1f21cd
@ -30,6 +30,7 @@ public class Toast extends CordovaPlugin {
|
|||||||
toast.setGravity(Gravity.CENTER_VERTICAL|Gravity.CENTER_HORIZONTAL, 0, 0);
|
toast.setGravity(Gravity.CENTER_VERTICAL|Gravity.CENTER_HORIZONTAL, 0, 0);
|
||||||
} else {
|
} else {
|
||||||
callbackContext.error("invalid position. valid options are 'top', 'center' and 'bottom'");
|
callbackContext.error("invalid position. valid options are 'top', 'center' and 'bottom'");
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ("short".equals(duration)) {
|
if ("short".equals(duration)) {
|
||||||
@ -38,6 +39,7 @@ public class Toast extends CordovaPlugin {
|
|||||||
toast.setDuration(android.widget.Toast.LENGTH_LONG);
|
toast.setDuration(android.widget.Toast.LENGTH_LONG);
|
||||||
} else {
|
} else {
|
||||||
callbackContext.error("invalid duration. valid options are 'short' and 'long'");
|
callbackContext.error("invalid duration. valid options are 'short' and 'long'");
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
toast.show();
|
toast.show();
|
||||||
@ -51,4 +53,4 @@ public class Toast extends CordovaPlugin {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user