use of com.alexvasilkov.android.commons.texts.SpannableBuilder in project GestureViews by alexvasilkov.
the class Ex6AdvancedDemoActivity method onPhotoInPagerSelected.
private void onPhotoInPagerSelected(int position) {
Photo photo = pagerAdapter.getPhoto(position);
if (photo == null) {
views.pagerTitle.setText(null);
} else {
SpannableBuilder title = new SpannableBuilder(Ex6AdvancedDemoActivity.this);
title.append(photo.getTitle()).append("\n").createStyle().setColorResId(R.color.text_secondary_light).apply().append(R.string.photo_by).append(" ").append(photo.getOwner().getUsername());
views.pagerTitle.setText(title.build());
}
}
use of com.alexvasilkov.android.commons.texts.SpannableBuilder in project GestureViews by alexvasilkov.
the class DemoActivity method onPhotoInPagerSelected.
/**
* Setting up photo title for current pager position.
*/
private void onPhotoInPagerSelected(int position) {
Photo photo = pagerAdapter.getPhoto(position);
if (photo == null) {
views.pagerTitle.setText(null);
} else {
SpannableBuilder title = new SpannableBuilder(DemoActivity.this);
title.append(photo.getTitle()).append("\n").createStyle().setColorResId(R.color.text_secondary_light).apply().append(R.string.demo_photo_by).append(" ").append(photo.getOwner().getUsername());
views.pagerTitle.setText(title.build());
}
}
use of com.alexvasilkov.android.commons.texts.SpannableBuilder in project GestureViews by alexvasilkov.
the class ListAdapter method onBindHolder.
private void onBindHolder(ViewHolder holder, int position) {
final Painting painting = paintings[position];
// Storing item position for click handler
holder.itemView.setTag(R.id.tag_item, position);
GlideHelper.loadThumb(holder.image, painting.thumbId);
CharSequence text = new SpannableBuilder(holder.title.getContext()).createStyle().setFont(Typeface.DEFAULT_BOLD).apply().append(painting.author).append("\n").clearStyle().append(painting.title).build();
holder.title.setText(text);
}
use of com.alexvasilkov.android.commons.texts.SpannableBuilder in project FoldableLayout by alexvasilkov.
the class UnfoldableDetailsActivity method openDetails.
public void openDetails(View coverView, Painting painting) {
final ImageView image = Views.find(detailsLayout, R.id.details_image);
final TextView title = Views.find(detailsLayout, R.id.details_title);
final TextView description = Views.find(detailsLayout, R.id.details_text);
GlideHelper.loadPaintingImage(image, painting);
title.setText(painting.getTitle());
SpannableBuilder builder = new SpannableBuilder(this);
builder.createStyle().setFont(Typeface.DEFAULT_BOLD).apply().append(R.string.year).append(": ").clearStyle().append(painting.getYear()).append("\n").createStyle().setFont(Typeface.DEFAULT_BOLD).apply().append(R.string.location).append(": ").clearStyle().append(painting.getLocation());
description.setText(builder.build());
unfoldableView.unfold(coverView, detailsLayout);
}
use of com.alexvasilkov.android.commons.texts.SpannableBuilder in project GestureViews by alexvasilkov.
the class LayoutsPagerAdapter method onBindViewHolder.
@Override
public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
settingsController.apply(holder.layout);
Painting painting = paintings[position];
GlideHelper.loadFull(holder.image, painting.imageId, painting.thumbId);
final CharSequence titleText = new SpannableBuilder(holder.itemView.getContext()).createStyle().setFont(Typeface.DEFAULT_BOLD).apply().append(paintings[position].author).append("\n").clearStyle().append(paintings[position].title).build();
holder.title.setText(titleText);
holder.button.setTag(paintings[position].link);
}
Aggregations