本文整理匯總了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();
}