Search in sources :

Example 36 with ProgressDialog

use of android.app.ProgressDialog in project JamsMusicPlayer by psaravan.

the class AsyncCopyMoveTask method onPreExecute.

protected void onPreExecute() {
    pd = new ProgressDialog(mFragment.getActivity());
    pd.setCancelable(false);
    pd.setIndeterminate(false);
    if (mShouldMove) {
        pd.setTitle(R.string.move);
        pd.setMessage(mContext.getResources().getString(R.string.moving_file));
    } else {
        pd.setTitle(R.string.copy);
        pd.setMessage(mContext.getResources().getString(R.string.copying_file));
    }
    pd.setButton(DialogInterface.BUTTON_NEUTRAL, mContext.getResources().getString(R.string.run_in_background), new OnClickListener() {

        @Override
        public void onClick(DialogInterface arg0, int arg1) {
            pd.dismiss();
        }
    });
    pd.show();
}
Also used : DialogInterface(android.content.DialogInterface) OnClickListener(android.content.DialogInterface.OnClickListener) ProgressDialog(android.app.ProgressDialog)

Example 37 with ProgressDialog

use of android.app.ProgressDialog in project JamsMusicPlayer by psaravan.

the class AsyncAutoGetAlbumArtTask method onPreExecute.

public void onPreExecute() {
    super.onPreExecute();
    pd = new ProgressDialog(mActivity);
    pd.setTitle(R.string.downloading_album_art);
    pd.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
    pd.setCancelable(false);
    pd.setCanceledOnTouchOutside(false);
    pd.setMessage(mContext.getResources().getString(R.string.scanning_for_missing_art));
    pd.setButton(DialogInterface.BUTTON_NEGATIVE, mContext.getResources().getString(R.string.cancel), new OnClickListener() {

        @Override
        public void onClick(DialogInterface dialog, int which) {
            dialog.dismiss();
            task.cancel(true);
        }
    });
    pd.show();
}
Also used : DialogInterface(android.content.DialogInterface) OnClickListener(android.content.DialogInterface.OnClickListener) ProgressDialog(android.app.ProgressDialog)

Example 38 with ProgressDialog

use of android.app.ProgressDialog in project weiciyuan by qii.

the class CommonProgressDialogFragment method onCreateDialog.

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    ProgressDialog dialog = new ProgressDialog(getActivity());
    dialog.setMessage(getArguments().getString("content"));
    return dialog;
}
Also used : ProgressDialog(android.app.ProgressDialog)

Example 39 with ProgressDialog

use of android.app.ProgressDialog in project android-ocr by rmtheis.

the class CaptureActivity method displayProgressDialog.

void displayProgressDialog() {
    // Set up the indeterminate progress dialog box
    indeterminateDialog = new ProgressDialog(this);
    indeterminateDialog.setTitle("Please wait");
    String ocrEngineModeName = getOcrEngineModeName();
    if (ocrEngineModeName.equals("Both")) {
        indeterminateDialog.setMessage("Performing OCR using Cube and Tesseract...");
    } else {
        indeterminateDialog.setMessage("Performing OCR using " + ocrEngineModeName + "...");
    }
    indeterminateDialog.setCancelable(false);
    indeterminateDialog.show();
}
Also used : ProgressDialog(android.app.ProgressDialog)

Example 40 with ProgressDialog

use of android.app.ProgressDialog in project android-ocr by rmtheis.

the class CaptureActivity method initOcrEngine.

/**
   * Requests initialization of the OCR engine with the given parameters.
   * 
   * @param storageRoot Path to location of the tessdata directory to use
   * @param languageCode Three-letter ISO 639-3 language code for OCR 
   * @param languageName Name of the language for OCR, for example, "English"
   */
private void initOcrEngine(File storageRoot, String languageCode, String languageName) {
    isEngineReady = false;
    // Set up the dialog box for the thermometer-style download progress indicator
    if (dialog != null) {
        dialog.dismiss();
    }
    dialog = new ProgressDialog(this);
    // If we have a language that only runs using Cube, then set the ocrEngineMode to Cube
    if (ocrEngineMode != TessBaseAPI.OEM_CUBE_ONLY) {
        for (String s : CUBE_REQUIRED_LANGUAGES) {
            if (s.equals(languageCode)) {
                ocrEngineMode = TessBaseAPI.OEM_CUBE_ONLY;
                SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
                prefs.edit().putString(PreferencesActivity.KEY_OCR_ENGINE_MODE, getOcrEngineModeName()).commit();
            }
        }
    }
    // If our language doesn't support Cube, then set the ocrEngineMode to Tesseract
    if (ocrEngineMode != TessBaseAPI.OEM_TESSERACT_ONLY) {
        boolean cubeOk = false;
        for (String s : CUBE_SUPPORTED_LANGUAGES) {
            if (s.equals(languageCode)) {
                cubeOk = true;
            }
        }
        if (!cubeOk) {
            ocrEngineMode = TessBaseAPI.OEM_TESSERACT_ONLY;
            SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
            prefs.edit().putString(PreferencesActivity.KEY_OCR_ENGINE_MODE, getOcrEngineModeName()).commit();
        }
    }
    // Display the name of the OCR engine we're initializing in the indeterminate progress dialog box
    indeterminateDialog = new ProgressDialog(this);
    indeterminateDialog.setTitle("Please wait");
    String ocrEngineModeName = getOcrEngineModeName();
    if (ocrEngineModeName.equals("Both")) {
        indeterminateDialog.setMessage("Initializing Cube and Tesseract OCR engines for " + languageName + "...");
    } else {
        indeterminateDialog.setMessage("Initializing " + ocrEngineModeName + " OCR engine for " + languageName + "...");
    }
    indeterminateDialog.setCancelable(false);
    indeterminateDialog.show();
    if (handler != null) {
        handler.quitSynchronously();
    }
    // with low memory that crash when running OCR with Cube, and prevent unwanted delays.
    if (ocrEngineMode == TessBaseAPI.OEM_CUBE_ONLY || ocrEngineMode == TessBaseAPI.OEM_TESSERACT_CUBE_COMBINED) {
        Log.d(TAG, "Disabling continuous preview");
        isContinuousModeActive = false;
        SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
        prefs.edit().putBoolean(PreferencesActivity.KEY_CONTINUOUS_PREVIEW, false);
    }
    // Start AsyncTask to install language data and init OCR
    baseApi = new TessBaseAPI();
    new OcrInitAsyncTask(this, baseApi, dialog, indeterminateDialog, languageCode, languageName, ocrEngineMode).execute(storageRoot.toString());
}
Also used : SharedPreferences(android.content.SharedPreferences) TessBaseAPI(com.googlecode.tesseract.android.TessBaseAPI) ProgressDialog(android.app.ProgressDialog)

Aggregations

ProgressDialog (android.app.ProgressDialog)267 DialogInterface (android.content.DialogInterface)47 Intent (android.content.Intent)23 View (android.view.View)21 File (java.io.File)19 TextView (android.widget.TextView)13 SuppressLint (android.annotation.SuppressLint)12 Handler (android.os.Handler)12 FrameLayout (android.widget.FrameLayout)12 ArrayList (java.util.ArrayList)12 IOException (java.io.IOException)11 JSONObject (org.json.JSONObject)10 Uri (android.net.Uri)9 LinearLayout (android.widget.LinearLayout)9 OnCancelListener (android.content.DialogInterface.OnCancelListener)8 Display (android.view.Display)8 Activity (android.app.Activity)7 Dialog (android.app.Dialog)7 ImageView (android.widget.ImageView)7 List (java.util.List)7