Java Code Examples for android.support.v4.view.ViewCompat#setTransitionName()
The following examples show how to use
android.support.v4.view.ViewCompat#setTransitionName() .
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 check out the related API usage on the sidebar.
Example 1
Source File: GenreAlbumsActivity.java From PainlessMusicPlayer with Apache License 2.0 | 6 votes |
@Override protected void onCreate(@Nullable final Bundle savedInstanceState) { super.onCreate(savedInstanceState); Dart.inject(this); ViewCompat.setTransitionName(findViewById(android.R.id.content), TRANSITION_NAME_ROOT); supportPostponeEnterTransition(); setTitle(genre); if (savedInstanceState == null) { getSupportFragmentManager().beginTransaction().add(android.R.id.content, GenreAlbumsFragment.instantiate(genreId)).commit(); } }
Example 2
Source File: GankMeiziAdapter.java From MoeQuest with Apache License 2.0 | 6 votes |
@Override public void onBindViewHolder(ClickableViewHolder holder, int position) { if (holder instanceof ItemViewHolder) { final ItemViewHolder itemViewHolder = (ItemViewHolder) holder; itemViewHolder.mTextView.setText(meizis.get(position).getDesc()); Glide.with(getContext()) .load(meizis.get(position).getUrl()) .centerCrop() .diskCacheStrategy(DiskCacheStrategy.ALL) .placeholder(R.drawable.placeholder_image) .into(itemViewHolder.ratioImageView) .getSize((width, height) -> { if (!itemViewHolder.item.isShown()) { itemViewHolder.item.setVisibility(View.VISIBLE); } }); itemViewHolder.ratioImageView.setTag(R.string.app_name, meizis.get(position).getUrl()); ViewCompat.setTransitionName(itemViewHolder.ratioImageView, meizis.get(position).getUrl()); } super.onBindViewHolder(holder, position); }
Example 3
Source File: DetailActivity.java From Dashboard with MIT License | 6 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mImageView = (ImageView) findViewById(R.id.image); progressBar = (ProgressBar) findViewById(R.id.loading); mAttacher = new PhotoViewAttacher(mImageView); ViewCompat.setTransitionName(mImageView, EXTRA_IMAGE); Picasso.with(this).load(getIntent().getStringExtra(EXTRA_IMAGE)).into(mImageView, new Callback.EmptyCallback() { @Override public void onSuccess() { progressBar.setVisibility(View.GONE); } @Override public void onError() { progressBar.setVisibility(View.GONE); } }); }
Example 4
Source File: SharedElementViewManager.java From native-navigation with MIT License | 6 votes |
@Override public void addView(ReactViewGroup parent, View child, int index) { String transitionName = (String) parent.getTag(R.id.react_shared_element_transition_name); String instanceId = (String) parent.getTag(R.id.react_shared_element_screen_instance_id); ReactInterface component = coordinator.componentFromId(instanceId); if (child instanceof ReactImageView) { ReactImageView iv = (ReactImageView) child; // TODO(lmr): do something to wait for image to load } ViewCompat.setTransitionName(child, transitionName); parent.addView(child, index); if (component != null) { component.notifySharedElementAddition(); } }
Example 5
Source File: PhotoImageActivity.java From v9porn with MIT License | 5 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_photo_image); ButterKnife.bind(this); goFullScreen(); imgUrl = getIntent().getStringExtra("imgurl"); GlideApp.with(this).load(imgUrl).into(img); ViewCompat.setTransitionName(img, "img"); init(); }
Example 6
Source File: VideoViewHolder.java From Anecdote with Apache License 2.0 | 5 votes |
@Override public void setData(int position, boolean isExpanded, String websiteName, Anecdote anecdote) { super.setData(position, isExpanded, websiteName, anecdote); if (mPlayerView != null && anecdote.media != null) { mPlayerView.setVideoUrl(anecdote.media); mPlayerView.setControllerDisplay(false); } ViewCompat.setTransitionName(mPlayerView, String.valueOf(position) + "_video"); }
Example 7
Source File: MovieDetailsActivity.java From AndroidSchool with Apache License 2.0 | 5 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); prepareWindowForAnimation(); setContentView(R.layout.activity_movie_details); ButterKnife.bind(this); setSupportActionBar(mToolbar); ViewCompat.setTransitionName(findViewById(R.id.app_bar), IMAGE); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); if (getSupportActionBar() != null) { getSupportActionBar().setDisplayHomeAsUpEnabled(true); } Movie movie = getIntent().getParcelableExtra(EXTRA_MOVIE); showMovie(movie); /** * TODO : task * * Load movie trailers and reviews and display them * * 1) See http://docs.themoviedb.apiary.io/#reference/movies/movieidtranslations/get?console=1 * http://docs.themoviedb.apiary.io/#reference/movies/movieidtranslations/get?console=1 * for API documentation * * 2) Load all the data using Agera library */ }
Example 8
Source File: MeizhiAdapter.java From GankMeizhi with Apache License 2.0 | 5 votes |
@Override public void onBindViewHolder(ViewHolder holder, int position) { ImageWrapper image = get(position); holder.imageView.setOriginalSize(image.width, image.height); Glide.with(context) .load(image.url) .diskCacheStrategy(DiskCacheStrategy.ALL) .into(holder.imageView); ViewCompat.setTransitionName(holder.imageView, image.url); }
Example 9
Source File: NewsMainFragment.java From ForPDA with GNU General Public License v3.0 | 5 votes |
@Override public void onItemClick(View view, NewsItem item, int position) { ViewCompat.setTransitionName(view, String.valueOf(position) + "_image"); Bundle args = new Bundle(); args.putInt(NewsDetailsFragment.ARG_NEWS_ID, item.getId()); args.putString(NewsDetailsFragment.ARG_NEWS_TITLE, item.getTitle()); args.putString(NewsDetailsFragment.ARG_NEWS_AUTHOR_NICK, item.getAuthor()); args.putString(NewsDetailsFragment.ARG_NEWS_DATE, item.getDate()); args.putString(NewsDetailsFragment.ARG_NEWS_IMAGE, item.getImgUrl()); args.putInt(NewsDetailsFragment.ARG_NEWS_COMMENTS_COUNT, item.getCommentsCount()); args.putBoolean(NewsDetailsFragment.OTHER_CASE, true); TabManager.get().add(NewsDetailsFragment.class, args); }
Example 10
Source File: MeiZhiActivity.java From gank with GNU General Public License v3.0 | 5 votes |
private void initMeizhiView() { setTitle(DateUtil.toDateTimeStr(meizi.publishedAt)); ivMeizhi.setImageDrawable(ShareElement.shareDrawable); ViewCompat.setTransitionName(ivMeizhi, GankConfig.TRANSLATE_GIRL_VIEW); attacher = new PhotoViewAttacher(ivMeizhi); Glide.with(this).load(meizi.url).asBitmap().into(new SimpleTarget<Bitmap>() { @Override public void onResourceReady(Bitmap resource, GlideAnimation<? super Bitmap> glideAnimation) { ivMeizhi.setImageBitmap(resource); attacher.update(); girl = resource; } @Override public void onLoadFailed(Exception e, Drawable errorDrawable) { ivMeizhi.setImageDrawable(errorDrawable); } }); attacher.setOnPhotoTapListener(new PhotoViewAttacher.OnPhotoTapListener() { @Override public void onPhotoTap(View view, float x, float y) { hideOrShowToolBar(); } @Override public void onOutsidePhotoTap() { hideOrShowToolBar(); } }); }
Example 11
Source File: GankActivity.java From Gank.io with GNU General Public License v3.0 | 5 votes |
private void initGankView() { list = new ArrayList<>(); adapter = new GankAdapter(list, this); rvGank.setLayoutManager(new LinearLayoutManager(this)); rvGank.setItemAnimator(new DefaultItemAnimator()); rvGank.setAdapter(adapter); setTitle(DateUtil.toDateString(meizi.publishedAt)); ivHead.setImageDrawable(ShareElement.shareDrawable); ViewCompat.setTransitionName(ivHead, PanConfig.TRANSLATE_GIRL_VIEW); fab.setClickable(false); }
Example 12
Source File: DetailActivity.java From RxAndroidBootstrap with Apache License 2.0 | 5 votes |
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_detail); mActionBarSize = getActionBarSize(); mFlexibleSpaceImageHeight = getResources().getDimensionPixelSize(R.dimen.flexible_space_image_height); image = (ImageView) findViewById(R.id.image); ViewCompat.setTransitionName(image, EXTRA_IMAGE); collapsingToolbar.setTitle(getIntent().getStringExtra(EXTRA_TITLE)); bitmapImageViewTarget = new Target() { @Override public void onBitmapLoaded(Bitmap bitmap, Picasso.LoadedFrom from) { Palette.generateAsync(bitmap, DetailActivity.this); image.setImageBitmap(bitmap); } @Override public void onBitmapFailed(Drawable errorDrawable) { //place your code here } @Override public void onPrepareLoad(Drawable placeHolderDrawable) { //place your code here } }; Picasso.with(this).load(getIntent().getStringExtra(EXTRA_IMAGE)).into(bitmapImageViewTarget); }
Example 13
Source File: AppOperateActivity.java From AppPlus with MIT License | 5 votes |
private void setupView() { mImageView = (ImageView) findViewById(R.id.iv_icon); mTvAppName = (TextView) findViewById(android.R.id.text1); mTvAppVersion = (TextView) findViewById(R.id.tv_version); mTvAppVersionCode = (TextView) findViewById(R.id.tv_version_code); mTvAppPackageName = (TextView) findViewById(android.R.id.text2); mTvOpen = (TextView) findViewById(R.id.tv_more); mTvExport = (TextView) findViewById(R.id.tv_export); mTvDetail = (TextView) findViewById(R.id.tv_detail); mTvShare = (TextView) findViewById(R.id.tv_share); ViewCompat.setTransitionName(mImageView, VIEW_NAME_HEADER_IMAGE); }
Example 14
Source File: Anim2Act.java From ZoomImageView with Apache License 2.0 | 5 votes |
@Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_anim2); ZoomImageView ziv = (ZoomImageView) findViewById(R.id.mZoomImageView); Glide.with(this) .load(R.mipmap.kali_bg) .into(ziv); ViewCompat.setTransitionName(ziv, "image"); }
Example 15
Source File: UserFragment.java From droidddle with Apache License 2.0 | 5 votes |
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_user_layout, container, false); ButterKnife.inject(this, view); ViewCompat.setTransitionName(mUserImageView, Scene.USER_IMAGE); // ViewCompat.setTransitionName(mUserNameView, Scene.USER_NAME); if (mToolbar != null) { mToolbar.inflateMenu(R.menu.menu_user); mToolbar.setTitle(mUser.name); mToolbar.setNavigationIcon(R.drawable.abc_ic_ab_back_mtrl_am_alpha); mToolbar.setOnMenuItemClickListener(this); mToolbar.setNavigationOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { getActivity().finish(); } }); mFollowMenu = mToolbar.getMenu().findItem(R.id.action_follow); mFollowMenu.setVisible(!isSelf()); if (!isSelf()) { checkFollowingStatus(); } } setupData(); return view; }
Example 16
Source File: DetailActivity.java From MaterializeYourApp with Apache License 2.0 | 5 votes |
@SuppressWarnings("ConstantConditions") @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); initActivityTransitions(); setContentView(R.layout.activity_detail); ViewCompat.setTransitionName(findViewById(R.id.app_bar_layout), EXTRA_IMAGE); supportPostponeEnterTransition(); setSupportActionBar((Toolbar) findViewById(R.id.toolbar)); getSupportActionBar().setDisplayHomeAsUpEnabled(true); String itemTitle = getIntent().getStringExtra(EXTRA_TITLE); collapsingToolbarLayout = (CollapsingToolbarLayout) findViewById(R.id.collapsing_toolbar); collapsingToolbarLayout.setTitle(itemTitle); collapsingToolbarLayout.setExpandedTitleColor(getResources().getColor(android.R.color.transparent)); final ImageView image = (ImageView) findViewById(R.id.image); Picasso.with(this).load(getIntent().getStringExtra(EXTRA_IMAGE)).into(image, new Callback() { @Override public void onSuccess() { Bitmap bitmap = ((BitmapDrawable) image.getDrawable()).getBitmap(); Palette.from(bitmap).generate(new Palette.PaletteAsyncListener() { public void onGenerated(Palette palette) { applyPalette(palette); } }); } @Override public void onError() { } }); TextView title = (TextView) findViewById(R.id.title); title.setText(itemTitle); }
Example 17
Source File: AppListAdapter.java From android-permission-checker-app with Apache License 2.0 | 4 votes |
@Override public void onBindViewHolder(AppListViewHolder holder, int position) { final AppDetails appDetails = appListPresenter.getItemAt(position); holder.appIcon.setImageDrawable(appDetails.icon); holder.appName.setText(appDetails.name); ViewCompat.setTransitionName(holder.appIcon, String.valueOf(position) + "_icon"); }
Example 18
Source File: BookDetailsActivity.java From NHentai-android with GNU General Public License v3.0 | 4 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_book_details); Intent intent = getIntent(); book = new Gson().fromJson(intent.getStringExtra(EXTRA_BOOK_DATA), Book.class); Toolbar toolbar = $(R.id.toolbar); setSupportActionBar(toolbar); getSupportActionBar().setDisplayHomeAsUpEnabled(true); collapsingToolbar = $(R.id.collapsing_toolbar); collapsingToolbar.setTitle(book.title); mImageView = $(R.id.app_bar_background); ViewCompat.setTransitionName(mImageView, TRANSITION_NAME_IMAGE); mFAB = $(R.id.fab); mTitleText = $(R.id.tv_title); mTagsLayout = $(R.id.book_tags_layout); mContentView = $(R.id.book_content); mProgressWheel = $(R.id.wheel_progress); FileCacheManager cm = FileCacheManager.getInstance(getApplicationContext()); if (cm.cacheExistsUrl(Constants.CACHE_THUMB, book.previewImageUrl)) { Picasso.with(getApplicationContext()) .load(cm.getBitmapUrlFile(Constants.CACHE_THUMB, book.previewImageUrl)) .fit() .centerCrop() .into(mImageView, new Callback() { @Override public void onSuccess() { MaterialImageLoading.animate(mImageView).setDuration(1500).start(); } @Override public void onError() { } }); } else { int color = ColorGenerator.MATERIAL.getColor(book.title); TextDrawable drawable = TextDrawable.builder().buildRect(book.title.substring(0, 1), color); mImageView.setImageDrawable(drawable); } if (cm.cacheExistsUrl(Constants.CACHE_COVER, book.bigCoverImageUrl)) { Picasso.with(getApplicationContext()) .load(cm.getBitmapUrlFile(Constants.CACHE_COVER, book.bigCoverImageUrl)) .fit() .centerCrop() .into(mImageView, new Callback() { @Override public void onSuccess() { MaterialImageLoading.animate(mImageView).setDuration(1500).start(); } @Override public void onError() { } }); } else { new CoverTask().execute(book); } startBookGet(); }
Example 19
Source File: DetailActivity.java From MVPAndroidBootstrap with Apache License 2.0 | 4 votes |
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_detail); mActionBarSize = getActionBarSize(); if (!TOOLBAR_IS_STICKY) { toolbar.setBackgroundColor(Color.TRANSPARENT); } image = (ImageView) findViewById(R.id.image); ViewCompat.setTransitionName(image, EXTRA_IMAGE); titleTextView.setText(getIntent().getStringExtra(EXTRA_TITLE)); bitmapImageViewTarget = new Target() { @Override public void onBitmapLoaded(Bitmap bitmap, Picasso.LoadedFrom from) { Palette.generateAsync(bitmap, DetailActivity.this); image.setImageBitmap(bitmap); } @Override public void onBitmapFailed(Drawable errorDrawable) { } @Override public void onPrepareLoad(Drawable placeHolderDrawable) { } }; Picasso.with(this).load(getIntent().getStringExtra(EXTRA_IMAGE)).into(bitmapImageViewTarget); setTitle(null); mScollView.setScrollViewCallbacks(this); ScrollUtils.addOnGlobalLayoutListener(mScollView, new Runnable() { @Override public void run() { mScollView.scrollTo(0, mFlexibleSpaceImageHeight - mActionBarSize); mScollView.scrollTo(0, 1); } }); }
Example 20
Source File: ShotFragment.java From droidddle with Apache License 2.0 | 4 votes |
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment View view = inflater.inflate(R.layout.fragment_shot_layout, container, false); ButterKnife.inject(this, view); if (mCommentEditView != null) { setupCommentEditView(); } if (UiUtils.hasLollipop() && mFab != null && mAnimation) { mFab.setAlpha(0f); getActivity().getWindow().getSharedElementEnterTransition() .addListener(new AnimUtils.TransitionListenerAdapter() { @Override public void onTransitionEnd(Transition transition) { animateFabIn(); } }); //由于没有单独设置 退出的 transition 所以和上面的一样 // getActivity().getWindow().getSharedElementReturnTransition() // .addListener(new AnimUtils.TransitionListenerAdapter(){ // @Override // public void onTransitionStart(Transition transition) { // animateFabOut(); // } // // }); } ViewCompat.setTransitionName(mShotImageView, Scene.SHOT_IMAGE); FrescoUtils.setShotHierarchy(getActivity(), mShotImageView); // ViewCompat.setTransitionName(mShotTitleView, Scene.SHOT_TITLE); // ViewCompat.setTransitionName(mShotDescriptionView, Scene.SHOT_DESCRIPTION); if (mToolbar != null) { mToolbar.inflateMenu(R.menu.menu_shot); mToolbar.setTitle(mShot.title); mToolbar.setNavigationIcon(R.drawable.abc_ic_ab_back_mtrl_am_alpha); mToolbar.setOnMenuItemClickListener(this); mToolbar.setNavigationOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { getActivity().finish(); } }); boolean isPro = mShot.user.pro; mToolbar.getMenu().findItem(R.id.action_add_attachment).setVisible(mIsSelf && isPro); } updateData(); // mObservableScrollView.setScrollViewCallbacks(this); boolean showAds = Pref.isShowHomeAds(getActivity()); if (showAds && !BuildConfig.IS_PLAY) { Ads.setupAds(getActivity(), mShotContentLayout); } return view; }