android.widget.ImageView.getTransitionName()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(12.3k)|赞(0)|评价(0)|浏览(324)

本文整理了Java中android.widget.ImageView.getTransitionName()方法的一些代码示例,展示了ImageView.getTransitionName()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ImageView.getTransitionName()方法的具体详情如下:
包路径:android.widget.ImageView
类名称:ImageView
方法名:getTransitionName

ImageView.getTransitionName介绍

暂无

代码示例

代码示例来源:origin: steelkiwi/cropiwa

@Override
public void onClick(View v) {
  if (isImage()) {
    Intent viewImageIntent = ViewImageActivity.callingIntent(v.getContext(), item);
    ActivityOptions options = ActivityOptions.makeSceneTransitionAnimation(
        (Activity) v.getContext(), image,
        image.getTransitionName());
    v.getContext().startActivity(viewImageIntent, options.toBundle());
  } else if (listener != null) {
    listener.onNewCropButtonClicked();
  }
}

代码示例来源:origin: materialos/android-icon-pack

@TargetApi(Build.VERSION_CODES.LOLLIPOP)
  @Override
  public void onMapSharedElements(List<String> names, Map<String, View> sharedElements) {
    if (isReturning) {
      ViewerPageFragment active = (ViewerPageFragment) getFragmentManager().findFragmentByTag("page:" + mCurrentPosition);
      ImageView sharedElement = active.getSharedElement();
      names.clear();
      names.add(sharedElement.getTransitionName());
      sharedElements.clear();
      sharedElements.put(sharedElement.getTransitionName(), sharedElement);
    }
  }
});

代码示例来源:origin: alexjlockwood/adp-activity-transitions

@Override
  public void onMapSharedElements(List<String> names, Map<String, View> sharedElements) {
    if (mIsReturning) {
      ImageView sharedElement = mCurrentDetailsFragment.getAlbumImage();
      if (sharedElement == null) {
        // If shared element is null, then it has been scrolled off screen and
        // no longer visible. In this case we cancel the shared element transition by
        // removing the shared element from the shared elements map.
        names.clear();
        sharedElements.clear();
      } else if (mStartingPosition != mCurrentPosition) {
        // If the user has swiped to a different ViewPager page, then we need to
        // remove the old shared element and replace it with the new shared element
        // that should be transitioned instead.
        names.clear();
        names.add(sharedElement.getTransitionName());
        sharedElements.clear();
        sharedElements.put(sharedElement.getTransitionName(), sharedElement);
      }
    }
  }
};

代码示例来源:origin: Jaouan/Article-Details-Transition-Example

@Override
  public void onAnimationEnd(Animator animation) {
    // - Start details activity.
    final ActivityOptions options =
        ActivityOptions.makeSceneTransitionAnimation(ListActivity.this, articleViewHolder.ivCoveringImage, articleViewHolder.ivCoveringImage.getTransitionName());
    final Intent intent = new Intent(ListActivity.this, DetailsActivity.class);
    intent.putExtra(DetailsActivity.EXTRA_ARTICLE, article);
    startActivity(intent, options.toBundle());
  }
});

代码示例来源:origin: alexjlockwood/adp-activity-transitions

@Override
  public void onClick(View v) {
    // TODO: is there a way to prevent user from double clicking and starting activity twice?
    Intent intent = new Intent(MainActivity.this, DetailsActivity.class);
    intent.putExtra(EXTRA_STARTING_ALBUM_POSITION, mAlbumPosition);
    if (!mIsDetailsActivityStarted) {
      mIsDetailsActivityStarted = true;
      startActivity(intent, ActivityOptions.makeSceneTransitionAnimation(MainActivity.this,
          mAlbumImage, mAlbumImage.getTransitionName()).toBundle());
    }
  }
}

代码示例来源:origin: vipulyaara/betterHotels

@Override
  public void onClick(View view) {
    Pair<View, String> p1 = Pair.create((View) ivImage2, ivImage2.getTransitionName());
    ActivityOptionsCompat options = ActivityOptionsCompat.
        makeSceneTransitionAnimation(((Activity) PublicationActivityOld.this), p1);
    Bundle bundle = options.toBundle();
    Intent i = new Intent(PublicationActivityOld.this, BlogDetailActivity.class);
    i.putExtra("image", R.drawable.img_food_3);
    i.putExtra("text", "12 Delicious places in Delhi for a date");
    startActivity(i, bundle);
  }
});

代码示例来源:origin: vipulyaara/betterHotels

@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
  @Override
  public void onClick(View view) {
    Bundle bundle = null;
    Pair<View, String> p1 = Pair.create((View) ivImage3, ivImage3.getTransitionName());
    ActivityOptionsCompat options = ActivityOptionsCompat.
        makeSceneTransitionAnimation(HotelSrpActivity.this, p1);
    bundle = options.toBundle();
    Intent i = new Intent(HotelSrpActivity.this, GalleryActivity.class);
    i.putExtra("image", R.drawable.img_city_10);
    startActivity(i, bundle);
  }
});

代码示例来源:origin: vipulyaara/betterHotels

@Override
  public void onClick(View view) {
    Pair<View, String> p1 = Pair.create((View) holder.ivHeroImage, holder.ivHeroImage.getTransitionName());
    ActivityOptionsCompat options = ActivityOptionsCompat.
        makeSceneTransitionAnimation(((Activity) context), p1);
    Bundle bundle = options.toBundle();
    Intent i = new Intent(context, BlogDetailActivity.class);
    i.putExtra("image", blogPost.getHeroImageResource());
    i.putExtra("text", blogPost.getPostTitle());
    context.startActivity(i, bundle);
  }
});

代码示例来源:origin: JustinRoom/JSCKit

private void toCircularReveal() {
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
    startActivity(new Intent(this, CircularRevealActivity.class).putExtra("transition", TransitionEnum.SLIDE.getLabel()),
        ActivityOptions.makeSceneTransitionAnimation(this, new Pair<View, String>(imageView, imageView.getTransitionName())).toBundle());
  } else {
    startActivity(new Intent(this, CircularRevealActivity.class));
  }
}

代码示例来源:origin: vipulyaara/betterHotels

@Override
  public void onClick(View view) {
    Pair<View, String> p1 = Pair.create((View) ivHero1, ivHero1.getTransitionName());
    ActivityOptionsCompat options = ActivityOptionsCompat.
        makeSceneTransitionAnimation((TripListActivity.this), p1);
    Bundle bundle = options.toBundle();
    Intent i = new Intent(TripListActivity.this, TripDetailActivity.class);
    startActivity(i, bundle);
  }
});

代码示例来源:origin: xbmc/Kore

@TargetApi(21)
protected void showFragment(AbstractFragment fragment, ImageView sharedImageView, AbstractFragment.DataHolder dataHolder) {
  FragmentTransaction fragTrans = getSupportFragmentManager().beginTransaction();
  // Set up transitions
  if (Utils.isLollipopOrLater()) {
    dataHolder.setPosterTransitionName(sharedImageView.getTransitionName());
    sharedElementTransition.setupEnterTransition(this, fragTrans, fragment, sharedImageView);
  } else {
    fragTrans.setCustomAnimations(R.anim.fragment_details_enter, 0,
                   R.anim.fragment_list_popenter, 0);
  }
  fragTrans.replace(R.id.fragment_container, fragment, getActionBarTitle())
       .addToBackStack(null)
       .commit();
}

代码示例来源:origin: vipulyaara/betterHotels

@Override
      public void onClick(View view) {
        Pair<View, String> p1 = Pair.create((View) ivImage, ivImage.getTransitionName());
        ActivityOptionsCompat options = ActivityOptionsCompat.
            makeSceneTransitionAnimation(((Activity) getContext()), p1);
        Bundle bundle = options.toBundle();
        Intent i = new Intent(getContext(), BlogDetailActivity.class);
        i.putExtra("image", drawables[position]);
//                i.putExtra("title", titlesArray[positionInfo.getPosition()]);
        getContext().startActivity(i, bundle);
      }
    });

代码示例来源:origin: vipulyaara/betterHotels

@Override
  public void onClick(View view) {
    Pair<View, String> p1 = Pair.create((View) ivHero1, ivHero1.getTransitionName());
    ActivityOptionsCompat options = ActivityOptionsCompat.
        makeSceneTransitionAnimation((TripsListActivity.this), p1);
    Bundle bundle = options.toBundle();
    Intent i = new Intent(TripsListActivity.this, TripDetailActivity.class);
    startActivity(i, bundle);
  }
});

代码示例来源:origin: vipulyaara/betterHotels

@Override
  public void onClick(View view) {
    Pair<View, String> p1 = Pair.create((View) ivImage, ivImage.getTransitionName());
    Pair<View, String> p2 = Pair.create((View) viewBg, viewBg.getTransitionName());
    ActivityOptionsCompat options = ActivityOptionsCompat.
        makeSceneTransitionAnimation(((Activity) PublicationActivityOld.this), p1, p2);
    Bundle bundle = options.toBundle();
    Intent i = new Intent(PublicationActivityOld.this, BlogDetailActivity.class);
    i.putExtra("image", R.drawable.img_city_42);
    i.putExtra("text", "10 Reasons to book your tickets to Kashmir");
    startActivity(i, bundle);
  }
});

代码示例来源:origin: luhaoaimama1/LollipopTransition

@TargetApi(Build.VERSION_CODES.LOLLIPOP)
  @Override
  public void onMapSharedElements(List<String> names, Map<String, View> sharedElements) {
    super.onMapSharedElements(names, sharedElements);
    if (mIsReturning) {
      ImageView sharedElement = ViewPagerHelper.getPositionFrament(SharePicAcitivity.this,
          mCurrentFragment, vpHelper.getCurrentPostion()).getAlbumImage();
      if (sharedElement != null) {
        sharedElement.setTransitionName(FiveShareNormalAcitivty.PIC);
        sharedElements.put(sharedElement.getTransitionName(), sharedElement);
      }
    } else {
      ImageView sharedElement = mCurrentFragment.getAlbumImage();
      if (sharedElement != null) {
        sharedElement.setTransitionName(FiveShareNormalAcitivty.PIC);
        sharedElements.put(sharedElement.getTransitionName(), sharedElement);
      }
    }
  }
};

代码示例来源:origin: vipulyaara/betterHotels

@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
        @Override
        public void onClick(View view) {
          Bundle bundle = null;
          if (positionInfo.getPosition() == 5) {
            Pair<View, String> p1 = Pair.create((View) ivLocation, ivLocation.getTransitionName());
            ActivityOptionsCompat options = ActivityOptionsCompat.
                makeSceneTransitionAnimation(((Activity) getContext()), p1);
            bundle = options.toBundle();
            Intent i = new Intent(getContext(), NoHotelsActivity.class);
            i.putExtra("image", drawables4[positionInfo.getPosition()]);
            i.putExtra("title", titlesArray[positionInfo.getPosition()]);
            getContext().startActivity(i, bundle);
          } else if (positionInfo.getPosition() == 0) {
            Utils.startActivityWithClipReveal(getContext(), SearchCityActivity.class, ivLocation);
          } else {
            Pair<View, String> p1 = Pair.create((View) ivLocation, ivLocation.getTransitionName());
            ActivityOptionsCompat options = ActivityOptionsCompat.
                makeSceneTransitionAnimation(((Activity) getContext()), p1);
            bundle = options.toBundle();
            Intent i = new Intent(getContext(), HotelSrpActivity.class);
            i.putExtra("image", drawables4[positionInfo.getPosition()]);
            i.putExtra("title", titlesArray[positionInfo.getPosition()]);
            getContext().startActivity(i, bundle);
          }
        }
}

代码示例来源:origin: googlesamples/android-unsplash

private ActivityOptions getActivityOptions(PhotoItemBinding binding) {
    Pair authorPair = Pair.create(binding.author, binding.author.getTransitionName());
    Pair photoPair = Pair.create(binding.photo, binding.photo.getTransitionName());
    View decorView = getWindow().getDecorView();
    View statusBackground = decorView.findViewById(android.R.id.statusBarBackground);
    View navBackground = decorView.findViewById(android.R.id.navigationBarBackground);
    Pair statusPair = Pair.create(statusBackground,
        statusBackground.getTransitionName());

    final ActivityOptions options;
    if (navBackground == null) {
      options = ActivityOptions.makeSceneTransitionAnimation(this,
          authorPair, photoPair, statusPair);
    } else {
      Pair navPair = Pair.create(navBackground, navBackground.getTransitionName());
      options = ActivityOptions.makeSceneTransitionAnimation(this,
          authorPair, photoPair, statusPair, navPair);
    }
    return options;
  }
}

代码示例来源:origin: xbmc/Kore

/**
 * Callback from list fragment when a addon is selected.
 * Switch fragment in portrait
 * @param vh
 */
@TargetApi(21)
public void onAddonSelected(AddonListFragment.ViewHolder vh) {
  Bundle bundle = vh.dataHolder.getBundle();
  selectedAddonId = bundle.getString(AddonInfoFragment.BUNDLE_KEY_ADDONID);
  selectedAddonTitle = vh.dataHolder.getTitle();
  // Replace list fragment
  final AbstractFragment addonDetailsFragment =
      bundle.getBoolean(AddonInfoFragment.BUNDLE_KEY_BROWSABLE)
    ? new AddonDetailsFragment()
    : new AddonInfoFragment()
    ;
  addonDetailsFragment.setDataHolder(vh.dataHolder);
  vh.dataHolder.setSquarePoster(true);
  if(Utils.isLollipopOrLater()) {
    vh.dataHolder.setPosterTransitionName(vh.artView.getTransitionName());
  }
  showFragment(addonDetailsFragment, vh.artView, vh.dataHolder);
  updateActionBar(getActionBarTitle(), true);
}

代码示例来源:origin: google/android-transition-examples

/**
  * Handles a view click by setting the current position to the given {@code position} and
  * starting a {@link  ImagePagerFragment} which displays the image at the position.
  *
  * @param view the clicked {@link ImageView} (the shared element view will be re-mapped at the
  * GridFragment's SharedElementCallback)
  * @param position the selected view position
  */
 @Override
 public void onItemClicked(View view, int position) {
  // Update the position.
  MainActivity.currentPosition = position;
  // Exclude the clicked card from the exit transition (e.g. the card will disappear immediately
  // instead of fading out with the rest to prevent an overlapping animation of fade and move).
  ((TransitionSet) fragment.getExitTransition()).excludeTarget(view, true);
  ImageView transitioningView = view.findViewById(R.id.card_image);
  fragment.getFragmentManager()
    .beginTransaction()
    .setReorderingAllowed(true) // Optimize for shared element transition
    .addSharedElement(transitioningView, transitioningView.getTransitionName())
    .replace(R.id.fragment_container, new ImagePagerFragment(), ImagePagerFragment.class
      .getSimpleName())
    .addToBackStack(null)
    .commit();
 }
}

相关文章

ImageView类方法