Search in sources :

Example 1 with HandlerQueueManager

use of org.prebid.mobile.rendering.utils.helpers.HandlerQueueManager in project prebid-mobile-android by prebid.

the class WebViewInterstitial method setMRAIDInterface.

public void setMRAIDInterface() {
    BaseJSInterface mraid = new InterstitialJSInterface(getContext(), this, new JsExecutor(this, new Handler(Looper.getMainLooper()), new HandlerQueueManager()));
    addJavascriptInterface(mraid, "jsBridge");
    LogUtil.debug(TAG, "JS bridge initialized");
    setBaseJSInterface(mraid);
}
Also used : BaseJSInterface(org.prebid.mobile.rendering.views.webview.mraid.BaseJSInterface) InterstitialJSInterface(org.prebid.mobile.rendering.views.webview.mraid.InterstitialJSInterface) JsExecutor(org.prebid.mobile.rendering.views.webview.mraid.JsExecutor) Handler(android.os.Handler) HandlerQueueManager(org.prebid.mobile.rendering.utils.helpers.HandlerQueueManager)

Example 2 with HandlerQueueManager

use of org.prebid.mobile.rendering.utils.helpers.HandlerQueueManager in project prebid-mobile-android by prebid.

the class BaseJSInterface method javaScriptCallback.

@Override
@JavascriptInterface
public void javaScriptCallback(String handlerHash, String method, String value) {
    HandlerQueueManager handlerQueueManager = mJsExecutor.getHandlerQueueManager();
    Handler handler = handlerQueueManager.findHandler(handlerHash);
    if (handler != null) {
        Message responseMessage = new Message();
        Bundle bundle = new Bundle();
        bundle.putString(JSON_METHOD, method);
        bundle.putString(JSON_VALUE, value);
        responseMessage.setData(bundle);
        handler.dispatchMessage(responseMessage);
        handlerQueueManager.removeHandler(handlerHash);
    }
}
Also used : Message(android.os.Message) Bundle(android.os.Bundle) Handler(android.os.Handler) HandlerQueueManager(org.prebid.mobile.rendering.utils.helpers.HandlerQueueManager) JavascriptInterface(android.webkit.JavascriptInterface)

Example 3 with HandlerQueueManager

use of org.prebid.mobile.rendering.utils.helpers.HandlerQueueManager in project prebid-mobile-android by prebid.

the class WebViewBanner method setMRAIDInterface.

public void setMRAIDInterface() {
    BaseJSInterface mraid = new BannerJSInterface(getContext(), this, new JsExecutor(this, new Handler(Looper.getMainLooper()), new HandlerQueueManager()));
    addJavascriptInterface(mraid, "jsBridge");
    LogUtil.debug(TAG, "JS bridge initialized");
    setBaseJSInterface(mraid);
}
Also used : BaseJSInterface(org.prebid.mobile.rendering.views.webview.mraid.BaseJSInterface) BannerJSInterface(org.prebid.mobile.rendering.views.webview.mraid.BannerJSInterface) JsExecutor(org.prebid.mobile.rendering.views.webview.mraid.JsExecutor) Handler(android.os.Handler) HandlerQueueManager(org.prebid.mobile.rendering.utils.helpers.HandlerQueueManager)

Aggregations

Handler (android.os.Handler)3 HandlerQueueManager (org.prebid.mobile.rendering.utils.helpers.HandlerQueueManager)3 BaseJSInterface (org.prebid.mobile.rendering.views.webview.mraid.BaseJSInterface)2 JsExecutor (org.prebid.mobile.rendering.views.webview.mraid.JsExecutor)2 Bundle (android.os.Bundle)1 Message (android.os.Message)1 JavascriptInterface (android.webkit.JavascriptInterface)1 BannerJSInterface (org.prebid.mobile.rendering.views.webview.mraid.BannerJSInterface)1 InterstitialJSInterface (org.prebid.mobile.rendering.views.webview.mraid.InterstitialJSInterface)1