Java Code Examples for android.widget.TextView#setTransitionName()

The following examples show how to use android.widget.TextView#setTransitionName() . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may want to check out the right sidebar which shows the related API usage.
Example 1
Source Project: atlas   File: PhotoAdapter.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public void onBindViewHolder(final PhotoViewHolder holder, final int position) {
    Photo data = photos.get(position);
    TextView authorview = holder.itemView.findViewById(R.id.author);
    ImageView photoview = holder.itemView.findViewById(R.id.photo);
    holder.setAuthor(data.author);
    photoview.setTransitionName(String.format(photoTransitionFormat, data.id));
    authorview.setText(data.author);
    authorview.setTransitionName(String.format(authorTransitionFormat, data.id));
    holder.setId(data.id);
    Glide.with(layoutInflater.getContext())
            .load(data.getPhotoUrl(requestedPhotoWidth))
            .placeholder(R.color.placeholder)
            .override(ImageSize.NORMAL[0], ImageSize.NORMAL[1])
            .into((ImageView) holder.itemView.findViewById(R.id.photo));
}
 
Example 2
@Override
public void onBindViewHolder(final PhotoViewHolder holder, final int position) {
    Photo data = photos.get(position);
    TextView authorview = holder.itemView.findViewById(R.id.author);
    ImageView photoview = holder.itemView.findViewById(R.id.photo);
    holder.setAuthor(data.author);
    photoview.setTransitionName(String.format(photoTransitionFormat, data.id));
    authorview.setText(data.author);
    authorview.setTransitionName(String.format(authorTransitionFormat, data.id));
    holder.setId(data.id);
    Glide.with(layoutInflater.getContext())
            .load(data.getPhotoUrl(requestedPhotoWidth))
            .placeholder(R.color.placeholder)
            .override(ImageSize.NORMAL[0], ImageSize.NORMAL[1])
            .into((ImageView) holder.itemView.findViewById(R.id.photo));
}
 
Example 3
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
    App app = activity.getAppByListPosition(position);
    if (null == app) {
        return;
    }
    DetailsActivity.app = app;
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        ImageView iconView = view.findViewById(R.id.icon);
        String transitionNameIcon = activity.getString(R.string.details_transition_view_name);
        iconView.setTransitionName(transitionNameIcon);
        TextView textView = view.findViewById(R.id.text1);
        String transitionNameText = activity.getString(R.string.details_transition_view_name_text);
        textView.setTransitionName(transitionNameText);
        activity.startActivity(
            DetailsActivity.getDetailsIntent(activity, DetailsActivity.app.getPackageName()),
            ActivityOptionsCompat.makeSceneTransitionAnimation(
                activity,
                new Pair<View, String>(iconView, transitionNameIcon),
                new Pair<View, String>(textView, transitionNameText)
            ).toBundle()
        );
    } else {
        activity.startActivity(DetailsActivity.getDetailsIntent(activity, DetailsActivity.app.getPackageName()));
    }
}
 
Example 4
Source Project: Easy_xkcd   File: ComicFragment.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public Object instantiateItem(final ViewGroup container, final int position) {
    View itemView = setupPager(container, position);
    final PhotoView pvComic = itemView.findViewById(R.id.ivComic);
    final TextView tvAlt = itemView.findViewById(R.id.tvAlt);
    final TextView tvTitle = itemView.findViewById(R.id.tvTitle);

    RealmComic comic = getRealmComic(position); //TODO check if comic is null

    try {
        tvAlt.setText(Html.fromHtml(comic.getAltText()));
        tvTitle.setText((prefHelper.subtitleEnabled() ? "" : comic.getComicNumber() + ": ") + Html.fromHtml(RealmComic.getInteractiveTitle(comic, getActivity())));
        pvComic.setTransitionName("im" + comic.getComicNumber());
        tvTitle.setTransitionName(String.valueOf(comic.getComicNumber()));

        loadComicImage(comic, pvComic);
    } catch (NullPointerException e) {
        Timber.e(e, "NullPointerException at %s", position);
    }


    container.addView(itemView);
    return itemView;
}