本文整理匯總了Java中cn.sharesdk.framework.ShareSDK類的典型用法代碼示例。如果您正苦於以下問題:Java ShareSDK類的具體用法?Java ShareSDK怎麽用?Java ShareSDK使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
ShareSDK類屬於cn.sharesdk.framework包,在下文中一共展示了ShareSDK類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: collectCells
import cn.sharesdk.framework.ShareSDK; //導入依賴的package包/類
protected ArrayList<Object> collectCells() {
ArrayList<Object> cells = new ArrayList<Object>();
Platform[] platforms = ShareSDK.getPlatformList();
if (platforms == null) {
platforms = new Platform[0];
}
HashMap<String, String> hides = getHiddenPlatforms();
if (hides == null) {
hides = new HashMap<String, String>();
}
for (Platform p : platforms) {
if (!hides.containsKey(p.getName())) {
cells.add(p);
}
}
ArrayList<CustomerLogo> customers = getCustomerLogos();
if (customers != null && customers.size() > 0) {
cells.addAll(customers);
}
return cells;
}
示例2: showEditPage
import cn.sharesdk.framework.ShareSDK; //導入依賴的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();
}
示例3: collectCells
import cn.sharesdk.framework.ShareSDK; //導入依賴的package包/類
protected ArrayList<Object> collectCells() {
ArrayList<Object> cells = new ArrayList<Object>();
Platform[] platforms = ShareSDK.getPlatformList();
if (platforms == null) {
platforms = new Platform[0];
}
HashMap<String, String> hides = getHiddenPlatforms();
if (hides == null) {
hides = new HashMap<String, String>();
}
for (Platform p : platforms) {
if (!hides.containsKey(p.getName())) {
cells.add(p);
}
}
ArrayList<CustomerLogo> customers = getCustomerLogos();
if (customers != null && customers.size() > 0) {
cells.addAll(customers);
}
return cells;
}
示例4: b
import cn.sharesdk.framework.ShareSDK; //導入依賴的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."));
}
示例5: show
import cn.sharesdk.framework.ShareSDK; //導入依賴的package包/類
public final void show(Context context) {
this.context = context;
// 顯示方式是由platform和silent兩個字段控製的
// 如果platform設置了,則無須顯示九宮格,否則都會顯示;
// 如果silent為true,表示不進入編輯頁麵,否則會進入。
if (shareParamsMap.containsKey("platform")) {
String name = String.valueOf(shareParamsMap.get("platform"));
Platform platform = ShareSDK.getPlatform(name);
boolean isCustomPlatform = platform instanceof CustomPlatform;
boolean isUseClientToShare = isUseClientToShare(platform);
if (silent || isCustomPlatform || isUseClientToShare) {
shareSilently(platform);
} else {
prepareForEditPage(platform);
}
} else {
showPlatformPage(context);
}
}
示例6: showShare
import cn.sharesdk.framework.ShareSDK; //導入依賴的package包/類
private void showShare() {
ShareSDK.initSDK(this);
OnekeyShare oks = new OnekeyShare();
//關閉sso授權
oks.disableSSOWhenAuthorize();
// title標題,印象筆記、郵箱、信息、微信、人人網和QQ空間等使用
oks.setTitle(mWebView.getTitle());
// titleUrl是標題的網絡鏈接,QQ和QQ空間等使用
oks.setTitleUrl(mUrl);
// text是分享文本,所有平台都需要這個字段
oks.setText("哇,這家夥做的高仿微信跟真的一樣耶");
// imagePath是圖片的本地路徑,Linked-In以外的平台都支持此參數
//oks.setImagePath("/sdcard/test.jpg");//確保SDcard下麵存在此張圖片
// url僅在微信(包括好友和朋友圈)中使用
oks.setUrl(mUrl);
// site是分享此內容的網站名稱,僅在QQ空間使用
oks.setSite(getString(R.string.app_name_in_about));
// siteUrl是分享此內容的網站地址,僅在QQ空間使用
oks.setSiteUrl(mUrl);
// 啟動分享GUI
oks.show(this);
}
示例7: Share
import cn.sharesdk.framework.ShareSDK; //導入依賴的package包/類
public static void Share(Context context){
ShareSDK.initSDK(context);
OnekeyShare oks = new OnekeyShare();
//關閉sso授權
oks.disableSSOWhenAuthorize();
// 分享時Notification的圖標和文字 2.5.9以後的版本不調用此方法
//oks.setNotification(R.drawable.ic_launcher, getString(R.string.app_name));
// title標題,印象筆記、郵箱、信息、微信、人人網和QQ空間使用
oks.setTitle("我是分享標題");
// titleUrl是標題的網絡鏈接,僅在人人網和QQ空間使用
oks.setTitleUrl("http://sharesdk.cn");
// text是分享文本,所有平台都需要這個字段
oks.setText("我是分享文本,啦啦啦~");
// imagePath是圖片的本地路徑,Linked-In以外的平台都支持此參數
oks.setImagePath("/sdcard/test.jpg");//確保SDcard下麵存在此張圖片
// url僅在微信(包括好友和朋友圈)中使用
oks.setUrl("http://sharesdk.cn");
// comment是我對這條分享的評論,僅在人人網和QQ空間使用
oks.setComment("我是測試評論文本");
// site是分享此內容的網站名稱,僅在QQ空間使用
oks.setSite("我也是分享標題");
// siteUrl是分享此內容的網站地址,僅在QQ空間使用
oks.setSiteUrl("http://sharesdk.cn");
// 啟動分享GUI
oks.show(context);
}
示例8: onClick
import cn.sharesdk.framework.ShareSDK; //導入依賴的package包/類
public void onClick(View v) {
if(v.getTag() == null)
return;
String tag = (String) v.getTag();
if (tag.equals("close")) {
// 取消分享的統計
for(Platform plat : platforms) {
ShareSDK.logDemoEvent(5, plat);
}
finish();
return;
}
if (tag.equals("ok")) {
onShareButtonClick(v);
return;
}
}
示例9: run
import cn.sharesdk.framework.ShareSDK; //導入依賴的package包/類
public void run() {
try {
Message message = new Message();
message.what = 2;
if ("none".equals(DeviceHelper.getInstance(this.a.activity).getDetailNetworkTypeForStatic())) {
message.arg1 = 1;
UIHandler.sendMessage(message, this.a);
return;
}
if (ShareSDK.isRemoveCookieOnAuthorize()) {
CookieSyncManager.createInstance(this.a.activity);
CookieManager.getInstance().removeAllCookie();
}
message.obj = this.a.a.getAuthorizeUrl();
UIHandler.sendMessage(message, this.a);
} catch (Throwable th) {
Ln.e(th);
}
}
示例10: j
import cn.sharesdk.framework.ShareSDK; //導入依賴的package包/類
private String j(String str) {
JSONObject i = i();
DeviceHelper instance = DeviceHelper.getInstance(this.a);
try {
i.put("type", "DEVICE");
i.put("key", instance.getDeviceKey());
i.put("carrier", instance.getCarrier());
i.put("appkey", str);
i.put("apppkg", instance.getPackageName());
i.put("appver", String.valueOf(instance.getAppVersion()));
i.put("sdkver", 50000 + ShareSDK.getSDKVersionCode());
i.put("networktype", instance.getDetailNetworkTypeForStatic());
} catch (Throwable e) {
Ln.e(e);
}
return i.toString();
}
示例11: a
import cn.sharesdk.framework.ShareSDK; //導入依賴的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."));
}
示例12: initSocialLogin
import cn.sharesdk.framework.ShareSDK; //導入依賴的package包/類
private void initSocialLogin() {
Platform[] platforms = ShareSDK.getPlatformList();
if (platforms == null) {
return;
}
for (Platform p : platforms) {
if ("QQ".equals(p.getName())) {
qqLoginView.setVisibility(View.VISIBLE);
otherLoginView.setVisibility(View.VISIBLE);
}
if ("Wechat".equals(p.getName())) {
wxLoginView.setVisibility(View.VISIBLE);
otherLoginView.setVisibility(View.VISIBLE);
}
}
}
示例13: onCreate
import cn.sharesdk.framework.ShareSDK; //導入依賴的package包/類
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Compact.getInstance().init(this);
ShareSDK.initSDK(this, Constants.SHARE_SDK_APPID);
Intent intent = getIntent();
if (Intent.ACTION_SEND.equals(intent.getAction())
&& "text/plain".equals(intent.getType())) {
String text = intent.getStringExtra(Intent.EXTRA_TEXT);
int textSize = SharePreferencesUtils.textSize(this, getResources().getInteger(R.integer.option_default_textSize));
Bitmap bitmap = getShareBitmap(text, textSize);
TCAgentUtils.Share(this, Constants.LABEL_FROM_SHARE, text);
WeixinShareUtils.shareImage(bitmap);
finish();
}
}
示例14: updateUserInfoFromLocal
import cn.sharesdk.framework.ShareSDK; //導入依賴的package包/類
/**
* 從本地更新用戶信息 - 登錄成功後保存到偏好設置
*/
public void updateUserInfoFromLocal() {
// 移除第三方授權
Platform wechat = ShareSDK.getPlatform(Wechat.NAME);
if (wechat.isAuthValid()) {
wechat.removeAccount(true);
}
Platform qq = ShareSDK.getPlatform(QQ.NAME);
if (qq.isAuthValid()) {
qq.removeAccount(true);
}
// 內存緩存
UserBean.userAccount = this;
// 磁盤緩存
encode();
}
示例15: onError
import cn.sharesdk.framework.ShareSDK; //導入依賴的package包/類
public final void onError(Platform platform, int action, Throwable t) {
t.printStackTrace();
Message msg = new Message();
msg.arg1 = 2;
msg.arg2 = action;
msg.obj = t;
UIHandler.sendMessage(msg, this);
// 分享失敗的統計
ShareSDK.logDemoEvent(4, platform);
}