use of me.zhanghai.android.douya.network.api.info.apiv2.SimpleUser 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);
mProfileFragment = ProfileFragment.newInstance(userIdOrUid, simpleUser, user);
FragmentUtils.add(mProfileFragment, this, android.R.id.content);
} else {
mProfileFragment = FragmentUtils.findById(this, android.R.id.content);
}
}
use of me.zhanghai.android.douya.network.api.info.apiv2.SimpleUser in project Douya by DreaminginCodeZH.
the class BaseUserAdapter method onBindViewHolder.
@Override
public void onBindViewHolder(final ViewHolder holder, int position) {
final Context context = RecyclerViewUtils.getContext(holder);
final SimpleUser user = getItem(position);
holder.itemView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
context.startActivity(ProfileActivity.makeIntent(user, context));
}
});
ImageUtils.loadAvatar(holder.avatarImage, user.avatar);
holder.nameText.setText(user.name);
//noinspection deprecation
holder.descriptionText.setText(user.uid);
}
use of me.zhanghai.android.douya.network.api.info.apiv2.SimpleUser in project Douya by DreaminginCodeZH.
the class ProfileFollowshipLayout method bind.
public void bind(final User userInfo, List<SimpleUser> followingList) {
final Context context = getContext();
OnClickListener viewFollowingListListener = new OnClickListener() {
@Override
public void onClick(View view) {
context.startActivity(FollowingListActivity.makeIntent(userInfo.getIdOrUid(), context));
}
};
mTitleText.setOnClickListener(viewFollowingListListener);
mViewMoreText.setOnClickListener(viewFollowingListListener);
int i = 0;
for (final SimpleUser user : followingList) {
if (i >= USER_COUNT_MAX) {
break;
}
if (i >= mFollowingList.getChildCount()) {
ViewUtils.inflateInto(R.layout.profile_user_item, mFollowingList);
}
View userLayout = mFollowingList.getChildAt(i);
UserLayoutHolder holder = (UserLayoutHolder) userLayout.getTag();
if (holder == null) {
holder = new UserLayoutHolder(userLayout);
userLayout.setTag(holder);
}
ImageUtils.loadAvatar(holder.avatarImage, user.avatar);
holder.nameText.setText(user.name);
userLayout.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {
context.startActivity(ProfileActivity.makeIntent(user, context));
}
});
++i;
}
ViewUtils.setVisibleOrGone(mFollowingList, i != 0);
ViewUtils.setVisibleOrGone(mEmptyView, i == 0);
if (userInfo.followingCount > i) {
mViewMoreText.setText(context.getString(R.string.view_more_with_count_format, userInfo.followingCount));
} else {
mViewMoreText.setVisibility(GONE);
}
for (int count = mFollowingList.getChildCount(); i < count; ++i) {
ViewUtils.setVisibleOrGone(mFollowingList.getChildAt(i), false);
}
if (userInfo.followerCount > 0) {
mFollwerText.setText(context.getString(R.string.profile_follower_count_format, userInfo.followerCount));
mFollwerText.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {
context.startActivity(FollowerListActivity.makeIntent(userInfo.getIdOrUid(), context));
}
});
} else {
mFollwerText.setVisibility(GONE);
}
}
use of me.zhanghai.android.douya.network.api.info.apiv2.SimpleUser in project Douya by DreaminginCodeZH.
the class AccountUserResource method setArguments.
protected AccountUserResource setArguments(Account account) {
SimpleUser partialUser = makePartialUser(account);
super.setArguments(partialUser.getIdOrUid(), partialUser, AccountUtils.getUser(account));
FragmentUtils.ensureArguments(this).putParcelable(EXTRA_ACCOUNT, account);
return this;
}
use of me.zhanghai.android.douya.network.api.info.apiv2.SimpleUser in project Douya by DreaminginCodeZH.
the class AccountUserResource method makePartialUser.
private SimpleUser makePartialUser(Account account) {
SimpleUser partialUser = new SimpleUser();
//noinspection deprecation
partialUser.id = AccountUtils.getUserId(account);
//noinspection deprecation
partialUser.uid = String.valueOf(partialUser.id);
partialUser.name = AccountUtils.getUserName(account);
return partialUser;
}
Aggregations