#60 Is it possible to change the android theme?

This commit is contained in:
EddyVerbruggen 2015-11-29 21:00:46 +01:00
parent 03320113b4
commit 6ee16e9e7d
2 changed files with 6 additions and 2 deletions

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-dev">
<name>Toast</name>

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)) {