本文整理匯總了Java中cn.sharesdk.framework.Platform類的典型用法代碼示例。如果您正苦於以下問題:Java Platform類的具體用法?Java Platform怎麽用?Java Platform使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
Platform類屬於cn.sharesdk.framework包,在下文中一共展示了Platform類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getName
import cn.sharesdk.framework.Platform; //導入依賴的package包/類
private String getName(Platform plat) {
if (plat == null) {
return "";
}
String name = plat.getName();
if (name == null) {
return "";
}
int resId = com.mob.tools.utils.R.getStringRes(context, plat.getName());
if (resId > 0) {
return context.getString(resId);
}
return null;
}
示例2: share
import cn.sharesdk.framework.Platform; //導入依賴的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);
}
示例3: showEditPage
import cn.sharesdk.framework.Platform; //導入依賴的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();
}
示例4: setData
import cn.sharesdk.framework.Platform; //導入依賴的package包/類
public void setData(Platform[] platforms, HashMap<String, String> hiddenPlatforms) {
if (platforms != null) {
if (hiddenPlatforms == null || hiddenPlatforms.size() <= 0) {
this.logos.addAll(Arrays.asList(platforms));
} else {
ArrayList<Platform> ps = new ArrayList();
for (Platform p : platforms) {
if (!hiddenPlatforms.containsKey(p.getName())) {
ps.add(p);
}
}
this.logos.addAll(ps);
}
this.checkedPositionList.clear();
notifyDataSetChanged();
}
}
示例5: getJoinSelectedUser
import cn.sharesdk.framework.Platform; //導入依賴的package包/類
private String getJoinSelectedUser(HashMap<String, Object> data) {
if (data != null && data.containsKey("selected")) {
@SuppressWarnings("unchecked")
ArrayList<String> selected = (ArrayList<String>) data.get("selected");
String platform = ((Platform)data.get("platform")).getName();
if("FacebookMessenger".equals(platform)) {
return null;
}
StringBuilder sb = new StringBuilder();
for (String sel : selected) {
sb.append('@').append(sel).append(' ');
}
return sb.toString();
}
return null;
}
示例6: shareSilently
import cn.sharesdk.framework.Platform; //導入依賴的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);
}
}
}
示例7: b
import cn.sharesdk.framework.Platform; //導入依賴的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: shareDataToShareParams
import cn.sharesdk.framework.Platform; //導入依賴的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);
}
示例9: isUseClientToShare
import cn.sharesdk.framework.Platform; //導入依賴的package包/類
/** 判斷指定平台是否隻能使用客戶端分享 */
final boolean isUseClientToShare(Platform platform) {
String name = platform.getName();
if ("Wechat".equals(name) || "WechatMoments".equals(name)
|| "WechatFavorite".equals(name) || "ShortMessage".equals(name)
|| "Email".equals(name) || "GooglePlus".equals(name)
|| "QQ".equals(name) || "Pinterest".equals(name)
|| "Instagram".equals(name) || "Yixin".equals(name)
|| "YixinMoments".equals(name) || "QZone".equals(name)
|| "Mingdao".equals(name) || "Line".equals(name)
|| "KakaoStory".equals(name) || "KakaoTalk".equals(name)
|| "Bluetooth".equals(name) || "WhatsApp".equals(name)
|| "BaiduTieba".equals(name) || "Laiwang".equals(name)
|| "LaiwangMoments".equals(name) || "Alipay".equals(name)
|| "FacebookMessenger".equals(name)
) {
return true;
} else if ("Evernote".equals(name)) {
if ("true".equals(platform.getDevinfo("ShareByAppClient"))) {
return true;
}
} else if ("SinaWeibo".equals(name)) {
if ("true".equals(platform.getDevinfo("ShareByAppClient"))) {
Intent test = new Intent(Intent.ACTION_SEND);
test.setPackage("com.sina.weibo");
test.setType("image/*");
ResolveInfo ri = platform.getContext().getPackageManager().resolveActivity(test, 0);
return (ri != null);
}
}
return false;
}
示例10: onClick
import cn.sharesdk.framework.Platform; //導入依賴的package包/類
public void onClick(View view) {
Integer position = ((ViewHolder) view.getTag()).position;
if (this.directOnlyPosition == -1 || position.intValue() == this.directOnlyPosition) {
boolean direct;
Object item = getItem(position.intValue());
if (item instanceof Platform) {
direct = ShareCore.isDirectShare((Platform) item);
} else {
direct = true;
}
if (!direct || this.directOnlyPosition != -1 || this.checkedPositionList.isEmpty()) {
if (this.checkedPositionList.contains(position)) {
this.checkedPositionList.remove(position);
if (direct) {
this.directOnlyPosition = -1;
}
} else {
this.checkedPositionList.add(position);
if (direct) {
this.directOnlyPosition = position.intValue();
}
}
notifyDataSetChanged();
}
}
}
示例11: collectCells
import cn.sharesdk.framework.Platform; //導入依賴的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;
}
示例12: getPlatLogo
import cn.sharesdk.framework.Platform; //導入依賴的package包/類
private Bitmap getPlatLogo(Platform plat) {
if (plat == null) {
return null;
}
String name = plat.getName();
if (name == null) {
return null;
}
String resName = "logo_" + plat.getName();
int resId = getBitmapRes(activity, resName);
if(resId > 0) {
return BitmapFactory.decodeResource(activity.getResources(), resId);
}
return null;
}
示例13: shareDataToShareParams
import cn.sharesdk.framework.Platform; //導入依賴的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);
}
示例14: filterShareContent
import cn.sharesdk.framework.Platform; //導入依賴的package包/類
protected a filterShareContent(cn.sharesdk.framework.Platform.ShareParams shareParams, HashMap<String, Object> hashMap) {
a aVar = new a();
aVar.b = shareParams.getText();
if (hashMap != null) {
aVar.a = String.valueOf(hashMap.get("id"));
aVar.d.add(String.valueOf(hashMap.get("original_pic")));
aVar.g = hashMap;
}
return aVar;
}
示例15: refreshPanel
import cn.sharesdk.framework.Platform; //導入依賴的package包/類
private void refreshPanel(LinearLayout[] llCells, Object[] logos) {
int cellBack = ResHelper.getBitmapRes(page.getContext(), "ssdk_oks_classic_platform_cell_back");
int disableBack = ResHelper.getBitmapRes(page.getContext(), "ssdk_oks_classic_platfrom_cell_back_nor");
for (int i = 0; i < logos.length; i++) {
ImageView ivLogo = ResHelper.forceCast(llCells[i].getChildAt(0));
TextView tvName = ResHelper.forceCast(llCells[i].getChildAt(1));
if (logos[i] == null) {
ivLogo.setVisibility(View.INVISIBLE);
tvName.setVisibility(View.INVISIBLE);
llCells[i].setBackgroundResource(disableBack);
llCells[i].setOnClickListener(null);
} else {
ivLogo.setVisibility(View.VISIBLE);
tvName.setVisibility(View.VISIBLE);
ivLogo.requestLayout();
tvName.requestLayout();
llCells[i].setBackgroundResource(cellBack);
llCells[i].setOnClickListener(this);
llCells[i].setTag(logos[i]);
if (logos[i] instanceof CustomerLogo) {
CustomerLogo logo = ResHelper.forceCast(logos[i]);
if (logo.logo != null) {
ivLogo.setImageBitmap(logo.logo);
} else {
ivLogo.setImageBitmap(null);
}
if (logo.label != null) {
tvName.setText(logo.label);
} else {
tvName.setText("");
}
} else {
Platform plat = ResHelper.forceCast(logos[i]);
String name = plat.getName().toLowerCase();
int resId = ResHelper.getBitmapRes(ivLogo.getContext(),"ssdk_oks_classic_" + name);
if (resId > 0) {
ivLogo.setImageResource(resId);
} else {
ivLogo.setImageBitmap(null);
}
resId = ResHelper.getStringRes(tvName.getContext(), "ssdk_" + name);
if (resId > 0) {
tvName.setText(resId);
} else {
tvName.setText("");
}
}
}
}
}