mirror of
https://github.com/EddyVerbruggen/Toast-PhoneGap-Plugin.git
synced 2025-02-24 10:12:53 +08:00
finalised Android impl
This commit is contained in:
parent
f5ab4e7baf
commit
cbdd1027b4
@ -20,15 +20,12 @@ public class Toast extends CordovaPlugin {
|
||||
|
||||
cordova.getActivity().runOnUiThread(new Runnable() {
|
||||
public void run() {
|
||||
android.widget.Toast toast = new android.widget.Toast(webView.getContext());
|
||||
toast.setText(message);
|
||||
android.widget.Toast toast = android.widget.Toast.makeText(webView.getContext(), message, 0);
|
||||
|
||||
if ("top".equals(position)) {
|
||||
// TODO correct position
|
||||
toast.setGravity(Gravity.CENTER_VERTICAL|Gravity.CENTER_HORIZONTAL, 0, 0);
|
||||
toast.setGravity(Gravity.TOP|Gravity.CENTER_HORIZONTAL, 0, 20);
|
||||
} else if ("bottom".equals(position)) {
|
||||
// TODO correct position
|
||||
toast.setGravity(Gravity.CENTER_VERTICAL|Gravity.CENTER_HORIZONTAL, 0, 0);
|
||||
toast.setGravity(Gravity.BOTTOM|Gravity.CENTER_HORIZONTAL, 0, 20);
|
||||
} else if ("center".equals(position)) {
|
||||
toast.setGravity(Gravity.CENTER_VERTICAL|Gravity.CENTER_HORIZONTAL, 0, 0);
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user