This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) | |
{ | |
TransitionManager.beginDelayedTransition(mCoordinatorLayout); | |
} | |
else | |
{ | |
// Transition Magic for APIs 19+ | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) | |
{ | |
TransitionManager.beginDelayedTransition(mCoordinatorLayout); | |
} | |
else | |
{ | |
// Transition Magic for APIs 19+ | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) | |
{ | |
TransitionManager.beginDelayedTransition(mCoordinatorLayout); | |
} | |
else | |
{ | |
// Transition Magic for APIs 19+ | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MainActivity<F extends Fragment & ViewWithSharedElements> extends AppCompatActivity | |
{ | |
private static final long TRANSITION_DEFAULT_TIME = 1000; | |
@BindView(R.id.coordinator_layout) CoordinatorLayout mCoordinatorLayout; | |
private FragmentManager mFragmentManager; | |
@Override | |
protected void onCreate(Bundle savedInstanceState) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void loadInitialFragment() | |
{ | |
F fragment = (F) SimpleFragment.newInstance(R.layout.fragment_logo_center); | |
FragmentTransaction fragmentTransaction = mFragmentManager.beginTransaction(); | |
fragmentTransaction.replace(R.id.fragment_container, fragment); | |
fragmentTransaction.commit(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void setDelayedLoaders() | |
{ | |
Handler h1 = new Handler(); | |
h1.postDelayed(this::transition1, 1000); | |
Handler h2 = new Handler(); | |
h2.postDelayed(this::transition2, 3000); | |
Handler h3 = new Handler(); | |
h3.postDelayed(this::transition3, 5000); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class SimpleFragment extends Fragment implements ViewWithSharedElements | |
{ | |
private static final String RESOURCE_LAYOUT = "RESOURCE_LAYOUT"; | |
private int mLayoutResourceId; | |
@Nullable @BindView(R.id.logo) ImageView mLogo; | |
@Nullable @BindView(R.id.button) ImageButton mButton; | |
public SimpleFragment() | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Enter Transition | |
Fade fade = new Fade(); | |
fade.setStartDelay(TRANSITION_DEFAULT_TIME); | |
toFragment.setEnterTransition(fade); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Enter Transition | |
Fade fade = new Fade(); | |
fade.setStartDelay(TRANSITION_DEFAULT_TIME); | |
toFragment.setEnterTransition(fade); | |
// Exit Transition | |
toFragment.setExitTransition(new Fade()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Enter Shared Elements Transition | |
TransitionSet enterTransitionSet = new TransitionSet(); | |
enterTransitionSet.addTransition(TransitionInflater.from(this).inflateTransition(android.R.transition.move)); | |
enterTransitionSet.setDuration(TRANSITION_DEFAULT_TIME); | |
toFragment.setSharedElementEnterTransition(enterTransitionSet); | |
// Exit Shared Elements Transition | |
TransitionSet exitTransitionSet = new TransitionSet(); | |
exitTransitionSet.addTransition(TransitionInflater.from(this).inflateTransition(android.R.transition.move)); | |
exitTransitionSet.setDuration(TRANSITION_DEFAULT_TIME); |
OlderNewer