Android Open Source - interamap Splash Screen






From Project

Back to project page interamap.

License

The source code is released under:

MIT License

If you think the Android project interamap 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.richso.interamap;
/*from   ww w  .ja v  a  2 s. c  om*/
import android.app.Activity;
import android.content.Intent;
import android.os.AsyncTask;
import android.os.Bundle;
import android.widget.ProgressBar;
import com.richso.interamap.utils.L;

public class SplashScreen extends Activity {
    private static final int TIMER_RUNTIME = 5000;
    private ProgressBar progressBar;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_splash);
        init();
        (new LogoTask()).execute();
    }

    private void init() {
        progressBar = (ProgressBar)findViewById(R.id.progressBar);
    }

    private void goToAuthScreen() {
        Intent intent = new Intent(SplashScreen.this, AuthorizationScreen.class);
        startActivity(intent);
        overridePendingTransition(R.anim.fade_in, R.anim.fade_out);
        SplashScreen.this.finish();
    }

    private class LogoTask extends AsyncTask<Void, Integer, Void> {
        private int progress;

        @Override
        protected void onPreExecute() {
            super.onPreExecute();
            progress = 0;
        }

        @Override
        protected Void doInBackground(Void... params) {
            while( progress < TIMER_RUNTIME ) {
                try {
                    Thread.sleep(200);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                    L.e("InterruptedException : " + e.getMessage());
                }
                progress += 200;
                publishProgress(progress);
            }
            return null;
        }

        @Override
        protected void onProgressUpdate(Integer... values) {
            int progress = progressBar.getMax() * values[0] / TIMER_RUNTIME;
            progressBar.setProgress(progress);
        }

        @Override
        protected void onPostExecute(Void aVoid) {
            super.onPostExecute(aVoid);
            goToAuthScreen();
        }
    }

}




Java Source Code List

com.richso.interamap.AuthorizationScreen.java
com.richso.interamap.BaseActivity.java
com.richso.interamap.CategoryScreen.java
com.richso.interamap.HomeScreen.java
com.richso.interamap.MapScreen.java
com.richso.interamap.MoreInfoScreen.java
com.richso.interamap.RegistrationScreen.java
com.richso.interamap.SplashScreen.java
com.richso.interamap.adapter.CategoryAdapter.java
com.richso.interamap.adapter.ImageAdapter.java
com.richso.interamap.adapter.MarkerInfoAdapter.java
com.richso.interamap.dialogue.WarningDialog.java
com.richso.interamap.item.Category.java
com.richso.interamap.item.ItemCategory.java
com.richso.interamap.utils.Constant.java
com.richso.interamap.utils.Device.java
com.richso.interamap.utils.L.java
com.richso.interamap.view.MapFragment.java