use of com.meisolsson.githubsdk.model.GistFile in project gh4a by slapperwan.
the class GistActivity method fillData.
private void fillData(final Gist gist) {
mGist = gist;
if (gist.owner() != null) {
getSupportActionBar().setSubtitle(gist.owner().login());
}
TextView tvDesc = findViewById(R.id.tv_desc);
tvDesc.setText(TextUtils.isEmpty(gist.description()) ? getString(R.string.gist_no_description) : gist.description());
TextView tvCreatedAt = findViewById(R.id.tv_created_at);
tvCreatedAt.setText(StringUtils.formatRelativeTime(this, gist.createdAt(), true));
Map<String, GistFile> files = gist.files();
if (files != null && !files.isEmpty()) {
ViewGroup container = findViewById(R.id.file_container);
LayoutInflater inflater = getLayoutInflater();
container.removeAllViews();
for (GistFile gistFile : files.values()) {
TextView rowView = (TextView) inflater.inflate(R.layout.selectable_label, container, false);
rowView.setText(gistFile.filename());
rowView.setTextColor(UiUtils.resolveColor(this, android.R.attr.textColorPrimary));
rowView.setOnClickListener(this);
rowView.setTag(gistFile);
container.addView(rowView);
}
} else {
findViewById(R.id.file_card).setVisibility(View.GONE);
}
findViewById(R.id.tv_private).setVisibility(gist.isPublic() ? View.GONE : View.VISIBLE);
}
use of com.meisolsson.githubsdk.model.GistFile in project gh4a by slapperwan.
the class GistActivity method onClick.
@Override
public void onClick(View view) {
GistFile file = (GistFile) view.getTag();
startActivity(GistViewerActivity.makeIntent(this, mGistId, file.filename()));
}
Aggregations