Search in sources :

Example 1 with ShareInfoBean

use of com.benmu.framework.model.ShareInfoBean in project WeexErosFramework by bmfe.

the class DefaultShareAdapter method share.

public void share(Activity activity, String params, JSCallback success, JSCallback fail) {
    if (activity == null || TextUtils.isEmpty(params))
        return;
    this.mAct = activity;
    this.mSuccess = success;
    this.mFailed = fail;
    ParseManager parseManager = ManagerFactory.getManagerService(ParseManager.class);
    ShareInfoBean shareInfo = null;
    try {
        shareInfo = parseManager.parseObject(params, ShareInfoBean.class);
    } catch (Exception e) {
        e.printStackTrace();
    }
    if (shareInfo == null)
        return;
    if (shareInfo.isPopUp()) {
        if (shareInfo.getPlatforms() == null || shareInfo.getPlatforms().size() > 1) {
            JsPoster.postFailed("请确定分享平台", fail);
            return;
        }
        shareDirectly(shareInfo, shareInfo.getPlatforms().get(0));
    } else {
        showShareDialog(shareInfo);
    }
}
Also used : ShareInfoBean(com.benmu.framework.model.ShareInfoBean) ParseManager(com.benmu.framework.manager.impl.ParseManager)

Example 2 with ShareInfoBean

use of com.benmu.framework.model.ShareInfoBean in project WeexErosFramework by bmfe.

the class GlobalWebViewActivity method init.

private void init() {
    Intent data = getIntent();
    mWebViewParams = (WebViewParamBean) data.getSerializableExtra(Constant.WEBVIEW_PARAMS);
    String mUrl = mWebViewParams.getUrl();
    ShareInfoBean shareInfo = mWebViewParams.getShareInfo();
    if (shareInfo != null) {
        getNavigationBar().setRightIcon(R.drawable.icon_share);
    }
    rl_refresh = findViewById(R.id.rl_refresh);
    mProgressBar = (ProgressBar) findViewById(R.id.pb_progress);
    mWeb = (WebView) findViewById(R.id.webView);
    mContainer = (RelativeLayout) findViewById(R.id.rl_container);
    WebSettings settings = mWeb.getSettings();
    settings.setCacheMode(WebSettings.LOAD_NO_CACHE);
    settings.setUseWideViewPort(true);
    settings.setLoadWithOverviewMode(true);
    settings.setJavaScriptEnabled(true);
    mWeb.addJavascriptInterface(new JSMethod(this), "bmnative");
    settings.setDomStorageEnabled(true);
    if (Build.VERSION.SDK_INT >= 21) {
        settings.setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW);
    }
    mWeb.setWebViewClient(new MyWebViewClient(this));
    mWeb.setWebChromeClient(new MyWebChromeClient());
    if (!TextUtils.isEmpty(mUrl)) {
        mWeb.loadUrl(mUrl);
    }
    ModalManager.BmLoading.showLoading(this, "", true);
}
Also used : ShareInfoBean(com.benmu.framework.model.ShareInfoBean) WebSettings(android.webkit.WebSettings) Intent(android.content.Intent)

Aggregations

ShareInfoBean (com.benmu.framework.model.ShareInfoBean)2 Intent (android.content.Intent)1 WebSettings (android.webkit.WebSettings)1 ParseManager (com.benmu.framework.manager.impl.ParseManager)1