@Override public void onPostExecute(DeckTask.TaskData result) { updateCardsList(); if (mProgressDialog != null && mProgressDialog.isShowing()) { mProgressDialog.dismiss(); } }
@Override public void onPostExecute(DeckTask.TaskData result) { if (mProgressDialog != null && mProgressDialog.isShowing()) { mProgressDialog.dismiss(); } lockCheckAction = false; }
@Override public void onPreExecute() { Resources res = getResources(); if (mProgressDialog != null && mProgressDialog.isShowing()) { mProgressDialog.setMessage(res.getString(R.string.card_browser_sorting_cards)); } else { mProgressDialog = StyledProgressDialog.show( CardBrowser.this, "", res.getString(R.string.card_browser_sorting_cards), true); } }
@Override public void onPreExecute() { Resources res = getResources(); mProgressDialog = StyledProgressDialog.show( CardBrowser.this, "", res.getString(R.string.saving_changes), true); }
@Override public void onPostExecute(DeckTask.TaskData result) { if (!result.getBoolean()) { closeCardBrowser(DeckPicker.RESULT_DB_ERROR); } mProgressDialog.dismiss(); }
@Override public void onPreExecute() { Resources res = getResources(); mProgressDialog = StyledProgressDialog.show( DeckOptions.this, "", res.getString(R.string.reordering_cards), false); }
@Override public void onPostExecute(DeckTask.TaskData result) { if (result.getBoolean()) { updateCardInList( mCol.getCard(Long.parseLong(mCards.get(mPositionInCardsList).get("id")))); } else { closeCardBrowser(DeckPicker.RESULT_DB_ERROR); } mProgressDialog.dismiss(); }
@Override public void onPreExecute() { if (!mUndoRedoDialogShowing) { if (mProgressDialog != null && mProgressDialog.isShowing()) { mProgressDialog.setMessage(getResources().getString(R.string.card_browser_load)); mProgressDialog.setOnCancelListener( new OnCancelListener() { @Override public void onCancel(DialogInterface arg0) { canceled = true; DeckTask.cancelTask(); closeCardBrowser(); } }); } else { mProgressDialog = StyledProgressDialog.show( CardBrowser.this, "", getResources().getString(R.string.card_browser_load), true, true, new OnCancelListener() { @Override public void onCancel(DialogInterface arg0) { canceled = true; DeckTask.cancelTask(); closeCardBrowser(); } }); } } else { mProgressDialog.setMessage(getResources().getString(R.string.card_browser_load)); mUndoRedoDialogShowing = false; } }
public static StyledProgressDialog show( Context context, CharSequence title, CharSequence message, boolean indeterminable, boolean cancelable, DialogInterface.OnCancelListener cancelListener) { final StyledProgressDialog dialog = new StyledProgressDialog(context); LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); View layout = inflater.inflate(R.layout.styled_progress_dialog, null); dialog.addContentView( layout, new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT)); // set title if (title != null && title.length() > 0) { ((TextView) layout.findViewById(R.id.alertTitle)).setText(title); // if (icon != 0) { // ((ImageView) layout.findViewById(R.id.icon)).setImageResource(icon); // } else { // layout.findViewById(R.id.icon).setVisibility(View.GONE); // } } else { layout.findViewById(R.id.topPanel).setVisibility(View.GONE); layout.findViewById(R.id.titleDivider).setVisibility(View.GONE); } // set the message if (message != null) { TextView tv = (TextView) layout.findViewById(R.id.message); tv.setText(message); // if (messageSize != 0) { // tv.setTextSize(messageSize * context.getResources().getDisplayMetrics().scaledDensity); // } } // set background try { Themes.setStyledProgressDialogDialogBackgrounds(layout); } catch (OutOfMemoryError e) { Log.e(AnkiDroidApp.TAG, "StyledDialog - Dialog could not be created: " + e); Themes.showThemedToast( context, context.getResources().getString(R.string.error_insufficient_memory), false); return null; } dialog.setContentView(layout); dialog.setCancelable(cancelable); dialog.setOnCancelListener(cancelListener); if (animationEnabled(context)) { dialog.show(); } return dialog; }
@Override public void onProgressUpdate(DeckTask.TaskData... values) { if (canceled) { return; } ArrayList<HashMap<String, String>> cards = values[0].getCards(); if (cards == null) { Resources res = getResources(); StyledDialog.Builder builder = new StyledDialog.Builder(CardBrowser.this); builder.setTitle(res.getString(R.string.error)); builder.setIcon(android.R.drawable.ic_dialog_alert); builder.setMessage(res.getString(R.string.card_browser_cardloading_error)); builder.setPositiveButton( res.getString(R.string.ok), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { closeCardBrowser(); } }); builder.setOnCancelListener( new OnCancelListener() { @Override public void onCancel(DialogInterface dialog) { closeCardBrowser(); } }); builder.create().show(); } else { if (mPrefFixArabic) { for (HashMap<String, String> entry : cards) { entry.put("sfld", ArabicUtilities.reshapeSentence(entry.get("sfld"))); } } try { int field = AnkiDroidApp.getSharedPrefs(getBaseContext()).getInt("cardBrowserField", 0); Card tempCard = mCol.getCard( Long.parseLong( cards.get(0).get("id"))); // Long.parseLong(mCards.get(0).get("id")) ArrayList<String> uniqueFields = new ArrayList<String>(); if (field > 0 && (mFields != null)) { for (HashMap<String, String> entry : cards) { tempCard = mCol.getCard(Long.parseLong(entry.get("id"))); String item = tempCard.note().getitem(mFields[field]); entry.put("sfld", item); if (!uniqueFields.contains(item)) { uniqueFields.add(item); mAllCards.add(entry); mCards.add(entry); } } } else { mAllCards.addAll(cards); mCards.addAll(cards); } if (mOrder == CARD_ORDER_NONE) { updateCardsList(); mProgressDialog.dismiss(); } else { DeckTask.launchDeckTask( DeckTask.TASK_TYPE_UPDATE_CARD_BROWSER_LIST, mSortCardsHandler, new DeckTask.TaskData(mAllCards, new HashMapCompare())); } } catch (OutOfMemoryError e) { Log.e(AnkiDroidApp.TAG, "CardBrowser: mLoadCardsHandler: OutOfMemoryError: " + e); Themes.showThemedToast( CardBrowser.this, getResources().getString(R.string.error_insufficient_memory), false); closeCardBrowser(); } } }
@Override public void onPostExecute(DeckTask.TaskData result) { mProgressDialog.dismiss(); }
@Override public void onPreExecute() { mProgressDialog = StyledProgressDialog.show(Preferences.this, "", dialogMessage, true); }