Search in sources :

Example 6 with ProgressDialog

use of android.app.ProgressDialog in project Trello-Android by chrisHoekstra.

the class MainActivity method onCreateDialog.

@Override
protected Dialog onCreateDialog(int id) {
    switch(id) {
        case DIALOG_PROGRESS:
            ProgressDialog dialog = new ProgressDialog(this);
            dialog.setCustomTitle(null);
            dialog.setMessage(getString(R.string.loading));
            dialog.setIndeterminate(true);
            dialog.setCancelable(false);
            return dialog;
        case DIALOG_LOGIN_ERROR:
            return new AlertDialog.Builder(this).setTitle(R.string.error).setMessage(getResources().getString(R.string.login_error_message)).setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {

                public void onClick(DialogInterface dialog, int whichButton) {
                    dialog.dismiss();
                }
            }).create();
    }
    return super.onCreateDialog(id);
}
Also used : DialogInterface(android.content.DialogInterface) ProgressDialog(android.app.ProgressDialog)

Example 7 with ProgressDialog

use of android.app.ProgressDialog in project android_frameworks_base by ParanoidAndroid.

the class ExternalStorageFormatter method updateProgressDialog.

public void updateProgressDialog(int msg) {
    if (mProgressDialog == null) {
        mProgressDialog = new ProgressDialog(this);
        mProgressDialog.setIndeterminate(true);
        mProgressDialog.setCancelable(false);
        mProgressDialog.getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_ALERT);
        mProgressDialog.show();
    }
    mProgressDialog.setMessage(getText(msg));
}
Also used : ProgressDialog(android.app.ProgressDialog)

Example 8 with ProgressDialog

use of android.app.ProgressDialog in project android_frameworks_base by ParanoidAndroid.

the class KeyguardSimPukView method getSimUnlockProgressDialog.

private Dialog getSimUnlockProgressDialog() {
    if (mSimUnlockProgressDialog == null) {
        mSimUnlockProgressDialog = new ProgressDialog(mContext);
        mSimUnlockProgressDialog.setMessage(mContext.getString(R.string.kg_sim_unlock_progress_dialog_message));
        mSimUnlockProgressDialog.setIndeterminate(true);
        mSimUnlockProgressDialog.setCancelable(false);
        if (!(mContext instanceof Activity)) {
            mSimUnlockProgressDialog.getWindow().setType(WindowManager.LayoutParams.TYPE_KEYGUARD_DIALOG);
        }
    }
    return mSimUnlockProgressDialog;
}
Also used : Activity(android.app.Activity) ProgressDialog(android.app.ProgressDialog)

Example 9 with ProgressDialog

use of android.app.ProgressDialog in project android_frameworks_base by ParanoidAndroid.

the class ShutdownThread method beginShutdownSequence.

private static void beginShutdownSequence(Context context) {
    synchronized (sIsStartedGuard) {
        if (sIsStarted) {
            Log.d(TAG, "Shutdown sequence already running, returning.");
            return;
        }
        sIsStarted = true;
    }
    // throw up an indeterminate system dialog to indicate radio is
    // shutting down.
    ProgressDialog pd = new ProgressDialog(context);
    pd.setTitle(context.getText(mReboot ? com.android.internal.R.string.reboot_system : com.android.internal.R.string.power_off));
    pd.setMessage(context.getText(mReboot ? com.android.internal.R.string.reboot_progress : com.android.internal.R.string.shutdown_progress));
    pd.setIndeterminate(true);
    pd.setCancelable(false);
    pd.getWindow().setType(WindowManager.LayoutParams.TYPE_KEYGUARD_DIALOG);
    pd.show();
    sInstance.mContext = context;
    sInstance.mPowerManager = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
    // make sure we never fall asleep again
    sInstance.mCpuWakeLock = null;
    try {
        sInstance.mCpuWakeLock = sInstance.mPowerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, TAG + "-cpu");
        sInstance.mCpuWakeLock.setReferenceCounted(false);
        sInstance.mCpuWakeLock.acquire();
    } catch (SecurityException e) {
        Log.w(TAG, "No permission to acquire wake lock", e);
        sInstance.mCpuWakeLock = null;
    }
    // also make sure the screen stays on for better user experience
    sInstance.mScreenWakeLock = null;
    if (sInstance.mPowerManager.isScreenOn()) {
        try {
            sInstance.mScreenWakeLock = sInstance.mPowerManager.newWakeLock(PowerManager.FULL_WAKE_LOCK, TAG + "-screen");
            sInstance.mScreenWakeLock.setReferenceCounted(false);
            sInstance.mScreenWakeLock.acquire();
        } catch (SecurityException e) {
            Log.w(TAG, "No permission to acquire wake lock", e);
            sInstance.mScreenWakeLock = null;
        }
    }
    // start the thread that initiates shutdown
    sInstance.mHandler = new Handler() {
    };
    sInstance.start();
}
Also used : Handler(android.os.Handler) ProgressDialog(android.app.ProgressDialog)

Example 10 with ProgressDialog

use of android.app.ProgressDialog in project android_frameworks_base by ParanoidAndroid.

the class DirListActivity method showDir.

/**
     * Loads the contents of dir into the list view.
     *
     * @param dirPath
     *      directory to load into list view
     */
private void showDir(String dirPath) {
    mCurrentDirPath = dirPath;
    /** Show progress dialog with a delay */
    final Handler delayedDialogHandler = new Handler() {

        @Override
        public void handleMessage(Message msg) {
            if (msg.what == MSG_SHOW_PROGRESS_DIALOG) {
                if (sProgressDialog == null) {
                    sProgressDialog = new ProgressDialog(DirListActivity.this);
                    sProgressDialog.setCancelable(false);
                    sProgressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
                    sProgressDialog.setTitle(R.string.dialog_progress_title);
                    sProgressDialog.setMessage(getText(R.string.dialog_progress_msg));
                }
                sProgressDialog.show();
            }
        }
    };
    Message msgShowDialog = delayedDialogHandler.obtainMessage(MSG_SHOW_PROGRESS_DIALOG);
    delayedDialogHandler.sendMessageDelayed(msgShowDialog, PROGRESS_DIALOG_DELAY_MS);
    /** Delegate loading contents from SD card to a new thread */
    new LoadListItemsThread(mCurrentDirPath, new Handler() {

        @Override
        public void handleMessage(Message msg) {
            if (msg.what == MSG_LOADED_ITEMS) {
                setTitle(shortenTitle(mCurrentDirPath));
                delayedDialogHandler.removeMessages(MSG_SHOW_PROGRESS_DIALOG);
                if (sProgressDialog != null) {
                    sProgressDialog.dismiss();
                }
                if (msg.obj == null) {
                    Toast.makeText(DirListActivity.this, NO_RESPONSE_MESSAGE, Toast.LENGTH_LONG).show();
                } else {
                    setListAdapter(new DirListAdapter(DirListActivity.this, (ListItem[]) msg.obj));
                }
            }
        }
    }).start();
}
Also used : Message(android.os.Message) Handler(android.os.Handler) ProgressDialog(android.app.ProgressDialog)

Aggregations

ProgressDialog (android.app.ProgressDialog)247 DialogInterface (android.content.DialogInterface)43 Intent (android.content.Intent)20 View (android.view.View)17 File (java.io.File)17 Handler (android.os.Handler)12 FrameLayout (android.widget.FrameLayout)12 TextView (android.widget.TextView)10 IOException (java.io.IOException)10 JSONObject (org.json.JSONObject)10 LinearLayout (android.widget.LinearLayout)9 ArrayList (java.util.ArrayList)9 SuppressLint (android.annotation.SuppressLint)8 Display (android.view.Display)8 Activity (android.app.Activity)7 Uri (android.net.Uri)7 AsyncTask (android.os.AsyncTask)7 Bundle (android.os.Bundle)6 KeyEvent (android.view.KeyEvent)6 ImageView (android.widget.ImageView)6