mirror of
https://github.com/EddyVerbruggen/Toast-PhoneGap-Plugin.git
synced 2025-02-24 18:52:51 +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() {
|
cordova.getActivity().runOnUiThread(new Runnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
android.widget.Toast toast = new android.widget.Toast(webView.getContext());
|
android.widget.Toast toast = android.widget.Toast.makeText(webView.getContext(), message, 0);
|
||||||
toast.setText(message);
|
|
||||||
|
|
||||||
if ("top".equals(position)) {
|
if ("top".equals(position)) {
|
||||||
// TODO correct position
|
toast.setGravity(Gravity.TOP|Gravity.CENTER_HORIZONTAL, 0, 20);
|
||||||
toast.setGravity(Gravity.CENTER_VERTICAL|Gravity.CENTER_HORIZONTAL, 0, 0);
|
|
||||||
} else if ("bottom".equals(position)) {
|
} else if ("bottom".equals(position)) {
|
||||||
// TODO correct position
|
toast.setGravity(Gravity.BOTTOM|Gravity.CENTER_HORIZONTAL, 0, 20);
|
||||||
toast.setGravity(Gravity.CENTER_VERTICAL|Gravity.CENTER_HORIZONTAL, 0, 0);
|
|
||||||
} else if ("center".equals(position)) {
|
} else if ("center".equals(position)) {
|
||||||
toast.setGravity(Gravity.CENTER_VERTICAL|Gravity.CENTER_HORIZONTAL, 0, 0);
|
toast.setGravity(Gravity.CENTER_VERTICAL|Gravity.CENTER_HORIZONTAL, 0, 0);
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user