Android Open Source - SSPIA Splash Class






From Project

Back to project page SSPIA.

License

The source code is released under:

MIT License

If you think the Android project SSPIA 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.fiec.sspia.mclass;
//from ww  w .  jav a2s  .  c  o  m
import android.app.Activity;
import android.os.AsyncTask;
import android.util.Log;
import android.widget.ProgressBar;

import com.fiec.ssapp.R;
import com.fiec.sspia.buff.Tag;
import com.fiec.sspia.db.SolarDb;
import com.fiec.sspia.util.MenuSettings;

public class SplashClass extends AsyncTask<Void, Integer, Boolean>{
  
  private SolarDb db;
  private Activity context;
  private ProgressBar progress;
  public String _isChk;
  private static int _POS = 0;
  int progreso = 0;
  
  boolean isdone = false;
  
  public SplashClass(Activity context, ProgressBar progress, SolarDb db){
    this.context = context;
    this.progress = progress;
    this.db = db;
  }
  
  public void initialize() {    
    String[] aux; 
    String[] planets = context.getResources().getStringArray(R.array.theplanets);
    int[] inits = context.getResources().getIntArray(R.array.planetscode);
    int[] inits2 = context.getResources().getIntArray(R.array.satcode);
  
    //progress.setMax(inits.length + inits2.length);
    String[] dats;
    db.createPlanets(planets);
    //publish();
     String[] satellites = context.getResources().getStringArray(R.array.satellites);
     int[] satplanet= context.getResources().getIntArray(R.array.satelliteplanet);
     db.createSatellites(satellites,satplanet);
     //publish();
    for (int i = 0; i < inits.length; i++) {
      dats = context.getResources().getStringArray(inits[i]);
      db.create(dats);
      //publish();
    }
    for (int i = 0; i < inits2.length; i++) {
      dats = context.getResources().getStringArray(inits2[i]);
      db.create(dats);
      //publish();
    }
      
     aux = db.getMarsTemp(db.getIdbyPname("Mars"));
     db.createLog("off", "true", aux[0], aux[1],0);
     
     _isChk = db.getIsCheck();
     //publish();
    context.getActionBar().show();
    //context.onBackPressed();
  }
  
  private void initialize2() {    
    String[] aux; 
    String[] planets = context.getResources().getStringArray(R.array.theplanets);
    int[] inits = context.getResources().getIntArray(R.array.planetscode);
    int[] inits2 = context.getResources().getIntArray(R.array.satcode);
  
    progress.setMax(inits.length + inits2.length);
    String[] dats;
    db.createPlanets(planets);
    publish();
     String[] satellites = context.getResources().getStringArray(R.array.satellites);
     int[] satplanet= context.getResources().getIntArray(R.array.satelliteplanet);
     db.createSatellites(satellites,satplanet);
     publish();
    for (int i = 0; i < inits.length; i++) {
      dats = context.getResources().getStringArray(inits[i]);
      db.create(dats);
      publish();
    }
    for (int i = 0; i < inits2.length; i++) {
      dats = context.getResources().getStringArray(inits2[i]);
      db.create(dats);
      publish();
    }
      
     aux = db.getMarsTemp(db.getIdbyPname("Mars"));
     db.createLog("off", "true", aux[0], aux[1],0);
     
     _isChk = db.getIsCheck();
     publish();
  }
  
  private void publish(){
    progreso++;
    publishProgress(progreso);
  }
  
  public synchronized boolean isDone() throws InterruptedException{
    while(isdone == false){
      wait();
    }
    if(isdone == true) return true;
    else return false;
  }

  @Override
  protected Boolean doInBackground(Void... params) {
    initialize();
    return true;
  }
  
  @Override
  protected void onProgressUpdate(Integer... values) {
    this.progress.setProgress(values[0]);
  }
  
  @Override
  protected void onPostExecute(Boolean result) {
    if(result == true){
      this.isdone = true;
      notify();
      context.getActionBar().show();
      context.onBackPressed();      
    }
  }
}




Java Source Code List

com.fiec.sspia.buff.DefaultNoti.java
com.fiec.sspia.buff.PlanetClass.java
com.fiec.sspia.buff.PlanetSource.java
com.fiec.sspia.buff.Tag.java
com.fiec.sspia.db.Celestial.java
com.fiec.sspia.db.DBHelper.java
com.fiec.sspia.db.DbAuxClass.java
com.fiec.sspia.db.Planets.java
com.fiec.sspia.db.Satellites.java
com.fiec.sspia.db.SolarDb.java
com.fiec.sspia.main.InformationTab.java
com.fiec.sspia.main.SatellitesClass.java
com.fiec.sspia.main.SolarActivity.java
com.fiec.sspia.main.TabsPlanets.java
com.fiec.sspia.mclass.MainClass.java
com.fiec.sspia.mclass.MainFragment.java
com.fiec.sspia.mclass.SSNotific.java
com.fiec.sspia.mclass.SetttingsClass.java
com.fiec.sspia.mclass.SplashClass.java
com.fiec.sspia.system.BroadcastRec.java
com.fiec.sspia.system.SspiaService.java
com.fiec.sspia.system.StartingNotis.java
com.fiec.sspia.util.AbstrCd.java
com.fiec.sspia.util.CdClass.java
com.fiec.sspia.util.CustomInfoAdapter.java
com.fiec.sspia.util.CustomMenuAdapter.java
com.fiec.sspia.util.FillMenuAdapter.java
com.fiec.sspia.util.JSONParser.java
com.fiec.sspia.util.MainGridAdapterClass.java
com.fiec.sspia.util.MenuSettings.java
com.fiec.sspia.util.SSInterfaceNoti.java
com.fiec.sspia.util.SatelliteGridAdapterClass.java
com.fiec.sspia.util.TempClass.java
com.fiec.sspia.util.TransitionClass.java