Java Code Examples for cn.sharesdk.framework.Platform#getName()

The following examples show how to use cn.sharesdk.framework.Platform#getName() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PlatformGridViewAdapter.java    From BigApp_Discuz_Android with Apache License 2.0 6 votes vote down vote up
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;
}
 
Example 2
Source File: EditPage.java    From WeCenterMobile-Android with GNU General Public License v2.0 6 votes vote down vote up
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;
}
 
Example 3
Source File: EditPage.java    From BigApp_WordPress_Android with Apache License 2.0 6 votes vote down vote up
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.toLowerCase());
	if(resId > 0) {
		return BitmapFactory.decodeResource(activity.getResources(), resId);
	}
	return null;
}
 
Example 4
Source File: EditPage.java    From BigApp_Discuz_Android with Apache License 2.0 6 votes vote down vote up
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.toLowerCase());
	if(resId > 0) {
		return BitmapFactory.decodeResource(activity.getResources(), resId);
	}
	return null;
}
 
Example 5
Source File: EditPage.java    From ShareSDKShareDifMsgDemo-Android with MIT License 6 votes vote down vote up
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;
}
 
Example 6
Source File: AuthPageAty.java    From Huochexing12306 with Apache License 2.0 6 votes vote down vote up
public AuthAdapter(Context context) {
	this.context = context;
	// 获取平台列表
	Platform[] tmp = ShareSDK.getPlatformList();
	platforms = new ArrayList<Platform>();
	if (tmp == null) {
		return;
	}

	for (Platform p : tmp) {
		String name = p.getName();
		if ((p instanceof CustomPlatform)
				|| !ShareCore.canAuthorize(p.getContext(), name)) {
			continue;
		}
		if (p.getName().equals(Wechat.NAME)){
			continue;
		}
		platforms.add(p);
	}
}
 
Example 7
Source File: LoginActivity.java    From Viewer with Apache License 2.0 6 votes vote down vote up
@Override
public boolean onLogin(String platform, HashMap<String, Object> res) {
       if(platform == null){
        return false;
       }
       
       showProgressDialog(R.string.wait_for_login);
       Platform myPlatform = ShareSDK.getPlatform(platform);
       String uid = myPlatform.getDb().getUserId();
       String thirdSymbol = myPlatform.getName();
       String nickName =  myPlatform.getDb().getUserName();
       // 0 无性别,1男 , 2女
       int sex = 0;
       if("m".equals(myPlatform.getDb().getUserGender())){
        sex = 1;
       }else{
        sex = 2;
       }
       
       mUserLoginHandler.setOtherLoginData(uid,thirdSymbol,nickName,sex);
       mUserLoginHandler.doThing(UserLoginHandler.THIRD_LOGIN);
	return true;
}
 
Example 8
Source File: EditPage.java    From Huochexing12306 with Apache License 2.0 6 votes vote down vote up
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;
}
 
Example 9
Source File: PlatformGridView.java    From WeCenterMobile-Android with GNU General Public License v2.0 6 votes vote down vote up
private String getName(Platform plat) {
	if (plat == null) {
		return "";
	}

	String name = plat.getName();
	if (name == null) {
		return "";
	}

	int resId = cn.sharesdk.framework.utils.R.getStringRes(getContext(), plat.getName());
	if (resId > 0) {
		return getContext().getString(resId);
	}
	return null;
}
 
Example 10
Source File: LoginActivity.java    From xmpp with Apache License 2.0 5 votes vote down vote up
@Override
public void onComplete(Platform platform, int i, HashMap<String, Object> hashMap) {
    Log.i("login","chenggong");
    Log.i("login",platform.getName()+"");
    Log.i("login",hashMap.toString());
    Log.i("login", platform.getDb().getUserId()+"");

    Message m = new Message();
    m.what = 1;
    m.obj = new Object[]{platform.getName(), hashMap, platform.getDb().getUserId()};
    h.sendMessage(m);
}
 
Example 11
Source File: OnekeyShareThemeImpl.java    From Social with Apache License 2.0 5 votes vote down vote up
/** 判断指定平台是否只能使用客户端分享 */
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;
}
 
Example 12
Source File: PlatformGridView.java    From ShareSDKShareDifMsgDemo-Android with MIT License 5 votes vote down vote up
private Bitmap getIcon(Platform plat) {
	if (plat == null) {
		return null;
	}

	String name = plat.getName();
	if (name == null) {
		return null;
	}

	String resName = "logo_" + plat.getName();
	int resId = getBitmapRes(getContext(), resName);
	return BitmapFactory.decodeResource(getResources(), resId);
}
 
Example 13
Source File: EditPage.java    From -Android_ShareSDK_Example_Wechat with MIT License 5 votes vote down vote up
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);
	return BitmapFactory.decodeResource(activity.getResources(), resId);
}
 
Example 14
Source File: PlatformGridView.java    From WeCenterMobile-Android with GNU General Public License v2.0 5 votes vote down vote up
private Bitmap getIcon(Platform plat) {
	if (plat == null) {
		return null;
	}

	String name = plat.getName();
	if (name == null) {
		return null;
	}

	String resName = "logo_" + plat.getName();
	int resId = getBitmapRes(getContext(), resName);
	return BitmapFactory.decodeResource(getResources(), resId);
}
 
Example 15
Source File: PlatformGridView.java    From -Android_ShareSDK_Example_Wechat with MIT License 5 votes vote down vote up
private String getName(Platform plat) {
	if (plat == null) {
		return "";
	}

	String name = plat.getName();
	if (name == null) {
		return "";
	}

	int resId = cn.sharesdk.framework.utils.R.getStringRes(getContext(), plat.getName());
	return getContext().getString(resId);
}
 
Example 16
Source File: AuthPageAty.java    From Huochexing12306 with Apache License 2.0 5 votes vote down vote up
private String getName(Platform plat) {
	if (plat == null) {
		return "";
	}

	String name = plat.getName();
	if (name == null) {
		return "";
	}

	int resId = cn.sharesdk.framework.utils.R.getStringRes(context, plat.getName());
	return context.getString(resId);
}
 
Example 17
Source File: EditPage.java    From BigApp_WordPress_Android with Apache License 2.0 5 votes vote down vote up
private void initAtUserView() {
	LinearLayout atLayout = (LinearLayout) findViewByResName("atLayout");
	for(Platform platform : platforms) {
		String platformName = platform.getName();
		if (isShowAtUserLayout(platformName)) {
			View view = LayoutInflater.from(activity).inflate(getLayoutRes(activity, "skyblue_editpage_at_layout"), null);
			TextView atDescTextView = (TextView) view.findViewById(getIdRes(activity, "atDescTextView"));
			TextView atTextView = (TextView) view.findViewById(getIdRes(activity, "atTextView"));

			OnClickListener atBtnClickListener = new OnClickListener() {
				public void onClick(View v) {
					FollowListPage subPage = new FollowListPage();
					subPage.setPlatform((Platform) v.getTag());
					subPage.showForResult(activity, null, EditPage.this);
				}
			};
			atTextView.setTag(platform);
			atTextView.setOnClickListener(atBtnClickListener);
			atDescTextView.setTag(platform);
			atDescTextView.setOnClickListener(atBtnClickListener);

			atTextView.setText(getAtUserButtonText(platformName));
			atDescTextView.setText(getContext().getString(getStringRes(activity, "list_friends"), getLogoName(platformName)));

			atLayout.addView(view);
		}
	}

}
 
Example 18
Source File: PlatformGridView.java    From BigApp_WordPress_Android with Apache License 2.0 5 votes vote down vote up
private Bitmap getIcon(Platform plat) {
	if (plat == null) {
		return null;
	}

	String name = plat.getName();
	if (name == null) {
		return null;
	}

	String resName = "logo_" + plat.getName();
	int resId = getBitmapRes(getContext(), resName.toLowerCase());
	return BitmapFactory.decodeResource(getResources(), resId);
}
 
Example 19
Source File: AuthPageAty.java    From Huochexing12306 with Apache License 2.0 5 votes vote down vote up
private Bitmap getIcon(Platform plat) {
	if (plat == null) {
		return null;
	}

	String name = plat.getName();
	if (name == null) {
		return null;
	}

	String resName = "logo_" + plat.getName();
	int resId = cn.sharesdk.framework.utils.R.getResId(R.drawable.class, resName);
	return BitmapFactory.decodeResource(context.getResources(), resId);
}
 
Example 20
Source File: PlatformMananger.java    From ShareSDK-for-Android with MIT License 4 votes vote down vote up
private void afterPlatformsGot(Platform[] platforms) {
		ShareListItemInEntity entity = null;
		PlatformEntity normalEntity = null;
		for (Platform platform : platforms) {
			String name = platform.getName();
			//客户端分享的情况
//			if (DemoUtils.isUseClientToShare(name)) {
//				continue;
//			}
			if (platform instanceof CustomPlatform) {
				continue;
			}
			//#if def{lang} == cn
			// 处理左边按钮和右边按钮
			//#elif def{lang} == en
			// initiate buttons
			//#endif
			entity = new ShareListItemInEntity();
			entity.setPlatform(platform);
			normalEntity = new PlatformEntity();
			normalEntity.setmPlatform(platform);
			entity.setType(SharePlatformType.FOREIGN_SHARE_PLAT);
			int platNameRes = ResHelper.getStringRes(context, "ssdk_" + name.toLowerCase());
			String resName = "ssdk_oks_classic_" + name;
			int resId = ResourcesUtils.getBitmapRes(context, resName.toLowerCase());
			if (resId > 0) {
				entity.setIcon(resId);
				normalEntity.setmIcon(resId);
			}

			if (platNameRes > 0) {
				String platName = context.getString(platNameRes);
				entity.setName(platName);
				normalEntity.setName(platName);
				String text = context.getString(R.string.share_to_format, platName);
			}
			if (Arrays.asList(china).contains(name) ) {
				if((!name.equals("Cmcc")) && (!name.equals("Telecom"))){
					chinaList.add(entity);
				}
				if (AuthorizationUserInfoUtils.canAuthorize(name)) {
					chinaListNormal.add(normalEntity);
				}
				if (AuthorizationUserInfoUtils.canGetUserInfo(name)) {
					chinaListNormalUserInfo.add(normalEntity);
				}
			} else {
				if (Arrays.asList(system).contains(name)) {
					systemList.add(entity);
					if (AuthorizationUserInfoUtils.canAuthorize(name)) {
						systemListNormal.add(normalEntity);
					}
					if (AuthorizationUserInfoUtils.canGetUserInfo(name)) {
						systemListNormal.add(normalEntity);
					}
				} else {
					if ((!name.equals("Accountkit")) && (!name.equals("GooglePlus"))){
						lists.add(entity);
					}
					if (AuthorizationUserInfoUtils.canAuthorize(name)) {
						normalList.add(normalEntity);
					}
					if (AuthorizationUserInfoUtils.canGetUserInfo(name)) {
						normalListUserInfo.add(normalEntity);
					}
				}

			}

		}
	}