Search in sources :

Example 1 with ReleaseAssetAdapter

use of com.gh4a.adapter.ReleaseAssetAdapter in project gh4a by slapperwan.

the class ReleaseInfoActivity method fillData.

private void fillData() {
    ImageView gravatar = findViewById(R.id.iv_gravatar);
    AvatarHandler.assignAvatar(gravatar, mRelease.author());
    gravatar.setOnClickListener(this);
    StyleableTextView details = findViewById(R.id.tv_releaseinfo);
    String detailsText = getString(R.string.release_details, ApiHelpers.getUserLogin(this, mRelease.author()), StringUtils.formatRelativeTime(this, mRelease.createdAt(), true));
    StringUtils.applyBoldTagsAndSetText(details, detailsText);
    TextView releaseType = findViewById(R.id.tv_releasetype);
    if (mRelease.draft()) {
        releaseType.setText(R.string.release_type_draft);
    } else if (mRelease.prerelease()) {
        releaseType.setText(R.string.release_type_prerelease);
    } else {
        releaseType.setText(R.string.release_type_final);
    }
    TextView tag = findViewById(R.id.tv_releasetag);
    tag.setText(getString(R.string.release_tag, mRelease.tagName()));
    tag.setOnClickListener(this);
    if (mRelease.assets() != null && !mRelease.assets().isEmpty()) {
        RecyclerView downloadsList = findViewById(R.id.download_list);
        ReleaseAssetAdapter adapter = new ReleaseAssetAdapter(this);
        adapter.addAll(mRelease.assets());
        adapter.setOnItemClickListener(this);
        downloadsList.setLayoutManager(new LinearLayoutManager(this));
        downloadsList.setNestedScrollingEnabled(false);
        downloadsList.setAdapter(adapter);
    } else {
        findViewById(R.id.downloads).setVisibility(View.GONE);
    }
}
Also used : ReleaseAssetAdapter(com.gh4a.adapter.ReleaseAssetAdapter) StyleableTextView(com.gh4a.widget.StyleableTextView) TextView(android.widget.TextView) RecyclerView(android.support.v7.widget.RecyclerView) ImageView(android.widget.ImageView) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) StyleableTextView(com.gh4a.widget.StyleableTextView)

Aggregations

LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)1 RecyclerView (android.support.v7.widget.RecyclerView)1 ImageView (android.widget.ImageView)1 TextView (android.widget.TextView)1 ReleaseAssetAdapter (com.gh4a.adapter.ReleaseAssetAdapter)1 StyleableTextView (com.gh4a.widget.StyleableTextView)1