本文整理汇总了Java中android.support.v4.view.ViewCompat.setTransitionName方法的典型用法代码示例。如果您正苦于以下问题:Java ViewCompat.setTransitionName方法的具体用法?Java ViewCompat.setTransitionName怎么用?Java ViewCompat.setTransitionName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.support.v4.view.ViewCompat
的用法示例。
在下文中一共展示了ViewCompat.setTransitionName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onBindViewHolder
import android.support.v4.view.ViewCompat; //导入方法依赖的package包/类
@Override
public void onBindViewHolder(final ImageViewHolder holder, int position) {
final AnimalItem animalItem = animalItems.get(position);
Picasso.with(holder.itemView.getContext())
.load(animalItem.imageUrl)
.into(holder.animalImageView);
ViewCompat.setTransitionName(holder.animalImageView, animalItem.name);
holder.itemView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
animalItemClickListener.onAnimalItemClick(holder.getAdapterPosition(), animalItem, holder.animalImageView);
}
});
}
示例2: instantiateItem
import android.support.v4.view.ViewCompat; //导入方法依赖的package包/类
@Override
public Object instantiateItem(ViewGroup container, final int position) {
final View view = LayoutInflater.from(context)
.inflate(R.layout.page_image_item_preview, container, false);
final ViewHolder viewHolder = new ViewHolder(view);
ViewCompat.setTransitionName(viewHolder.photoView, images.get(position).getUrl());
Glide.with(context)
.load(images.get(position).getUrl())
.dontTransform()
.dontAnimate()
.into(new SimpleTarget<GlideDrawable>() {
@Override
public void onResourceReady(GlideDrawable resource, GlideAnimation<? super GlideDrawable> glideAnimation) {
viewHolder.photoView.setImageDrawable(resource);
startPostponedEnterTransition(position);
}
});
container.addView(viewHolder.itemView);
return viewHolder;
}
示例3: launchDetail
import android.support.v4.view.ViewCompat; //导入方法依赖的package包/类
public static void launchDetail(MainActivity fromActivity, View fromView, Thing item, View backgroundView) {
ViewCompat.setTransitionName(fromView, "detail_element");
ViewCompat.setTransitionName(fromActivity.findViewById(R.id.fab), "fab");
ActivityOptionsCompat options =
TransitionHelper.makeOptionsCompat(
fromActivity,
Pair.create(fromView, "detail_element"),
Pair.create(fromActivity.findViewById(R.id.fab), "fab")
);
Intent intent = new Intent(fromActivity, MainActivity.class);
intent.putExtra("item_text", item.text);
intent.putExtra("fragment_resource_id", R.layout.fragment_thing_detail);
if (backgroundView != null) BitmapUtil.storeBitmapInIntent(BitmapUtil.createBitmap(backgroundView), intent);
ActivityCompat.startActivity(fromActivity, intent, options.toBundle());
fromActivity.overridePendingTransition(R.anim.slide_up, R.anim.scale_down);
}
示例4: onCreate
import android.support.v4.view.ViewCompat; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setActionBarTitle(R.string.idol_info);
initActionBar(ACTIONBAR_TYPE_NULL);
String charaJson = umi.getIntentString("theChara");
String charaID = umi.getIntentString("charaID");
if (!TextUtils.isEmpty(charaJson)){
Chara chara = JsonUtils.getBeanFromJson(charaJson, Chara.class);
setBinding(R.layout.activity_chara_detail)
.setVariable(com.lazyeraser.imas.derehelper.BR.viewModel, new CharaViewModel(this, chara))
.setVariable(com.lazyeraser.imas.derehelper.BR.viewModel2, new SongListVM(this, chara.getChara_id()));
}else if (!TextUtils.isEmpty(charaID)){
setBinding(R.layout.activity_chara_detail)
.setVariable(com.lazyeraser.imas.derehelper.BR.viewModel, new CharaViewModel(this, charaID))
.setVariable(com.lazyeraser.imas.derehelper.BR.viewModel2, new SongListVM(this, Integer.valueOf(charaID)));
}
ViewCompat.setTransitionName(getBView(R.id.chara_icon), "chara_icon");
}
示例5: onBeforeViewShows
import android.support.v4.view.ViewCompat; //导入方法依赖的package包/类
@Override
public void onBeforeViewShows(View contentView) {
ViewCompat.setTransitionName(scrollView, "detail_element");
ViewCompat.setTransitionName(getActivity().findViewById(R.id.fab), "fab");
MainActivity.of(getActivity()).fab.setTranslationY(400);
TransitionHelper.excludeEnterTarget(getActivity(), R.id.toolbar_container, true);
TransitionHelper.excludeEnterTarget(getActivity(), R.id.full_screen, true);
}
示例6: dealListView
import android.support.v4.view.ViewCompat; //导入方法依赖的package包/类
private void dealListView() {
LayoutInflater layoutInflater = LayoutInflater.from(this);
for (int i = 0; i < 20; i++) {
View childView = layoutInflater.inflate(R.layout.detail_list_item, null);
listContainer.addView(childView);
ImageView headView = (ImageView) childView.findViewById(R.id.head);
if (i < headStrs.length) {
headView.setImageResource(imageIds[i % imageIds.length]);
ViewCompat.setTransitionName(headView, headStrs[i]);
}
}
}
示例7: onBindViewHolder
import android.support.v4.view.ViewCompat; //导入方法依赖的package包/类
@Override
public void onBindViewHolder(HomeMovieListAdapter.MovieWrapperViewHolder holder, int position) {
String posterPath = resultList.get(position).getPosterPath();
String imageUrl = Constants.TMDB_IMAGE_URL + "w185";
String posterUrl = imageUrl + posterPath;
if (!posterUrl.isEmpty()) {
Glide.with(holder.listItem.getContext())
.load(posterUrl)
.placeholder(R.drawable.movie_poster_placeholder)
.crossFade()
.into(holder.moviePoster);
}
ViewCompat.setTransitionName(holder.moviePoster, posterPath);
holder.title.setText(resultList.get(position).getTitle());
if (resultList.get(position).getVoteAverage() != 0.0) {
holder.movieRating.setText(String.format(Locale.US, "%.1f",
resultList.get(position).getVoteAverage()));
} else {
holder.movieRating.setText("-");
}
}
示例8: showEffect
import android.support.v4.view.ViewCompat; //导入方法依赖的package包/类
@Override
public void showEffect() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
ViewCompat.setTransitionName(mainImage, IMG_TRANSITION_TAG);
ActivityCompat.startPostponedEnterTransition(this);
}
}
示例9: onBindViewHolder
import android.support.v4.view.ViewCompat; //导入方法依赖的package包/类
@Override
public void onBindViewHolder(UserHolder holder, int position) {
UserModel user = users.get(position);
Bitmap photo = usersPhotos.get(user.getUserId());
holder.userName.setText(user.getFullName());
if (photo != null) {
holder.userPhoto.setImageBitmap(photo);
} else {
holder.userPhoto.setImageDrawable(context.getResources().getDrawable(R.drawable.user_icon));
}
ViewCompat.setTransitionName(holder.userPhoto, String.valueOf(position) + "_image");
ViewCompat.setTransitionName(holder.userName, String.valueOf(position) + "_fullName");
}
示例10: onCreateView
import android.support.v4.view.ViewCompat; //导入方法依赖的package包/类
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.main_task_pager,container,false);
if(task!=null){
//Assign views
MyTextView taskNameView = rootView.findViewById(R.id.main_task_name);
ImageView taskIconView = rootView.findViewById(R.id.main_task_icon);
MyTextView taskHintView = rootView.findViewById(R.id.main_task_hint);
CardView taskCardView = rootView.findViewById(R.id.pager_task_card);
//Populate vies with task info
taskNameView.setText(taskName);
taskHintView.setText(taskHint);
taskHintView.setTextColor(ContextCompat.getColor(getContext(),R.color.greenDark));
taskIconView.setImageResource(taskIconResID);
ViewCompat.setTransitionName(taskCardView,getString(R.string.active_task_image_transition));
taskCardView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
((MainFragment)getParentFragment()).openTaskDetail();
}
});
}
return rootView;
}
示例11: onCreate
import android.support.v4.view.ViewCompat; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setActionBarTitle(R.string.card_detail);
initActionBar(ACTIONBAR_TYPE_NULL);
Card card = JsonUtils.getBeanFromJson(umi.getIntentString("theCard"), Card.class);
setBinding(R.layout.activity_card_detail).setVariable(com.lazyeraser.imas.derehelper.BR.viewModel, new CardViewModel(this, card));
ViewCompat.setTransitionName(getBView(R.id.card_icon), "card_icon");
}
示例12: initViews
import android.support.v4.view.ViewCompat; //导入方法依赖的package包/类
@Override
protected void initViews(Bundle savedInstanceState) {
showSystemUI();
setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setShowHideAnimationEnabled(true);
mImageView = (ImageView) findViewById(R.id.picture);
ViewCompat.setTransitionName(mImageView, TRANSIT_PIC);
mImageView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
hideOrShowToolbar();
}
});
}
示例13: loadData
import android.support.v4.view.ViewCompat; //导入方法依赖的package包/类
@Override
protected void loadData() {
mImageUrl = getIntent().getStringExtra(EXTRA_IMAGE_URL);
mImageTitle = getIntent().getStringExtra(EXTRA_IMAGE_TITLE);
ViewCompat.setTransitionName(mImageView, TRANSIT_PIC);
Glide.with(this).load(mImageUrl).diskCacheStrategy(DiskCacheStrategy.ALL).priority(Priority.IMMEDIATE).crossFade(0)
.override(Target.SIZE_ORIGINAL, Target.SIZE_ORIGINAL).into(mImageView);
hideOrShowToolbar();
}
示例14: startWithTransition
import android.support.v4.view.ViewCompat; //导入方法依赖的package包/类
public static void startWithTransition(Activity activity, Intent intent, View sourceView) {
ViewCompat.setTransitionName(sourceView, TRANSITION_NAME);
ActivityOptionsCompat options = ActivityOptionsCompat.makeSceneTransitionAnimation(
activity, sourceView, TRANSITION_NAME);
activity.startActivity(intent, options.toBundle());
}
示例15: initializeComponents
import android.support.v4.view.ViewCompat; //导入方法依赖的package包/类
public void initializeComponents() {
mContext = PicImageDetailActivity.this;
ButterKnife.bind(this);
// Retrieve the correct Item instance, using the ID provided in the Intent
String imagePath = getIntent().getStringExtra(EXTRA_PARAM_ID);
ViewCompat.setTransitionName(imageDetail, VIEW_NAME_HEADER_IMAGE);
if (imagePath != null && imagePath.length() > 0) {
Log.d(TAG, "imagePath = " + imagePath);
Uri imageUri = Uri.fromFile(new File(imagePath));
ImageLoader.loadImage(mContext, imageDetail, imageUri, R.drawable.place_holder_landscape);
}
}