cn.sharesdk.onekeyshare.ShareContentCustomizeCallback Java Examples

The following examples show how to use cn.sharesdk.onekeyshare.ShareContentCustomizeCallback. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: WeatherActivity.java    From PoetryWeather with Apache License 2.0 5 votes vote down vote up
private void showShare() {
    OnekeyShare oks = new OnekeyShare();
    //关闭sso授权
    oks.disableSSOWhenAuthorize();

    // title标题,微信、QQ和QQ空间等平台使用
    oks.setTitle(getString(R.string.shareName));
    // titleUrl QQ和QQ空间跳转链接
    oks.setTitleUrl("http://hzmeurasia.cn");
    // text是分享文本,所有平台都需要这个字段
    oks.setText("我是分享文本");
    // imagePath是图片的本地路径,Linked-In以外的平台都支持此参数
    //确保SDcard下面存在此张图片
    oks.setImagePath(Environment.getExternalStorageDirectory().getAbsolutePath()+"/ScreenPoetryWeather.png");
    // url在微信、微博,Facebook等平台中使用
    oks.setShareContentCustomizeCallback(new ShareContentCustomizeCallback() {
        @Override
        public void onShare(Platform platform, Platform.ShareParams shareParams) {
            if (platform.getName().equalsIgnoreCase(QQ.NAME)) {
                shareParams.setText(null);
                shareParams.setTitle(null);
                shareParams.setTitleUrl(null);
                shareParams.setImagePath(Environment.getExternalStorageDirectory().getAbsolutePath()+"/ScreenPoetryWeather.png");
            }
        }
    });
    oks.setUrl("http://hzmeurasia.cn");
    // 启动分享GUI
    oks.show(this);
}