Search in sources :

Example 1 with CustomPlatform

use of cn.sharesdk.framework.CustomPlatform in project nmid-headline by miao1007.

the class OnekeyShare method show.

public void show(Context context) {
    ShareSDK.initSDK(context);
    this.context = context;
    // 打开分享菜单的统计
    ShareSDK.logDemoEvent(1, null);
    // 若为“使用客户端分享”的平台,则直接分享,否则进入编辑页面
    if (shareParamsMap.containsKey("platform")) {
        String name = String.valueOf(shareParamsMap.get("platform"));
        Platform platform = ShareSDK.getPlatform(name);
        if (silent || ShareCore.isUseClientToShare(name) || platform instanceof CustomPlatform) {
            HashMap<Platform, HashMap<String, Object>> shareData = new HashMap<Platform, HashMap<String, Object>>();
            shareData.put(ShareSDK.getPlatform(name), shareParamsMap);
            share(shareData);
            return;
        }
    }
    PlatformListFakeActivity platformListFakeActivity;
    try {
        if (OnekeyShareTheme.SKYBLUE == theme) {
            platformListFakeActivity = (PlatformListFakeActivity) Class.forName("cn.sharesdk.onekeyshare.theme.skyblue.PlatformListPage").newInstance();
        } else {
            platformListFakeActivity = (PlatformListFakeActivity) Class.forName("cn.sharesdk.onekeyshare.theme.classic.PlatformListPage").newInstance();
        }
    } catch (Exception e) {
        e.printStackTrace();
        return;
    }
    platformListFakeActivity.setDialogMode(dialogMode);
    platformListFakeActivity.setShareParamsMap(shareParamsMap);
    platformListFakeActivity.setSilent(silent);
    platformListFakeActivity.setCustomerLogos(customers);
    platformListFakeActivity.setBackgroundView(bgView);
    platformListFakeActivity.setHiddenPlatforms(hiddenPlatforms);
    platformListFakeActivity.setOnShareButtonClickListener(onShareButtonClickListener);
    platformListFakeActivity.setThemeShareCallback(new ThemeShareCallback() {

        @Override
        public void doShare(HashMap<Platform, HashMap<String, Object>> shareData) {
            share(shareData);
        }
    });
    if (shareParamsMap.containsKey("platform")) {
        String name = String.valueOf(shareParamsMap.get("platform"));
        Platform platform = ShareSDK.getPlatform(name);
        platformListFakeActivity.showEditPage(context, platform);
        return;
    }
    platformListFakeActivity.show(context, null);
}
Also used : Platform(cn.sharesdk.framework.Platform) CustomPlatform(cn.sharesdk.framework.CustomPlatform) HashMap(java.util.HashMap) CustomPlatform(cn.sharesdk.framework.CustomPlatform)

Aggregations

CustomPlatform (cn.sharesdk.framework.CustomPlatform)1 Platform (cn.sharesdk.framework.Platform)1 HashMap (java.util.HashMap)1