Search in sources :

Example 1 with MainActivity

use of de.tum.in.tumcampusapp.component.ui.overview.MainActivity in project TumCampusApp by TCA-Team.

the class BaseActivity method setUpToolbar.

public void setUpToolbar() {
    String parent = NavUtils.getParentActivityName(this);
    Toolbar toolbar = findViewById(R.id.main_toolbar);
    setSupportActionBar(toolbar);
    if (getSupportActionBar() != null && (parent != null || this instanceof MainActivity)) {
        getSupportActionBar().setDisplayHomeAsUpEnabled(true);
        getSupportActionBar().setHomeButtonEnabled(true);
    }
}
Also used : MainActivity(de.tum.in.tumcampusapp.component.ui.overview.MainActivity) Toolbar(android.support.v7.widget.Toolbar)

Example 2 with MainActivity

use of de.tum.in.tumcampusapp.component.ui.overview.MainActivity in project TumCampusApp by TCA-Team.

the class StartupActivity method startApp.

/**
 * Animates the TUM logo into place (left upper corner) and animates background up.
 * Afterwards {@link MainActivity} gets started
 */
private void startApp() {
    // Get views to be moved
    final View background = findViewById(R.id.startup_background);
    final ImageView tumLogo = findViewById(R.id.startup_tum_logo);
    final TextView loadingText = findViewById(R.id.startup_loading);
    final TextView first = findViewById(R.id.startup_loading_first);
    // Make some position calculations
    final int actionBarHeight = getActionBarHeight();
    final float screenHeight = background.getHeight();
    // Setup animation
    AnimatorSet set = new AnimatorSet();
    set.playTogether(ObjectAnimator.ofFloat(background, "translationY", background.getTranslationX(), actionBarHeight - screenHeight), ObjectAnimator.ofFloat(tumLogo, "alpha", 1, 0, 0), ObjectAnimator.ofFloat(loadingText, "alpha", 1, 0, 0), ObjectAnimator.ofFloat(first, "alpha", 1, 0, 0), ObjectAnimator.ofFloat(tumLogo, "translationY", 0, -screenHeight / 3), ObjectAnimator.ofFloat(loadingText, "translationY", 0, -screenHeight / 3), ObjectAnimator.ofFloat(first, "translationY", 0, -screenHeight / 3));
    set.setInterpolator(new AccelerateDecelerateInterpolator());
    set.addListener(new Animator.AnimatorListener() {

        @Override
        public void onAnimationStart(Animator animation) {
        // NOOP
        }

        @Override
        public void onAnimationEnd(Animator animation) {
            // Start the demo Activity if demo mode is set
            Intent intent = new Intent(StartupActivity.this, MainActivity.class);
            startActivity(intent);
            finish();
            overridePendingTransition(R.anim.fadein, R.anim.fadeout);
        }

        @Override
        public void onAnimationCancel(Animator animation) {
        // NOOP
        }

        @Override
        public void onAnimationRepeat(Animator animation) {
        // NOOP
        }
    });
    set.start();
}
Also used : Animator(android.animation.Animator) ObjectAnimator(android.animation.ObjectAnimator) AccelerateDecelerateInterpolator(android.view.animation.AccelerateDecelerateInterpolator) TextView(android.widget.TextView) AnimatorSet(android.animation.AnimatorSet) Intent(android.content.Intent) ImageView(android.widget.ImageView) MainActivity(de.tum.in.tumcampusapp.component.ui.overview.MainActivity) ImageView(android.widget.ImageView) View(android.view.View) TextView(android.widget.TextView)

Aggregations

MainActivity (de.tum.in.tumcampusapp.component.ui.overview.MainActivity)2 Animator (android.animation.Animator)1 AnimatorSet (android.animation.AnimatorSet)1 ObjectAnimator (android.animation.ObjectAnimator)1 Intent (android.content.Intent)1 Toolbar (android.support.v7.widget.Toolbar)1 View (android.view.View)1 AccelerateDecelerateInterpolator (android.view.animation.AccelerateDecelerateInterpolator)1 ImageView (android.widget.ImageView)1 TextView (android.widget.TextView)1