use of com.google.api.ads.admanager.axis.v202108.User in project Douya by DreaminginCodeZH.
the class NavigationAccountListLayout method bind.
public void bind() {
List<Account> accountList = new ArrayList<>(Arrays.asList(AccountUtils.getAccounts()));
accountList.remove(AccountUtils.getActiveAccount());
Account recentOneAccount = AccountUtils.getRecentOneAccount();
if (recentOneAccount != null) {
accountList.remove(recentOneAccount);
}
Account recentTwoAccount = AccountUtils.getRecentTwoAccount();
if (recentTwoAccount != null) {
accountList.remove(recentTwoAccount);
}
if (recentOneAccount != null) {
accountList.add(recentOneAccount);
}
if (recentTwoAccount != null) {
accountList.add(recentTwoAccount);
}
int i = 0;
for (final Account account : accountList) {
if (i >= mAccountList.getChildCount()) {
ViewUtils.inflateInto(R.layout.navigation_account_item, mAccountList);
}
View accountLayout = mAccountList.getChildAt(i);
accountLayout.setVisibility(VISIBLE);
AccountLayoutHolder holder = (AccountLayoutHolder) accountLayout.getTag();
if (holder == null) {
holder = new AccountLayoutHolder(accountLayout);
accountLayout.setTag(holder);
}
User user = mAdapter.getUser(account);
if (user != null) {
ImageUtils.loadNavigationAccountListAvatar(holder.avatarImage, user.getLargeAvatarOrAvatar());
} else {
holder.avatarImage.setImageResource(R.drawable.avatar_icon_40dp);
}
holder.nameText.setText(mAdapter.getPartialUser(account).name);
accountLayout.setOnClickListener(view -> {
if (mListener != null) {
mListener.switchToAccount(account);
}
});
++i;
}
ViewUtils.setVisibleOrGone(mDividerView, i > 0);
for (int count = mAccountList.getChildCount(); i < count; ++i) {
mAccountList.getChildAt(i).setVisibility(GONE);
}
}
use of com.google.api.ads.admanager.axis.v202108.User in project Douya by DreaminginCodeZH.
the class ProfileActivity method onCreate.
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
overridePendingTransition(0, 0);
// Calls ensureSubDecor().
findViewById(android.R.id.content);
if (savedInstanceState == null) {
Intent intent = getIntent();
String userIdOrUid = intent.getStringExtra(EXTRA_USER_ID_OR_UID);
SimpleUser simpleUser = intent.getParcelableExtra(EXTRA_SIMPLE_USER);
User user = intent.getParcelableExtra(EXTRA_USER_INFO);
mFragment = ProfileFragment.newInstance(userIdOrUid, simpleUser, user);
FragmentUtils.add(mFragment, this, android.R.id.content);
} else {
mFragment = FragmentUtils.findById(this, android.R.id.content);
}
}
use of com.google.api.ads.admanager.axis.v202108.User in project Douya by DreaminginCodeZH.
the class ProfileBroadcastsLayout method bind.
public void bind(User user, List<Broadcast> broadcastList) {
Context context = getContext();
View.OnClickListener viewMoreListener = view -> context.startActivity(BroadcastListActivity.makeIntent(user, context));
mTitleText.setOnClickListener(viewMoreListener);
mViewMoreText.setOnClickListener(viewMoreListener);
int i = 0;
for (Broadcast broadcast : broadcastList) {
if (i >= BROADCAST_COUNT_MAX) {
break;
}
if (broadcast.rebroadcastedBroadcast != null) {
continue;
}
if (i >= mBroadcastList.getChildCount()) {
ViewUtils.inflateInto(R.layout.profile_broadcast_item, mBroadcastList);
}
View broadcastLayout = mBroadcastList.getChildAt(i);
broadcastLayout.setVisibility(VISIBLE);
BroadcastLayoutHolder holder = (BroadcastLayoutHolder) broadcastLayout.getTag();
if (holder == null) {
holder = new BroadcastLayoutHolder(broadcastLayout);
broadcastLayout.setTag(holder);
ViewUtils.setTextViewLinkClickable(holder.textText);
}
// HACK: Should not change on rebind.
if (holder.boundBroadcastId != broadcast.id) {
SizedImageItem image = null;
if (broadcast.attachment != null) {
image = broadcast.attachment.image;
}
if (image == null) {
List<? extends SizedImageItem> images = broadcast.attachment != null && broadcast.attachment.imageList != null ? broadcast.attachment.imageList.images : broadcast.images;
if (images.size() > 0) {
image = images.get(0);
}
}
if (image != null) {
holder.image.setVisibility(VISIBLE);
ImageUtils.loadImage(holder.image, image);
} else {
holder.image.setVisibility(GONE);
}
CharSequence text = broadcast.getTextWithEntities(context);
if (TextUtils.isEmpty(text) && broadcast.attachment != null) {
text = broadcast.attachment.title;
}
holder.textText.setText(text);
boolean hasTime = !TextUtils.isEmpty(broadcast.createTime);
ViewUtils.setVisibleOrGone(holder.timeText, hasTime);
if (hasTime) {
holder.timeText.setDoubanTime(broadcast.createTime);
}
ViewUtils.setVisibleOrGone(holder.timeActionSpace, hasTime);
holder.actionText.setText(broadcast.action);
broadcastLayout.setOnClickListener(view -> context.startActivity(BroadcastActivity.makeIntent(broadcast, context)));
holder.boundBroadcastId = broadcast.id;
}
++i;
}
ViewUtils.setVisibleOrGone(mBroadcastList, i != 0);
ViewUtils.setVisibleOrGone(mEmptyView, i == 0);
if (user.broadcastCount > i) {
mViewMoreText.setText(context.getString(R.string.view_more_with_count_format, user.broadcastCount));
} else {
mViewMoreText.setVisibility(GONE);
}
for (int count = mBroadcastList.getChildCount(); i < count; ++i) {
mBroadcastList.getChildAt(i).setVisibility(GONE);
}
}
use of com.google.api.ads.admanager.axis.v202108.User in project fastjson by alibaba.
the class Issue3132 method test_for_issue.
public void test_for_issue() throws Exception {
User user = new User();
user.setId(9);
user.setName("asdffsf");
System.out.println(JSONObject.toJSONString(user));
}
use of com.google.api.ads.admanager.axis.v202108.User in project openstack4j by ContainX.
the class KeystoneUserServiceTests method getUser_byName_byDomainId_NotExist_Test.
/**
* returns null for an non-existing user when the user specified by name and domain.
*
* @throws Exception
*/
public void getUser_byName_byDomainId_NotExist_Test() throws Exception {
respondWith(JSON_USER_GET_BYNAME_BYDOMAINID_NOT_EXIST);
User user = osv3().identity().users().getByName(USER_NAME, USER_DOMAIN_ID);
assertNull(user);
}
Aggregations