@Override protected void onCreate(Bundle savedInstanceState) { if (Utils.hasLollipop()) requestWindowFeature(Window.FEATURE_CONTENT_TRANSITIONS); super.onCreate(savedInstanceState); if (Utils.hasLollipop()) { getWindow().setEnterTransition(new Fade()); } setContentView(R.layout.activity_main); Log.d(TAG, "onCreate"); FlexibleAdapter.enableLogs(true); // Initialize Toolbar, Drawer & FAB initializeToolbar(); initializeDrawer(); initializeFab(); // Initialize Fragment containing Adapter & RecyclerView initializeFragment(savedInstanceState); // With FlexibleAdapter v5.0.0 we don't need to call this function anymore // It is automatically called if Activity implements FlexibleAdapter.OnUpdateListener //updateEmptyView(); }
@Override public void initView(Bundle savedInstanceState, View view) { Random random = new Random(); FragmentUtils.setBackgroundColor(this, Color.rgb(random.nextInt(256), random.nextInt(256), random.nextInt(256))); btnShowAboutFragment = (Button) view.findViewById(R.id.btn_show_about_fragment); btnShowAboutFragment.setOnClickListener(this); view.findViewById(R.id.btn_add_hide).setOnClickListener(this); view.findViewById(R.id.btn_add_show).setOnClickListener(this); view.findViewById(R.id.btn_add_child).setOnClickListener(this); view.findViewById(R.id.btn_pop_to_root).setOnClickListener(this); view.findViewById(R.id.btn_pop_add).setOnClickListener(this); view.findViewById(R.id.btn_hide_show).setOnClickListener(this); view.findViewById(R.id.btn_replace).setOnClickListener(this); ivSharedElement = (ImageView) view.findViewById(R.id.iv_shared_element); tvAboutFragment = (TextView) view.findViewById(R.id.tv_about_fragment); demo0Fragment = this; sharedElement = new FragmentUtils.SharedElement(ivSharedElement, getString(R.string.fragment_transition)); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { setExitTransition(new Fade()); } }
@Override public void onCreate(Bundle state) { super.onCreate(state); if (Build.VERSION.SDK_INT >= 21) { getWindow().setExitTransition(new Fade()); } setPreferencesDefaults(); setContentView(R.layout.splash); new Handler().postDelayed(new Runnable() { @Override public void run() { startNextActivity(); supportFinishAfterTransition(); } }, 500); }
@Override protected void onCreate(Bundle savedInstanceState) { Fade s = new Fade(); s.setDuration(1000); getWindow().setEnterTransition(s); super.onCreate(savedInstanceState); /*setContentView(R.layout.newslayout); if (savedInstanceState == null) { getSupportFragmentManager().beginTransaction() .add(R.id.newscontainer, new NewsFragment()) .commit(); }*/ // ATTENTION: This was auto-generated to implement the App Indexing API. // See https://g.co/AppIndexing/AndroidStudio for more information. }
public void startDetailActivity(String itemId, View viewRoot) { Activity container = getActivity(); Intent i = new Intent(container, DetailActivity.class); i.putExtra(EXTRA_ITEM_ID, itemId); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { container.getWindow().setEnterTransition(new Fade(Fade.IN)); container.getWindow().setEnterTransition(new Fade(Fade.OUT)); ActivityOptions options = ActivityOptions .makeSceneTransitionAnimation(container, new Pair<>(viewRoot.findViewById(R.id.imv_list_item_circle), getString(R.string.transition_drawable)), new Pair<>(viewRoot.findViewById(R.id.lbl_message), getString(R.string.transition_message)), new Pair<>(viewRoot.findViewById(R.id.lbl_date_and_time), getString(R.string.transition_time_and_date))); startActivity(i, options.toBundle()); } else { startActivity(i); } }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { getWindow().requestFeature(Window.FEATURE_ACTIVITY_TRANSITIONS); getWindow().requestFeature(Window.FEATURE_CONTENT_TRANSITIONS); getWindow().setEnterTransition(new Fade()); } setContentView(R.layout.activity_index_view); recyclerView = findViewById(R.id.recycler_view); recyclerView.setLayoutManager(new LinearLayoutManager(this)); recyclerView.addItemDecoration(new DividerDecoration()); IndexViewAdapter adapter = new IndexViewAdapter(DataUtil.getItemDataList(555)); recyclerView.setAdapter(adapter); final RecyclerIndex<Index> index = new RecyclerIndex<>(recyclerView); index.attachIndex(); index.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Toast.makeText(getBaseContext(), index.getData().getText(), Toast.LENGTH_SHORT).show(); } }); }
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP) private TransitionSet constructTransitions() { int[] slideTargets = {R.id.ChatRecyclerView, R.id.chat_input, R.id.chat_input_divider}; Transition slideTransition = new Slide(Gravity.BOTTOM); Transition fadeTransition = new Fade(); for (int slideTarget : slideTargets) { slideTransition.addTarget(slideTarget); fadeTransition.excludeTarget(slideTarget, true); } TransitionSet set = new TransitionSet(); set.addTransition(slideTransition); set.addTransition(fadeTransition); return set; }
@RequiresApi(api = Build.VERSION_CODES.HONEYCOMB) private void handleTransitions() { useSysTransition = getIntent().getBooleanExtra(KEY_USE_SYS_TRANSITION, false); if(useSysTransition) { ivDetail.setVisibility(View.VISIBLE); Fade fade = new Fade(); fade.setDuration(500); getWindow().setEnterTransition(fade); getWindow().setExitTransition(fade); ChangeBounds changeBounds = new ChangeBounds(); getWindow().setSharedElementEnterTransition(changeBounds); } entity = (TransitionsEntity) getIntent().getSerializableExtra(KEY_ENTITY); KLog.d(entity); GlideUtils.displayImage(this, ivDetail, entity.getUrl(), R.drawable.def_placeholder); }
@Override protected void onCreate(Bundle savedInstanceState) { if (Utils.hasLollipop()) requestWindowFeature(Window.FEATURE_CONTENT_TRANSITIONS); super.onCreate(savedInstanceState); if (Utils.hasLollipop()) { getWindow().setExitTransition(new Fade()); } //TODO: Remove after evaluation testing try { Thread.sleep(2000); } catch (InterruptedException e) { e.printStackTrace(); } Intent intent = new Intent(this, MainActivity.class); ActivityOptionsCompat options = ActivityOptionsCompat.makeSceneTransitionAnimation(this); ActivityCompat.startActivity(this, intent, options.toBundle()); ActivityCompat.finishAfterTransition(this); }
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 public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Force trigger System UI cover on this Activity hideSystemUI(); showSystemUI(); // Avoid flash while transition from former Activity postponeEnterTransition(); getWindow().setStatusBarColor(Color.TRANSPARENT); getWindow().setNavigationBarColor(Color.TRANSPARENT); getWindow().getDecorView().setBackgroundColor(Color.TRANSPARENT); // Using the fade effect for Activity transition Fade fade = new Fade(); fade.excludeTarget(android.R.id.statusBarBackground, true); fade.excludeTarget(android.R.id.navigationBarBackground, true); fade.excludeTarget(R.id.showing_image_view, true); fade.setDuration(TRANSITION_DURATION); applyTransitionToWindow(getWindow(), fade, true, true, true, true, true); setContentView(R.layout.activity_twitterized_image_showing); setupViews(); }
@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); }
@TargetApi(Build.VERSION_CODES.LOLLIPOP) private void setupFragmentForSharedElement( Fragment outFragment, Fragment inFragment, FragmentTransaction transaction, Bundle options) { FragmentSharedElementTransition transition = new FragmentSharedElementTransition(); inFragment.setSharedElementEnterTransition(transition); inFragment.setSharedElementReturnTransition(transition); Fade fade = new Fade(); inFragment.setEnterTransition(fade); inFragment.setReturnTransition(fade); ViewGroup rootView = (ViewGroup) outFragment.getView(); ViewGroup transitionGroup = ViewUtils.findViewGroupWithTag( rootView, R.id.react_shared_element_group_id, options.getString(TRANSITION_GROUP)); AutoSharedElementCallback.addSharedElementsToFragmentTransaction(transaction, transitionGroup); }
@TargetApi(Build.VERSION_CODES.LOLLIPOP) @OnClick(R.id.next) public void onClickBegin(View view) { //set behavior for this fragment setExitTransition(new Slide(Gravity.START)); setReenterTransition(new Slide(Gravity.TOP)); WelcomeFragmentStep2 fragment = new WelcomeFragmentStep2(); //set behavior for new fragment transitions fragment.setEnterTransition(new Fade()); fragment.setSharedElementEnterTransition(getNextButtonTransition()); getActivity().getFragmentManager().beginTransaction() .replace(R.id.root, fragment) .addSharedElement(next, "next") .addToBackStack(null) .commit(); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); getWindow().requestFeature(Window.FEATURE_CONTENT_TRANSITIONS); getWindow().setAllowEnterTransitionOverlap(true); getWindow().setAllowReturnTransitionOverlap(true); setContentView(R.layout.activity_animation); Fade fade = new Fade(); fade.setDuration(5000); //fade.addTarget(findViewById(R.id.view)); getWindow().setEnterTransition(fade); getWindow().setExitTransition(fade); }
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); }
@Override public void displayDetails(AnnouncementItem announcementItem) { FullAnnouncement announcement = announcementItem.getAnnouncement(); FragmentManager fm = getFragmentManager(); FragmentTransaction ft = fm.beginTransaction(); AnnouncementDetailsFragment announcementDetailsFragment = AnnouncementDetailsFragment.newInstance(announcement); if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { TransitionInflater transitionInflater = null; transitionInflater = TransitionInflater.from(getContext()); Transition details_enter = transitionInflater.inflateTransition(R.transition.details_enter); Transition details_exit = transitionInflater.inflateTransition(R.transition.details_exit); setSharedElementEnterTransition(details_enter); setSharedElementReturnTransition(details_exit); setExitTransition(new Fade()); announcementDetailsFragment.setSharedElementEnterTransition(details_enter); announcementDetailsFragment.setSharedElementReturnTransition(details_exit); ft.addSharedElement(announcementItem.getBackgroundView(), announcementItem.getBackgroundView().getTransitionName()); } ft.replace(R.id.content_main, announcementDetailsFragment, "Announcement details transition"); ft.addToBackStack(null); ft.commitAllowingStateLoss(); }
public static void startToolbarAnimation( Context context, ViewGroup v ) { if (new UpdaterOptions(context).disableAnimations()) { return; } if (Build.VERSION.SDK_INT >= 21) { TransitionManager.beginDelayedTransition(v, new TransitionSet() .addTransition(new Fade(Fade.IN)) .addTransition(new Slide(Gravity.LEFT)) .addTransition(new ChangeBounds()) ); } else if (Build.VERSION.SDK_INT >= 14){ android.support.transition.TransitionManager.beginDelayedTransition(v, new AutoTransition().setDuration(250)); } { // No animation } }
@NonNull @Override protected Transition createTransition(@NonNull ViewGroup container, @NonNull View entering, @Nullable View leaving, boolean push) { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) { return new TransitionSet() .setOrdering(ORDERING_TOGETHER) .addTransition(new Fade(Fade.OUT)) .addTransition(new Fade(Fade.IN)); } final TransitionSet transition = new TransitionSet() .addTransition(new ChangeBounds()) .addTransition(new ChangeClipBounds()) .addTransition(new ChangeTransform()); transition.setPathMotion(new ArcMotion()); return transition; }
@Override public void onOpenStoryDetail(Story story, StoryAdapter.ViewHolder vh) { Fragment storyDetailFragment = StoryDetailFragment.newInstance(story); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { Transition changeTransform = TransitionInflater.from(this) .inflateTransition(R.transition.transition_story); mTopStoriesFragment.setExitTransition(new Fade()); storyDetailFragment.setEnterTransition(new Fade()); storyDetailFragment.setSharedElementEnterTransition(changeTransform); storyDetailFragment.setSharedElementReturnTransition(changeTransform); } getSupportFragmentManager().beginTransaction() .replace(R.id.fragment_container, storyDetailFragment, TAG_STORY_DETAIL) .addToBackStack(null) .addSharedElement(vh.itemView, getString(R.string.story_transition_name, story.getId())) .commit(); }
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); DataBase.db = new DatabaseHelper(this); if (DataBase.db.hideLaunch()) { start(true); } setContentView(R.layout.activity_launch); mLaunchPreference = (CheckBox) findViewById(R.id.launch_preference); mButtonStart = (FloatingActionButton) findViewById(R.id.button_start); getWindow().setExitTransition(new Fade()); mButtonStart.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (mLaunchPreference.isChecked()) { DataBase.db.setHideLaunchPreference(); } start(false); } }); }
private void onTrackProperties(String path) { logger.debug("onTrackProperties({})", path); //TODO Think of better way to find appropriate track for (FileDataSource source : mData) { if (source.path.equals(path)) { mEditedTrack = source.tracks.get(0); break; } } if (mEditedTrack == null) return; Bundle args = new Bundle(2); args.putString(TrackProperties.ARG_NAME, mEditedTrack.name); args.putInt(TrackProperties.ARG_COLOR, mEditedTrack.style.color); Fragment fragment = Fragment.instantiate(this, TrackProperties.class.getName(), args); fragment.setEnterTransition(new Fade()); FragmentTransaction ft = mFragmentManager.beginTransaction(); ft.replace(R.id.contentPanel, fragment, "trackProperties"); ft.addToBackStack("trackProperties"); ft.commit(); updateMapViewArea(); }
@Override public void onDataSourceSelected(@NonNull DataSource source) { Bundle args = new Bundle(3); if (mLocationState != LocationState.DISABLED && mLocationService != null) { Location location = mLocationService.getLocation(); args.putDouble(DataList.ARG_LATITUDE, location.getLatitude()); args.putDouble(DataList.ARG_LONGITUDE, location.getLongitude()); } else { MapPosition position = mMap.getMapPosition(); args.putDouble(DataList.ARG_LATITUDE, position.getLatitude()); args.putDouble(DataList.ARG_LONGITUDE, position.getLongitude()); } args.putInt(DataList.ARG_HEIGHT, mExtendPanel.getHeight()); DataList fragment = (DataList) Fragment.instantiate(this, DataList.class.getName(), args); fragment.setDataSource(source); FragmentTransaction ft = mFragmentManager.beginTransaction(); fragment.setEnterTransition(new Fade()); ft.add(R.id.extendPanel, fragment, "dataList"); ft.addToBackStack("dataList"); ft.commit(); }
@Override protected void onCreate(Bundle savedInstanceState) { if (Utils.hasLollipop()) requestWindowFeature(Window.FEATURE_CONTENT_TRANSITIONS); super.onCreate(savedInstanceState); if (Utils.hasLollipop()) { getWindow().setEnterTransition(new Fade()); } setContentView(R.layout.activity_main); if (BuildConfig.DEBUG) { FlexibleAdapter.enableLogs(Level.VERBOSE); } else { FlexibleAdapter.enableLogs(Level.SUPPRESS); } Log.v("onCreate"); // Initialize Toolbar, Drawer & FAB initializeToolbar(); initializeDrawer(); initializeFab(); // Initialize Fragment containing Adapter & RecyclerView initializeFragment(savedInstanceState); }
@OnClick({ R.id.text1 }) public void onTextClick() { // Create a TransitionSet that will animated ChangeBounds and Fade TransitionSet transitionSet = new TransitionSet(); transitionSet.addTransition(new ChangeBounds()); transitionSet.addTransition(new Fade()); TransitionManager.beginDelayedTransition(mLayout, transitionSet); // Remove text1 from the Layout mLayout.removeView(mText1); // Increase the height of Text1 and set a top margin LinearLayout.LayoutParams params = (LinearLayout.LayoutParams) mText1.getLayoutParams(); params.height *= 2; params.topMargin = 100; mText1.setLayoutParams(params); // Add text1 back to the layout // TransitionManager will automagically apply animations mLayout.addView(mText1, 1); }
@Override protected void onCreate(Bundle savedInstanceState) { if (Utils.hasLollipop()) requestWindowFeature(Window.FEATURE_CONTENT_TRANSITIONS); super.onCreate(savedInstanceState); if (Utils.hasLollipop()) { getWindow().setExitTransition(new Fade()); } Intent intent = new Intent(this, MainActivity.class); ActivityOptionsCompat options = ActivityOptionsCompat.makeSceneTransitionAnimation(this); ActivityCompat.startActivity(this, intent, options.toBundle()); ActivityCompat.finishAfterTransition(this); }
private Fragment addSharedElement(Fragment fragment) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { fragment.setSharedElementEnterTransition(new DetailTransition()); fragment.setEnterTransition(new Fade()); fragment.setSharedElementReturnTransition(new DetailTransition()); } return fragment; }
@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 protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_flash_fix_a); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { Fade fade = new Fade(); fade.excludeTarget(R.id.appBar, true); fade.excludeTarget(android.R.id.statusBarBackground, true); fade.excludeTarget(android.R.id.navigationBarBackground, true); getWindow().setEnterTransition(fade); getWindow().setExitTransition(fade); } final ImageView imageView = (ImageView) findViewById(R.id.flash_fix_xml_activity_a_imageView); Glide.with(this) .load(STARFISH_IMAGE_URL) .centerCrop() .into(imageView); Button button = (Button) findViewById(R.id.flash_fix_xml_activity_a_btn); button.setText(R.string.starfish); button.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(FlashFixProgrammaticActivityA.this, FlashFixProgrammaticActivityB.class); ActivityOptionsCompat options = ActivityOptionsCompat. makeSceneTransitionAnimation(FlashFixProgrammaticActivityA.this, imageView, ViewCompat.getTransitionName(imageView)); startActivity(intent, options.toBundle()); } }); }
public static FullScreenImageFragment newInstance(ArrayList<Poster> imageList, int position) { Bundle args = new Bundle(); args.putParcelableArrayList(ARG_IMAGE_LIST, imageList); args.putInt(ARA_SELECT_POSITION, position); FullScreenImageFragment fragment = new FullScreenImageFragment(); fragment.setArguments(args); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { Fade fade = new Fade(); fade.setDuration(500); fragment.setEnterTransition(fade); } return fragment; }
@Nullable @Override public android.view.View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, Bundle savedInstanceState) { android.view.View v = inflater.inflate(R.layout.fragment_splash, container, false); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { setReturnTransition(new Fade()); } return v; }
private void performTransition() { if (isDestroyed()) { return; } Fragment previousFragment = mFragmentManager.findFragmentById(R.id.fragment_container); Fragment nextFragment = Fragment2.newInstance(); FragmentTransaction fragmentTransaction = mFragmentManager.beginTransaction(); // 1. Exit for Previous Fragment Fade exitFade = new Fade(); exitFade.setDuration(FADE_DEFAULT_TIME); previousFragment.setExitTransition(exitFade); // 2. Shared Elements Transition TransitionSet enterTransitionSet = new TransitionSet(); enterTransitionSet.addTransition(TransitionInflater.from(this).inflateTransition(android.R.transition.move)); enterTransitionSet.setDuration(MOVE_DEFAULT_TIME); enterTransitionSet.setStartDelay(FADE_DEFAULT_TIME); nextFragment.setSharedElementEnterTransition(enterTransitionSet); // 3. Enter Transition for New Fragment Fade enterFade = new Fade(); enterFade.setStartDelay(MOVE_DEFAULT_TIME + FADE_DEFAULT_TIME); enterFade.setDuration(FADE_DEFAULT_TIME); nextFragment.setEnterTransition(enterFade); View logo = ButterKnife.findById(this, R.id.fragment1_logo); fragmentTransaction.addSharedElement(logo, logo.getTransitionName()); fragmentTransaction.replace(R.id.fragment_container, nextFragment); fragmentTransaction.commitAllowingStateLoss(); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // https://guides.codepath.com/android/Shared-Element-Activity-Transition getWindow().requestFeature(Window.FEATURE_CONTENT_TRANSITIONS); getWindow().setExitTransition(new Fade(Fade.OUT)); setContentView(R.layout.activity_main); mSwitch = findViewById(R.id.enable_switch); mSwitchText = findViewById(R.id.enable_text); mAdapter = new MyAdapter(); mList = findViewById(R.id.list); mList.setLayoutManager(new LinearLayoutManager(this)); mList.setAdapter(mAdapter); initLayout(); initEvents(); initSpinner(); if (DataManager.getInstance().hasPermission(getApplicationContext())) { process(); startService(new Intent(this, AlarmService.class)); } Log.d(">>>>ID", PreferenceManager.getInstance().getString(PreferenceManager.FCM_ID)); }