本文整理汇总了Java中android.transition.Slide.addTarget方法的典型用法代码示例。如果您正苦于以下问题:Java Slide.addTarget方法的具体用法?Java Slide.addTarget怎么用?Java Slide.addTarget使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.transition.Slide
的用法示例。
在下文中一共展示了Slide.addTarget方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCreate
import android.transition.Slide; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_viewer);
ButterKnife.bind(this);
Slide slide = new Slide(Gravity.LEFT);
slide.addTarget(R.id.tv_text);
getWindow().setEnterTransition(slide);
// Explode explode = new Explode();
// explode.addTarget(R.id.tv_text);
// getWindow().setEnterTransition(explode);
ImageView imageView = (ImageView) findViewById(R.id.image);
imageView.setImageResource(getIntent().getIntExtra("resId", R.mipmap.pic_1));
// ViewCompat.setTransitionName(imageView, "image");
}
示例2: onStart
import android.transition.Slide; //导入方法依赖的package包/类
@Override
protected void onStart() {
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP){
Slide slide = new Slide(Gravity.BOTTOM);
if(isFirstLaunch) {
fab.hide();
isFirstLaunch = false;
}
slide.addTarget(R.id.description_card);
slide.addTarget(R.id.venue_time_card);
slide.addTarget(R.id.registration_card);
slide.addTarget(R.id.prizes_card);
slide.addTarget(R.id.organizers_card);
slide.setInterpolator(new LinearOutSlowInInterpolator());
getWindow().setEnterTransition(slide);
getWindow().setExitTransition(slide);
getWindow().setReenterTransition(slide);
setupEnterAnimation();
}
super.onStart();
}
示例3: setupSlideTransition
import android.transition.Slide; //导入方法依赖的package包/类
private void setupSlideTransition() {
Slide slideEnter = new Slide();
slideEnter.addTarget(R.id.text_card);
slideEnter.setDuration(1000);
slideEnter.setStartDelay(500);
slideEnter.setSlideEdge(Gravity.RIGHT);
slideEnter.excludeTarget(android.R.id.navigationBarBackground, true);
slideEnter.excludeTarget(android.R.id.statusBarBackground, true);
getWindow().setEnterTransition(slideEnter);
// Tips: Cann't set same Transition object to more than one Transition callbacks.
// getWindow().setReenterTransition(slideEnter);
Slide slideOut = new Slide();
slideOut.addTarget(R.id.text_card);
slideOut.setDuration(500);
slideOut.setSlideEdge(Gravity.RIGHT);
slideOut.excludeTarget(android.R.id.navigationBarBackground, true);
slideOut.excludeTarget(android.R.id.statusBarBackground, true);
getWindow().setExitTransition(slideOut);
}
示例4: onCheckedChanged
import android.transition.Slide; //导入方法依赖的package包/类
@Override public void onCheckedChanged(final RadioGroup group, int checkedId) {
switch (checkedId) {
case R.id.select_scene_1: {
// You can start an automatic transition with TransitionManager.go().
TransitionManager.go(mScene1);
break;
}
case R.id.select_scene_2: {
TransitionSet set = new TransitionSet();
Slide slide = new Slide(Gravity.LEFT);
slide.addTarget(R.id.transition_title);
set.addTransition(slide);
set.addTransition(new ChangeBounds());
set.setOrdering(TransitionSet.ORDERING_TOGETHER);
set.setDuration(350);
TransitionManager.go(mScene2, set);
break;
}
case R.id.select_scene_3: {
// You can also start a transition with a custom TransitionManager.
mTransitionManagerForScene3.transitionTo(mScene3);
break;
}
}
}
示例5: onGoClicked
import android.transition.Slide; //导入方法依赖的package包/类
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
@OnClick(R.id.next)
protected void onGoClicked(View view) {
AccelerateInterpolator interpolator = new AccelerateInterpolator(1.5f);
Slide right = new Slide(Gravity.END);
right.setInterpolator(interpolator);
right.addTarget(R.id.text);
Slide left = new Slide(Gravity.START);
left.setInterpolator(interpolator);
left.addTarget(R.id.icon);
TransitionSet set = new TransitionSet();
set.setOrdering(TransitionSet.ORDERING_TOGETHER);
set.addTransition(right).addTransition(left);
setExitTransition(set);
AppListFragment fragment = new AppListFragment();
Bundle args = new Bundle();
int cX = (int) (view.getX() + view.getWidth() / 2);
int cY = (int) (view.getY() + view.getHeight() / 2);
args.putInt("cX", cX);
args.putInt("cY", cY);
fragment.setArguments(args);
fragment.setEnterTransition(new Fade());
getActivity().getFragmentManager().beginTransaction()
.replace(R.id.root, fragment)
.addToBackStack(null)
.commit();
}
示例6: onCreate
import android.transition.Slide; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_detail);
ButterKnife.bind(this);
Picasso.with(this)
.load(getIntent().getData())
.placeholder(R.color.placeholder)
.into(imageView);
author.setText("—" + getIntent().getStringExtra(EXTRA_AUTHOR));
toolbar.setNavigationOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
finishAfterTransition();
}
});
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
Slide slide = new Slide(Gravity.BOTTOM);
slide.addTarget(R.id.description);
slide.setInterpolator(AnimationUtils.loadInterpolator(this, android.R.interpolator.linear_out_slow_in));
slide.setDuration(slideDuration);
getWindow().setEnterTransition(slide);
}
}
示例7: getSlideExplosionTransition
import android.transition.Slide; //导入方法依赖的package包/类
/**
* explode animation moving view to specific sides using 'Slide Transition'
*
* @return returns transition (null if API level 14 is less than LOLLIPOP)
*/
public static Transition getSlideExplosionTransition(int duration,
View topViewContainer,
View bottomViewContainer,
View leftViewContainer,
View rightViewContainer)
{
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)
{
TransitionSet set = new TransitionSet();
Slide slideTop = new Slide(android.view.Gravity.TOP);
slideTop.addTarget(topViewContainer);
set.addTransition(slideTop);
Slide slideBottom = new Slide(android.view.Gravity.BOTTOM);
slideBottom.addTarget(bottomViewContainer);
set.addTransition(slideBottom);
Slide slideLeft = new Slide(android.view.Gravity.LEFT);
slideLeft.addTarget(leftViewContainer);
set.addTransition(slideLeft);
Slide slideRight = new Slide(android.view.Gravity.RIGHT);
slideRight.addTarget(rightViewContainer);
set.addTransition(slideRight);
set.setDuration(duration);
return set;
}
return null;
}
示例8: initTransitions
import android.transition.Slide; //导入方法依赖的package包/类
private void initTransitions() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
Slide slideInBottom = new Slide();
slideInBottom.addTarget(R.id.text_image_fragment_camera_info);
slideInBottom.addTarget(R.id.text_image_fragment_lens_info);
slideInBottom.setStartDelay(300);
getActivity().getWindow().setEnterTransition(slideInBottom);
Slide slide = new Slide();
slide.addTarget(R.id.text_image_fragment_camera_info);
slide.addTarget(R.id.text_image_fragment_lens_info);
}
}
示例9: initTransitions
import android.transition.Slide; //导入方法依赖的package包/类
private void initTransitions() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
Slide slideInBottom = new Slide();
slideInBottom.addTarget(R.id.text_image_camera_info);
slideInBottom.addTarget(R.id.text_image_lens_info);
slideInBottom.setStartDelay(300);
getWindow().setEnterTransition(slideInBottom);
Slide slide = new Slide();
slide.addTarget(R.id.text_image_camera_info);
slide.addTarget(R.id.text_image_lens_info);
getWindow().setReturnTransition(slide);
postponeEnterTransition();
}
}
示例10: initViews
import android.transition.Slide; //导入方法依赖的package包/类
private void initViews() {
personInSpace = (PersonInSpace) getIntent().getSerializableExtra(PERSON_IN_SPACE_DATA);
// Toolbar
setSupportActionBar(toolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
appBarLayout.addOnOffsetChangedListener(new AppBarOnOffsetChangedListener());
// Data
Bitmap bitmap = getIntent().getParcelableExtra(PERSON_IN_SPACE_IMAGE);
photoImageView.setImageBitmap(bitmap);
nameTextView.setText(personInSpace.name());
locationTextView.setText(personInSpace.location());
// Load photo using Picasso, and set text container background using Palette.
Picasso.with(this)
.load(personInSpace.bioPhotoImageUrl())
.noPlaceholder()
.into(photoImageView,
PicassoPalette.with(personInSpace.bioPhotoImageUrl(), photoImageView)
.intoCallBack(new PicassoPalette.CallBack() {
@Override
public void onPaletteLoaded(Palette palette) {
int darkVibrantColor = palette.getDarkVibrantColor(
getResources().getColor(R.color.colorPrimaryDark));
getWindow().setStatusBarColor(darkVibrantColor);
}
}));
// Set transition animations
TransitionSet enterTransitionSet = new TransitionSet();
Fade fade = new Fade();
Slide slideBottom = new Slide(Gravity.BOTTOM);
slideBottom.addTarget(contentView);
enterTransitionSet.addTransition(fade);
enterTransitionSet.addTransition(slideBottom);
getWindow().setEnterTransition(enterTransitionSet);
getWindow().getSharedElementEnterTransition()
.addListener(new ShowFabOnEndTransitionListener());
}
示例11: setTransition
import android.transition.Slide; //导入方法依赖的package包/类
private void setTransition() {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
return;
}
final TransitionSet transition = new TransitionSet();
ChangeBounds transition1 = new ChangeBounds();
transition.addTransition(transition1);
ChangeTransform transition2 = new ChangeTransform();
transition.addTransition(transition2);
ChangeClipBounds transition3 = new ChangeClipBounds();
transition.addTransition(transition3);
ChangeImageTransform transition4 = new ChangeImageTransform();
transition.addTransition(transition4);
transition.setDuration(SHARED_ELEMENT_TRANSITION_DURATION);
FastOutSlowInInterpolator interpolator = new FastOutSlowInInterpolator();
transition1.setInterpolator(interpolator);
transition2.setInterpolator(interpolator);
transition3.setInterpolator(interpolator);
transition4.setInterpolator(interpolator);
final GravityArcMotion pathMotion = new GravityArcMotion();
transition.setPathMotion(pathMotion);
getWindow().setSharedElementEnterTransition(transition);
getWindow().setSharedElementReturnTransition(transition);
getWindow().setSharedElementsUseOverlay(false);
Slide slide = new Slide(Gravity.TOP);
slide.setInterpolator(new LinearOutSlowInInterpolator());
slide.addTarget(appBar);
slide.setDuration(225);
slide.setStartDelay(100);
getWindow().setEnterTransition(slide);
Slide slideOut = (Slide) slide.clone();
slideOut.setInterpolator(new FastOutLinearInInterpolator());
slideOut.setStartDelay(0);
getWindow().setReturnTransition(slideOut);
}