Android Open Source - videoMerge Splash Activity






From Project

Back to project page videoMerge.

License

The source code is released under:

Apache License

If you think the Android project videoMerge 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.dragonplayer.merge;
//from   w  w  w.  j  a  v a2  s .  c  om
import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.res.AssetManager;
import android.graphics.BitmapFactory;
import android.graphics.BitmapFactory.Options;
import android.os.*;
import android.view.Display;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.LinearLayout.LayoutParams;




//import com.flurry.android.FlurryAgent;
//import com.google.analytics.tracking.android.EasyTracker;
import com.dragonplayer.merge.utils.FileMover;
import com.dragonplayer.merge.utils.Utils;

import java.io.*;
/**
 * 
 * @author ??????
 *
 */
public class SplashActivity extends Activity {
  
  Handler handler;
  
    private class Splash extends AsyncTask {

        protected Integer doInBackground(Void avoid[]) {
            String cmd[] = {
                "ffmpeg", "Cicle Fina.ttf", "01.mp3", "02.mp3", "03.mp3", "04.mp3", "05.mp3", "06.mp3", "07.mp3", "eat.avi", "happybirthday.avi" 
            };
            
            for (int i = 0; i < cmd.length; i++) {
                try {
                    (new FileMover(getAssets().open(cmd[i]), (new StringBuilder("/data/data/com.dragonplayer.merge/")).append(cmd[i]).toString())).moveIt();
                }
                catch(FileNotFoundException filenotfoundexception) {
                    filenotfoundexception.printStackTrace();
                    clearApplicationData();
                    return Integer.valueOf(2);
                }
                catch(IOException ioexception) {
                    ioexception.printStackTrace();
                    return Integer.valueOf(1);
                }
            }

            return Integer.valueOf(0);
        }

        protected Object doInBackground(Object aobj[]) {
            return doInBackground((Void[])aobj);
        }

        protected void onPostExecute(Integer integer) {
            if(integer.intValue() == 0)
                handler.postDelayed(new Runnable() {

                    public void run() {
                        startActivity(new Intent(getBaseContext(), MainActivity.class));
                        finish();
                    }
                }, 500);
            else if(integer.intValue() == 1) {
                android.app.AlertDialog.Builder builder = new android.app.AlertDialog.Builder(SplashActivity.this);
                builder.setTitle("ERROR!").setMessage("You don't have enough free space on your device!").setCancelable(true).setPositiveButton("OK", new android.content.DialogInterface.OnClickListener() {

                    public void onClick(DialogInterface dialoginterface, int i) {
                        dialoginterface.dismiss();
                        finish();
                    }
                });
                
                builder.create().show();
            } 
            else {
                (new Splash()).execute(new Void[0]);
            }
            
            super.onPostExecute(integer);
        }

        protected void onPostExecute(Object obj) {
            onPostExecute((Integer)obj);
        }

        private Splash() {
            super();
        }

        Splash(Splash splash) {
            this();
        }
    }


    public SplashActivity() {
        handler = new Handler();
    }

    public static boolean deleteDir(File file) {
        
      if(file == null || !file.isDirectory()) 
        return file.delete();

      String fileList[];
        fileList = file.list();

        for (int i = 0; i < fileList.length; i++) 
          if(!deleteDir(new File(file, fileList[i])))
              return false;
        
        return file.delete();
  }

    public void clearApplicationData() {
      
        File file = new File(getCacheDir().getParent());
        
        if(!file.exists()) 
          return;

        String fileList[];
        fileList = file.list();

        for (int j = 0; j < fileList.length; j++) {
          if(!fileList[j].equals("lib"))
            deleteDir(new File(file, fileList[j]));
        }
    }

    protected void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        
        setContentView(R.layout.splash_layout);
        
//        ImageView logoimage = (ImageView)findViewById(R.id.logoimglaunchapp);
//        LayoutParams params = (LayoutParams) logoimage.getLayoutParams();
//        
//        Options options = new Options();
//        options.inJustDecodeBounds = true;
//        BitmapFactory.decodeResource(getResources(), R.drawable.launchapp, options);
//        
//        int screenWidth = getResources().getDisplayMetrics().widthPixels;
//        int screenHeight = getResources().getDisplayMetrics().heightPixels;
//        
//        params.height = options.outHeight * (screenWidth / 5 * 4) / options.outWidth;
//        params.width = screenWidth / 5 * 4;
//        
//        logoimage.setLayoutParams(params);
//        
//        Utils.deleteLogToFile();
//        Utils.writeLogToFile("---------------Start App---------------");
        Utils.deleteAllJPGS();
        
        (new Splash(null)).execute(new Void[0]);
    }

    protected void onStart() {
        super.onStart();
    }

    protected void onStop() {
        super.onStop();
    }
}




Java Source Code List

com.dragonplayer.merge.FBLikeActivity.java
com.dragonplayer.merge.FacebookActivity.java
com.dragonplayer.merge.FacebookEventObserver.java
com.dragonplayer.merge.LoadingDialog.java
com.dragonplayer.merge.MainActivity.java
com.dragonplayer.merge.SplashActivity.java
com.dragonplayer.merge.TextInputActivity.java
com.dragonplayer.merge.adapter.FrameListAdapter.java
com.dragonplayer.merge.adapter.FrameSubListAdapter.java
com.dragonplayer.merge.adapter.MediaListAdapter.java
com.dragonplayer.merge.adapter.ProjectListAdapter.java
com.dragonplayer.merge.adapter.ProjectSubListAdapter.java
com.dragonplayer.merge.fragment.AboutFragment.java
com.dragonplayer.merge.fragment.AddAudioFragment.java
com.dragonplayer.merge.fragment.BaseFragment.java
com.dragonplayer.merge.fragment.FinishFragment.java
com.dragonplayer.merge.fragment.FrameFragment.java
com.dragonplayer.merge.fragment.FrameListFragment.java
com.dragonplayer.merge.fragment.GiftFragment.java
com.dragonplayer.merge.fragment.GridFragment.java
com.dragonplayer.merge.fragment.HomeFragment.java
com.dragonplayer.merge.fragment.LockConfirmFragment.java
com.dragonplayer.merge.fragment.LockFragment.java
com.dragonplayer.merge.fragment.UploadConfirmFragment.java
com.dragonplayer.merge.fragment.UploadFragment.java
com.dragonplayer.merge.fragment.UploadInfoFragment.java
com.dragonplayer.merge.fragment.UploadSelectMediaFragment.java
com.dragonplayer.merge.fragment.WorkFragment.java
com.dragonplayer.merge.frames.FrameInfo.java
com.dragonplayer.merge.frames.FramePart.java
com.dragonplayer.merge.frames.FrameView.java
com.dragonplayer.merge.frames.Frame.java
com.dragonplayer.merge.frames.FramesLayout.java
com.dragonplayer.merge.frames.Frames.java
com.dragonplayer.merge.frames.HorizontalListView.java
com.dragonplayer.merge.frames.ProjectFiles.java
com.dragonplayer.merge.frames.timeout.java
com.dragonplayer.merge.utils.AppConnectivity.java
com.dragonplayer.merge.utils.BannerData.java
com.dragonplayer.merge.utils.BitmapManager.java
com.dragonplayer.merge.utils.BitmapUtil.java
com.dragonplayer.merge.utils.Constants.java
com.dragonplayer.merge.utils.DlgWindow1.java
com.dragonplayer.merge.utils.DlgWindow2.java
com.dragonplayer.merge.utils.DlgWindow4.java
com.dragonplayer.merge.utils.DlgWindow5.java
com.dragonplayer.merge.utils.DlgWindow6.java
com.dragonplayer.merge.utils.DlgWindow7.java
com.dragonplayer.merge.utils.DlgWindow8.java
com.dragonplayer.merge.utils.FileMover.java
com.dragonplayer.merge.utils.Flag.java
com.dragonplayer.merge.utils.MLog.java
com.dragonplayer.merge.utils.SingleMediaScanner.java
com.dragonplayer.merge.utils.Utils.java
com.dragonplayer.merge.utils.WeTouch_network_interface.java
com.dragonplayer.merge.utils.WeTouch_uploadImage.java
com.dragonplayer.merge.utils.WebService.java