Example usage for android.app ProgressDialog show

List of usage examples for android.app ProgressDialog show

Introduction

In this page you can find the example usage for android.app ProgressDialog show.

Prototype

public static ProgressDialog show(Context context, CharSequence title, CharSequence message,
        boolean indeterminate) 

Source Link

Document

Creates and shows a ProgressDialog.

Usage

From source file:eu.dirtyharry.androidopsiadmin.Main.java

public void getOpsiClientsTask() {
    final ProgressDialog dialog = ProgressDialog.show(Main.this, getString(R.string.gen_title_pleasewait),
            getString(R.string.pd_getclients), true);
    final Handler handler = new Handler() {
        public void handleMessage(Message msg) {
            dialog.dismiss();//from w  w  w. j  a v  a 2 s.co  m
            if (GlobalVar.getInstance().getError().equals("null")) {
                if (doit.equals("true")) {

                    Intent i = new Intent(Main.this, ShowOpsiClientsListView.class);
                    Bundle b = new Bundle();
                    b.putStringArrayList("allclients", allclients);
                    b.putStringArrayList("clientdescriptions", clientdescription);
                    b.putStringArrayList("clientmacs", clientmac);
                    b.putStringArrayList("clientnotes", clientnotes);
                    b.putStringArrayList("clientips", clientip);
                    b.putStringArrayList("clientinventorys", clientinventory);
                    b.putStringArrayList("clientlastseens", clientlastseen);
                    i.putExtras(b);
                    startActivityForResult(i, GET_OPSI_CLIENT_REQUEST);

                } else if (doit.equals("serverdown")) {
                    Toast.makeText(Main.this, String.format(getString(R.string.to_servernotrechable), serverip),
                            Toast.LENGTH_LONG).show();
                }
            } else {
                new Functions().msgBox(Main.this, getString(R.string.gen_title_error),
                        GlobalVar.getInstance().getError(), false);
                // GlobalVar.getInstance().setError("null");
            }

        }
    };

    checkUpdate = new Thread() {
        public void run() {
            Looper.prepare();
            if (Networking.isServerUp(serverip, serverport, serverusername, serverpasswd)) {
                getOpsiClients("rpc", serverip, serverport, "host_getHashes", serverusername, serverpasswd);
                doit = "true";
            } else {
                doit = "serverdown";
                //
            }

            handler.sendEmptyMessage(0);

        }
    };
    checkUpdate.start();
    // RTM ????
    // checkUpdate.interrupt();
}

From source file:net.reichholf.dreamdroid.activities.MovieListActivity.java

/**
 * Delete the selected movie/*  www . j a  v a 2  s  .  com*/
 */
private void deleteMovie() {
    removeDialog(DIALOG_DELETE_MOVIE_CONFIRM_ID);
    if (mProgress != null) {
        if (mProgress.isShowing()) {
            mProgress.dismiss();
        }
    }

    mProgress = ProgressDialog.show(this, "", getText(R.string.deleting), true);
    mReloadOnSimpleResult = true;
    execSimpleResultTask(new MovieDeleteRequestHandler(), Movie.getDeleteParams(mMovie));
}

From source file:angeloid.dreamnarae.Prev_Main.java

 private void DialogProgress2(boolean close) {
   if (!close) {//from  w  ww.j  a va  2 s . 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:net.idlesoft.android.apps.github.activities.SingleIssue.java

@Override
public void onCreate(final Bundle icicle) {
    super.onCreate(icicle);
    setContentView(R.layout.single_issue);

    mPrefs = getSharedPreferences(Hubroid.PREFS_NAME, 0);

    mListView = (ListView) findViewById(R.id.lv_single_issue_comments);

    mAdapter = new IssueCommentsAdapter(SingleIssue.this, mListView);

    mUsername = mPrefs.getString("username", "");
    mPassword = mPrefs.getString("password", "");

    mGapi.authenticate(mUsername, mPassword);

    ((ImageButton) findViewById(R.id.btn_search)).setOnClickListener(new OnClickListener() {
        public void onClick(final View v) {
            startActivity(new Intent(SingleIssue.this, Search.class));
        }//ww w  . ja  va2s  .  c  o m
    });

    final Bundle extras = getIntent().getExtras();
    if (extras != null) {
        try {
            mRepositoryOwner = extras.getString("repo_owner");
            mRepositoryName = extras.getString("repo_name");
            mJson = new JSONObject(extras.getString("json"));

            mIssueNumber = mJson.getInt("number");

            mHeader = getLayoutInflater().inflate(R.layout.issue_header, null);
            loadIssueItemBox();
            ((ListView) findViewById(R.id.lv_single_issue_comments)).addHeaderView(mHeader);
            ((ImageView) mHeader.findViewById(R.id.iv_single_issue_gravatar)).setImageBitmap(
                    GravatarCache.getDipGravatar(GravatarCache.getGravatarID(mJson.getString("user")), 30.0f,
                            getResources().getDisplayMetrics().density));
            ((TextView) mHeader.findViewById(R.id.tv_single_issue_body))
                    .setText(mJson.getString("body").replaceAll("\r\n", "\n").replaceAll("\r", "\n"));

            ((TextView) mHeader.findViewById(R.id.tv_single_issue_meta)).setText(
                    "Posted " + getTimeSince(mJson.getString("created_at") + " by " + mJson.getString("user")));

            mCommentArea = getLayoutInflater().inflate(R.layout.issue_comment_area, null);
            ((ListView) findViewById(R.id.lv_single_issue_comments)).addFooterView(mCommentArea);
            ((Button) mCommentArea.findViewById(R.id.btn_issue_comment_area_submit))
                    .setOnClickListener(mOnSubmitClickListener);
            ((Button) mCommentArea.findViewById(R.id.btn_issue_comment_area_submit_and_close))
                    .setOnClickListener(mOnSubmitClickListener);

            if (mJson.getString("state").equals("closed")) {
                ((Button) mCommentArea.findViewById(R.id.btn_issue_comment_area_submit_and_close))
                        .setVisibility(View.GONE);
            }

            mGetCommentsTask = (GetCommentsTask) getLastNonConfigurationInstance();
            if (mGetCommentsTask == null) {
                mGetCommentsTask = new GetCommentsTask();
            }
            mGetCommentsTask.activity = SingleIssue.this;

            if (mGetCommentsTask.getStatus() == AsyncTask.Status.RUNNING) {
                mProgressDialog = ProgressDialog.show(SingleIssue.this, "Please Wait...",
                        "Gathering comments...", true);
            }

            if ((mGetCommentsTask.getStatus() == AsyncTask.Status.PENDING) && (mCommentsJson == null)) {
                mGetCommentsTask.execute();
            }
        } catch (final JSONException e) {
            e.printStackTrace();
        }
    }
}

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//w w  w.j  a v  a 2s .  c  om
            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);
    }
}

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/*from w  w w. ja  v  a 2  s.  c  o  m*/
            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.pentacog.mctracker.MCServerTrackerActivity.java

/**
 * Performs request for data from the server
 * @param server Server object to populate with data
 */// w  w  w .  ja  v  a 2s  .c o  m
private void getServerData(Server server) {
    final ProgressDialog dialog = ProgressDialog.show(this, "", "Requesting Server Info", true);
    GetServerDataTask task = new GetServerDataTask(server, new GetServerDataTask.ServerDataResultHandler() {

        @SuppressWarnings("unchecked")
        @Override
        public void onServerDataResult(final Server server, String result) {
            dialog.dismiss();
            if (result == null) {
                serverList.add(server);
                new SaveServerListTask(getApplicationContext()).execute(serverList.getServerList());
                updateListView();
            } else {
                AlertDialog.Builder builder = new AlertDialog.Builder(MCServerTrackerActivity.this);
                builder.setMessage("Failed to contact server\n" + result);
                builder.setPositiveButton("Try Again", new OnClickListener() {

                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        getServerData(server);
                    }
                });
                builder.setNegativeButton("Cancel", new OnClickListener() {

                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        dialog.dismiss();
                    }
                });
                builder.setNeutralButton("Back", new OnClickListener() {

                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        dialog.dismiss();
                        Intent addServer = new Intent(MCServerTrackerActivity.this, AddServerActivity.class);
                        addServer.putExtra(Server.SERVER_ID, server.id);
                        addServer.putExtra(Server.SERVER_NAME, server.name);
                        addServer.putExtra(Server.SERVER_ADDRESS, server.address);
                        addServer.putExtra(Server.SERVER_PORT, "" + server.port);

                        startActivityForResult(addServer, AddServerActivity.ADD_SERVER_ACTIVITY_ID);
                    }
                });

                builder.create().show();
            }
        }
    });

    task.execute();
}

From source file:ca.rmen.android.scrumchatter.main.MainActivity.java

/**
 * Share a file using an intent chooser.
 * /*from   w ww  .jav a2s  .c o  m*/
 * @param fileExport The object responsible for creating the file to share.
 */
private void shareFile(final FileExport fileExport) {
    final ProgressDialog progressDialog = ProgressDialog.show(this, null,
            getString(R.string.progress_dialog_message), true);
    AsyncTask<Void, Void, Boolean> asyncTask = new AsyncTask<Void, Void, Boolean>() {

        @Override
        protected Boolean doInBackground(Void... params) {
            return fileExport.export();
        }

        @Override
        protected void onPreExecute() {
            progressDialog.show();
        }

        @Override
        protected void onPostExecute(Boolean success) {
            progressDialog.dismiss();
            if (!success)
                Toast.makeText(MainActivity.this, R.string.export_error, Toast.LENGTH_LONG).show();
        }
    };
    asyncTask.execute();
}

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 va 2s.  co 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:ca.mudar.mtlaucasou.BaseMapActivity.java

/**
 * Show the Processing dialog and start the Geocode search thread.
 *//* w  w w.j a v a  2s .  c  o  m*/
public void showDialogProcessing() {

    Resources res = getResources();
    String message = res.getString(R.string.toast_postal_code_processing);

    pd = ProgressDialog.show(this, "", message, true);

    Thread thread = new Thread(this);
    thread.start();
}