Compare commits

...
2 Commits
3 changed files with 7 additions and 3 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "cordova-plugin-x-toast",
"version": "2.2.1",
"version": "2.2.2",
"description": "This plugin allows you to show a Toast. A Toast is a little non intrusive buttonless popup which automatically disappears.",
"cordova": {
"id": "cordova-plugin-x-toast",
+1 -1
View File
@@ -2,7 +2,7 @@
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
xmlns:android="http://schemas.android.com/apk/res/android"
id="cordova-plugin-x-toast"
version="2.2.1">
version="2.2.2">
<name>Toast</name>
+5 -1
View File
@@ -1,5 +1,6 @@
package nl.xservices.plugins;
import android.graphics.Color;
import android.view.Gravity;
import org.apache.cordova.CallbackContext;
import org.apache.cordova.CordovaPlugin;
@@ -52,10 +53,13 @@ public class Toast extends CordovaPlugin {
cordova.getActivity().runOnUiThread(new Runnable() {
public void run() {
android.widget.Toast toast = android.widget.Toast.makeText(
cordova.getActivity().getApplicationContext(),
cordova.getActivity().getWindow().getContext(),
message,
"short".equals(duration) ? android.widget.Toast.LENGTH_SHORT : android.widget.Toast.LENGTH_LONG);
// toast.getView().setBackgroundColor(Color.GRAY);
// toast.getView().setPadding(20, 10, 20, 10);
toast.getView().getBackground().setTint(Color.DKGRAY);
if ("top".equals(position)) {
toast.setGravity(Gravity.TOP|Gravity.CENTER_HORIZONTAL, 0, 20 + addPixelsY);
} else if ("bottom".equals(position)) {