本文整理汇总了Java中com.google.samples.apps.iosched.util.AccountUtils.getPlusImageUrl方法的典型用法代码示例。如果您正苦于以下问题:Java AccountUtils.getPlusImageUrl方法的具体用法?Java AccountUtils.getPlusImageUrl怎么用?Java AccountUtils.getPlusImageUrl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.samples.apps.iosched.util.AccountUtils
的用法示例。
在下文中一共展示了AccountUtils.getPlusImageUrl方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: populateAccountList
import com.google.samples.apps.iosched.util.AccountUtils; //导入方法依赖的package包/类
private void populateAccountList(List<Account> accounts) {
mAccountListContainer.removeAllViews();
LayoutInflater layoutInflater = LayoutInflater.from(this);
for (Account account : accounts) {
View itemView = layoutInflater.inflate(R.layout.list_item_account,
mAccountListContainer, false);
((TextView) itemView.findViewById(R.id.profile_email_text))
.setText(account.name);
final String accountName = account.name;
String imageUrl = AccountUtils.getPlusImageUrl(this, accountName);
if (!TextUtils.isEmpty(imageUrl)) {
mImageLoader.loadImage(imageUrl,
(ImageView) itemView.findViewById(R.id.profile_image));
}
itemView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
ConnectivityManager cm = (ConnectivityManager)
getSystemService(CONNECTIVITY_SERVICE);
NetworkInfo activeNetwork = cm.getActiveNetworkInfo();
if (activeNetwork == null || !activeNetwork.isConnected()) {
// if there's no network, don't try to change the selected account
Toast.makeText(BaseActivity.this, R.string.no_connection_cant_login,
Toast.LENGTH_SHORT).show();
mDrawerLayout.closeDrawer(GravityCompat.START);
} else {
LOGD(TAG, "User requested switch to account: " + accountName);
AccountUtils.setActiveAccount(BaseActivity.this, accountName);
onAccountChangeRequested();
startLoginProcess();
mAccountBoxExpanded = false;
setupAccountBoxToggle();
mDrawerLayout.closeDrawer(GravityCompat.START);
setupAccountBox();
}
}
});
mAccountListContainer.addView(itemView);
}
}
示例2: setupAccountBox
import com.google.samples.apps.iosched.util.AccountUtils; //导入方法依赖的package包/类
/**
* Sets up the account box. The account box is the area at the top of the nav drawer that
* shows which account the user is logged in as, and lets them switch accounts. It also
* shows the user's Google+ cover photo as background.
*/
private void setupAccountBox() {
mAccountListContainer = (LinearLayout) findViewById(R.id.account_list);
if (mAccountListContainer == null) {
//This activity does not have an account box
return;
}
final View chosenAccountView = findViewById(R.id.chosen_account_view);
Account chosenAccount = AccountUtils.getActiveAccount(this);
if (chosenAccount == null) {
// No account logged in; hide account box
chosenAccountView.setVisibility(View.GONE);
mAccountListContainer.setVisibility(View.GONE);
return;
} else {
chosenAccountView.setVisibility(View.VISIBLE);
mAccountListContainer.setVisibility(View.INVISIBLE);
}
AccountManager am = AccountManager.get(this);
Account[] accountArray = am.getAccountsByType(GoogleAuthUtil.GOOGLE_ACCOUNT_TYPE);
List<Account> accounts = new ArrayList<Account>(Arrays.asList(accountArray));
accounts.remove(chosenAccount);
ImageView coverImageView = (ImageView) chosenAccountView.findViewById(R.id.profile_cover_image);
ImageView profileImageView = (ImageView) chosenAccountView.findViewById(R.id.profile_image);
TextView nameTextView = (TextView) chosenAccountView.findViewById(R.id.profile_name_text);
TextView email = (TextView) chosenAccountView.findViewById(R.id.profile_email_text);
mExpandAccountBoxIndicator = (ImageView) findViewById(R.id.expand_account_box_indicator);
String name = AccountUtils.getPlusName(this);
if (name == null) {
nameTextView.setVisibility(View.GONE);
} else {
nameTextView.setVisibility(View.VISIBLE);
nameTextView.setText(name);
}
String imageUrl = AccountUtils.getPlusImageUrl(this);
if (imageUrl != null) {
mImageLoader.loadImage(imageUrl, profileImageView);
}
String coverImageUrl = AccountUtils.getPlusCoverUrl(this);
if (coverImageUrl != null) {
mImageLoader.loadImage(coverImageUrl, coverImageView);
} else {
coverImageView.setImageResource(R.color.nearby_header_color);
}
email.setText(chosenAccount.name);
if (accounts.isEmpty()) {
// There's only one account on the device, so no need for a switcher.
mExpandAccountBoxIndicator.setVisibility(View.GONE);
mAccountListContainer.setVisibility(View.GONE);
chosenAccountView.setEnabled(false);
return;
}
chosenAccountView.setEnabled(true);
mExpandAccountBoxIndicator.setVisibility(View.VISIBLE);
chosenAccountView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
mAccountBoxExpanded = !mAccountBoxExpanded;
setupAccountBoxToggle();
}
});
setupAccountBoxToggle();
populateAccountList(accounts);
}
示例3: populateAccountList
import com.google.samples.apps.iosched.util.AccountUtils; //导入方法依赖的package包/类
private void populateAccountList(List<Account> accounts) {
mAccountListContainer.removeAllViews();
LayoutInflater layoutInflater = LayoutInflater.from(this);
for (Account account : accounts) {
View itemView = layoutInflater.inflate(R.layout.list_item_account,
mAccountListContainer, false);
((TextView) itemView.findViewById(R.id.profile_email_text))
.setText(account.name);
final String accountName = account.name;
String imageUrl = AccountUtils.getPlusImageUrl(this, accountName);
if (!TextUtils.isEmpty(imageUrl)) {
mImageLoader.loadImage(imageUrl,
(ImageView) itemView.findViewById(R.id.profile_image));
}
itemView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
ConnectivityManager cm = (ConnectivityManager)
getSystemService(CONNECTIVITY_SERVICE);
NetworkInfo activeNetwork = cm.getActiveNetworkInfo();
if (activeNetwork == null || !activeNetwork.isConnected()) {
// if there's no network, don't try to change the selected account
Toast.makeText(BaseActivity.this, R.string.no_connection_cant_login,
Toast.LENGTH_SHORT).show();
mDrawerLayout.closeDrawer(Gravity.START);
return;
} else {
LOGD(TAG, "User requested switch to account: " + accountName);
AccountUtils.setActiveAccount(BaseActivity.this, accountName);
onAccountChangeRequested();
startLoginProcess();
mAccountBoxExpanded = false;
setupAccountBoxToggle();
mDrawerLayout.closeDrawer(Gravity.START);
setupAccountBox();
}
}
});
mAccountListContainer.addView(itemView);
}
}