本文整理汇总了Java中cn.sharesdk.framework.PlatformActionListener类的典型用法代码示例。如果您正苦于以下问题:Java PlatformActionListener类的具体用法?Java PlatformActionListener怎么用?Java PlatformActionListener使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PlatformActionListener类属于cn.sharesdk.framework包,在下文中一共展示了PlatformActionListener类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: share
import cn.sharesdk.framework.PlatformActionListener; //导入依赖的package包/类
public static void share(String title, String titleurl
, String text, String imagedir, String imageUrl, String url, String platformName, PlatformActionListener listener) {
// QQ.NAME;
// Wechat.NAME
// SinaWeibo.NAMENAME;
Platform p = ShareSDK.getPlatform(platformName);
if (p != null) {
p.setPlatformActionListener(listener);
}
Platform.ShareParams sp = new Platform.ShareParams();
if (TextUtils.isEmpty(imagedir)) {
sp.setImageUrl(imageUrl);
} else {
sp.setImagePath(imagedir);
}
sp.setTitle(title);
sp.setTitleUrl(titleurl);
sp.setText(text);
sp.setUrl(url);
p.share(sp);
}
示例2: getUserInfo
import cn.sharesdk.framework.PlatformActionListener; //导入依赖的package包/类
/**
* 获取用户基本信息。注意授权只是获取access_token和openID等信息。
*
* @param context
* @param platformName
* @param userId 若为null,表示获取授权账户自己的资料;否则为该Id对应的微博用户资料。
* @param paListener
*/
public static void getUserInfo(Context context, String platformName, String userId, PlatformActionListener paListener) {
ensureInit(context);
Platform platform = ShareSDK.getPlatform(context, platformName);
platform.setPlatformActionListener(getUiThreadActionListener(paListener));
/* 获取用户的资料,如果account为null,则表示获取授权账户自己的资料。 其结果将通过操作回调paListener返回给外部代码,
* 在oncomplete中的hashmap返回数据,然后开发者再自己解析数据,通过打印hashmap的数据看看有哪些数据是你想要的。
* weibo.showUser(“3189087725”); //获取账号为“3189087725”的资料
*/
platform.showUser(userId);
}
示例3: getUiThreadActionListener
import cn.sharesdk.framework.PlatformActionListener; //导入依赖的package包/类
private static UiPlatformActionListener getUiThreadActionListener(final PlatformActionListener paListener) {
UiPlatformActionListener result = sPaListener.get(paListener);
if (result == null) {
result = new UiPlatformActionListener(paListener);
sPaListener.put(paListener, result);
}
return result;
}
示例4: onError
import cn.sharesdk.framework.PlatformActionListener; //导入依赖的package包/类
@Override
public void onError(final Platform platform, final int action, final Throwable e) {
L.e(ShareSdk.class, "platform:" + platform.getName() + ", action:" + parseAction(action), e);
final PlatformActionListener paListener = mPaListrnerRef.get();
if (paListener != null) {
AbsApp.get().getMainHandler().post(new Runnable() {
@Override
public void run() {
paListener.onError(platform, action, e);
}
});
}
}
示例5: onComplete
import cn.sharesdk.framework.PlatformActionListener; //导入依赖的package包/类
@Override
public void onComplete(final Platform platform, final int action, final HashMap<String, Object> res) {
final PlatformActionListener paListener = mPaListrnerRef.get();
if (paListener != null) {
AbsApp.get().getMainHandler().post(new Runnable() {
@Override
public void run() {
paListener.onComplete(platform, action, res);
}
});
}
}
示例6: onCancel
import cn.sharesdk.framework.PlatformActionListener; //导入依赖的package包/类
@Override
public void onCancel(final Platform platform, final int action) {
L.w(ShareSdk.class, "platform:" + platform.getName() + ", action:" + parseAction(action));
final PlatformActionListener paListener = mPaListrnerRef.get();
if (paListener != null) {
AbsApp.get().getMainHandler().post(new Runnable() {
@Override
public void run() {
paListener.onCancel(platform, action);
}
});
}
}
示例7: show
import cn.sharesdk.framework.PlatformActionListener; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public void show(Context context) {
HashMap<String, Object> shareParamsMap = new HashMap<String, Object>();
shareParamsMap.putAll(params);
if (!(context instanceof MobApplication)) {
MobSDK.init(context.getApplicationContext());
}
// 打开分享菜单的统计
ShareSDK.logDemoEvent(1, null);
int iTheme = 0;
try {
iTheme = ResHelper.parseInt(String.valueOf(shareParamsMap.remove("theme")));
} catch (Throwable t) {}
OnekeyShareTheme theme = OnekeyShareTheme.fromValue(iTheme);
OnekeyShareThemeImpl themeImpl = theme.getImpl();
themeImpl.setShareParamsMap(shareParamsMap);
themeImpl.setDialogMode(shareParamsMap.containsKey("dialogMode") ? ((Boolean) shareParamsMap.remove("dialogMode")) : false);
themeImpl.setSilent(shareParamsMap.containsKey("silent") ? ((Boolean) shareParamsMap.remove("silent")) : false);
themeImpl.setCustomerLogos((ArrayList<CustomerLogo>) shareParamsMap.remove("customers"));
themeImpl.setHiddenPlatforms((HashMap<String, String>) shareParamsMap.remove("hiddenPlatforms"));
themeImpl.setPlatformActionListener((PlatformActionListener) shareParamsMap.remove("callback"));
themeImpl.setShareContentCustomizeCallback((ShareContentCustomizeCallback) shareParamsMap.remove("customizeCallback"));
if (shareParamsMap.containsKey("disableSSO") ? ((Boolean) shareParamsMap.remove("disableSSO")) : false) {
themeImpl.disableSSO();
}
themeImpl.show(context.getApplicationContext());
}
示例8: show
import cn.sharesdk.framework.PlatformActionListener; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public void show(Context context) {
HashMap<String, Object> shareParamsMap = new HashMap<String, Object>();
shareParamsMap.putAll(params);
ShareSDK.initSDK(context);
// 打开分享菜单的统计
ShareSDK.logDemoEvent(1, null);
int iTheme = 0;
try {
iTheme = com.mob.tools.utils.R.parseInt(String.valueOf(shareParamsMap.remove("theme")));
} catch (Throwable t) {}
OnekeyShareTheme theme = OnekeyShareTheme.fromValue(iTheme);
OnekeyShareThemeImpl themeImpl = theme.getImpl();
themeImpl.setShareParamsMap(shareParamsMap);
themeImpl.setDialogMode(shareParamsMap.containsKey("dialogMode") ? ((Boolean) shareParamsMap.remove("dialogMode")) : false);
themeImpl.setSilent(shareParamsMap.containsKey("silent") ? ((Boolean) shareParamsMap.remove("silent")) : false);
themeImpl.setCustomerLogos((ArrayList<CustomerLogo>) shareParamsMap.remove("customers"));
themeImpl.setHiddenPlatforms((HashMap<String, String>) shareParamsMap.remove("hiddenPlatforms"));
themeImpl.setPlatformActionListener((PlatformActionListener) shareParamsMap.remove("callback"));
themeImpl.setShareContentCustomizeCallback((ShareContentCustomizeCallback) shareParamsMap.remove("customizeCallback"));
if (shareParamsMap.containsKey("disableSSO") ? ((Boolean) shareParamsMap.remove("disableSSO")) : false) {
themeImpl.disableSSO();
}
themeImpl.show(context);
}
示例9: show
import cn.sharesdk.framework.PlatformActionListener; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public void show(Context context) {
HashMap<String, Object> shareParamsMap = new HashMap<String, Object>();
shareParamsMap.putAll(params);
MobSDK.init(context.getApplicationContext());
ShareSDK.initSDK(context);
// 打开分享菜单的统计
ShareSDK.logDemoEvent(1, null);
int iTheme = 0;
try {
iTheme = ResHelper.parseInt(String.valueOf(shareParamsMap.remove("theme")));
} catch (Throwable t) {}
OnekeyShareTheme theme = OnekeyShareTheme.fromValue(iTheme);
OnekeyShareThemeImpl themeImpl = theme.getImpl();
themeImpl.setShareParamsMap(shareParamsMap);
themeImpl.setDialogMode(shareParamsMap.containsKey("dialogMode") ? ((Boolean) shareParamsMap.remove("dialogMode")) : false);
themeImpl.setSilent(shareParamsMap.containsKey("silent") ? ((Boolean) shareParamsMap.remove("silent")) : false);
themeImpl.setCustomerLogos((ArrayList<CustomerLogo>) shareParamsMap.remove("customers"));
themeImpl.setHiddenPlatforms((HashMap<String, String>) shareParamsMap.remove("hiddenPlatforms"));
themeImpl.setPlatformActionListener((PlatformActionListener) shareParamsMap.remove("callback"));
themeImpl.setShareContentCustomizeCallback((ShareContentCustomizeCallback) shareParamsMap.remove("customizeCallback"));
if (shareParamsMap.containsKey("disableSSO") ? ((Boolean) shareParamsMap.remove("disableSSO")) : false) {
themeImpl.disableSSO();
}
themeImpl.show(context.getApplicationContext());
}
示例10: show
import cn.sharesdk.framework.PlatformActionListener; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public void show(Context context) {
HashMap<String, Object> shareParamsMap = new HashMap<String, Object>();
shareParamsMap.putAll(params);
ShareSDK.initSDK(context.getApplicationContext());
// 打开分享菜单的统计
ShareSDK.logDemoEvent(1, null);
int iTheme = 0;
try {
iTheme = ResHelper.parseInt(String.valueOf(shareParamsMap.remove("theme")));
} catch (Throwable t) {}
OnekeyShareTheme theme = OnekeyShareTheme.fromValue(iTheme);
OnekeyShareThemeImpl themeImpl = theme.getImpl();
themeImpl.setShareParamsMap(shareParamsMap);
themeImpl.setDialogMode(shareParamsMap.containsKey("dialogMode") ? ((Boolean) shareParamsMap.remove("dialogMode")) : false);
themeImpl.setSilent(shareParamsMap.containsKey("silent") ? ((Boolean) shareParamsMap.remove("silent")) : false);
themeImpl.setCustomerLogos((ArrayList<CustomerLogo>) shareParamsMap.remove("customers"));
themeImpl.setHiddenPlatforms((HashMap<String, String>) shareParamsMap.remove("hiddenPlatforms"));
themeImpl.setPlatformActionListener((PlatformActionListener) shareParamsMap.remove("callback"));
themeImpl.setShareContentCustomizeCallback((ShareContentCustomizeCallback) shareParamsMap.remove("customizeCallback"));
if (shareParamsMap.containsKey("disableSSO") ? ((Boolean) shareParamsMap.remove("disableSSO")) : false) {
themeImpl.disableSSO();
}
themeImpl.show(context.getApplicationContext());
}
示例11: a
import cn.sharesdk.framework.PlatformActionListener; //导入依赖的package包/类
public void a(String str, String str2, String str3, String str4, String str5, PlatformActionListener platformActionListener) {
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append("mqqapi://share/to_qzone?");
stringBuilder.append("src_type=app&");
stringBuilder.append("version=1&");
stringBuilder.append("file_type=news&");
if (!TextUtils.isEmpty(str4)) {
stringBuilder.append("image_url=").append(Base64.encodeToString(str4.getBytes(com.qiniu.android.common.Constants.UTF_8), 2)).append(com.alipay.sdk.sys.a.b);
}
stringBuilder.append("title=").append(Base64.encodeToString(str.getBytes(com.qiniu.android.common.Constants.UTF_8), 2)).append(com.alipay.sdk.sys.a.b);
stringBuilder.append("description=").append(Base64.encodeToString(str3.getBytes(com.qiniu.android.common.Constants.UTF_8), 2)).append(com.alipay.sdk.sys.a.b);
stringBuilder.append("app_name=").append(Base64.encodeToString(str5.getBytes(com.qiniu.android.common.Constants.UTF_8), 2)).append(com.alipay.sdk.sys.a.b);
stringBuilder.append("open_id=&");
stringBuilder.append("share_id=").append(this.d).append(com.alipay.sdk.sys.a.b);
stringBuilder.append("url=").append(Base64.encodeToString(str2.getBytes(com.qiniu.android.common.Constants.UTF_8), 2)).append(com.alipay.sdk.sys.a.b);
stringBuilder.append("req_type=MQ==&");
stringBuilder.append("cflag=").append(Base64.encodeToString((a() ? "1" : "0").getBytes(com.qiniu.android.common.Constants.UTF_8), 2));
Intent intent = new Intent("android.intent.action.VIEW");
intent.setData(Uri.parse(stringBuilder.toString()));
if (this.a.getContext().getPackageManager().resolveActivity(intent, 1) == null) {
b(str, str2, str3, str4, str5, platformActionListener);
return;
}
i iVar = new i();
iVar.a(stringBuilder.toString(), true);
iVar.a(platformActionListener);
iVar.a(this.d);
iVar.show(this.a.getContext(), null);
}
示例12: b
import cn.sharesdk.framework.PlatformActionListener; //导入依赖的package包/类
public void b(String str, String str2, String str3, String str4, String str5, PlatformActionListener platformActionListener) {
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append("http://openmobile.qq.com/api/check2?");
stringBuilder.append("page=qzshare.html&");
stringBuilder.append("loginpage=loginindex.html&");
stringBuilder.append("logintype=qzone&");
stringBuilder.append("action=shareToQQ&");
stringBuilder.append("sdkv=2.6&");
stringBuilder.append("sdkp=a&");
DeviceHelper instance = DeviceHelper.getInstance(this.a.getContext());
stringBuilder.append("status_os=").append(Data.urlEncode(instance.getOSVersionName(), com.qiniu.android.common.Constants.UTF_8)).append(com.alipay.sdk.sys.a.b);
stringBuilder.append("status_machine=").append(Data.urlEncode(instance.getModel(), com.qiniu.android.common.Constants.UTF_8)).append(com.alipay.sdk.sys.a.b);
stringBuilder.append("status_version=").append(Data.urlEncode(instance.getOSVersion(), com.qiniu.android.common.Constants.UTF_8)).append(com.alipay.sdk.sys.a.b);
stringBuilder.append("appId=").append(this.d).append(com.alipay.sdk.sys.a.b);
Object appName = instance.getAppName();
if (TextUtils.isEmpty(appName)) {
stringBuilder.append("appName=").append(Data.urlEncode(str5, com.qiniu.android.common.Constants.UTF_8)).append(com.alipay.sdk.sys.a.b);
} else {
stringBuilder.append("appName=").append(Data.urlEncode(appName, com.qiniu.android.common.Constants.UTF_8)).append(com.alipay.sdk.sys.a.b);
}
if (str.length() > 40) {
str = str.substring(40) + "...";
}
stringBuilder.append("title=").append(Data.urlEncode(str, com.qiniu.android.common.Constants.UTF_8)).append(com.alipay.sdk.sys.a.b);
if (str.length() > 80) {
str.substring(80) + "...";
}
stringBuilder.append("summary=").append(Data.urlEncode(str3, com.qiniu.android.common.Constants.UTF_8)).append(com.alipay.sdk.sys.a.b);
stringBuilder.append("targeturl=").append(Data.urlEncode(str2, com.qiniu.android.common.Constants.UTF_8)).append(com.alipay.sdk.sys.a.b);
if (!TextUtils.isEmpty(str4)) {
stringBuilder.append("imageUrl=").append(Data.urlEncode(str4, com.qiniu.android.common.Constants.UTF_8)).append(com.alipay.sdk.sys.a.b);
}
stringBuilder.append("site=").append(Data.urlEncode(str5, com.qiniu.android.common.Constants.UTF_8)).append(com.alipay.sdk.sys.a.b);
stringBuilder.append("type=1");
i iVar = new i();
iVar.a(stringBuilder.toString(), false);
iVar.a(platformActionListener);
iVar.a(this.d);
iVar.show(this.a.getContext(), null);
}
示例13: l
import cn.sharesdk.framework.PlatformActionListener; //导入依赖的package包/类
l(WechatHelper wechatHelper, DeviceHelper deviceHelper, String str, PlatformActionListener platformActionListener, Platform platform, HashMap hashMap) {
this.g = wechatHelper;
this.b = deviceHelper;
this.c = str;
this.d = platformActionListener;
this.e = platform;
this.f = hashMap;
}
示例14: k
import cn.sharesdk.framework.PlatformActionListener; //导入依赖的package包/类
k(i iVar, DeviceHelper deviceHelper, String str, PlatformActionListener platformActionListener, HashMap hashMap) {
this.f = iVar;
this.b = deviceHelper;
this.c = str;
this.d = platformActionListener;
this.e = hashMap;
}
示例15: thirdSinaLogin
import cn.sharesdk.framework.PlatformActionListener; //导入依赖的package包/类
/**
* 新浪微博授权、获取用户信息页面
*/
private void thirdSinaLogin() {
//初始化新浪平台
Platform pf = ShareSDK.getPlatform(this, SinaWeibo.NAME);
pf.SSOSetting(true);
//设置监听
pf.setPlatformActionListener((PlatformActionListener) LoginSuccessActivity.this);
//获取登陆用户的信息,如果没有授权,会先授权,然后获取用户信息
pf.authorize();
}