Example usage for android.os Handler postDelayed

List of usage examples for android.os Handler postDelayed

Introduction

In this page you can find the example usage for android.os Handler postDelayed.

Prototype

public final boolean postDelayed(Runnable r, long delayMillis) 

Source Link

Document

Causes the Runnable r to be added to the message queue, to be run after the specified amount of time elapses.

Usage

From source file:com.money.manager.ex.reports.IncomeVsExpensesListFragment.java

@Override
public void onLoadFinished(Loader<Cursor> loader, Cursor data) {
    switch (loader.getId()) {
    case ID_LOADER_REPORT:
        //                ((IncomeVsExpensesAdapter) getListAdapter()).swapCursor(data);
        ((IncomeVsExpensesAdapter) getListAdapter()).changeCursor(data);

        if (isResumed()) {
            setListShown(true);//from  w  w w . j  av  a 2 s. c om
        } else {
            setListShownNoAnimation(true);
        }
        // calculate income, expenses
        double income = 0, expenses = 0;
        if (data == null)
            return;

        while (data.moveToNext()) {
            if (data.getInt(data.getColumnIndex(
                    IncomeVsExpenseReportEntity.Month)) != IncomeVsExpensesActivity.SUBTOTAL_MONTH) {
                income += data.getDouble(data.getColumnIndex(IncomeVsExpenseReportEntity.Income));
                expenses += data.getDouble(data.getColumnIndex(IncomeVsExpenseReportEntity.Expenses));
            }
        }
        updateListViewFooter(mFooterListView, income, expenses);
        if (data.getCount() > 0) {
            getListView().removeFooterView(mFooterListView);
            getListView().addFooterView(mFooterListView);
        }

        if (((IncomeVsExpensesActivity) getActivity()).mIsDualPanel) {
            Handler handler = new Handler();
            handler.postDelayed(new Runnable() {
                @Override
                public void run() {
                    showChart();
                }
            }, 1 * 1000);
        }
        break;

    case ID_LOADER_YEARS:
        if (data != null && data.moveToFirst()) {
            while (!data.isAfterLast()) {
                int year = data.getInt(data.getColumnIndex("Year"));
                if (mYearsSelected.get(year, false) == false) {
                    mYearsSelected.put(year, false);
                }
                data.moveToNext();
            }
            startLoader();
        }
    }
}

From source file:com.musiqueplayer.playlistequalizerandroidwear.activities.MainActivity.java

@Override
public void onCreate(Bundle savedInstanceState) {

    sMainActivity = this;
    action = getIntent().getAction();//w ww . j  a v  a2  s.  co m
    AppRater.app_launched(this);
    isDarkTheme = PreferenceManager.getDefaultSharedPreferences(this).getBoolean("dark_theme", true);

    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    navigationMap.put(Constants.NAVIGATE_LIBRARY, navigateLibrary);
    navigationMap.put(Constants.NAVIGATE_PLAYLIST, navigatePlaylist);
    navigationMap.put(Constants.NAVIGATE_QUEUE, navigateQueue);
    navigationMap.put(Constants.NAVIGATE_NOWPLAYING, navigateNowplaying);
    navigationMap.put(Constants.NAVIGATE_TIMER, navigateTimer);
    navigationMap.put(Constants.NAVIGATE_ALBUM, navigateAlbum);
    navigationMap.put(Constants.NAVIGATE_ARTIST, navigateArtist);

    mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
    panelLayout = (SlidingUpPanelLayout) findViewById(R.id.sliding_layout);

    navigationView = (NavigationView) findViewById(R.id.nav_view);
    View header = navigationView.inflateHeaderView(R.layout.nav_header);

    albumart = (ImageView) header.findViewById(R.id.album_art);
    songtitle = (TextView) header.findViewById(R.id.song_title);
    songartist = (TextView) header.findViewById(R.id.song_artist);

    setPanelSlideListeners(panelLayout);

    navDrawerRunnable.postDelayed(new Runnable() {
        @Override
        public void run() {
            setupDrawerContent(navigationView);
            setupNavigationIcons(navigationView);
        }
    }, 700);

    if (TimberUtils.isMarshmallow()) {
        checkPermissionAndThenLoad();
    } else {
        loadEverything();
    }

    addBackstackListener();

    if (Intent.ACTION_VIEW.equals(action)) {
        Handler handler = new Handler();
        handler.postDelayed(new Runnable() {
            @Override
            public void run() {
                MusicPlayer.clearQueue();
                MusicPlayer.openFile(getIntent().getData().getPath());
                stopService(new Intent(getApplicationContext(), TimeService.class));
                if (!MusicPlayer.isPlaying()) {
                    startService(new Intent(getApplicationContext(), TimeService.class));
                }
                MusicPlayer.playOrPause();
                navigateNowplaying.run();
            }
        }, 350);
    }

}

From source file:com.frostytornado.cordova.plugin.ad.admob.Util.java

@TargetApi(Build.VERSION_CODES.HONEYCOMB)
protected void handleLayoutChangeOverlap() {
    getView(plugin.getWebView()).addOnLayoutChangeListener(new View.OnLayoutChangeListener() {

        @Override//from   w w  w .  j  av  a 2  s  . co  m
        public void onLayoutChange(View v, int left, int top, int right, int bottom, int oldLeft, int oldTop,
                int oldRight, int oldBottom) {
            if (left == oldLeft && top == oldTop && right == oldRight && bottom == oldBottom) {
                return;
            }

            Log.d(LOG_TAG, "onLayoutChange");
            //Util.alert(cordova.getActivity(), "onLayoutChange");

            int orientation = Util.getDisplayRotation(plugin.getCordova().getActivity());
            if (orientation != lastOrientation) {
                Log.d(LOG_TAG, String.format("orientation: %d", orientation));
                //Util.alert(cordova.getActivity(), String.format("orientation: %d", orientation));
                if (bannerPreviousSize != null && bannerPreviousSize.equals("SMART_BANNER")) {
                    Log.d(LOG_TAG, String.format("position: %s, size: %s", bannerPreviousPosition,
                            bannerPreviousSize));
                    //Util.alert(cordova.getActivity(), String.format("position: %s, size: %s", position, size));

                    //overlap
                    //http://stackoverflow.com/questions/11281562/android-admob-resize-on-landscape
                    if (bannerView != null) {
                        //if banner is showing
                        RelativeLayout bannerViewLayout = (RelativeLayout) bannerView.getParent();
                        if (bannerViewLayout != null) {
                            //bannerViewLayout.removeView(bannerView);
                            //bannerView.destroy();
                            //bannerView = null;            
                            Log.d(LOG_TAG, String.format("position: %s, size: %s", bannerPreviousPosition,
                                    bannerPreviousSize));
                            //Util.alert(cordova.getActivity(), String.format("position: %s, size: %s", position, size));

                            //http://stackoverflow.com/questions/3072173/how-to-call-a-method-after-a-delay-in-android
                            final Handler handler = new Handler();
                            handler.postDelayed(new Runnable() {
                                @Override
                                public void run() {
                                    _showBannerAd(bannerPreviousPosition, bannerPreviousSize);
                                }
                            }, 1);//after 1ms
                        }
                    }
                }
            }

            lastOrientation = orientation;
        }
    });
}

From source file:se.chalmers.watchme.activity.MovieDetailsActivity.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_movie_details);
    getActionBar().setDisplayHomeAsUpEnabled(true);

    db = new DatabaseAdapter(getContentResolver());

    this.movie = (Movie) getIntent().getSerializableExtra(MOVIE_EXTRA);
    this.imdb = new IMDBHandler();

    this.poster = (ImageView) findViewById(R.id.poster);
    this.poster.setOnClickListener(new OnPosterClickListener());

    this.imdbButton = (Button) findViewById(R.id.browser_button);
    this.imdbButton.setEnabled(false);

    this.tagField = (EditText) findViewById(R.id.tag_field_details);
    this.noteField = (EditText) findViewById(R.id.note_field_details);

    this.myRatingBar = (RatingBar) findViewById(R.id.my_rating_bar);
    this.myRatingBar.setEnabled(false); // Unable to do this in XML (?)

    this.dialog = new ImageDialog(this);

    // Hide the progress spinner on init
    findViewById(R.id.imdb_loading_spinner).setVisibility(View.INVISIBLE);

    /*/*  www .  j a v  a  2  s.c  o  m*/
    * Create a new image download task for the poster image
    */
    this.imageTask = new ImageDownloadTask(new ImageDownloadTask.TaskActions() {

        public void onFinished(Bitmap image) {
            if (image != null) {
                poster.setImageBitmap(image);
            }
        }
    });

    /*
     * If no movie id was received earlier then finish this activity before
     * anything else is done
     */
    if (this.movie == null) {
        // TODO Why does this cause a crash?
        finish();
    }

    // Kick off the fetch for IMDb info IF there's a set API id
    // set.
    if (this.movie.hasApiIDSet()) {
        final AsyncTask<Integer, Void, JSONObject> t = new IMDBTask()
                .execute(new Integer[] { this.movie.getApiID() });

        // Cancel the task after a timeout
        Handler handler = new Handler();
        handler.postDelayed(new Runnable() {

            public void run() {
                if (t.getStatus() == AsyncTask.Status.RUNNING) {
                    t.cancel(true);
                    System.err.println("Fetching IMDb info did timeout");
                }
            }
        }, IMDB_FETCH_TIMEOUT);
    }

    // Populate various view fields from the Movie object
    populateFieldsFromMovie(this.movie);

}

From source file:angeloid.dreamnarae.Save_Main.java

private void DialogProgress(boolean close) {
    if (!close) {
        dialog_save = ProgressDialog.show(getActivity(), "", "Loading..", true);
        Save_ZipTest.startUnzipping_save(getActivity());
        Handler mHandler = new Handler();
        mHandler.postDelayed(new Runnable() {
            @Override//  w w  w  . j av a 2  s  .c o m
            public void run() {
                DialogProgress(true); //  .
                Save_Helper.instantExec_save(getActivity(), "busybox mount -o rw,remount /system ; ");
                StringBuilder save = new StringBuilder();
                try {
                    Thread.sleep(2000);
                    // Mount rw /system
                    save.append("mount -o rw,remount /system;");

                    // Create Folder system/etc/init.d 
                    save.append("mkdir /system/etc/init.d;");

                    // Create run-parts Script Folder
                    save.append("mkdir /system/angeloidteam/dreamnarae;");

                    // Avoid used in conjunction with other scripts
                    save.append("rm /system/etc/init.d/99provision;");
                    save.append("rm /system/etc/init.d/S99SoulTools;");

                    // Delete Flag Files
                    save.append("rm /system/SPiCa;");
                    save.append("rm /system/DN;");
                    save.append("rm /system/Miracle;");
                    save.append("rm /system/Save;");
                    save.append("rm /system/etc/init.d/98banner_dreamnarae_spica;");
                    save.append("rm /system/etc/init.d/98banner_dreamnarae_save;");
                    save.append("rm /system/etc/init.d/98banner_dreamnarae_miracle;");
                    save.append("rm /system/etc/init.d/98banner_dreamnarae_prev;");
                    save.append("rm /system/98banner_dreamnarae_spica;");
                    save.append("rm /system/98banner_dreamnarae_save;");
                    save.append("rm /system/98banner_dreamnarae_miracle;");
                    save.append("rm /system/98banner_dreamnarae_prev;");

                    // Delete old Script Manager Files
                    save.append("rm /system/bin/EnableDN.sh;");
                    save.append("rm /data/DNEnable;");
                    save.append("rm /system/bin/RemoveDN.sh;");
                    save.append("rm /data/DNPrev.sh;");
                    save.append("rm /data/DNSPiCa.sh;");
                    save.append("rm /data/DNSave.sh;");
                    save.append("rm /data/DNMiracle.sh;");

                    // Delete New Script Manager Files
                    save.append("rm /system/etc/install-recovery.sh;");

                    // Delete DreamNarae SPiCa
                    save.append("rm /system/etc/init.d/00prop;");
                    save.append("rm /system/etc/init.d/01io;");
                    save.append("rm /system/etc/init.d/02freq;");
                    save.append("rm /system/etc/init.d/03zipalign;");
                    save.append("rm /system/etc/init.d/01kswapd0;");
                    save.append("rm /system/etc/init.d/02io;");
                    save.append("rm /system/etc/init.d/03freq;");
                    save.append("rm /system/etc/init.d/04zipalign;");
                    save.append("rm /system/angeloidteam/dreamnarae/00prop;");
                    save.append("rm /system/angeloidteam/dreamnarae/01io;");
                    save.append("rm /system/angeloidteam/dreamnarae/02freq;");

                    //Delete DreamNarae Miracle
                    save.append("rm /system/etc/init.d/00set;");
                    save.append("rm /system/etc/init.d/01property;");
                    save.append("rm /system/etc/init.d/02vsls;");
                    save.append("rm /system/etc/init.d/03dch;");
                    save.append("rm /system/etc/init.d/04zip;");
                    save.append("rm /system/angeloidteam/dreamnarae/00set;");
                    save.append("rm /system/angeloidteam/dreamnarae/01property;");
                    save.append("rm /system/angeloidteam/dreamnarae/02vsls;");
                    save.append("rm /system/angeloidteam/dreamnarae/03dch;");

                    //Delete DreamNarae Save
                    save.append("rm /system/etc/init.d/00sp;");
                    save.append("rm /system/etc/init.d/01v;");
                    save.append("rm /system/etc/init.d/02deep;");
                    save.append("rm /system/etc/init.d/03zip;");
                    save.append("rm /system/angeloidteam/dreamnarae/00sp;");
                    save.append("rm /system/angeloidteam/dreamnarae/01v;");
                    save.append("rm /system/angeloidteam/dreamnarae/02deep;");

                    // Delete DreamNarae Prev
                    save.append("rm /system/etc/init.d/00proppv;");
                    save.append("rm /system/etc/init.d/01kswapd0pv;");
                    save.append("rm /system/etc/init.d/02iopv;");
                    save.append("rm /system/etc/init.d/03freqpv;");
                    save.append("rm /system/etc/init.d/04zippv;");
                    save.append("rm /system/etc/init.d/01iopv;");
                    save.append("rm /system/etc/init.d/02freqpv;");
                    save.append("rm /system/angeloidteam/dreamnarae/00propv;");
                    save.append("rm /system/angeloidteam/dreamnarae/01iopv;");
                    save.append("rm /system/angeloidteam/dreamnarae/02freqpv;");

                    // Copy save Files to /system/
                    save.append("cat /data/data/angeloid.dreamnarae/files/00sp > /system/etc/init.d/00sp;");
                    save.append("cat /data/data/angeloid.dreamnarae/files/01v > /system/etc/init.d/01v;");
                    save.append("cat /data/data/angeloid.dreamnarae/files/02deep > /system/etc/init.d/02deep;");
                    save.append(
                            "cat /data/data/angeloid.dreamnarae/files/98banner_dreamnarae_save > /system/98banner_dreamnarae_save;");
                    save.append(
                            "cat /data/data/angeloid.dreamnarae/files/install-recovery.sh > /system/etc/install-recovery.sh;");

                    // Copy run-parts /system/angeloidteam/dreamnarae
                    save.append(
                            "cat /data/data/angeloid.dreamnarae/files/00sp > /system/angeloidteam/dreamnarae/00sp;");
                    save.append(
                            "cat /data/data/angeloid.dreamnarae/files/01v > /system/angeloidteam/dreamnarae/01v;");
                    save.append(
                            "cat /data/data/angeloid.dreamnarae/files/02deep > /system/angeloidteam/dreamnarae/02deep;");

                    // Delete Download Files
                    save.append("rm /data/data/angeloid.dreamnarae.save/files/00sp;");
                    save.append("rm /data/data/angeloid.dreamnarae.save/files/01v;");
                    save.append("rm /data/data/angeloid.dreamnarae.save/files/02deep;");
                    save.append("rm /data/data/angeloid.dreamnarae.save/files/98banner_dreamnarae_save;");
                    save.append("rm /data/data/angeloid.dreamnarae.save/files/install-recovery.sh;");

                    // Permission save Files
                    save.append("chmod 755 /system/etc/init.d/00sp;");
                    save.append("chmod 755 /system/etc/init.d/01v;");
                    save.append("chmod 755 /system/etc/init.d/02deep;");
                    save.append("chmod 755 /system/98banner_dreamnarae_save;");
                    save.append("chmod 755 /system/etc/install-recovery.sh;");

                    // Permission run-parts
                    save.append("chmod 755 /system/angeloidteam/dreamnarae/00sp;");
                    save.append("chmod 755 /system/angeloidteam/dreamnarae/01v;");
                    save.append("chmod 755 /system/angeloidteam/dreamnarae/02deep;");

                    // Mount ro /system
                    save.append("busybox mount -o ro,remount /system;");

                    // Reboot Device(Only to Progress1)
                    save.append("reboot;");

                    try {
                        Thread.sleep(3000);
                        Save_Helper.instantExec_save(getActivity(), save.toString());

                    } catch (InterruptedException e) {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
                    }

                } catch (InterruptedException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }
        }, 10000);
    } else {
        dialog_save.dismiss(); // DialogProgress(true) ,false 
    }
}

From source file:angeloid.dreamnarae.Prev_Main.java

 private void DialogProgress1(boolean close) {
   if (!close) {//from  w w  w.j ava2  s . co m
      dialog_prev1 = ProgressDialog.show(getActivity(), "", "Loading..",
            true);
      Prev_ZipTest.startUnzipping_prev(getActivity());
      Handler mHandler1 = new Handler();
      mHandler1.postDelayed(new Runnable() {
         @Override
         public void run() {
            DialogProgress1(true); //  .
            Prev_Helper.instantExec_prev(getActivity(),
                  "busybox mount -o rw,remount /system ; ");
            StringBuilder prev = new StringBuilder();
            try {
               Thread.sleep(2000);
               // Mount rw /system
               prev.append("mount -o rw,remount /system;");
                  
               // Create Folder system/etc/init.d 
               prev.append("mkdir /system/etc/init.d;");
                  
               // Create run-parts Script Folder
               prev.append("mkdir /system/angeloidteam/dreamnarae;");

               // Avoid used in conjunction with other scripts
               prev.append("rm /system/etc/init.d/99provision;");
               prev.append("rm /system/etc/init.d/S99SoulTools;");
                  
               // Delete Flag Files
               prev.append("rm /system/SPiCa;");
               prev.append("rm /system/DN;");
               prev.append("rm /system/Miracle;");
               prev.append("rm /system/Save;");
               prev.append("rm /system/etc/init.d/98banner_dreamnarae_spica;");
               prev.append("rm /system/etc/init.d/98banner_dreamnarae_prev;");
               prev.append("rm /system/etc/init.d/98banner_dreamnarae_save;");
               prev.append("rm /system/etc/init.d/98banner_dreamnarae_miracle;");
               prev.append("rm /system/98banner_dreamnarae_spica;");
               prev.append("rm /system/98banner_dreamnarae_prev;");
               prev.append("rm /system/98banner_dreamnarae_save;");
               prev.append("rm /system/98banner_dreamnarae_miracle;");

               // Delete old Script Manager Files
               prev.append("rm /system/bin/EnableDN.sh;");
               prev.append("rm /data/DNEnable;");
               prev.append("rm /system/bin/RemoveDN.sh;");
               prev.append("rm /data/DNPrev.sh;");
               prev.append("rm /data/DNSPiCa.sh;");
               prev.append("rm /data/DNSave.sh;");
               prev.append("rm /data/DNMiracle.sh;");

               // Delete New Script Manager Files
               prev.append("rm /system/etc/install-recovery.sh;");

               // Delete DreamNarae SPiCa
               prev.append("rm /system/etc/init.d/00prop;");
               prev.append("rm /system/etc/init.d/01io;");
               prev.append("rm /system/etc/init.d/02freq;");
               prev.append("rm /system/etc/init.d/03zipalign;");
               prev.append("rm /system/etc/init.d/01kswapd0;");
               prev.append("rm /system/etc/init.d/02io;");
               prev.append("rm /system/etc/init.d/03freq;");
               prev.append("rm /system/etc/init.d/04zipalign;");
               prev.append("rm /system/angeloidteam/dreamnarae/00prop;");
               prev.append("rm /system/angeloidteam/dreamnarae/01io;");
               prev.append("rm /system/angeloidteam/dreamnarae/02freq;");

               //Delete DreamNarae Miracle
               prev.append("rm /system/etc/init.d/00set;");
               prev.append("rm /system/etc/init.d/01property;");
               prev.append("rm /system/etc/init.d/02vsls;");
               prev.append("rm /system/etc/init.d/03dch;");
               prev.append("rm /system/etc/init.d/04zip;");
               prev.append("rm /system/angeloidteam/dreamnarae/00set;");
               prev.append("rm /system/angeloidteam/dreamnarae/01property;");
               prev.append("rm /system/angeloidteam/dreamnarae/02vsls;");
               prev.append("rm /system/angeloidteam/dreamnarae/03dch;");

               //Delete DreamNarae Save
               prev.append("rm /system/etc/init.d/00sp;");
               prev.append("rm /system/etc/init.d/01v;");
               prev.append("rm /system/etc/init.d/02deep;");
               prev.append("rm /system/etc/init.d/03zip;");
               prev.append("rm /system/angeloidteam/dreamnarae/00sp;");
               prev.append("rm /system/angeloidteam/dreamnarae/01v;");
               prev.append("rm /system/angeloidteam/dreamnarae/02deep;");

               // Delete DreamNarae Prev
               prev.append("rm /system/etc/init.d/00proppv;");
               prev.append("rm /system/etc/init.d/01kswapd0pv;");
               prev.append("rm /system/etc/init.d/02iopv;");
               prev.append("rm /system/etc/init.d/03freqpv;");
               prev.append("rm /system/etc/init.d/04zippv;");
               prev.append("rm /system/etc/init.d/01iopv;");
               prev.append("rm /system/etc/init.d/02freqpv;");
               prev.append("rm /system/angeloidteam/dreamnarae/00propv;");
               prev.append("rm /system/angeloidteam/dreamnarae/01iopv;");
               prev.append("rm /system/angeloidteam/dreamnarae/02freqpv;");

               // Copy Prev Files to /system/
               prev.append("cat /data/data/angeloid.dreamnarae/files/00proppv > /system/etc/init.d/00proppv;");
               prev.append("cat /data/data/angeloid.dreamnarae/files/01iopv > /system/etc/init.d/01iopv;");
               prev.append("cat /data/data/angeloid.dreamnarae/files/02freqpv > /system/etc/init.d/02freqpv;");
               prev.append("cat /data/data/angeloid.dreamnarae/files/98banner_dreamnarae_prev > /system/98banner_dreamnarae_prev;");
               prev.append("cat /data/data/angeloid.dreamnarae/files/install-recovery.sh > /system/etc/install-recovery.sh;");

               // Copy run-parts /system/angeloidteam/dreamnarae
               prev.append("cat /data/data/angeloid.dreamnarae/files/00proppv > /system/angeloidteam/dreamnarae/00proppv;");
               prev.append("cat /data/data/angeloid.dreamnarae/files/01iopv >  /system/angeloidteam/dreamnarae/01iopv;");
               prev.append("cat /data/data/angeloid.dreamnarae/files/02freqpv > /system/angeloidteam/dreamnarae/02freqpv;");
                  
               // Delete Download Files
               prev.append("rm /data/data/angeloid.dreamnarae/files/00proppv;");
               prev.append("rm /data/data/angeloid.dreamnarae/files/01iopv;");
               prev.append("rm /data/data/angeloid.dreamnarae/files/02freqpv;");
               prev.append("rm /data/data/angeloid.dreamnarae/files/install-recovery.sh;");
               prev.append("rm /data/data/angeloid.dreamnarae/files/98banner_dreamnarae_prev;");

               // Permission prev Files
               prev.append("chmod 755 /system/etc/init.d/00proppv;");
               prev.append("chmod 755 /system/etc/init.d/01iopv;");
               prev.append("chmod 755 /system/etc/init.d/02freqpv;");
               prev.append("chmod 755 /system/98banner_dreamnarae_prev;");
               prev.append("chmod 755 /system/etc/install-recovery.sh;");
                  
               // Permission run-parts
               prev.append("chmod 755 /system/angeloidteam/dreamnarae/00proppv;");
               prev.append("chmod 755 /system/angeloidteam/dreamnarae/01iopv;");
               prev.append("chmod 755 /system/angeloidteam/dreamnarae/02freqpv;");

               // Mount ro /system
               prev.append("busybox mount -o ro,remount /system;");

               // Reboot Device(Only to Progress1)
               prev.append("reboot;");

               try {
                  Thread.sleep(3000);
                  Prev_Helper.instantExec_prev(getActivity(),
                        prev.toString());

               } catch (InterruptedException e) {
                  // TODO Auto-generated catch block
                  e.printStackTrace();
               }

            } catch (InterruptedException e) {
               // TODO Auto-generated catch block
               e.printStackTrace();
            }
         }
      }, 10000);
   } else {
      dialog_prev1.dismiss(); // DialogProgress(true) ,false
                        // 
   }

}

From source file:angeloid.dreamnarae.SPiCa_Main.java

private void DialogProgress(boolean close) {
    if (!close) {
        dialog_spica = ProgressDialog.show(getActivity(), "", "Loading..", true);
        SPiCa_ZipTest.startUnzipping_spica(getActivity());
        Handler mHandler = new Handler();
        mHandler.postDelayed(new Runnable() {
            @Override// w  ww  .j a  v  a  2s.  c  o m
            public void run() {
                DialogProgress(true); //  .
                SPiCa_Helper.instantExec_spica(getActivity(), "busybox mount -o rw,remount /system ; ");
                StringBuilder spica = new StringBuilder();
                try {
                    Thread.sleep(2000);
                    // Mount rw /system
                    spica.append("mount -o rw,remount /system;");

                    // Create Folder system/etc/init.d 
                    spica.append("mkdir /system/etc/init.d;");

                    // Create run-parts Script Folder
                    spica.append("mkdir /system/angeloidteam/dreamnarae;");

                    // Avoid used in conjunction with other scripts
                    spica.append("rm /system/etc/init.d/99provision;");
                    spica.append("rm /system/etc/init.d/S99SoulTools;");

                    // Delete Flag Files
                    spica.append("rm /system/SPiCa;");
                    spica.append("rm /system/DN;");
                    spica.append("rm /system/miracle;");
                    spica.append("rm /system/Save;");
                    spica.append("rm /system/etc/init.d/98banner_dreamnarae_spica;");
                    spica.append("rm /system/etc/init.d/98banner_dreamnarae_prev;");
                    spica.append("rm /system/etc/init.d/98banner_dreamnarae_save;");
                    spica.append("rm /system/etc/init.d/98banner_dreamnarae_miracle;");
                    spica.append("rm /system/98banner_dreamnarae_spica;");
                    spica.append("rm /system/98banner_dreamnarae_prev;");
                    spica.append("rm /system/98banner_dreamnarae_save;");
                    spica.append("rm /system/98banner_dreamnarae_miracle;");

                    // Delete old Script Manager Files
                    spica.append("rm /system/bin/EnableDN.sh;");
                    spica.append("rm /data/DNEnable;");
                    spica.append("rm /system/bin/RemoveDN.sh;");
                    spica.append("rm /data/DNPrev.sh;");
                    spica.append("rm /data/DNSPiCa.sh;");
                    spica.append("rm /data/DNSave.sh;");
                    spica.append("rm /data/DNMiracle.sh;");

                    // Delete New Script Manager Files
                    spica.append("rm /system/etc/install-recovery.sh;");

                    // Delete DreamNarae SPiCa
                    spica.append("rm /system/etc/init.d/00prop;");
                    spica.append("rm /system/etc/init.d/01io;");
                    spica.append("rm /system/etc/init.d/02freq;");
                    spica.append("rm /system/etc/init.d/03zipalign;");
                    spica.append("rm /system/etc/init.d/01kswapd0;");
                    spica.append("rm /system/etc/init.d/02io;");
                    spica.append("rm /system/etc/init.d/03freq;");
                    spica.append("rm /system/etc/init.d/04zipalign;");
                    spica.append("rm /system/angeloidteam/dreamnarae/00prop;");
                    spica.append("rm /system/angeloidteam/dreamnarae/01io;");
                    spica.append("rm /system/angeloidteam/dreamnarae/02freq;");

                    //Delete DreamNarae Miracle
                    spica.append("rm /system/etc/init.d/00set;");
                    spica.append("rm /system/etc/init.d/01property;");
                    spica.append("rm /system/etc/init.d/02vsls;");
                    spica.append("rm /system/etc/init.d/03dch;");
                    spica.append("rm /system/etc/init.d/04zip;");
                    spica.append("rm /system/angeloidteam/dreamnarae/00set;");
                    spica.append("rm /system/angeloidteam/dreamnarae/01property;");
                    spica.append("rm /system/angeloidteam/dreamnarae/02vsls;");
                    spica.append("rm /system/angeloidteam/dreamnarae/03dch;");

                    //Delete DreamNarae Save
                    spica.append("rm /system/etc/init.d/00sp;");
                    spica.append("rm /system/etc/init.d/01v;");
                    spica.append("rm /system/etc/init.d/02deep;");
                    spica.append("rm /system/etc/init.d/03zip;");
                    spica.append("rm /system/angeloidteam/dreamnarae/00sp;");
                    spica.append("rm /system/angeloidteam/dreamnarae/01v;");
                    spica.append("rm /system/angeloidteam/dreamnarae/02deep;");

                    // Delete DreamNarae Prev
                    spica.append("rm /system/etc/init.d/00proppv;");
                    spica.append("rm /system/etc/init.d/01kswapd0pv;");
                    spica.append("rm /system/etc/init.d/02iopv;");
                    spica.append("rm /system/etc/init.d/03freqpv;");
                    spica.append("rm /system/etc/init.d/04zippv;");
                    spica.append("rm /system/etc/init.d/01iopv;");
                    spica.append("rm /system/etc/init.d/02freqpv;");
                    spica.append("rm /system/angeloidteam/dreamnarae/00propv;");
                    spica.append("rm /system/angeloidteam/dreamnarae/01iopv;");
                    spica.append("rm /system/angeloidteam/dreamnarae/02freqpv;");

                    // Copy spica Files to /system/
                    spica.append(
                            "cat /data/data/angeloid.dreamnarae/files/00prop > /system/etc/init.d/00prop;");
                    spica.append("cat /data/data/angeloid.dreamnarae/files/01io > /system/etc/init.d/01io;");
                    spica.append(
                            "cat /data/data/angeloid.dreamnarae/files/02freq > /system/etc/init.d/02freq;");
                    spica.append(
                            "cat /data/data/angeloid.dreamnarae/files/98banner_dreamnarae_spica > /system/98banner_dreamnarae_spica;");
                    spica.append(
                            "cat /data/data/angeloid.dreamnarae/files/install-recovery.sh > /system/etc/install-recovery.sh;");

                    // Copy run-parts /system/angeloidteam/dreamnarae
                    spica.append(
                            "cat /data/data/angeloid.dreamnarae/files/00prop > /system/angeloidteam/dreamnarae/00prop;");
                    spica.append(
                            "cat /data/data/angeloid.dreamnarae/files/01io > /system/angeloidteam/dreamnarae/01io;");
                    spica.append(
                            "cat /data/data/angeloid.dreamnarae/files/02freq > /system/angeloidteam/dreamnarae/02freq;");

                    // Delete Download Files
                    spica.append("rm /data/data/angeloid.dreamnarae/files/00prop;");
                    spica.append("rm /data/data/angeloid.dreamnarae/files/01io;");
                    spica.append("rm /data/data/angeloid.dreamnarae/files/02freq;");
                    spica.append("rm /data/data/angeloid.dreamnarae/files/98banner_dreamnarae_spica;");
                    spica.append("rm /data/data/angeloid.dreamnarae/files/install-recovery.sh;");

                    // Permission spica Files
                    spica.append("chmod 755 /system/etc/init.d/00prop;");
                    spica.append("chmod 755 /system/etc/init.d/01io;");
                    spica.append("chmod 755 /system/etc/init.d/02freq;");
                    spica.append("chmod 755 /system/98banner_dreamnarae_spica;");
                    spica.append("chmod 755 /system/etc/install-recovery.sh;");

                    // Permission run-parts
                    spica.append("chmod 755 /system/angeloidteam/dreamnarae/00prop;");
                    spica.append("chmod 755 /system/angeloidteam/dreamnarae/01io;");
                    spica.append("chmod 755 /system/angeloidteam/dreamnarae/02freq;");

                    // Mount ro /system
                    spica.append("busybox mount -o ro,remount /system;");

                    // Reboot Device(Only to Progress1)
                    spica.append("reboot;");

                    try {
                        Thread.sleep(3000);
                        SPiCa_Helper.instantExec_spica(getActivity(), spica.toString());

                    } catch (InterruptedException e) {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
                    }

                } catch (InterruptedException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }
        }, 10000);
    } else {
        dialog_spica.dismiss(); // DialogProgress(true) ,false 
    }
}

From source file:com.liato.bankdroid.WebViewActivity.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.webview);/*from   w w  w. j av a 2s. com*/
    this.addTitleButton(R.drawable.title_icon_back, "back", this);
    this.addTitleButton(R.drawable.title_icon_forward, "forward", this);
    this.addTitleButton(R.drawable.title_icon_refresh, "refresh", this);
    this.setTitleButtonEnabled("forward", false);
    this.setTitleButtonEnabled("back", false);
    this.setTitleButtonEnabled("refresh", false);

    final CookieSyncManager csm = CookieSyncManager.createInstance(this);
    mWebView = (WebView) findViewById(R.id.wvBank);
    mWebView.setBackgroundColor(0);
    mWebView.getSettings().setJavaScriptEnabled(true);
    mWebView.getSettings().setBuiltInZoomControls(true);
    mWebView.getSettings().setUserAgentString(Urllib.DEFAULT_USER_AGENT);
    mWebView.setScrollBarStyle(WebView.SCROLLBARS_OUTSIDE_OVERLAY);

    mWebView.setWebChromeClient(new WebChromeClient() {
        public void onProgressChanged(WebView view, int progress) {
            activity.setProgressBar(progress);
            if (progress == 100) {
                Handler handler = new Handler();
                Runnable runnable = new Runnable() {
                    public void run() {
                        activity.hideProgressBar();
                    }
                };
                // Let the progress bar hit 100% before we hide it.
                handler.postDelayed(runnable, 100);

            } else if (mFirstPageLoaded) {
                activity.showProgressBar();
            }
        }
    });
    mWebView.setWebViewClient(new BankWebViewClient());
    String preloader = "Error...";
    try {
        preloader = IOUtils.toString(getResources().openRawResource(R.raw.loading));
        preloader = String.format(preloader, "", // Javascript function
                "" // HTML
        );
    } catch (NotFoundException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    mWebView.loadDataWithBaseURL("what://is/this/i/dont/even", preloader, "text/html", "utf-8", null);

    Bundle extras = getIntent().getExtras();
    final long bankId = extras.getLong("bankid", -1);
    //final long bankId = -1;
    if (bankId >= 0) {
        Runnable generateLoginPage = new Runnable() {
            public void run() {
                Bank bank = BankFactory.bankFromDb(bankId, WebViewActivity.this, false);
                SessionPackage loginPackage = bank.getSessionPackage(WebViewActivity.this);
                CookieStore cookieStore = loginPackage.getCookiestore();
                if ((cookieStore != null) && !cookieStore.getCookies().isEmpty()) {
                    CookieManager cookieManager = CookieManager.getInstance();
                    String cookieString;
                    for (Cookie cookie : cookieStore.getCookies()) {
                        cookieString = String.format("%s=%s;%spath=%s; domain=%s;", cookie.getName(),
                                cookie.getValue(),
                                cookie.getExpiryDate() == null ? ""
                                        : "expires=" + cookie.getExpiryDate() + "; ",
                                cookie.getPath() == null ? "/" : cookie.getPath(), cookie.getDomain());
                        cookieManager.setCookie(cookie.getDomain(), cookieString);
                    }
                    csm.sync();
                }
                mWebView.loadDataWithBaseURL("what://is/this/i/dont/even", loginPackage.getHtml(), "text/html",
                        "utf-8", null);
            }
        };
        new Thread(generateLoginPage).start();
    }
}

From source file:angeloid.dreamnarae.Prev_Main.java

 private void DialogProgress2(boolean close) {
   if (!close) {/*from   www  .  j  a  va 2s  .c o m*/
      dialog_prev2 = ProgressDialog.show(getActivity(), "", "Loading..",
            true);
      Prev_ZipTest.startUnzipping_prev(getActivity());
      Handler mHandler2 = new Handler();
      mHandler2.postDelayed(new Runnable() {
         @Override
         public void run() {
            DialogProgress2(true); //  .
            Prev_Helper2.instantExec_prev2(getActivity(),
                  "busybox mount -o rw,remount /system ; ");
            StringBuilder prev2 = new StringBuilder();
            try {
               Thread.sleep(2000);
               // Mount rw /system
               prev2.append("mount -o rw,remount /system;");
                  
               // Create Folder system/etc/init.d 
               prev2.append("mkdir /system/etc/init.d;");
                  
               // Create run-parts Script Folder
               prev2.append("mkdir /system/angeloidteam/dreamnarae;");
                  
               // Avoid used in conjunction with other scripts
               prev2.append("rm /system/etc/init.d/99provision;");
               prev2.append("rm /system/etc/init.d/S99SoulTools;");

               // Delete Flag Files
               prev2.append("rm /system/SPiCa;");
               prev2.append("rm /system/DN;");
               prev2.append("rm /system/Miracle;");
               prev2.append("rm /system/Save;");
               prev2.append("rm /system/etc/init.d/98banner_dreamnarae_spica;");
               prev2.append("rm /system/etc/init.d/98banner_dreamnarae_prev;");
               prev2.append("rm /system/etc/init.d/98banner_dreamnarae_save;");
               prev2.append("rm /system/etc/init.d/98banner_dreamnarae_miracle;");
               prev2.append("rm /system/98banner_dreamnarae_spica;");
               prev2.append("rm /system/98banner_dreamnarae_prev;");
               prev2.append("rm /system/98banner_dreamnarae_save;");
               prev2.append("rm /system/98banner_dreamnarae_miracle;");

               // Delete old Script Manager Files
               prev2.append("rm /system/bin/EnableDN.sh;");
               prev2.append("rm /data/DNEnable;");
               prev2.append("rm /system/bin/RemoveDN.sh;");
               prev2.append("rm /data/DNPrev.sh;");
               prev2.append("rm /data/DNSPiCa.sh;");
               prev2.append("rm /data/DNSave.sh;");
               prev2.append("rm /data/DNMiracle.sh;");

               // Delete New Script Manager Files
               prev2.append("rm /system/etc/install-recovery.sh;");

               // Delete DreamNarae SPiCa
               prev2.append("rm /system/etc/init.d/00prop;");
               prev2.append("rm /system/etc/init.d/01io;");
               prev2.append("rm /system/etc/init.d/02freq;");
               prev2.append("rm /system/etc/init.d/03zipalign;");
               prev2.append("rm /system/etc/init.d/01kswapd0;");
               prev2.append("rm /system/etc/init.d/02io;");
               prev2.append("rm /system/etc/init.d/03freq;");
               prev2.append("rm /system/etc/init.d/04zipalign;");
               prev2.append("rm /system/angeloidteam/dreamnarae/00prop;");
               prev2.append("rm /system/angeloidteam/dreamnarae/01io;");
               prev2.append("rm /system/angeloidteam/dreamnarae/02freq;");

               //Delete DreamNarae Miracle
               prev2.append("rm /system/etc/init.d/00set;");
               prev2.append("rm /system/etc/init.d/01property;");
               prev2.append("rm /system/etc/init.d/02vsls;");
               prev2.append("rm /system/etc/init.d/03dch;");
               prev2.append("rm /system/etc/init.d/04zip;");
               prev2.append("rm /system/angeloidteam/dreamnarae/00set;");
               prev2.append("rm /system/angeloidteam/dreamnarae/01property;");
               prev2.append("rm /system/angeloidteam/dreamnarae/02vsls;");
               prev2.append("rm /system/angeloidteam/dreamnarae/03dch;");

               //Delete DreamNarae Save
               prev2.append("rm /system/etc/init.d/00sp;");
               prev2.append("rm /system/etc/init.d/01v;");
               prev2.append("rm /system/etc/init.d/02deep;");
               prev2.append("rm /system/etc/init.d/03zip;");
               prev2.append("rm /system/angeloidteam/dreamnarae/00sp;");
               prev2.append("rm /system/angeloidteam/dreamnarae/01v;");
               prev2.append("rm /system/angeloidteam/dreamnarae/02deep;");

               // Delete DreamNarae Prev
               prev2.append("rm /system/etc/init.d/00proppv;");
               prev2.append("rm /system/etc/init.d/01kswapd0pv;");
               prev2.append("rm /system/etc/init.d/02iopv;");
               prev2.append("rm /system/etc/init.d/03freqpv;");
               prev2.append("rm /system/etc/init.d/04zippv;");
               prev2.append("rm /system/etc/init.d/01iopv;");
               prev2.append("rm /system/etc/init.d/02freqpv;");
               prev2.append("rm /system/angeloidteam/dreamnarae/00propv;");
               prev2.append("rm /system/angeloidteam/dreamnarae/01iopv;");
               prev2.append("rm /system/angeloidteam/dreamnarae/02freqpv;");
                  
               // Copy Prev Files to /system/
               prev2.append("cat /data/data/angeloid.dreamnarae/files/00proppv > /system/etc/init.d/00proppv;");
               prev2.append("cat /data/data/angeloid.dreamnarae/files/01iopv > /system/etc/init.d/01iopv;");
               prev2.append("cat /data/data/angeloid.dreamnarae/files/02freqpv > /system/etc/init.d/02freqpv;");
               prev2.append("cat /data/data/angeloid.dreamnarae/files/98banner_dreamnarae_prev > /system/98banner_dreamnarae_prev;");
               prev2.append("cat /data/data/angeloid.dreamnarae/files/install-recovery.sh > /system/etc/install-recovery.sh;");

               // Copy run-parts /system/angeloidteam/dreamnarae
               prev2.append("cat /data/data/angeloid.dreamnarae/files/00proppv > /system/angeloidteam/dreamnarae/00proppv;");
               prev2.append("cat /data/data/angeloid.dreamnarae/files/01iopv >  /system/angeloidteam/dreamnarae/01iopv;");
               prev2.append("cat /data/data/angeloid.dreamnarae/files/02freqpv > /system/angeloidteam/dreamnarae/02freqpv;");
                  
               // Delete Download Files
               prev2.append("rm /data/data/angeloid.dreamnarae/files/00proppv;");
               prev2.append("rm /data/data/angeloid.dreamnarae/files/01iopv;");
               prev2.append("rm /data/data/angeloid.dreamnarae/files/02freqpv;");
               prev2.append("rm /data/data/angeloid.dreamnarae/files/install-recovery.sh;");
               prev2.append("rm /data/data/angeloid.dreamnarae/files/98banner_dreamnarae_prev;");

               // Permission prev Files
               prev2.append("chmod 755 /system/etc/init.d/00proppv;");
               prev2.append("chmod 755 /system/etc/init.d/01iopv;");
               prev2.append("chmod 755 /system/etc/init.d/02freqpv;");
               prev2.append("chmod 755 /system/98banner_dreamnarae_prev;");
               prev2.append("chmod 755 /system/etc/install-recovery.sh;");
                  
               // Permission run-parts
               prev2.append("chmod 755 /system/angeloidteam/dreamnarae/00proppv;");
               prev2.append("chmod 755 /system/angeloidteam/dreamnarae/01iopv;");
               prev2.append("chmod 755 /system/angeloidteam/dreamnarae/02freqpv;");

               // Mount ro /system
               prev2.append("busybox mount -o ro,remount /system;");

               try {
                  Thread.sleep(3000);
                  Prev_Helper2.instantExec_prev2(getActivity(),
                        prev2.toString());

               } catch (InterruptedException e) {
                  // TODO Auto-generated catch block
                  e.printStackTrace();
               }

            } catch (InterruptedException e) {
               // TODO Auto-generated catch block
               e.printStackTrace();
            }
         }
      }, 25000);
   } else {
      dialog_prev2.dismiss(); // DialogProgress(true) ,false
                        // 
      usercheck_prev.setImageResource(R.drawable.apply);
      previ.setEnabled(false);
      previ.setFocusable(false);
      previi.setEnabled(false);
      previi.setFocusable(false);
      progresstext_prev.setText(R.string.tab_tab2_installed);
   }

}

From source file:angeloid.dreamnarae.Save_Main.java

private void DialogProgress2(boolean close) {
    if (!close) {
        dialog_save2 = ProgressDialog.show(getActivity(), "", "Loading..", true);
        Save_ZipTest.startUnzipping_save(getActivity());
        Handler mHandler2 = new Handler();
        mHandler2.postDelayed(new Runnable() {
            @Override/* ww  w  .j a v a 2s.c o  m*/
            public void run() {
                DialogProgress2(true); //  .
                Save_Helper2.instantExec_save2(getActivity(), "busybox mount -o rw,remount /system ; ");
                StringBuilder save2 = new StringBuilder();
                try {
                    Thread.sleep(2000);
                    // Mount rw /system
                    save2.append("mount -o rw,remount /system;");

                    // Create Folder system/etc/init.d 
                    save2.append("mkdir /system/etc/init.d;");

                    // Create run-parts Script Folder
                    save2.append("mkdir /system/angeloidteam/dreamnarae;");

                    // Avoid used in conjunction with other scripts
                    save2.append("rm /system/etc/init.d/99provision;");
                    save2.append("rm /system/etc/init.d/S99SoulTools;");

                    // Delete Flag Files
                    save2.append("rm /system/SPiCa;");
                    save2.append("rm /system/DN;");
                    save2.append("rm /system/Miracle;");
                    save2.append("rm /system/Save;");
                    save2.append("rm /system/etc/init.d/98banner_dreamnarae_spica;");
                    save2.append("rm /system/etc/init.d/98banner_dreamnarae_save;");
                    save2.append("rm /system/etc/init.d/98banner_dreamnarae_miracle;");
                    save2.append("rm /system/etc/init.d/98banner_dreamnarae_prev;");
                    save2.append("rm /system/98banner_dreamnarae_spica;");
                    save2.append("rm /system/98banner_dreamnarae_save;");
                    save2.append("rm /system/98banner_dreamnarae_miracle;");
                    save2.append("rm /system/98banner_dreamnarae_prev;");

                    // Delete old Script Manager Files
                    save2.append("rm /system/bin/EnableDN.sh;");
                    save2.append("rm /data/DNEnable;");
                    save2.append("rm /system/bin/RemoveDN.sh;");
                    save2.append("rm /data/DNPrev.sh;");
                    save2.append("rm /data/DNSPiCa.sh;");
                    save2.append("rm /data/DNSave.sh;");
                    save2.append("rm /data/DNMiracle.sh;");

                    // Delete New Script Manager Files
                    save2.append("rm /system/etc/install-recovery.sh;");

                    // Delete DreamNarae SPiCa
                    save2.append("rm /system/etc/init.d/00prop;");
                    save2.append("rm /system/etc/init.d/01io;");
                    save2.append("rm /system/etc/init.d/02freq;");
                    save2.append("rm /system/etc/init.d/03zipalign;");
                    save2.append("rm /system/etc/init.d/01kswapd0;");
                    save2.append("rm /system/etc/init.d/02io;");
                    save2.append("rm /system/etc/init.d/03freq;");
                    save2.append("rm /system/etc/init.d/04zipalign;");
                    save2.append("rm /system/angeloidteam/dreamnarae/00prop;");
                    save2.append("rm /system/angeloidteam/dreamnarae/01io;");
                    save2.append("rm /system/angeloidteam/dreamnarae/02freq;");

                    //Delete DreamNarae Miracle
                    save2.append("rm /system/etc/init.d/00set;");
                    save2.append("rm /system/etc/init.d/01property;");
                    save2.append("rm /system/etc/init.d/02vsls;");
                    save2.append("rm /system/etc/init.d/03dch;");
                    save2.append("rm /system/etc/init.d/04zip;");
                    save2.append("rm /system/angeloidteam/dreamnarae/00set;");
                    save2.append("rm /system/angeloidteam/dreamnarae/01property;");
                    save2.append("rm /system/angeloidteam/dreamnarae/02vsls;");
                    save2.append("rm /system/angeloidteam/dreamnarae/03dch;");

                    //Delete DreamNarae Save
                    save2.append("rm /system/etc/init.d/00sp;");
                    save2.append("rm /system/etc/init.d/01v;");
                    save2.append("rm /system/etc/init.d/02deep;");
                    save2.append("rm /system/etc/init.d/03zip;");
                    save2.append("rm /system/angeloidteam/dreamnarae/00sp;");
                    save2.append("rm /system/angeloidteam/dreamnarae/01v;");
                    save2.append("rm /system/angeloidteam/dreamnarae/02deep;");

                    // Delete DreamNarae Prev
                    save2.append("rm /system/etc/init.d/00proppv;");
                    save2.append("rm /system/etc/init.d/01kswapd0pv;");
                    save2.append("rm /system/etc/init.d/02iopv;");
                    save2.append("rm /system/etc/init.d/03freqpv;");
                    save2.append("rm /system/etc/init.d/04zippv;");
                    save2.append("rm /system/etc/init.d/01iopv;");
                    save2.append("rm /system/etc/init.d/02freqpv;");
                    save2.append("rm /system/angeloidteam/dreamnarae/00propv;");
                    save2.append("rm /system/angeloidteam/dreamnarae/01iopv;");
                    save2.append("rm /system/angeloidteam/dreamnarae/02freqpv;");

                    // Copy save Files to /system/
                    save2.append("cat /data/data/angeloid.dreamnarae/files/00sp > /system/etc/init.d/00sp;");
                    save2.append("cat /data/data/angeloid.dreamnarae/files/01v > /system/etc/init.d/01v;");
                    save2.append(
                            "cat /data/data/angeloid.dreamnarae/files/02deep > /system/etc/init.d/02deep;");
                    save2.append(
                            "cat /data/data/angeloid.dreamnarae/files/98banner_dreamnarae_save > /system/98banner_dreamnarae_save;");
                    save2.append(
                            "cat /data/data/angeloid.dreamnarae/files/install-recovery.sh > /system/etc/install-recovery.sh;");

                    // Copy run-parts /system/angeloidteam/dreamnarae
                    save2.append(
                            "cat /data/data/angeloid.dreamnarae/files/00sp > /system/angeloidteam/dreamnarae/00sp;");
                    save2.append(
                            "cat /data/data/angeloid.dreamnarae/files/01v > /system/angeloidteam/dreamnarae/01v;");
                    save2.append(
                            "cat /data/data/angeloid.dreamnarae/files/02deep > /system/angeloidteam/dreamnarae/02deep;");

                    // Delete Download Files
                    save2.append("rm /data/data/angeloid.dreamnarae.save/files/00sp;");
                    save2.append("rm /data/data/angeloid.dreamnarae.save/files/01v;");
                    save2.append("rm /data/data/angeloid.dreamnarae.save/files/02deep;");
                    save2.append("rm /data/data/angeloid.dreamnarae.save/files/98banner_dreamnarae_save;");
                    save2.append("rm /data/data/angeloid.dreamnarae.save/files/install-recovery.sh;");

                    // Permission save Files
                    save2.append("chmod 755 /system/etc/init.d/00sp;");
                    save2.append("chmod 755 /system/etc/init.d/01v;");
                    save2.append("chmod 755 /system/etc/init.d/02deep;");
                    save2.append("chmod 755 /system/98banner_dreamnarae_save;");
                    save2.append("chmod 755 /system/etc/install-recovery.sh;");

                    // Permission run-parts
                    save2.append("chmod 755 /system/angeloidteam/dreamnarae/00sp;");
                    save2.append("chmod 755 /system/angeloidteam/dreamnarae/01v;");
                    save2.append("chmod 755 /system/angeloidteam/dreamnarae/02deep;");

                    // Mount ro /system
                    save2.append("busybox mount -o ro,remount /system;");

                    try {
                        Thread.sleep(3000);
                        Save_Helper2.instantExec_save2(getActivity(), save2.toString());

                    } catch (InterruptedException e) {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
                    }

                } catch (InterruptedException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }
        }, 25000);
    } else {
        dialog_save2.dismiss(); // DialogProgress(true) ,false 
        usercheck_save.setImageResource(R.drawable.apply);
        savei.setEnabled(false);
        savei.setFocusable(false);
        saveii.setEnabled(false);
        saveii.setFocusable(false);
        progresstext_save.setText(R.string.tab_tab2_installed);
    }
}