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);
}
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));
}
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;
}
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();
}
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();
}
Aggregations