本文整理匯總了Java中cn.sharesdk.framework.Platform.isValid方法的典型用法代碼示例。如果您正苦於以下問題:Java Platform.isValid方法的具體用法?Java Platform.isValid怎麽用?Java Platform.isValid使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類cn.sharesdk.framework.Platform
的用法示例。
在下文中一共展示了Platform.isValid方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: unauthorize
import cn.sharesdk.framework.Platform; //導入方法依賴的package包/類
public static void unauthorize(Context context, String platformName) {
ensureInit(context);
Platform platform = ShareSDK.getPlatform(context, platformName);
if (platform.isValid()) platform.removeAccount();
}
示例2: getView
import cn.sharesdk.framework.Platform; //導入方法依賴的package包/類
public View getView(int position, View convertView, ViewGroup parent) {
if (convertView == null) {
convertView = View.inflate(context, R.layout.auth_page_item, null);
}
int count = getCount();
View llItem = convertView.findViewById(R.id.llItem);
int dp_10 = cn.sharesdk.framework.utils.R.dipToPx(parent.getContext(), 10);
if (count == 1) {
llItem.setBackgroundResource(R.drawable.list_item_single_normal);
llItem.setPadding(0, 0, 0, 0);
convertView.setPadding(dp_10, dp_10, dp_10, dp_10);
}
else if (position == 0) {
llItem.setBackgroundResource(R.drawable.list_item_first_normal);
llItem.setPadding(0, 0, 0, 0);
convertView.setPadding(dp_10, dp_10, dp_10, 0);
}
else if (position == count - 1) {
llItem.setBackgroundResource(R.drawable.list_item_last_normal);
llItem.setPadding(0, 0, 0, 0);
convertView.setPadding(dp_10, 0, dp_10, dp_10);
}
else {
llItem.setBackgroundResource(R.drawable.list_item_middle_normal);
llItem.setPadding(0, 0, 0, 0);
convertView.setPadding(dp_10, 0, dp_10, 0);
}
Platform plat = getItem(position);
ImageView ivLogo = (ImageView) convertView.findViewById(R.id.ivLogo);
Bitmap logo = getIcon(plat);
if (logo != null && !logo.isRecycled()) {
ivLogo.setImageBitmap(logo);
}
CheckedTextView ctvName = (CheckedTextView) convertView.findViewById(R.id.ctvName);
ctvName.setChecked(plat.isValid());
if (plat.isValid()) {
String userName = plat.getDb().get("nickname");
if (userName == null || userName.length() <= 0 || "null".equals(userName)) {
userName = getName(plat);
}
ctvName.setText(userName);
} else {
ctvName.setText(R.string.not_yet_authorized);
}
return convertView;
}
示例3: isAuthorized
import cn.sharesdk.framework.Platform; //導入方法依賴的package包/類
/**
* 判斷某平台是否已經授權(在ShareSDK中,判斷此平台是否授權的方法是isValid,而取消授權的方法是removeAccount)。
* @param context
* @param platformName e.g: {@link QZone#NAME}
* @return
*/
public static boolean isAuthorized(Context context, String platformName) {
ensureInit(context);
Platform platform = ShareSDK.getPlatform(context, platformName);
return platform.isValid();
}