@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { //转场动画 getWindow().requestFeature(Window.FEATURE_CONTENT_TRANSITIONS); getWindow().setEnterTransition(new Explode()); getWindow().setExitTransition(new Explode()); } setContentView(R.layout.activity_main); ClassLoader loader = MainActivity.class.getClassLoader(); if (loader != null){ Log.d(TAG, "onCreate: classloader:" + loader.toString()); Log.d(TAG, "onCreate: classloader:" + loader.getParent().toString()); } ButterKnife.bind(this); initViews(); }
@OnClick(R.id.square2) public void onClick() { FragmentSharedElementTransitionTarget targetFragment = new FragmentSharedElementTransitionTarget(); // FIXME: 08/02/2017 the shared element transitions to the next fragment below other views while it should be on top as in Activity transitions if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { TransitionSet transitionSet = new TransitionSet(); transitionSet.addTransition(new ChangeBounds()); transitionSet.setPathMotion(new ArcMotion()); targetFragment.setSharedElementEnterTransition(transitionSet); targetFragment.setSharedElementReturnTransition(transitionSet); targetFragment.setEnterTransition(TransitionInflater.from(getActivity()).inflateTransition(R.transition.slide_bottom)); targetFragment.setExitTransition(TransitionInflater.from(getActivity()).inflateTransition(R.transition.slide_top_and_fade)); setExitTransition(new Explode()); setReenterTransition(new Explode()); setAllowReturnTransitionOverlap(false); } getActivity().getSupportFragmentManager() .beginTransaction() .addSharedElement(square2, getString(R.string.custom_element_transition_name)) .replace(R.id.fragmentContainer, targetFragment) .addToBackStack(null) .commit(); }
public void openTaskDetail(){ Task clickedTask = adapter.getTask(mTaskViewPager.getCurrentItem()); Fragment taskDetailFragment = new TaskDetailFragment(); ((TaskDetailFragment)taskDetailFragment).setDisplayedTask(clickedTask); if(Build.VERSION.SDK_INT>=Build.VERSION_CODES.LOLLIPOP) { Explode explode = new Explode(); explode.setDuration(300); Fade fade = new Fade(); fade.setDuration(400); taskDetailFragment.setEnterTransition(fade); setExitTransition(explode); setReenterTransition(explode); } getActivity().getSupportFragmentManager() .beginTransaction() .replace(R.id.content_frame, taskDetailFragment) .addToBackStack(null) .commit(); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { Window window = getWindow(); window.requestFeature(Window.FEATURE_CONTENT_TRANSITIONS); window.setEnterTransition(new Explode()); window.setExitTransition(new Explode()); } setContentView(R.layout.activity_game); Mailbox.getInstance().atHome(this); mTvTime = (TextView) findViewById(R.id.tv_time); mTvStep = (TextView) findViewById(R.id.tv_step); mBtnChooseAndStart = (Button) findViewById(R.id.btn_choose_and_start); }
@Override protected void onCreate(Bundle savedInstanceState) { // 设置一个exit transition if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { getWindow().requestFeature(Window.FEATURE_CONTENT_TRANSITIONS); getWindow().setEnterTransition(new Explode()); getWindow().setExitTransition(new Explode()); } super.onCreate(savedInstanceState); setContentView(R.layout.activity_fragment); newFragment = new VideoFragment(); FragmentTransaction transaction = getSupportFragmentManager().beginTransaction(); transaction.replace(R.id.frameLayout, newFragment); transaction.addToBackStack(null); transaction.commit(); }
public GalleryFragment() { final Fade fade = new Fade(); fade.addTarget(R.id.appbar); Explode explode = new Explode(); explode.excludeTarget(R.id.appbar, true); Elevation elevation = new Elevation(); elevation.addTarget(R.id.gallery_card); elevation.setStartDelay(250); // arbitrarily chosen delay TransitionSet exit = new TransitionSet(); exit.addTransition(fade); exit.addTransition(explode); exit.addTransition(elevation); setExitTransition(exit); }
public void setAnimation() { type = getIntent().getStringExtra("type"); switch (type) { case "1": getWindow().setEnterTransition(new Explode()); getWindow().setExitTransition(new Explode()); break; case "2": getWindow().setEnterTransition(new Slide()); getWindow().setExitTransition(new Slide()); break; case "3": getWindow().setEnterTransition(new Fade()); getWindow().setExitTransition(new Fade()); break; } }
@Override protected void onCreate(Bundle savedInstanceState) { if(BuildUtil.isLargeThanAPI21()){ Fade fade = new Fade(); Explode explode = new Explode(); fade.setDuration(100); getWindow().requestFeature(Window.FEATURE_CONTENT_TRANSITIONS); getWindow().setEnterTransition(fade); getWindow().setExitTransition(fade); } super.onCreate(savedInstanceState); setContentView(R.layout.activity_about_us); getSupportActionBar().setTitle("关于我们"); getSupportActionBar().setDisplayHomeAsUpEnabled(true); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { getWindow().requestFeature(Window.FEATURE_CONTENT_TRANSITIONS); getWindow().setExitTransition(new Explode()); } mDecorView = getWindow().getDecorView(); mDefaultUIFlag = mDecorView.getSystemUiVisibility() | View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR; getWindow().setStatusBarColor(ContextCompat.getColor(this, R.color.main_background)); // setAppTheme(); setContentView(R.layout.activity_main); setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); ButterKnife.bind(this); analyseIntent(); initChildViews(savedInstanceState); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { getWindow().setEnterTransition(new Explode()); getWindow().setExitTransition(new Explode()); } setContentView(getLayoutResource()); Toolbar toolBar = (Toolbar) findViewById(R.id.toolbar); if (toolBar != null) { toolBar.bringToFront(); setSupportActionBar(toolBar); getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setIcon(new ColorDrawable(android.R.color.transparent)); getSupportActionBar().setTitle(R.string.choose_service); setToolBar(toolBar); } }
@OnClick({R.id.bt_go, R.id.fab}) public void onClick(View view) { switch (view.getId()) { case R.id.fab: getWindow().setExitTransition(null); getWindow().setEnterTransition(null); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { ActivityOptions options = ActivityOptions.makeSceneTransitionAnimation(this, fab, fab.getTransitionName()); startActivity(new Intent(this, RegisterActivity.class), options.toBundle()); } else { startActivity(new Intent(this, RegisterActivity.class)); } break; case R.id.bt_go: Explode explode = new Explode(); explode.setDuration(500); getWindow().setExitTransition(explode); getWindow().setEnterTransition(explode); ActivityOptionsCompat oc2 = ActivityOptionsCompat.makeSceneTransitionAnimation(this); Intent i2 = new Intent(this,LoginSuccessActivity.class); startActivity(i2, oc2.toBundle()); break; } }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_login_success); Explode explode = new Explode(); explode.setDuration(500); getWindow().setExitTransition(explode); getWindow().setEnterTransition(explode); }
@Override public void initView(Bundle savedInstanceState, View view) { if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP) { Explode explode = (Explode) TransitionInflater.from(this).inflateTransition(R.transition.explode_1000); Fade fade = (Fade) TransitionInflater.from(this).inflateTransition(R.transition.fade_1000); getWindow().setEnterTransition(fade); getWindow().setExitTransition(explode); } findViewById(android.R.id.content).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { SharedElementActivityActivity.start(SharedElementActivityActivity.this); } }); }
@Override public void initView(Bundle savedInstanceState, View view) { getToolBar().setTitle(getString(R.string.demo_activity)); viewSharedElement = (ImageView) findViewById(R.id.view_shared_element); findViewById(R.id.btn_cls).setOnClickListener(this); findViewById(R.id.btn_cls_opt_anim).setOnClickListener(this); findViewById(R.id.btn_cls_opt_shared).setOnClickListener(this); findViewById(R.id.btn_cls_opt_scale_up).setOnClickListener(this); findViewById(R.id.btn_cls_opt_thumbnail_scale_up).setOnClickListener(this); findViewById(R.id.btn_cls_opt_clip_reveal).setOnClickListener(this); findViewById(R.id.btn_cls_anim).setOnClickListener(this); findViewById(R.id.btn_shared_element).setOnClickListener(this); findViewById(R.id.btn_start_home_activity).setOnClickListener(this); findViewById(R.id.btn_finish_all_activity).setOnClickListener(this); TextView tvAboutActivity = (TextView) findViewById(R.id.tv_about_activity); tvAboutActivity.setText("Is ImageActivity Exists: " + ActivityUtils.isActivityExists(Config.PKG, ImageActivity.class.getName()) + "\ngetLauncherActivity: " + ActivityUtils.getLauncherActivity(Config.PKG) + "\ngetTopActivity: " + ActivityUtils.getTopActivity() ); bitmap = ((BitmapDrawable) viewSharedElement.getDrawable()).getBitmap(); if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP) { Explode explode = (Explode) TransitionInflater.from(this).inflateTransition(R.transition.explode_1000); Fade fade = (Fade) TransitionInflater.from(this).inflateTransition(R.transition.fade_1000); getWindow().setEnterTransition(explode); getWindow().setReturnTransition(fade); } }
@Override public void onCreate(Bundle savedInstanceState) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { getWindow().requestFeature(Window.FEATURE_CONTENT_TRANSITIONS); getWindow().setExitTransition(new Explode()); } super.onCreate(savedInstanceState); setContentView(R.layout.activity_search); initialise(); configure(); setSearchListeners(); }
public void setupTransitions() { // Add shared element transition animation if on Lollipop or later if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { // Enter transitions TransitionSet setEnter = new TransitionSet(); Transition slideDown = new Explode(); slideDown.addTarget(headerView); slideDown.excludeTarget(scrollView, true); slideDown.setDuration(500); setEnter.addTransition(slideDown); Transition fadeOut = new Slide(Gravity.BOTTOM); fadeOut.addTarget(scrollView); fadeOut.setDuration(500); setEnter.addTransition(fadeOut); // Exit transitions TransitionSet setExit = new TransitionSet(); Transition slideDown2 = new Explode(); slideDown2.addTarget(headerView); slideDown2.setDuration(570); setExit.addTransition(slideDown2); Transition fadeOut2 = new Slide(Gravity.BOTTOM); fadeOut2.addTarget(scrollView); fadeOut2.setDuration(280); setExit.addTransition(fadeOut2); getWindow().setEnterTransition(setEnter); getWindow().setReturnTransition(setExit); } }
@Override protected void onCreate(@Nullable Bundle savedInstanceState) { getWindow().requestFeature(Window.FEATURE_CONTENT_TRANSITIONS); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { getWindow().setExitTransition(new Explode()); } super.onCreate(savedInstanceState); LoadingDialog.init(this);//用户页面返回时重设context mFragmentManager = getFragmentManager(); mFragmentListMap = new HashMap<>();//创建一个fragment集合,根据viewID保存hash集合中,可以根据viewid进行操作而不乱 }
private void setupWindowAnimations() { if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP) { Fade fade = new Fade(); fade.setDuration(1000); getWindow().setEnterTransition(fade); Toast.makeText(this, "Animation", Toast.LENGTH_SHORT).show(); Explode slide = new Explode(); slide.setDuration(1000); getWindow().setReenterTransition(slide); } }
private void setupWindowAnimations() { if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP) { Explode slide = new Explode(); slide.setDuration(1000); getWindow().setExitTransition(slide); } }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { getWindow().requestFeature(Window.FEATURE_CONTENT_TRANSITIONS); getWindow().setEnterTransition(new Explode()); } setContentView(R.layout.activity_image); imageView = (ImageView) findViewById(R.id.imageView); textView = (TextView) findViewById(R.id.textView); ViewCompat.setTransitionName(imageView, VIEW_NAME_IMAGE); Intent intent = getIntent(); if (intent != null) { imageId = intent.getIntExtra(KEY_IMAGE_ID, 0); description = intent.getStringExtra(KEY_DESCRIPTION); } imageView.setImageResource(imageId); textView.setText(description); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { addTransitionListener(); } }
/** * activity scene transition animation */ @TargetApi(Build.VERSION_CODES.LOLLIPOP) private Transition makeTransition() { TransitionSet transition = new TransitionSet(); transition.addTransition(new Explode()); transition.addTransition(new Fade()); transition.setDuration(400); return transition; }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); getWindow().requestFeature(Window.FEATURE_CONTENT_TRANSITIONS); getWindow().setAllowEnterTransitionOverlap(true); getWindow().setAllowReturnTransitionOverlap(true); Explode explode = new Explode(); explode.setDuration(1000); getWindow().setEnterTransition(explode); getWindow().setExitTransition(explode); setContentView(R.layout.activity_animation); }
@TargetApi(Build.VERSION_CODES.LOLLIPOP) public void initTransitionAnimation() { getWindow().requestFeature(Window.FEATURE_CONTENT_TRANSITIONS); //设置Activity过渡动画 getWindow().setEnterTransition(new Explode()); }
@TargetApi(Build.VERSION_CODES.LOLLIPOP) @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); getWindow().requestFeature(Window.FEATURE_CONTENT_TRANSITIONS); //设置Activity过渡动画 getWindow().setEnterTransition(new Explode()); setContentView(R.layout.guoke_detail_page); initToolbar(); initStatusBar(); LoadRequest(); }
@TargetApi(Build.VERSION_CODES.LOLLIPOP) public void initTransitionAnimation(){ getWindow().requestFeature(Window.FEATURE_CONTENT_TRANSITIONS); //设置Activity过渡动画 getWindow().setEnterTransition(new Explode()); }
@Override protected void beforeCreate() { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { getWindow().requestFeature(Window.FEATURE_CONTENT_TRANSITIONS); getWindow().setExitTransition(new Explode());//new Slide() new Fade() } }
private void setUpEnterTransition() { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { Explode transition = new Explode(); transition.setDuration(TRANSITION_DURATION); getWindow().setEnterTransition(transition); } }
private void setTransition() { Explode explode = new Explode(); explode.setDuration(500); explode.setMode(Explode.MODE_IN); Explode explode1 = new Explode(); explode1.setDuration(500); explode1.setMode(Explode.MODE_OUT); getWindow().setEnterTransition(explode); getWindow().setReturnTransition(explode1); }
/** * 重写父类的onCreate方法,在该方法中调用initInjector,afterCreate等方法,在以后的activity代码中就不用书写这些 */ @Override protected void onCreate(Bundle savedInstanceState) { if(BuildUtil.isLargeThanAPI21()){ Fade fade = new Fade(); Explode explode = new Explode(); fade.setDuration(100); getWindow().requestFeature(Window.FEATURE_CONTENT_TRANSITIONS); getWindow().setEnterTransition(explode); getWindow().setExitTransition(fade); } super.onCreate(savedInstanceState); beforeSetView(); //设定透明状态栏 if(!BuildUtil.isLowerThanAPI19() && transStatusFlag){ getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); } int layout = setContentView(); setContentView(layout); mApplicationComponent = ((IHandSwApplication)getApplication()).getComponent(); mActivityComponent = DaggerActivityComponent.builder() .activityModule(new ActivityModule(this)) .applicationComponent(mApplicationComponent) .build(); mToastUtil = mActivityComponent.getToastUtil(); mRetrofit = mActivityComponent.getRetrofit(); Activities.add(this); initInjector(); attachView(); custom(); afterCreate(); //推送必调用 PushAgent.getInstance(this).onAppStart(); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); getWindow().setEnterTransition(new Fade()); getWindow().setExitTransition(new Explode()); setContentView(R.layout.activity_picture_select); initViews(); initDatas(); initEvents(); }
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View v = inflater.inflate(R.layout.fragment_dashboard, container, false); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { setExitTransition(new Explode()); } return v; }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.my_apply); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); final ActionBar ab = getSupportActionBar(); ab.setTitle("신청리스트"); ab.setDisplayHomeAsUpEnabled(true); mPrefs = getSharedPreferences(PREF_NAME, Context.MODE_PRIVATE); mEditor = mPrefs.edit(); ViewPager applyPager = (ViewPager) findViewById(R.id.viewpager); if (applyPager != null) { setupTabViewPager(applyPager); } TabLayout tabLayout = (TabLayout) findViewById(R.id.apply_tabs); tabLayout.setupWithViewPager(applyPager); if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { Window window = getWindow(); Transition exitTrans = new Explode(); Transition reenterTrans = new Explode(); window.setExitTransition(exitTrans); window.setReenterTransition(reenterTrans); window.setAllowEnterTransitionOverlap(true); window.setAllowReturnTransitionOverlap(true); } }
/*********************************************************************************************** * * Lifecycle Methods * */ @Override @SuppressLint("NewApi") public void onCreate(Bundle savedInstanceState) { // Set window transition elements if(BuildUtils.isLollipop()) { getWindow().requestFeature(Window.FEATURE_CONTENT_TRANSITIONS); TransitionSet transitions = new TransitionSet() .addTransition(new ChangeBounds()) .addTransition(new Fade()); getWindow().setEnterTransition(new Explode()); getWindow().setExitTransition(new Explode()); getWindow().setSharedElementEnterTransition(transitions); getWindow().setSharedElementExitTransition(transitions); } super.onCreate(savedInstanceState); setContentView(R.layout.activity_license); // Load UI mToolbar = ButterKnife.findById(this, R.id.appbar); mRecyler = ButterKnife.findById(this, R.id.recycler); // Set the toolbar as the support actionbar setSupportActionBar(mToolbar); parseExtras(savedInstanceState); // Set listeners getSupportActionBar().setDisplayHomeAsUpEnabled(true); mToolbar.setNavigationOnClickListener(this); mRecyler.setAdapter(mAdapter); mRecyler.setLayoutManager(new LinearLayoutManager(this)); mRecyler.setItemAnimator(new DefaultItemAnimator()); mRecyler.addItemDecoration(new StickyRecyclerHeadersElevationDecoration(mAdapter)); mAdapter.setOnItemClickListener(this); }
/*********************************************************************************************** * * Lifecycle Methods * */ @SuppressLint("NewApi") @Override protected void onCreate(Bundle savedInstanceState) { // Set window transition elements if(BuildUtils.isLollipop()) { getWindow().requestFeature(Window.FEATURE_CONTENT_TRANSITIONS); TransitionSet transitions = new TransitionSet() .addTransition(new ChangeBounds()) .addTransition(new Fade()); getWindow().setEnterTransition(new Explode()); getWindow().setExitTransition(new Explode()); getWindow().setSharedElementEnterTransition(transitions); getWindow().setSharedElementExitTransition(transitions); } super.onCreate(savedInstanceState); overridePendingTransition(0, 0); setContentView(R.layout.activity_license_detail); // Inflate components mAppbar = ButterKnife.findById(this, R.id.appbar); mName = ButterKnife.findById(this, R.id.name); mAuthor = ButterKnife.findById(this, R.id.author); mLicense = ButterKnife.findById(this, R.id.license); // Apply components setSupportActionBar(mAppbar); getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setDisplayShowTitleEnabled(false); mAppbar.setNavigationOnClickListener(this); // Parse extras parseExtras(savedInstanceState); }
/** * returns Explode Transition * * @param listener transition listener * @param duration duration for transition * @return returns explode transition (null if API level 14 is less than LOLLIPOP) */ public static Transition getExplodeTransition(Transition.TransitionListener listener, int duration) { if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { Explode explode = new Explode(); explode.setDuration(duration); explode.addListener(listener); return explode; } return null; }
private void setupWindowAnimations() { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { Explode explode = new Explode(); getWindow().setExitTransition(explode); Fade fade = new Fade(); getWindow().setReenterTransition(fade); } }
public static void goToMainActivity(Activity act) { Intent i = new Intent(act, MainActivity.class); if (Build.VERSION.SDK_INT == Build.VERSION_CODES.LOLLIPOP) { Activity activity = act; Bundle options = ActivityOptionsCompat.makeSceneTransitionAnimation(activity).toBundle(); activity.getWindow().setExitTransition(new Explode().setDuration(1500)); ActivityCompat.startActivityForResult(activity, i, 0, options); } else { act.startActivity(i); } act.finish(); }