use of cn.sharesdk.framework.Platform in project nmid-headline by miao1007.
the class NavigationDrawerFragment method navigation_drawer_avatar.
@OnClick(R.id.navigation_drawer_avatar)
void navigation_drawer_avatar() {
ShareSDK.initSDK(getActivity());
Platform qzone = ShareSDK.getPlatform(getActivity().getApplicationContext(), QZone.NAME);
qzone.SSOSetting(false);
qzone.setPlatformActionListener(this);
qzone.authorize();
if (mDrawerLayout != null) {
mDrawerLayout.closeDrawer(Gravity.START);
}
}
use of cn.sharesdk.framework.Platform in project nmid-headline by miao1007.
the class ShareCore method isUseClientToShare.
/** 判断指定平台是否使用客户端分享 */
public static boolean isUseClientToShare(String platform) {
if ("Wechat".equals(platform) || "WechatMoments".equals(platform) || "WechatFavorite".equals(platform) || "ShortMessage".equals(platform) || "Email".equals(platform) || "GooglePlus".equals(platform) || "QQ".equals(platform) || "Pinterest".equals(platform) || "Instagram".equals(platform) || "Yixin".equals(platform) || "YixinMoments".equals(platform) || "QZone".equals(platform) || "Mingdao".equals(platform) || "Line".equals(platform) || "KakaoStory".equals(platform) || "KakaoTalk".equals(platform) || "Bluetooth".equals(platform) || "WhatsApp".equals(platform) || "BaiduTieba".equals(platform) || "Laiwang".equals(platform) || "LaiwangMoments".equals(platform)) {
return true;
} else if ("Evernote".equals(platform)) {
Platform plat = ShareSDK.getPlatform(platform);
if ("true".equals(plat.getDevinfo("ShareByAppClient"))) {
return true;
}
} else if ("SinaWeibo".equals(platform)) {
Platform plat = ShareSDK.getPlatform(platform);
if ("true".equals(plat.getDevinfo("ShareByAppClient"))) {
Intent test = new Intent(Intent.ACTION_SEND);
test.setPackage("com.sina.weibo");
test.setType("image/*");
ResolveInfo ri = plat.getContext().getPackageManager().resolveActivity(test, 0);
return (ri != null);
}
}
return false;
}
use of cn.sharesdk.framework.Platform in project nmid-headline by miao1007.
the class EditPage method onClick.
public void onClick(View v) {
if (v.equals(llTitle.getBtnBack())) {
Platform plat = null;
for (int i = 0; i < views.length; i++) {
if (views[i].getVisibility() == View.INVISIBLE) {
plat = platformList[i];
break;
}
}
// a statistics of Cancel-sharing
if (plat != null) {
ShareSDK.logDemoEvent(5, plat);
}
finish();
return;
}
if (v.equals(llTitle.getBtnRight())) {
String text = etContent.getText().toString();
shareParamMap.put("text", text);
platforms.clear();
for (int i = 0; i < views.length; i++) {
if (views[i].getVisibility() != View.VISIBLE) {
platforms.add(platformList[i]);
}
}
if (platforms.size() > 0) {
setResultAndFinish();
} else {
int resId = getStringRes(activity, "select_one_plat_at_least");
if (resId > 0) {
Toast.makeText(getContext(), resId, Toast.LENGTH_SHORT).show();
}
}
return;
}
if (v instanceof FrameLayout) {
((FrameLayout) v).getChildAt(1).performClick();
return;
}
if (v.getVisibility() == View.INVISIBLE) {
v.setVisibility(View.VISIBLE);
} else {
v.setVisibility(View.INVISIBLE);
}
}
use of cn.sharesdk.framework.Platform in project nmid-headline by miao1007.
the class EditPage method afterPlatformListGot.
/** display platform list */
public void afterPlatformListGot() {
int size = platformList == null ? 0 : platformList.length;
views = new View[size];
final int dp_24 = dipToPx(getContext(), 24);
LayoutParams lpItem = new LayoutParams(dp_24, dp_24);
final int dp_9 = dipToPx(getContext(), 9);
lpItem.setMargins(0, 0, dp_9, 0);
FrameLayout.LayoutParams lpMask = new FrameLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
lpMask.gravity = Gravity.LEFT | Gravity.TOP;
int selection = 0;
for (int i = 0; i < size; i++) {
FrameLayout fl = new FrameLayout(getContext());
fl.setLayoutParams(lpItem);
if (i >= size - 1) {
fl.setLayoutParams(new LayoutParams(dp_24, dp_24));
}
llPlat.addView(fl);
fl.setOnClickListener(this);
ImageView iv = new ImageView(getContext());
iv.setScaleType(ScaleType.CENTER_INSIDE);
iv.setImageBitmap(getPlatLogo(platformList[i]));
iv.setLayoutParams(new FrameLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
fl.addView(iv);
views[i] = new View(getContext());
views[i].setBackgroundColor(0xcfffffff);
views[i].setOnClickListener(this);
String platformName = platformList[i].getName();
for (Platform plat : platforms) {
if (platformName.equals(plat.getName())) {
views[i].setVisibility(View.INVISIBLE);
selection = i;
}
}
views[i].setLayoutParams(lpMask);
fl.addView(views[i]);
}
final int postSel = selection;
UIHandler.sendEmptyMessageDelayed(0, 333, new Callback() {
public boolean handleMessage(Message msg) {
HorizontalScrollView hsv = (HorizontalScrollView) llPlat.getParent();
hsv.scrollTo(postSel * (dp_24 + dp_9), 0);
return false;
}
});
}
use of cn.sharesdk.framework.Platform in project nmid-headline by miao1007.
the class EditPageFakeActivity method setResultAndFinish.
protected void setResultAndFinish() {
ArrayList<String> imageArray = new ArrayList<String>();
if (shareImageList != null) {
for (ImageInfo imageInfo : shareImageList) {
if ("imagePath".equals(imageInfo.paramName) || "imageUrl".equals(imageInfo.paramName)) {
shareParamMap.put(imageInfo.paramName, imageInfo.srcValue);
} else if ("viewToShare".equals(imageInfo.paramName)) {
shareParamMap.put(imageInfo.paramName, imageInfo.bitmap);
} else if ("imageArray".equals(imageInfo.paramName)) {
imageArray.add(imageInfo.srcValue);
}
}
shareImageList.clear();
if (imageArray.size() == 0) {
shareParamMap.put("imageArray", null);
} else {
shareParamMap.put("imageArray", imageArray.toArray(new String[imageArray.size()]));
}
}
HashMap<Platform, HashMap<String, Object>> editRes = new HashMap<Platform, HashMap<String, Object>>();
for (Platform platform : platforms) {
if ("FacebookMessenger".equals(platform.getName())) {
HashMap<String, Object> param = new HashMap<String, Object>(shareParamMap);
if (toFriendList != null && toFriendList.size() > 0) {
param.put("address", toFriendList.get(toFriendList.size() - 1));
}
if (param.get("address") == null) {
int resId = getStringRes(activity, "select_a_friend");
if (resId > 0) {
Toast.makeText(getContext(), activity.getString(resId) + " - " + platform.getName(), Toast.LENGTH_SHORT).show();
}
return;
}
editRes.put(platform, param);
// a statistics of Sharing
ShareSDK.logDemoEvent(3, platform);
continue;
}
// a statistics of Sharing
ShareSDK.logDemoEvent(3, platform);
editRes.put(platform, shareParamMap);
}
HashMap<String, Object> res = new HashMap<String, Object>();
res.put("editRes", editRes);
setResult(res);
finish();
}
Aggregations