本文整理匯總了Java中cn.sharesdk.framework.Platform.ShareParams類的典型用法代碼示例。如果您正苦於以下問題:Java ShareParams類的具體用法?Java ShareParams怎麽用?Java ShareParams使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
ShareParams類屬於cn.sharesdk.framework.Platform包,在下文中一共展示了ShareParams類的13個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: showEditPage
import cn.sharesdk.framework.Platform.ShareParams; //導入依賴的package包/類
public final void showEditPage(final Platform platform) {
beforeFinish = new Runnable() {
public void run() {
boolean isSilent = isSilent();
boolean isCustomPlatform = platform instanceof CustomPlatform;
boolean isUseClientToShare = isUseClientToShare(platform);
if (isSilent || isCustomPlatform || isUseClientToShare) {
shareSilently(platform);
} else {
ShareParams sp = formateShareData(platform);
if (sp != null) {
// 編輯分享內容的統計
ShareSDK.logDemoEvent(3, null);
if (getCustomizeCallback() != null) {
getCustomizeCallback().onShare(platform, sp);
}
impl.showEditPage(activity, platform, sp);
}
}
}
};
finish();
}
示例2: shareDataToShareParams
import cn.sharesdk.framework.Platform.ShareParams; //導入依賴的package包/類
final ShareParams shareDataToShareParams(Platform plat) {
if (plat == null || shareParamsMap == null) {
toast("ssdk_oks_share_failed");
return null;
}
try {
String imagePath = R.forceCast(shareParamsMap.get("imagePath"));
Bitmap viewToShare = R.forceCast(shareParamsMap.get("viewToShare"));
if (TextUtils.isEmpty(imagePath) && viewToShare != null && !viewToShare.isRecycled()) {
String path = R.getCachePath(plat.getContext(), "screenshot");
File ss = new File(path, String.valueOf(System.currentTimeMillis()) + ".jpg");
FileOutputStream fos = new FileOutputStream(ss);
viewToShare.compress(CompressFormat.JPEG, 100, fos);
fos.flush();
fos.close();
shareParamsMap.put("imagePath", ss.getAbsolutePath());
}
} catch (Throwable t) {
t.printStackTrace();
toast("ssdk_oks_share_failed");
return null;
}
return new ShareParams(shareParamsMap);
}
示例3: shareSilently
import cn.sharesdk.framework.Platform.ShareParams; //導入依賴的package包/類
final void shareSilently(Platform platform) {
if (formateShareData(platform)) {
ShareParams sp = shareDataToShareParams(platform);
if (sp != null) {
toast("ssdk_oks_sharing");
if (customizeCallback != null) {
customizeCallback.onShare(platform, sp);
}
if (disableSSO) {
platform.SSOSetting(disableSSO);
}
platform.setPlatformActionListener(callback);
platform.share(sp);
}
}
}
示例4: shareDataToShareParams
import cn.sharesdk.framework.Platform.ShareParams; //導入依賴的package包/類
final ShareParams shareDataToShareParams(Platform plat) {
if (plat == null || shareParamsMap == null) {
toast("ssdk_oks_share_failed");
return null;
}
try {
String imagePath = ResHelper.forceCast(shareParamsMap.get("imagePath"));
Bitmap viewToShare = ResHelper.forceCast(shareParamsMap.get("viewToShare"));
if (TextUtils.isEmpty(imagePath) && viewToShare != null && !viewToShare.isRecycled()) {
String path = ResHelper.getCachePath(plat.getContext(), "screenshot");
File ss = new File(path, String.valueOf(System.currentTimeMillis()) + ".jpg");
FileOutputStream fos = new FileOutputStream(ss);
viewToShare.compress(CompressFormat.JPEG, 100, fos);
fos.flush();
fos.close();
shareParamsMap.put("imagePath", ss.getAbsolutePath());
}
} catch (Throwable t) {
t.printStackTrace();
toast("ssdk_oks_share_failed");
return null;
}
return new ShareParams(shareParamsMap);
}
示例5: shareDataToShareParams
import cn.sharesdk.framework.Platform.ShareParams; //導入依賴的package包/類
final ShareParams shareDataToShareParams(Platform plat) {
if (plat == null || shareParamsMap == null) {
toast("ssdk_oks_share_failed");
return null;
}
try {
String imagePath = ResHelper.forceCast(shareParamsMap.get("imagePath"));
Bitmap viewToShare = ResHelper.forceCast(shareParamsMap.get("viewToShare"));
if (TextUtils.isEmpty(imagePath) && viewToShare != null && !viewToShare.isRecycled()) {
String path = ResHelper.getCachePath(MobSDK.getContext(), "screenshot");
File ss = new File(path, String.valueOf(System.currentTimeMillis()) + ".jpg");
FileOutputStream fos = new FileOutputStream(ss);
viewToShare.compress(CompressFormat.JPEG, 100, fos);
fos.flush();
fos.close();
shareParamsMap.put("imagePath", ss.getAbsolutePath());
}
} catch (Throwable t) {
t.printStackTrace();
toast("ssdk_oks_share_failed");
return null;
}
return new ShareParams(shareParamsMap);
}
示例6: a
import cn.sharesdk.framework.Platform.ShareParams; //導入依賴的package包/類
public static void a(Context context, b bVar) {
ShareParams shareParams = new ShareParams();
shareParams.setShareType(4);
Bitmap bitmap = null;
if (!TextUtils.isEmpty(bVar.c())) {
bitmap = BitmapFactory.decodeFile(bVar.c());
}
if (bitmap != null) {
bitmap = Bitmap.createScaledBitmap(bitmap, 150, 150, true);
} else {
bitmap = Bitmap.createScaledBitmap(Bitmap.createBitmap(150, 150, Config.ARGB_8888),
150, 150, true);
}
shareParams.setImageData(bitmap);
shareParams.setTitle(bVar.a());
shareParams.setText(bVar.b());
shareParams.setUrl(bVar.e());
Platform platform = ShareSDK.getPlatform(Wechat.NAME);
if (platform.isClientValid()) {
platform.share(shareParams);
return;
}
Toast.makeText(context, o.a("未安裝微信或者微信版本過低。", "There is no WeChat or the version is too " +
"low."), 0).show();
c.d(o.a("未安裝微信或者微信版本過低。", "There is no WeChat or the version is too low."));
}
示例7: b
import cn.sharesdk.framework.Platform.ShareParams; //導入依賴的package包/類
public static void b(Context context, b bVar) {
ShareParams shareParams = new ShareParams();
shareParams.setShareType(4);
Bitmap bitmap = null;
if (!TextUtils.isEmpty(bVar.c())) {
bitmap = BitmapFactory.decodeFile(bVar.c());
}
if (bitmap != null) {
bitmap = Bitmap.createScaledBitmap(bitmap, 150, 150, true);
} else {
bitmap = Bitmap.createScaledBitmap(Bitmap.createBitmap(150, 150, Config.ARGB_8888),
150, 150, true);
}
shareParams.setImageData(bitmap);
shareParams.setTitle(bVar.a());
shareParams.setText(bVar.b());
shareParams.setUrl(bVar.e());
Platform platform = ShareSDK.getPlatform(WechatMoments.NAME);
if (platform.isClientValid()) {
platform.share(shareParams);
return;
}
Toast.makeText(context, o.a("未安裝微信或者微信版本過低。", "There is no WeChat or the version is too " +
"low."), 0).show();
c.d(o.a("未安裝微信或者微信版本過低。", "There is no WeChat or the version is too low."));
}
示例8: share
import cn.sharesdk.framework.Platform.ShareParams; //導入依賴的package包/類
public boolean share(Platform plat, HashMap<String, Object> data) {
if (plat == null || data == null) {
return false;
}
try {
Bitmap viewToShare = (Bitmap) data.get("viewToShare");
if (!(!TextUtils.isEmpty((String) data.get("imagePath")) || viewToShare == null || viewToShare.isRecycled())) {
File ss = new File(R.getCachePath(plat.getContext(), "screenshot"), String.valueOf(System.currentTimeMillis()) + ".jpg");
FileOutputStream fos = new FileOutputStream(ss);
viewToShare.compress(CompressFormat.JPEG, 100, fos);
fos.flush();
fos.close();
data.put("imagePath", ss.getAbsolutePath());
}
ShareParams sp = new ShareParams((HashMap) data);
if (this.customizeCallback != null) {
this.customizeCallback.onShare(plat, sp);
}
plat.share(sp);
return true;
} catch (Throwable t) {
t.printStackTrace();
return false;
}
}
示例9: shareTextImagePath
import cn.sharesdk.framework.Platform.ShareParams; //導入依賴的package包/類
/**
* 本地圖片的圖文位置分享
* @param text 不能超過140個漢字。
* @param imgPath 可選。本地圖片路徑(非私有目錄),圖片最大5M,僅支持JPEG、GIF、PNG格式。
* @param latitude 可選。有效範圍:-90.0到+90.0,+表示北緯。
* @param longitude 可選。有效範圍:-180.0到+180.0,+表示東經。
*/
public void shareTextImagePath(String text, String imgPath, float latitude, float longitude) {
checkText(text);
checkImage(imgPath);
cn.sharesdk.sina.weibo.SinaWeibo.ShareParams params = new cn.sharesdk.sina.weibo.SinaWeibo.ShareParams();
params.text = text;
params.imagePath = imgPath;
if (latitude != 0.0f) params.latitude = latitude;
if (longitude != 0.0f) params.longitude = longitude;
share(params);
}
示例10: shareTextImageUrl
import cn.sharesdk.framework.Platform.ShareParams; //導入依賴的package包/類
/**
* 網絡圖片的圖文分享
* @param title 標題(必填,不可為null,可以為"",會顯示"來自xxx(site參數)的分享",可為多個空格則會不顯示標題)
* @param titleUrl 標題超鏈接(必填)
* @param text 分享內容(必填[ShareSDK沒說必填],不可為null,不可為"",不可為null,可為多個空格則會不顯示)
* @param imgUrl
* @param site 網站名稱(選填[ShareSDK說必填],若為null或""則會用app名稱作替換,多個空格則會顯示空格如"來自 (空格)的分享")
* @param siteUrl 網站超鏈接(選填[ShareSDK說必填],其實沒用,分享出去的所有超鏈接都是titleUrl)
*/
public void shareTextImageUrl(String title, String titleUrl, String text, String imgUrl, String site, String siteUrl) {
checkTitle(title);
checkText(text);
cn.sharesdk.tencent.qzone.QZone.ShareParams params = new cn.sharesdk.tencent.qzone.QZone.ShareParams();
params.title = title;
params.titleUrl = titleUrl;
params.text = text;
params.imageUrl = imgUrl;
params.site = site;
params.siteUrl = siteUrl;
params.comment = text;
share(params);
}
示例11: shareImage
import cn.sharesdk.framework.Platform.ShareParams; //導入依賴的package包/類
/**並不能帶標題和文本,隻能在分享鏈接的時候或分享給好友的時候**/
public void shareImage(String imgPath) {
checkImage(imgPath);
cn.sharesdk.wechat.friends.Wechat.ShareParams params = new cn.sharesdk.wechat.friends.Wechat.ShareParams();
params.shareType = Wechat.SHARE_IMAGE;
params.imagePath = imgPath;
share(params);
}
示例12: shareWebPageWithText
import cn.sharesdk.framework.Platform.ShareParams; //導入依賴的package包/類
public void shareWebPageWithText(String title, String text, String imgPath, String pageUrl) {
checkTitle(title);
checkText(text);
checkUrl(pageUrl);
cn.sharesdk.wechat.friends.Wechat.ShareParams params = new cn.sharesdk.wechat.friends.Wechat.ShareParams();
params.shareType = Wechat.SHARE_WEBPAGE;
params.title = title;
params.text = text;
params.imagePath = imgPath;
params.url = pageUrl;
share(params);
}
示例13: prepareForEditPage
import cn.sharesdk.framework.Platform.ShareParams; //導入依賴的package包/類
private void prepareForEditPage(Platform platform) {
if (formateShareData(platform)) {
ShareParams sp = shareDataToShareParams(platform);
if (sp != null) {
// 編輯分享內容的統計
ShareSDK.logDemoEvent(3, null);
if (customizeCallback != null) {
customizeCallback.onShare(platform, sp);
}
showEditPage(context, platform, sp);
}
}
}