Search in sources :

Example 91 with PluginMethod

use of com.getcapacitor.PluginMethod in project capacitor-plugins by ionic-team.

the class TextZoomPlugin method getPreferred.

@PluginMethod
public void getPreferred(final PluginCall call) {
    JSObject ret = new JSObject();
    ret.put("value", textZoom.getPreferred());
    call.resolve(ret);
}
Also used : JSObject(com.getcapacitor.JSObject) PluginMethod(com.getcapacitor.PluginMethod)

Example 92 with PluginMethod

use of com.getcapacitor.PluginMethod in project capacitor-video-player by jepiqueau.

the class CapacitorVideoPlayerPlugin method getDuration.

@PluginMethod
public void getDuration(final PluginCall call) {
    this.call = call;
    JSObject ret = new JSObject();
    ret.put("method", "getDuration");
    String playerId = call.getString("playerId");
    if (playerId == null) {
        ret.put("result", false);
        ret.put("message", "Must provide a PlayerId");
        call.resolve(ret);
        return;
    }
    if ("fullscreen".equals(mode) && fsPlayerId.equals(playerId)) {
        bridge.getActivity().runOnUiThread(new Runnable() {

            @Override
            public void run() {
                JSObject ret = new JSObject();
                ret.put("method", "getDuration");
                if (fsFragment != null) {
                    int duration = fsFragment.getDuration();
                    ret.put("result", true);
                    ret.put("value", duration);
                    call.resolve(ret);
                } else {
                    ret.put("result", false);
                    ret.put("message", "Fullscreen fragment is not defined");
                    call.resolve(ret);
                }
            }
        });
    } else {
        ret.put("result", false);
        ret.put("message", "player is not defined");
        call.resolve(ret);
    }
}
Also used : MyRunnable(com.jeep.plugin.capacitor.capacitorvideoplayer.Notifications.MyRunnable) JSObject(com.getcapacitor.JSObject) PluginMethod(com.getcapacitor.PluginMethod)

Example 93 with PluginMethod

use of com.getcapacitor.PluginMethod in project capacitor-video-player by jepiqueau.

the class CapacitorVideoPlayerPlugin method stopAllPlayers.

@PluginMethod
public void stopAllPlayers(PluginCall call) {
    this.call = call;
    bridge.getActivity().runOnUiThread(new Runnable() {

        @Override
        public void run() {
            JSObject ret = new JSObject();
            ret.put("method", "stopAllPlayers");
            if (fsFragment != null) {
                fsFragment.pause();
                ret.put("result", true);
                ret.put("value", true);
                call.resolve(ret);
            } else {
                ret.put("result", false);
                ret.put("message", "Fullscreen fragment is not defined");
                call.resolve(ret);
            }
        }
    });
}
Also used : MyRunnable(com.jeep.plugin.capacitor.capacitorvideoplayer.Notifications.MyRunnable) JSObject(com.getcapacitor.JSObject) PluginMethod(com.getcapacitor.PluginMethod)

Example 94 with PluginMethod

use of com.getcapacitor.PluginMethod in project capacitor-video-player by jepiqueau.

the class CapacitorVideoPlayerPlugin method pause.

@PluginMethod
public void pause(final PluginCall call) {
    this.call = call;
    JSObject ret = new JSObject();
    ret.put("method", "pause");
    String playerId = call.getString("playerId");
    if (playerId == null) {
        ret.put("result", false);
        ret.put("message", "Must provide a PlayerId");
        call.resolve(ret);
        return;
    }
    if ("fullscreen".equals(mode) && fsPlayerId.equals(playerId)) {
        bridge.getActivity().runOnUiThread(new Runnable() {

            @Override
            public void run() {
                JSObject ret = new JSObject();
                ret.put("method", "pause");
                if (fsFragment != null) {
                    fsFragment.pause();
                    ret.put("result", true);
                    ret.put("value", true);
                    call.resolve(ret);
                } else {
                    ret.put("result", false);
                    ret.put("message", "Fullscreen fragment is not defined");
                    call.resolve(ret);
                }
            }
        });
    } else {
        ret.put("result", false);
        ret.put("message", "player is not defined");
        call.resolve(ret);
    }
}
Also used : MyRunnable(com.jeep.plugin.capacitor.capacitorvideoplayer.Notifications.MyRunnable) JSObject(com.getcapacitor.JSObject) PluginMethod(com.getcapacitor.PluginMethod)

Example 95 with PluginMethod

use of com.getcapacitor.PluginMethod in project capacitor-video-player by jepiqueau.

the class CapacitorVideoPlayerPlugin method setMuted.

@PluginMethod
public void setMuted(final PluginCall call) {
    this.call = call;
    JSObject ret = new JSObject();
    ret.put("method", "setMuted");
    String playerId = call.getString("playerId");
    if (playerId == null) {
        ret.put("result", false);
        ret.put("message", "Must provide a PlayerId");
        call.resolve(ret);
        return;
    }
    Boolean value = call.getBoolean("muted");
    if (value == null) {
        ret.put("result", true);
        ret.put("message", "Must provide a boolean true/false");
        call.resolve(ret);
        return;
    }
    final boolean bValue = value;
    if ("fullscreen".equals(mode) && fsPlayerId.equals(playerId)) {
        bridge.getActivity().runOnUiThread(new Runnable() {

            @Override
            public void run() {
                JSObject ret = new JSObject();
                ret.put("method", "setMuted");
                if (fsFragment != null) {
                    fsFragment.setMuted(bValue);
                    ret.put("result", true);
                    ret.put("value", bValue);
                    call.resolve(ret);
                } else {
                    ret.put("result", false);
                    ret.put("message", "Fullscreen fragment is not defined");
                    call.resolve(ret);
                }
            }
        });
    } else {
        ret.put("result", false);
        ret.put("message", "player is not defined");
        call.resolve(ret);
    }
}
Also used : MyRunnable(com.jeep.plugin.capacitor.capacitorvideoplayer.Notifications.MyRunnable) JSObject(com.getcapacitor.JSObject) PluginMethod(com.getcapacitor.PluginMethod)

Aggregations

PluginMethod (com.getcapacitor.PluginMethod)120 JSObject (com.getcapacitor.JSObject)93 JSONException (org.json.JSONException)18 MyRunnable (com.jeep.plugin.capacitor.capacitorvideoplayer.Notifications.MyRunnable)13 JSONObject (org.json.JSONObject)13 JSArray (com.getcapacitor.JSArray)12 Radar (io.radar.sdk.Radar)11 Location (android.location.Location)8 Intent (android.content.Intent)7 NotNull (org.jetbrains.annotations.NotNull)6 Nullable (org.jetbrains.annotations.Nullable)6 Uri (android.net.Uri)5 LatLng (com.google.android.libraries.maps.model.LatLng)5 GenericAd (admob.plus.core.GenericAd)4 GoogleSignInAccount (com.google.android.gms.auth.api.signin.GoogleSignInAccount)4 Gson (com.google.gson.Gson)4 PackageManager (android.content.pm.PackageManager)3 AppCompatActivity (androidx.appcompat.app.AppCompatActivity)3 User (io.ionic.demo.ecommerce.data.model.User)3 Context (android.content.Context)2