本文整理汇总了Java中android.transition.Slide.setDuration方法的典型用法代码示例。如果您正苦于以下问题:Java Slide.setDuration方法的具体用法?Java Slide.setDuration怎么用?Java Slide.setDuration使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.transition.Slide
的用法示例。
在下文中一共展示了Slide.setDuration方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCreate
import android.transition.Slide; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
// getWindow().requestFeature(Window.FEATURE_CONTENT_TRANSITIONS);
super.onCreate(savedInstanceState);
Slide slideIn = new Slide();
slideIn.setDuration(500);
//设置为进入
slideIn.setMode(Visibility.MODE_IN);
//设置从右边进入
slideIn.setSlideEdge(Gravity.RIGHT);
getWindow().setEnterTransition(new ChangeImageTransform().setDuration(3000));
// getWindow().setEnterTransition(new Explode().setDuration(2000));
// getWindow().setExitTransition(new Explode().setDuration(2000));
Slide slideReturn =new Slide();
slideReturn.setDuration(500);
slideReturn.setSlideEdge(Gravity.LEFT);
slideReturn.setMode(Visibility.MODE_OUT);
getWindow().setReturnTransition (slideReturn );
setContentView(R.layout.activity_img_transition);
mImageView = (ImageView) findViewById(R.id.img);
// Transition sharedElementEnterTransition = getWindow().getSharedElementEnterTransition();
}
示例2: addNextFragment
import android.transition.Slide; //导入方法依赖的package包/类
private void addNextFragment(Sample sample, ImageView squareBlue, boolean overlap) {
SharedElementFragment2 sharedElementFragment2 = SharedElementFragment2.newInstance(sample);
Slide slideTransition = new Slide(Gravity.RIGHT);
slideTransition.setDuration(getResources().getInteger(R.integer.anim_duration_medium));
ChangeBounds changeBoundsTransition = new ChangeBounds();
changeBoundsTransition.setDuration(getResources().getInteger(R.integer.anim_duration_medium));
sharedElementFragment2.setEnterTransition(slideTransition);
sharedElementFragment2.setAllowEnterTransitionOverlap(overlap);
sharedElementFragment2.setAllowReturnTransitionOverlap(overlap);
sharedElementFragment2.setSharedElementEnterTransition(changeBoundsTransition);
getFragmentManager().beginTransaction()
.replace(R.id.sample2_content, sharedElementFragment2)
.addToBackStack(null)
.addSharedElement(squareBlue, getString(R.string.square_blue_name))
.commit();
}
示例3: onCreate
import android.transition.Slide; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
setContentView(R.layout.activity_detail);
postponeEnterTransition();
TransitionSet transitions = new TransitionSet();
Slide slide = new Slide(Gravity.BOTTOM);
slide.setInterpolator(AnimationUtils.loadInterpolator(this,
android.R.interpolator.linear_out_slow_in));
slide.setDuration(getResources().getInteger(android.R.integer.config_shortAnimTime));
transitions.addTransition(slide);
transitions.addTransition(new Fade());
getWindow().setEnterTransition(transitions);
Intent intent = getIntent();
sharedElementCallback = new DetailSharedElementEnterCallback(intent);
setEnterSharedElementCallback(sharedElementCallback);
initialItem = intent.getIntExtra(IntentUtil.SELECTED_ITEM_POSITION, 0);
setUpViewPager(intent.<Photo>getParcelableArrayListExtra(IntentUtil.PHOTO));
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
toolbar.setNavigationOnClickListener(navigationOnClickListener);
super.onCreate(savedInstanceState);
}
示例4: setupSlideTransition
import android.transition.Slide; //导入方法依赖的package包/类
private void setupSlideTransition() {
Slide slideEnter = new Slide();
slideEnter.setSlideEdge(Gravity.LEFT);
slideEnter.setDuration(500);
slideEnter.setStartDelay(250);
slideEnter.excludeTarget(android.R.id.navigationBarBackground, true);
slideEnter.excludeTarget(android.R.id.statusBarBackground, true);
getWindow().setEnterTransition(slideEnter);
Slide slideOut = new Slide();
slideOut.setSlideEdge(Gravity.RIGHT);
slideOut.setDuration(500);
slideOut.setStartDelay(0);
slideOut.excludeTarget(android.R.id.navigationBarBackground, true);
slideOut.excludeTarget(android.R.id.statusBarBackground, true);
getWindow().setExitTransition(slideOut);
}
示例5: 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);
}
示例6: onTrackDetails
import android.transition.Slide; //导入方法依赖的package包/类
private void onTrackDetails(Track track, boolean current) {
Fragment fragment = mFragmentManager.findFragmentByTag("trackInformation");
if (fragment == null) {
fragment = Fragment.instantiate(this, TrackInformation.class.getName());
Slide slide = new Slide(mSlideGravity);
// Required to sync with FloatingActionButton
slide.setDuration(getResources().getInteger(android.R.integer.config_shortAnimTime));
fragment.setEnterTransition(slide);
FragmentTransaction ft = mFragmentManager.beginTransaction();
ft.replace(R.id.contentPanel, fragment, "trackInformation");
ft.addToBackStack("trackInformation");
ft.commit();
updateMapViewArea();
}
((TrackInformation) fragment).setTrack(track, current);
mExtendPanel.setForeground(getDrawable(R.drawable.dim));
mExtendPanel.getForeground().setAlpha(0);
ObjectAnimator anim = ObjectAnimator.ofInt(mExtendPanel.getForeground(), "alpha", 0, 255);
anim.setDuration(500);
anim.start();
}
示例7: toChainsDetail
import android.transition.Slide; //导入方法依赖的package包/类
public void toChainsDetail(ProductionChain chain, View origin) {
final ChainsDetailFragment detailFragment = new ChainsDetailFragment();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
final Slide slide = new Slide(Gravity.END);
slide.setDuration(333);
detailFragment.setEnterTransition(slide);
detailFragment.setExitTransition(slide);
overviewFragment.setExitTransition(new Fade());
Transition t = TransitionInflater.from(this).inflateTransition(android.R.transition.move);
detailFragment.setSharedElementEnterTransition(t);
detailFragment.setSharedElementReturnTransition(t);
}
final Bundle bundle = new Bundle();
bundle.putString(GameActivity.BUNDLE_CHAIN_KEY, gson.toJson(chain));
detailFragment.setArguments(bundle);
getSupportFragmentManager()
.beginTransaction()
.replace(R.id.game_activity_parent, detailFragment)
.addToBackStack(null)
.addSharedElement(origin, ViewCompat.getTransitionName(origin))
.commit();
getSupportFragmentManager().executePendingTransactions();
}
示例8: toOtherGoodsDetail
import android.transition.Slide; //导入方法依赖的package包/类
public void toOtherGoodsDetail(ProductionChain chain, View origin) {
final MaterialDetailFragment detailFragment = new MaterialDetailFragment();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
final Slide slide = new Slide(Gravity.END);
slide.setDuration(333);
detailFragment.setEnterTransition(slide);
detailFragment.setExitTransition(slide);
overviewFragment.setExitTransition(new Fade());
Transition t = TransitionInflater.from(this).inflateTransition(android.R.transition.move);
detailFragment.setSharedElementEnterTransition(t);
detailFragment.setSharedElementReturnTransition(t);
}
final Bundle bundle = new Bundle();
bundle.putString(GameActivity.BUNDLE_CHAIN_KEY, gson.toJson(chain));
detailFragment.setArguments(bundle);
getSupportFragmentManager()
.beginTransaction()
.replace(R.id.game_activity_parent, detailFragment)
.addToBackStack(null)
.addSharedElement(origin, ViewCompat.getTransitionName(origin))
.commit();
getSupportFragmentManager().executePendingTransactions();
}
示例9: toSettings
import android.transition.Slide; //导入方法依赖的package包/类
public void toSettings() {
final GameSettingsFragment fragment = new GameSettingsFragment();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
final Slide slide = new Slide(Gravity.END);
slide.setDuration(333);
fragment.setEnterTransition(slide);
fragment.setExitTransition(slide);
}
getSupportFragmentManager().beginTransaction()
.add(R.id.game_activity_parent, fragment)
.addToBackStack(null)
.commit();
}
示例10: initData
import android.transition.Slide; //导入方法依赖的package包/类
@Override
public void initData(Bundle savedInstanceState) {
if (savedInstanceState != null){
videoInfo = (VideoListInfo.Video) savedInstanceState.getSerializable(Constants.VIDEO_INFO);
}
initMedia();
if (videoInfo.getData().getConsumption() !=null ){
initRecyclerView();
mPresenter.getRelaRelateVideoInfo(videoInfo.getData().getId());
mPresenter.getShareInfo(videoInfo.getData().getId());
}else {
mPresenter.getVideoData(videoInfo.getData().getId());
}
dragBottomView.setDismissedListener(this);
replyDragBottomView.setDismissedListener(this);
if (supportsTransitions()){
Slide slide = new Slide(Gravity.BOTTOM);
slide.setDuration(500L);
slide.excludeTarget(android.R.id.statusBarBackground, true);
slide.excludeTarget(android.R.id.navigationBarBackground, true);
slide.excludeTarget(R.id.rl_screen, true);
slide.excludeTarget(R.id.detail_player, true);
getWindow().setEnterTransition(slide);
getWindow().getEnterTransition().excludeTarget(R.id.frameLayout,true);
getWindow().getEnterTransition().excludeTarget(R.id.fl_loading,true);
Fade fade = new Fade();
fade.setDuration(500L);
getWindow().setReturnTransition(fade);
}
}
示例11: setUpWindowAnimations
import android.transition.Slide; //导入方法依赖的package包/类
private void setUpWindowAnimations() {
if (android.os.Build.VERSION.SDK_INT >= 21) {
Slide slide = new Slide(Gravity.START);
slide.setDuration(3000);
getWindow().setEnterTransition(slide);
}
}
示例12: setupWindowAnimations
import android.transition.Slide; //导入方法依赖的package包/类
private void setupWindowAnimations() {
// Re-enter transition is executed when returning to this activity
Slide slideTransition = new Slide();
slideTransition.setSlideEdge(Gravity.LEFT);
slideTransition.setDuration(getResources().getInteger(R.integer.anim_duration_long));
getWindow().setReenterTransition(slideTransition);
getWindow().setExitTransition(slideTransition);
}
示例13: setupLayout
import android.transition.Slide; //导入方法依赖的package包/类
private void setupLayout(Sample sample) {
// Transition for fragment1
Slide slideTransition = new Slide(Gravity.LEFT);
slideTransition.setDuration(getResources().getInteger(R.integer.anim_duration_long));
// Create fragment and define some of it transitions
SharedElementFragment1 sharedElementFragment1 = SharedElementFragment1.newInstance(sample);
sharedElementFragment1.setReenterTransition(slideTransition);
sharedElementFragment1.setExitTransition(slideTransition);
sharedElementFragment1.setSharedElementEnterTransition(new ChangeBounds());
getSupportFragmentManager().beginTransaction()
.replace(R.id.sample2_content, sharedElementFragment1)
.commit();
}
示例14: onInit
import android.transition.Slide; //导入方法依赖的package包/类
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
@Override
protected void onInit(Bundle savedInstanceState) {
Slide slide = new Slide();
slide.setSlideEdge(Gravity.LEFT);//滑出的方向
slide.setInterpolator(new DecelerateInterpolator());
slide.setDuration(500);//动画持续时间
getWindow().setExitTransition(slide);
// init your data and call mLoadingAndRetryManager.xxx to control the view show and gone
loadData();
ContextCompat.getColor(this, R.color.colorPrimary);
}
示例15: 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);
}
}