Commit 218d555f authored by Luboš Horáček's avatar Luboš Horáček

#306 Kancelář po odhlášení

parent 698a4b89
......@@ -209,7 +209,23 @@ public class MainActivity extends FragmentActivity implements MenuActivity {
replaceLoaderFragment(new AnimationContainerFragment(), R.anim.slide_in, R.anim.slide_out);
}
private void stopAnimations() {
if ((screenDividerView != null) && (screenDividerView.animate() != null)) {
screenDividerView.animate().cancel();
screenDividerView.animate().setListener(null);
}
if ((startPreloaderView != null) && (startPreloaderView.animate() != null)) {
startPreloaderView.animate().cancel();
startPreloaderView.setX(0);
}
if ((screenContainerView != null) && (screenContainerView.animate() != null)) {
screenContainerView.animate().cancel();
}
canHide = false;
}
public void showLoadingScreen(boolean animate, Bundle args) {
stopAnimations();
try {
loaderFragment = LOADER_FRAGMENR_CLASS.newInstance();
if (args != null) {
......@@ -227,10 +243,13 @@ public class MainActivity extends FragmentActivity implements MenuActivity {
}
private boolean canHide = false;
public void hideLoadingScreen(boolean animation) {
final Fragment fragmentToHide = loaderFragment;
loaderFragment = null;
if (animation) {
canHide = true;
screenContainerView.setX((displayWidth + screenDividerView.getWidth()) - 20);
screenDividerView.setX(displayWidth - 20);
screenDividerView.setVisibility(View.VISIBLE);
......@@ -241,8 +260,11 @@ public class MainActivity extends FragmentActivity implements MenuActivity {
screenDividerView.animate().setDuration(START_PRELOADER_ANIM_DURATION).setInterpolator(timeInterpolator).x(-screenDividerView.getWidth()).setListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
hideFragment(fragmentToHide);
screenDividerView.setVisibility(View.INVISIBLE);
if (canHide) {
hideFragment(fragmentToHide);
screenDividerView.setVisibility(View.INVISIBLE);
}
canHide = false;
}
});
} else {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment