Android Open Source - rsmonitor-heartrate Activity Splash






From Project

Back to project page rsmonitor-heartrate.

License

The source code is released under:

GNU General Public License

If you think the Android project rsmonitor-heartrate listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.renaultsport.heartrate;
// w  ww.  jav  a 2 s.c  o  m
import android.app.Activity;
import android.content.DialogInterface;
import android.content.DialogInterface.OnCancelListener;
import android.content.Intent;
import android.media.MediaPlayer;
import android.os.Bundle;
import android.view.animation.AlphaAnimation;
import android.view.animation.Animation;
import android.view.animation.Animation.AnimationListener;
import android.widget.LinearLayout;




public class ActivitySplash extends Activity implements OnCancelListener
{
  private class IntroAnimationListener implements AnimationListener
  {
    private Activity    m_Parent  = null;
    private LinearLayout  m_Layout  = null;
    private int       m_nStep    = 0;


    public IntroAnimationListener (Activity parent, int step)
    {
      m_Parent  = parent;
      m_nStep    = step;
      m_Layout  = (LinearLayout) findViewById (R.id.introAnimation);
    }

    @Override
    public void onAnimationEnd (Animation animation)
    {
      AlphaAnimation localAlphaAnimation = null;
       
      switch (m_nStep)
      {
        case 0 :
          localAlphaAnimation = new AlphaAnimation (0.0F, 1.0F);
          localAlphaAnimation.setDuration    (STEP_TIME);
          localAlphaAnimation.setFillAfter  (true);
          
          m_Layout.setAnimation (localAlphaAnimation);
          localAlphaAnimation.setAnimationListener (this);
        break;

        case 1 :
          localAlphaAnimation = new AlphaAnimation (1.0F, 0.0F);
          localAlphaAnimation.setDuration    (STEP_TIME);
          localAlphaAnimation.setFillAfter  (true);
          
          m_Layout.setAnimation (localAlphaAnimation);
          localAlphaAnimation.setAnimationListener (this);
        break;

        case 2 :
          m_Layout.setBackgroundResource (R.drawable.intro_second);
           
          localAlphaAnimation = new AlphaAnimation (0.0F, 1.0F);
          localAlphaAnimation.setDuration    (STEP_TIME);
          localAlphaAnimation.setFillAfter  (true);
          
          m_Layout.setAnimation (localAlphaAnimation);
          localAlphaAnimation.setAnimationListener (this);
        break;

        case 3 :
          localAlphaAnimation = new AlphaAnimation (1.0F, 0.0F);
          localAlphaAnimation.setDuration    (STEP_TIME);
          localAlphaAnimation.setFillAfter  (true);
          
          m_Layout.setAnimation (localAlphaAnimation);
          localAlphaAnimation.setAnimationListener (this);
        break;

        default :
          m_Parent.startActivity (new Intent (ActivitySplash.this, ActivityWarning.class));
          m_Parent.finish ();
        break;
      }

      m_nStep ++;
    }

    @Override
    public void onAnimationRepeat (Animation animation) { }

    @Override
    public void onAnimationStart (Animation animation) { }
  }




  private static final long    STEP_TIME    = 1600;

  private MediaPlayer        m_MediaPlayer  = null;
  private IntroAnimationListener  m_Listener    = null;




  @Override
  public void onCreate(Bundle bundle)
  {
    super.onCreate (bundle);
    
    setContentView (R.layout.intro);

    m_Listener = new IntroAnimationListener (this, 0);
    m_Listener.onAnimationEnd (null);

    m_MediaPlayer = MediaPlayer.create (getBaseContext (), R.raw.accel);
    m_MediaPlayer.start ();
  }

  @Override
  public void onCancel (DialogInterface dialog)
  {
    if (m_MediaPlayer != null)
    {
      m_MediaPlayer.release ();
      m_MediaPlayer = null;
    }

    finish ();
  }

  @Override
  public void onStop ()
  {
    super.onStop ();

    if (m_MediaPlayer != null)
    {
      m_MediaPlayer.release ();
      m_MediaPlayer = null;
    }

    finish ();
  }
}




Java Source Code List

com.facebook.android.AsyncFacebookRunner.java
com.facebook.android.BaseDialogListener.java
com.facebook.android.BaseRequestListener.java
com.facebook.android.DialogError.java
com.facebook.android.FQLQuery.java
com.facebook.android.FacebookError.java
com.facebook.android.FacebookFunctions.java
com.facebook.android.Facebook.java
com.facebook.android.FbDialog.java
com.facebook.android.FieldsConnectionsDialog.java
com.facebook.android.FriendsGetProfilePics.java
com.facebook.android.FriendsList.java
com.facebook.android.GraphExplorer.java
com.facebook.android.IntentUriHandler.java
com.facebook.android.LoginButton.java
com.facebook.android.PermissionsDialog.java
com.facebook.android.Places.java
com.facebook.android.SessionEvents.java
com.facebook.android.SessionStore.java
com.facebook.android.TokenRefreshDialog.java
com.facebook.android.UpdateStatusResultDialog.java
com.facebook.android.UploadPhotoResultDialog.java
com.facebook.android.Util.java
com.facebook.android.Utility.java
com.googlecode.android.widgets.DateSlider.AlternativeDateSlider.java
com.googlecode.android.widgets.DateSlider.CustomDateSlider.java
com.googlecode.android.widgets.DateSlider.DateSlider.java
com.googlecode.android.widgets.DateSlider.DateTimeSlider.java
com.googlecode.android.widgets.DateSlider.DefaultDateSlider.java
com.googlecode.android.widgets.DateSlider.MonthYearDateSlider.java
com.googlecode.android.widgets.DateSlider.ScrollLayout.java
com.googlecode.android.widgets.DateSlider.TimeSlider.java
com.googlecode.android.widgets.DateSlider.TimeView.java
com.renaultsport.heartrate.ActivityMain.java
com.renaultsport.heartrate.ActivityRecord.java
com.renaultsport.heartrate.ActivitySplash.java
com.renaultsport.heartrate.ActivityUpload.java
com.renaultsport.heartrate.ActivityVideoReader.java
com.renaultsport.heartrate.ActivityWarning.java
com.renaultsport.heartrate.MainApplication.java
com.renaultsport.heartrate.utils.CaptureCamera.java
com.renaultsport.heartrate.utils.ClientThread.java
com.renaultsport.heartrate.utils.Constants.java
com.renaultsport.heartrate.utils.RunEncoder.java
team.stride.tabs.TabGroupActivity.java