Last active
July 16, 2017 20:29
-
-
Save azzeddineCH/36af0d5b8006c77362284b7338722f93 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
@Override | |
public void onAnimationStart(Animation animation) { | |
} | |
@Override | |
public void onAnimationEnd(Animation animation) { | |
new Handler().postDelayed(new Runnable() { | |
@Override | |
public void run() { | |
if(FirebaseUtils.isAuth()){ | |
startChatActivity(); | |
}else { | |
AuthFragment authFragment = new AuthFragment(); | |
if(Build.VERSION.SDK_INT>= Build.VERSION_CODES.LOLLIPOP){ | |
/** | |
activity or fragment entry transition and shared elements | |
is available only on API 21 and higher | |
**/ | |
Slide slide = new Slide(Gravity.BOTTOM); | |
slide.setDuration(350); | |
slide.setInterpolator(AnimationUtils.loadInterpolator( | |
getBaseContext(), | |
android.R.interpolator.linear_out_slow_in | |
)); | |
authFragment.setEnterTransition(slide); | |
/** | |
* inflating the shared element transition from the resource folder | |
* **/ | |
authFragment.setSharedElementEnterTransition(TransitionInflater.from(getBaseContext()).inflateTransition(R.transition.move)); | |
} | |
/** | |
* starting the auth fragment calling the support fragment Manger, | |
* with specifying the views that we want to be shared | |
* **/ | |
getSupportFragmentManager() | |
.beginTransaction() | |
.replace(R.id.fragment_container,authFragment) | |
.addSharedElement(findViewById(R.id.chat_me_logo),getResources().getString(R.string.app_name)) | |
.commit(); | |
} | |
} | |
}, | |
750); | |
} | |
@Override | |
public void onAnimationRepeat(Animation animation) { | |
} | |
/** | |
* a method used to start the chat activity | |
*/ | |
private void startChatActivity(){ | |
Intent intent =new Intent(LauncherActivity.this,ChatActivity.class); | |
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK); | |
startActivity(intent); | |
finish(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment