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:angeloid.dreamnarae.SPiCa_Main.java

private void DialogProgress2(boolean close) {
    if (!close) {
        dialog_spica2 = ProgressDialog.show(getActivity(), "", "Loading..", true);
        SPiCa_ZipTest.startUnzipping_spica(getActivity());
        Handler mHandler2 = new Handler();
        mHandler2.postDelayed(new Runnable() {
            @Override//  w  w w  .j a va2s  .c  om
            public void run() {
                DialogProgress2(true); //  .
                SPiCa_Helper2.instantExec_spica2(getActivity(), "busybox mount -o rw,remount /system ; ");
                StringBuilder spica2 = new StringBuilder();
                try {
                    Thread.sleep(2000);
                    // Mount rw /system
                    spica2.append("mount -o rw,remount /system;");

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                    try {
                        Thread.sleep(3000);
                        SPiCa_Helper2.instantExec_spica2(getActivity(), spica2.toString());

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

                } catch (InterruptedException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }
        }, 25000);
    } else {
        dialog_spica2.dismiss(); // DialogProgress(true) ,false 
        usercheck_spica.setImageResource(R.drawable.apply);
        spicai.setEnabled(false);
        spicai.setFocusable(false);
        spicaii.setEnabled(false);
        spicaii.setFocusable(false);
        progresstext_spica.setText(R.string.tab_tab2_installed);
    }
}

From source file:com.microsoft.mimickeralarm.ringing.ShareFragment.java

private void showToastInFragment(int resourceId) {
    String message = getResources().getString(resourceId);
    final TextView textView = (TextView) getView().findViewById(R.id.share_toast_message);
    textView.setText(message);//from w ww  . ja  v a  2 s  .c  om
    textView.setVisibility(View.VISIBLE);

    Handler handler = new Handler();
    mToastAutoDismiss = new Runnable() {
        @Override
        public void run() {
            textView.setVisibility(View.INVISIBLE);
        }
    };
    handler.postDelayed(mToastAutoDismiss, TOAST_IN_FRAGMENT_DELAY);
}

From source file:org.odk.collect.android.activities.GeoShapeOsmMapActivity.java

private void zoomToBounds() {
    map.getController().setZoom(4);/* w  ww.ja  va 2  s. c o  m*/
    map.invalidate();
    Handler handler = new Handler();
    handler.postDelayed(new Runnable() {
        public void run() {
            double minLat = Double.MAX_VALUE;
            double maxLat = Double.MIN_VALUE;
            double minLong = Double.MAX_VALUE;
            double maxLong = Double.MIN_VALUE;
            Integer size = mapMarkers.size();
            for (int i = 0; i < size; i++) {
                GeoPoint tempMarker = mapMarkers.get(i).getPosition();
                if (tempMarker.getLatitude() < minLat) {
                    minLat = tempMarker.getLatitude();
                }
                if (tempMarker.getLatitude() > maxLat) {
                    maxLat = tempMarker.getLatitude();
                }
                if (tempMarker.getLongitude() < minLong) {
                    minLong = tempMarker.getLongitude();
                }
                if (tempMarker.getLongitude() > maxLong) {
                    maxLong = tempMarker.getLongitude();
                }
            }
            BoundingBox boundingBox = new BoundingBox(maxLat, maxLong, minLat, minLong);
            map.zoomToBoundingBox(boundingBox, false);
            map.invalidate();
        }
    }, 100);
    map.invalidate();

}

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

private void updatePosition(final MenuItem menuItem) {
    runnable = null;//w  ww .ja va 2s  .c o m

    switch (menuItem.getItemId()) {
    case R.id.nav_library:
        runnable = navigateLibrary;

        break;
    case R.id.nav_playlists:
        runnable = navigatePlaylist;

        break;
    case R.id.nav_folders:
        runnable = navigateFolder;

        break;
    case R.id.nav_nowplaying:
        NavigationUtils.navigateToNowplaying(MainActivity.this, false);
        break;
    case R.id.nav_queue:
        runnable = navigateQueue;

        break;
    case R.id.nav_timer:
        runnable = navigateTimer;

        break;
    case R.id.nav_settings:
        NavigationUtils.navigateToSettings(MainActivity.this);
        break;
    case R.id.nav_about:
        mDrawerLayout.closeDrawers();
        Handler handler = new Handler();
        handler.postDelayed(new Runnable() {
            @Override
            public void run() {
                final String APP_PNAME = "com.musiqueplayer.playlistequalizerandroidwear";
                final Context mContext = getApplicationContext();
                final AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(
                        new ContextThemeWrapper(MainActivity.this, R.style.myDialog));

                final SpannableString s = new SpannableString(
                        Html.fromHtml("Thanks for downloading Music Player.<br>"
                                + "Thanks for being an awesome user! If you enjoy using <b>Music Player</b> app, please take a moment to rate it with <b>5 stars</b>. "
                                + ""));
                Linkify.addLinks(s, Linkify.ALL);

                alertDialogBuilder.setTitle("About");
                alertDialogBuilder.setMessage(s);

                alertDialogBuilder.setPositiveButton("Rate Now", new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface arg0, int arg1) {
                        mContext.startActivity(
                                new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + APP_PNAME)));

                    }
                });

                alertDialogBuilder.setNegativeButton("Remind Later", new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        dialog.dismiss();
                        SharedPreferences prefs = mContext.getSharedPreferences("apprater", 0);
                        SharedPreferences.Editor editor = prefs.edit();
                        editor.putLong("launch_count", 0);
                        editor.commit();
                    }
                });

                AlertDialog alertDialog = alertDialogBuilder.create();
                alertDialog.show();

            }
        }, 350);

        break;
    }

    if (runnable != null) {
        menuItem.setChecked(true);
        mDrawerLayout.closeDrawers();
        Handler handler = new Handler();
        handler.postDelayed(new Runnable() {
            @Override
            public void run() {
                runnable.run();
            }
        }, 350);
    }
}

From source file:angeloid.dreamnarae.Miracle_Main.java

private void DialogProgress1(boolean close) {
    if (!close) {
        dialog_miracle1 = ProgressDialog.show(getActivity(), "", "Loading..", true);
        Miracle_ZipTest.startUnzipping_miracle(getActivity());
        Handler mHandler1 = new Handler();
        mHandler1.postDelayed(new Runnable() {
            @Override//w w  w. j  a va  2  s .c  o m
            public void run() {
                DialogProgress1(true); //  .
                Miracle_Helper.instantExec_miracle(getActivity(), "busybox mount -o rw,remount /system ; ");
                StringBuilder miracle = new StringBuilder();
                try {
                    Thread.sleep(2000);
                    // Mount rw /system
                    miracle.append("mount -o rw,remount /system;");

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

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

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

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

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

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

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

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

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

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

                    // Copy Miracle Files to /system/
                    miracle.append(
                            "cat /data/data/angeloid.dreamnarae/files/00set > /system/etc/init.d/00set;");
                    miracle.append(
                            "cat /data/data/angeloid.dreamnarae/files/01property >  /system/etc/init.d/01property;");
                    miracle.append(
                            "cat /data/data/angeloid.dreamnarae/files/02vsls > /system/etc/init.d/02vsls;");
                    miracle.append(
                            "cat /data/data/angeloid.dreamnarae/files/03dch > /system/etc/init.d/03dch;");
                    miracle.append(
                            "cat /data/data/angeloid.dreamnarae/files/98banner_dreamnarae_miracle > /system/98banner_dreamnarae_miracle;");
                    miracle.append(
                            "cat /data/data/angeloid.dreamnarae/files/install-recovery.sh > /system/etc/install-recovery.sh;");

                    // Copy run-parts /system/angeloidteam/dreamnarae
                    miracle.append(
                            "cat /data/data/angeloid.dreamnarae/files/00set > /system/angeloidteam/dreamnarae/00set;");
                    miracle.append(
                            "cat /data/data/angeloid.dreamnarae/files/01property >  /system/angeloidteam/dreamnarae/01property;");
                    miracle.append(
                            "cat /data/data/angeloid.dreamnarae/files/02vsls > /system/angeloidteam/dreamnarae/02vsls;");
                    miracle.append(
                            "cat /data/data/angeloid.dreamnarae/files/03dch > /system/angeloidteam/dreamnarae/03dch;");

                    // Delete Download Files
                    miracle.append("rm /data/data/angeloid.dreamnarae/files/00set;");
                    miracle.append("rm /data/data/angeloid.dreamnarae/files/01property;");
                    miracle.append("rm /data/data/angeloid.dreamnarae/files/02vsls;");
                    miracle.append("rm /data/data/angeloid.dreamnarae/files/03dch;");
                    miracle.append("rm /data/data/angeloid.dreamnarae/files/install-recovery.sh;");
                    miracle.append("rm /data/data/angeloid.dreamnarae/files/98banner_dreamnarae_miracle;");

                    // Permission Miracle Files
                    miracle.append("chmod 755 /system/etc/init.d/00set;");
                    miracle.append("chmod 755 /system/etc/init.d/01property;");
                    miracle.append("chmod 755 /system/etc/init.d/02vsls;");
                    miracle.append("chmod 755 /system/etc/init.d/03dch;");
                    miracle.append("chmod 755 /system/angeloidteam/dreamnarae/00set;");
                    miracle.append("chmod 755 /system/angeloidteam/dreamnarae/01property;");
                    miracle.append("chmod 755 /system/angeloidteam/dreamnarae/02vsls;");
                    miracle.append("chmod 755 /system/angeloidteam/dreamnarae/03dch;");
                    miracle.append("chmod 755 /system/angeloidteam/dreamnarae/98banner_dreamnarae_miracle;");
                    miracle.append("chmod 755 /system/etc/install-recovery.sh;");

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

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

                    try {
                        Thread.sleep(3000);
                        Miracle_Helper.instantExec_miracle(getActivity(), miracle.toString());

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

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

}

From source file:com.orange.ocara.ui.activity.SetupAuditPathActivity.java

@Override
public void onConfigurationChanged(Configuration newConfig) {
    super.onConfigurationChanged(newConfig);
    Handler handler = new Handler();

    handler.postDelayed(new Runnable() {
        @java.lang.Override//from   w w w  .ja  v  a 2 s  .c  om
        public void run() {

            badgeNotifierCommentsAudit();
        }
    }, 200);
}

From source file:angeloid.dreamnarae.Miracle_Main.java

private void DialogProgress2(boolean close) {
    if (!close) {
        dialog_miracle2 = ProgressDialog.show(getActivity(), "", "Loading..", true);
        Miracle_ZipTest.startUnzipping_miracle(getActivity());
        Handler mHandler2 = new Handler();
        mHandler2.postDelayed(new Runnable() {
            @Override// w  w w  . j a  v a 2 s. c  o  m
            public void run() {
                DialogProgress2(true); //  .
                Miracle_Helper2.instantExec_miracle2(getActivity(), "busybox mount -o rw,remount /system ; ");
                StringBuilder miracle2 = new StringBuilder();
                try {
                    Thread.sleep(2000);
                    // Mount rw /system
                    miracle2.append("mount -o rw,remount /system;");

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

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

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

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

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

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

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

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

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

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

                    // Copy Miracle Files to /system/
                    miracle2.append(
                            "cat /data/data/angeloid.dreamnarae/files/00set > /system/etc/init.d/00set;");
                    miracle2.append(
                            "cat /data/data/angeloid.dreamnarae/files/01property >  /system/etc/init.d/01property;");
                    miracle2.append(
                            "cat /data/data/angeloid.dreamnarae/files/02vsls > /system/etc/init.d/02vsls;");
                    miracle2.append(
                            "cat /data/data/angeloid.dreamnarae/files/03dch > /system/etc/init.d/03dch;");
                    miracle2.append(
                            "cat /data/data/angeloid.dreamnarae/files/install-recovery.sh > /system/etc/install-recovery.sh;");
                    miracle2.append(
                            "cat /data/data/angeloid.dreamnarae/files/98banner_dreamnarae_miracle > /system/98banner_dreamnarae_miracle;");

                    // Copy Miracle Files to /system/angeloidteam/dreamnarae [Run-parts Scripts]
                    miracle2.append(
                            "cat /data/data/angeloid.dreamnarae/files/00set > /system/angeloidteam/dreamnarae/00set;");
                    miracle2.append(
                            "cat /data/data/angeloid.dreamnarae/files/01property >  /system/angeloidteam/dreamnarae/01property;");
                    miracle2.append(
                            "cat /data/data/angeloid.dreamnarae/files/02vsls > /system/angeloidteam/dreamnarae/02vsls;");
                    miracle2.append(
                            "cat /data/data/angeloid.dreamnarae/files/03dch > /system/angeloidteam/dreamnarae/03dch;");

                    // Delete Download Files
                    miracle2.append("rm /data/data/angeloid.dreamnarae/files/00set;");
                    miracle2.append("rm /data/data/angeloid.dreamnarae/files/01property;");
                    miracle2.append("rm /data/data/angeloid.dreamnarae/files/02vsls;");
                    miracle2.append("rm /data/data/angeloid.dreamnarae/files/03dch;");
                    miracle2.append("rm /data/data/angeloid.dreamnarae/files/install-recovery.sh;");
                    miracle2.append("rm /data/data/angeloid.dreamnarae/files/98banner_dreamnarae_miracle;");

                    // Permission Miracle Files
                    miracle2.append("chmod 755 /system/etc/init.d/00set;");
                    miracle2.append("chmod 755 /system/etc/init.d/01property;");
                    miracle2.append("chmod 755 /system/etc/init.d/02vsls;");
                    miracle2.append("chmod 755 /system/etc/init.d/03dch;");
                    miracle2.append("chmod 755 /system/98banner_dreamnarae_miracle;");
                    miracle2.append("chmod 755 /system/etc/install-recovery.sh;");

                    // Permission run-parts
                    miracle2.append("chmod 755 /system/angeloidteam/dreamnarae/00set;");
                    miracle2.append("chmod 755 /system/angeloidteam/dreamnarae/01property;");
                    miracle2.append("chmod 755 /system/angeloidteam/dreamnarae/02vsls;");
                    miracle2.append("chmod 755 /system/angeloidteam/dreamnarae/03dch;");

                    // Mount ro /system
                    miracle2.append("busybox mount -o ro,remount /system;");
                    try {
                        Thread.sleep(3000);
                        Miracle_Helper2.instantExec_miracle2(getActivity(), miracle2.toString());

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

                } catch (InterruptedException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }
        }, 25000);
    } else {
        dialog_miracle2.dismiss(); // DialogProgress(true) ,false 
        usercheck_miracle.setImageResource(R.drawable.apply);
        miraclei.setEnabled(false);
        miraclei.setFocusable(false);
        miracleii.setEnabled(false);
        miracleii.setFocusable(false);
        progresstext_miracle.setText(R.string.tab_tab2_installed);
    }

}

From source file:net.olejon.mdapp.DiseasesAndTreatmentsSearchActivity.java

@Override
public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) {
    if (mSearchLanguage.equals("")) {
        switch (i) {
        case 1: {
            mRecyclerView.scrollToPosition(mFirstPubMedPosition);
            break;
        }/*from   w  ww.jav  a2  s  . c  o m*/
        case 2: {
            mRecyclerView.scrollToPosition(mFirstWebOfSciencePosition);
            break;
        }
        case 3: {
            mRecyclerView.scrollToPosition(mFirstMedlinePlusPosition);
            break;
        }
        case 4: {
            mRecyclerView.scrollToPosition(mFirstWikipediaPosition);
            break;
        }
        case 5: {
            if (mFirstUpToDatePosition == 0) {
                mTools.showToast(getString(R.string.diseases_and_treatments_search_no_results), 1);
            } else {
                mRecyclerView.scrollToPosition(mFirstUpToDatePosition);
            }

            break;
        }
        case 6: {
            if (mFirstBmjPosition == 0) {
                mTools.showToast(getString(R.string.diseases_and_treatments_search_no_results), 1);
            } else {
                mRecyclerView.scrollToPosition(mFirstBmjPosition);
            }

            break;
        }
        }
    } else {
        switch (i) {
        case 1: {
            mRecyclerView.scrollToPosition(mFirstNhiPosition);
            break;
        }
        case 2: {
            mRecyclerView.scrollToPosition(mFirstSmlPosition);
            break;
        }
        case 3: {
            mRecyclerView.scrollToPosition(mFirstWikipediaPosition);
            break;
        }
        case 4: {
            mRecyclerView.scrollToPosition(mFirstForskningPosition);
            break;
        }
        case 5: {
            if (mFirstHelsebiblioteketPosition == 0) {
                mTools.showToast(getString(R.string.diseases_and_treatments_search_no_results), 1);
            } else {
                mRecyclerView.scrollToPosition(mFirstHelsebiblioteketPosition);
            }

            break;
        }
        case 6: {
            if (mFirstTidsskriftetPosition == 0) {
                mTools.showToast(getString(R.string.diseases_and_treatments_search_no_results), 1);
            } else {
                mRecyclerView.scrollToPosition(mFirstTidsskriftetPosition);
            }

            break;
        }
        case 7: {
            if (mFirstOncolexPosition == 0) {
                mTools.showToast(getString(R.string.diseases_and_treatments_search_no_results), 1);
            } else {
                mRecyclerView.scrollToPosition(mFirstOncolexPosition);
            }

            break;
        }
        case 8: {
            if (mFirstBrukerhandbokenPosition == 0) {
                mTools.showToast(getString(R.string.diseases_and_treatments_search_no_results), 1);
            } else {
                mRecyclerView.scrollToPosition(mFirstBrukerhandbokenPosition);
            }

            break;
        }
        case 9: {
            if (mFirstHelsenorgePosition == 0) {
                mTools.showToast(getString(R.string.diseases_and_treatments_search_no_results), 1);
            } else {
                mRecyclerView.scrollToPosition(mFirstHelsenorgePosition);
            }

            break;
        }
        }
    }

    Handler handler = new Handler();

    handler.postDelayed(new Runnable() {
        @Override
        public void run() {
            mSpinner.setSelection(0);
        }
    }, 250);
}

From source file:com.bjerva.tsplex.fragments.SignCategoryFragment.java

@Override
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    ma = (MainActivity) getActivity();//w  ww. j  a  va  2s .co  m

    mGaInstance = GoogleAnalytics.getInstance(ma);
    mGaTracker = mGaInstance.getTracker("UA-39295928-1");

    if (ma.getGsonSignsLite() != null) {
        Log.d(TAG, "Loading signs here");
        loadCategories();
    } else {
        final Handler handler = new Handler();
        final Runnable r = new Runnable() {
            public void run() {
                if (ma.isDoneLoading()) {
                    Log.d("Runnable", "Loading successful!");
                    loadCategories();
                } else {
                    Log.d("Runnable", "Loading failed...");
                    handler.postDelayed(this, 500);
                }
            }
        };
        handler.postDelayed(r, 1500);
    }
}

From source file:com.social.solution.fragment.MyFragment.java

public void LoadOldTweetsFirst() {
    downloading = true;//w w w  .jav  a 2s  .  c  om
    loading = true;

    Handler handlerTimer = new Handler();
    handlerTimer.postDelayed(new Runnable() {
        public void run() {
            HelperFunctions.statusesService.homeTimeline(150, null, TweetBank.lasttweetid, false, true, false,
                    true, new Callback<List<Tweet>>() {
                        @Override
                        public void success(Result<List<Tweet>> result) {
                            List<Tweet> ls = result.data;
                            if (ls.size() > 0) {
                                for (int i = 0; i < ls.size(); ++i) {
                                    Tweet t = ls.get(i);
                                    TweetBank.insertTweet(t);
                                }
                            }

                            lastTimeStamp = System.currentTimeMillis();

                            //lastDisplayTweetId  = TweetBank.lasttweetid;
                            //firstDisplayTweetId = TweetBank.firsttweetid;

                            displayTweetsFirst();
                            downloading = false;
                            loading = false;
                        }

                        @Override
                        public void failure(TwitterException exception) {
                            exception.printStackTrace();
                            System.out.println("EXCEPTION FAILED TWITTER");
                            lastTimeStamp = System.currentTimeMillis();
                            displayTweetsFirst();
                            // TODO make this toast when the internet connection is not present
                            //Toast.makeText(storedActivity, "Check Network connectivity", Toast.LENGTH_LONG).show();
                            linlaHeaderProgress.setVisibility(View.GONE);
                            listView.removeFooterView(footer);
                            loading = false;
                            downloading = false;
                        }
                    });
        }
    }, 2000);

}