Search in sources :

Example 6 with SimpleUser

use of me.zhanghai.android.douya.network.api.info.apiv2.SimpleUser in project Douya by DreaminginCodeZH.

the class BroadcastListActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    TransitionUtils.setupTransitionBeforeDecorate(this);
    super.onCreate(savedInstanceState);
    // Calls ensureSubDecor().
    findViewById(android.R.id.content);
    TransitionUtils.postponeTransition(this);
    if (savedInstanceState == null) {
        Intent intent = getIntent();
        String userIdOrUid = intent.getStringExtra(EXTRA_USER_ID_OR_UID);
        SimpleUser user = intent.getParcelableExtra(EXTRA_USER);
        String topic = intent.getStringExtra(EXTRA_TOPIC);
        FragmentUtils.add(BroadcastListActivityFragment.newInstance(userIdOrUid, user, topic), this, android.R.id.content);
    }
}
Also used : SimpleUser(me.zhanghai.android.douya.network.api.info.apiv2.SimpleUser) Intent(android.content.Intent)

Example 7 with SimpleUser

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);
    }
}
Also used : Context(android.content.Context) SimpleUser(me.zhanghai.android.douya.network.api.info.apiv2.SimpleUser) ImageView(android.widget.ImageView) BindView(butterknife.BindView) TextView(android.widget.TextView) View(android.view.View) FriendlyCardView(me.zhanghai.android.douya.ui.FriendlyCardView)

Aggregations

SimpleUser (me.zhanghai.android.douya.network.api.info.apiv2.SimpleUser)7 View (android.view.View)3 ImageView (android.widget.ImageView)3 TextView (android.widget.TextView)3 BindView (butterknife.BindView)3 Context (android.content.Context)2 Intent (android.content.Intent)2 User (me.zhanghai.android.douya.network.api.info.apiv2.User)2 RecyclerView (android.support.v7.widget.RecyclerView)1 FriendlyCardView (me.zhanghai.android.douya.ui.FriendlyCardView)1