use of android.app.ProgressDialog in project actor-platform by actorapp.
the class BaseFragment method execute.
public <T> Promise<T> execute(Promise<T> promise, int title) {
final ProgressDialog dialog = ProgressDialog.show(getContext(), "", getString(title), true, false);
promise.then(new Consumer<T>() {
@Override
public void apply(T t) {
dismissDialog(dialog);
}
}).failure(new Consumer<Exception>() {
@Override
public void apply(Exception e) {
dismissDialog(dialog);
}
});
return promise;
}
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();
}
use of android.app.ProgressDialog in project Anki-Android by Ramblurr.
the class Reviewer method onCreate.
// ----------------------------------------------------------------------------
// ANDROID METHODS
// ----------------------------------------------------------------------------
@Override
protected void onCreate(Bundle savedInstanceState) {
// Create the extensions as early as possible, so that they can be offered events.
mExtensions = new ReviewerExtRegistry(getBaseContext());
Themes.applyTheme(this);
super.onCreate(savedInstanceState);
Log.i(AnkiDroidApp.TAG, "Reviewer - onCreate");
// Remove the status bar and title bar
if (mPrefFullscreenReview) {
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
// Do not hide the title bar in Honeycomb, since it contains the action bar.
if (AnkiDroidApp.SDK_VERSION <= 11) {
requestWindowFeature(Window.FEATURE_NO_TITLE);
}
}
mChangeBorderStyle = Themes.getTheme() == Themes.THEME_ANDROID_LIGHT || Themes.getTheme() == Themes.THEME_ANDROID_DARK;
// The hardware buttons should control the music volume while reviewing.
setVolumeControlStream(AudioManager.STREAM_MUSIC);
Collection col = AnkiDroidApp.getCol();
if (col == null) {
reloadCollection(savedInstanceState);
return;
} else {
mSched = col.getSched();
mCollectionFilename = col.getPath();
mBaseUrl = Utils.getBaseUrl(col.getMedia().getDir());
restorePreferences();
setFullScreen(mPrefFullscreenReview);
registerExternalStorageListener();
if (mNightMode) {
mCurrentBackgroundColor = Themes.getNightModeCardBackground(this);
} else {
mCurrentBackgroundColor = Color.WHITE;
}
mUseQuickUpdate = shouldUseQuickUpdate();
initLayout(R.layout.flashcard);
try {
String[] title = mSched.getCol().getDecks().current().getString("name").split("::");
AnkiDroidApp.getCompat().setTitle(this, title[title.length - 1], mInvertedColors);
} catch (JSONException e) {
throw new RuntimeException(e);
}
AnkiDroidApp.getCompat().setSubtitle(this, "", mInvertedColors);
if (mPrefTextSelection) {
clipboardSetText("");
}
// Load the template for the card
try {
mCardTemplate = Utils.convertStreamToString(getAssets().open("card_template.html"));
} catch (IOException e) {
e.printStackTrace();
}
// Initialize text-to-speech. This is an asynchronous operation.
if (mSpeakText) {
ReadText.initializeTts(this);
mTTSProgressDialog = new ProgressDialog(this);
new AsyncTask<String, Void, Void>() {
@Override
protected void onPreExecute() {
mTTSProgressDialog.setMessage("Init TTS");
mTTSProgressDialog.show();
}
@Override
protected Void doInBackground(String... params) {
while (ReadText.mTTSInitDone == false) {
try {
Thread.sleep(500);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
return null;
}
@Override
protected void onPostExecute(Void res) {
mTTSProgressDialog.dismiss();
// Load the first card and start reviewing. Uses the answer card
// task to load a card, but since we send null
// as the card to answer, no card will be answered.
DeckTask.launchDeckTask(DeckTask.TASK_TYPE_ANSWER_CARD, mAnswerCardHandler, new DeckTask.TaskData(mSched, null, 0));
}
}.execute();
}
// Get last whiteboard state
if (mPrefWhiteboard && mCurrentCard != null && MetaDB.getWhiteboardState(this, mCurrentCard.getDid()) == 1) {
mShowWhiteboard = true;
mWhiteboard.setVisibility(View.VISIBLE);
}
// Load the first card and start reviewing. Uses the answer card
// task to load a card, but since we send null
// as the card to answer, no card will be answered.
DeckTask.launchDeckTask(DeckTask.TASK_TYPE_ANSWER_CARD, mAnswerCardHandler, new DeckTask.TaskData(mSched, null, 0));
// Since we aren't actually answering a card, decrement the rep count
mSched.setReps(mSched.getReps() - 1);
}
}
Aggregations