Example usage for android.app Dialog isShowing

List of usage examples for android.app Dialog isShowing

Introduction

In this page you can find the example usage for android.app Dialog isShowing.

Prototype

public boolean isShowing() 

Source Link

Usage

From source file:am.util.mvp.AMActivity.java

/**
 * ?// w w  w .  j  a v  a2  s.co  m
 *
 * @param dialog Dialog
 */
public void dismissDialog(Dialog dialog) {
    if (dialog.isShowing()) {
        dialog.dismiss();
    }
    mShowDialogs.remove(dialog);
}

From source file:com.king.base.BaseActivity.java

protected void dismissDialog(Dialog dialog) {
    if (dialog != null && dialog.isShowing()) {
        dialog.dismiss();
    }
}

From source file:com.otaupdater.SettingsActivity.java

@Override
protected void onPause() {
    super.onPause();
    for (Dialog dlg : dlgs) {
        if (dlg.isShowing())
            dlg.dismiss();//from w ww . j a va2 s .  c om
    }
    dlgs.clear();
}

From source file:com.darly.im.ui.CCPActivityBase.java

/**
 *
 *///from w  w  w .j a  v a 2 s  . c o m
private void releaseDialogList() {
    if (mAppDialogCache == null) {
        return;
    }

    for (Dialog dialog : mAppDialogCache) {
        if (dialog == null || !dialog.isShowing()) {
            continue;
        }
        dialog.dismiss();
    }
    mAppDialogCache.clear();
    mAppDialogCache = null;
}

From source file:com.chalmers.schmaps.test.GoogleMapSearchLocationTest.java

/**
 * Tests that a dialog is shown if a room is not found by querying for
 * something that does not exist within the database and confirms that
 * a dialog is shown upon the query./*from  w  w w .j a  v  a 2 s . c o  m*/
 */
public void testDialogRoomNotFound() {
    Dialog showingDialog = null;
    TouchUtils.tapView(this, this.lectureEdit);
    super.sendKeys(KeyEvent.KEYCODE_BACKSLASH);
    super.sendKeys("R O O M THATDOESNOTEXIST");
    super.sendKeys(KeyEvent.KEYCODE_POUND);
    super.getInstrumentation().waitForIdleSync();
    TouchUtils.clickView(this, this.editButton);
    super.getInstrumentation().waitForIdleSync();
    try {
        Field dialogRoomNotFound = activity.getClass().getDeclaredField("dialog");
        dialogRoomNotFound.setAccessible(true);
        showingDialog = (Dialog) dialogRoomNotFound.get(this.activity);
    } catch (Exception e) {
    }
    assertTrue(showingDialog.isShowing());
}

From source file:com.folioreader.activity.FolioActivity.java

private void initBook() {
    final Dialog pgDailog = ProgressDialog.show(FolioActivity.this, getString(R.string.please_wait));
    new Thread(new Runnable() {
        @Override//from  w  w  w.  j  av  a  2s.  c  o  m
        public void run() {
            mBook = FileUtil.saveEpubFile(FolioActivity.this, mEpubSourceType, mEpubFilePath, mEpubRawId,
                    mEpubFileName);
            mBookeFilePath = FileUtil.getFolioEpubFilePath(mEpubSourceType, mEpubFilePath, mEpubFileName);
            runOnUiThread(new Runnable() {
                @Override
                public void run() {
                    loadBook();
                    if (pgDailog != null && pgDailog.isShowing())
                        pgDailog.dismiss();
                }
            });
        }
    }).start();

    new DbAdapter(FolioActivity.this);
}

From source file:org.appcelerator.titanium.TiBaseActivity.java

private void releaseDialogs(boolean finish) {
    //clean up dialogs when activity is pausing or finishing
    for (Iterator<DialogWrapper> iter = dialogs.iterator(); iter.hasNext();) {
        DialogWrapper p = iter.next();/*from   w  w  w  .  j  a  v  a2s  . c  o  m*/
        Dialog dialog = p.getDialog();
        boolean persistent = p.getPersistent();
        //if the activity is pausing but not finishing, clean up dialogs only if
        //they are non-persistent
        if (finish || !persistent) {
            if (dialog != null && dialog.isShowing()) {
                dialog.dismiss();
            }
            dialogs.remove(p);
        }
    }
}

From source file:com.todoroo.astrid.activity.TaskEditFragment.java

/** Save task model from values in UI components */
public void save(boolean onPause) {
    if (title == null)
        return;//  w  w w .j ava2s . c  o m

    if (title.getText().length() > 0)
        model.setValue(Task.DELETION_DATE, 0L);

    if (title.getText().length() == 0)
        return;

    if (isNewTask) {
        taskOutstandingDao.deleteWhere(Criterion.and(TaskOutstanding.TASK_ID.eq(model.getId()),
                TaskOutstanding.COLUMN_STRING.eq(Task.TITLE.name),
                Criterion.or(TaskOutstanding.VALUE_STRING.isNull(), TaskOutstanding.VALUE_STRING.eq("")))); //$NON-NLS-1$
    }

    StringBuilder toast = new StringBuilder();
    synchronized (controls) {
        for (TaskEditControlSet controlSet : controls) {
            if (controlSet instanceof PopupControlSet) { // Save open control set
                PopupControlSet popup = (PopupControlSet) controlSet;
                Dialog d = popup.getDialog();
                if (d != null && d.isShowing()) {
                    getActivity().getIntent().putExtra(TOKEN_OPEN_CONTROL, popup.getClass());
                }
            }
            String toastText = controlSet.writeToModel(model);
            if (toastText != null)
                toast.append('\n').append(toastText);
        }
    }

    String processedToast = addDueTimeToToast(toast.toString());
    boolean cancelFinish = peopleControlSet != null && !peopleControlSet.saveSharingSettings(processedToast)
            && !onPause;

    boolean tagsChanged = Flags.check(Flags.TAGS_CHANGED);
    model.putTransitory(TaskService.TRANS_EDIT_SAVE, true);
    taskService.save(model);

    if (!onPause && !cancelFinish) {
        boolean taskEditActivity = (getActivity() instanceof TaskEditActivity);
        boolean isAssignedToMe = peopleControlSet.isAssignedToMe();
        boolean showRepeatAlert = model.getTransitory(TaskService.TRANS_REPEAT_CHANGED) != null
                && !TextUtils.isEmpty(model.getValue(Task.RECURRENCE));
        String assignedTo = peopleControlSet.getAssignedToString();
        String assignedEmail = ""; //$NON-NLS-1$
        String assignedId = Task.USER_ID_IGNORE;
        if (Task.userIdIsEmail(model.getValue(Task.USER_ID))) {
            assignedEmail = model.getValue(Task.USER_ID);
        }

        if (taskEditActivity) {
            Intent data = new Intent();
            if (!isAssignedToMe) {
                data.putExtra(TOKEN_TASK_WAS_ASSIGNED, true);
                data.putExtra(TOKEN_ASSIGNED_TO_DISPLAY, assignedTo);
                if (!TextUtils.isEmpty(assignedEmail))
                    data.putExtra(TOKEN_ASSIGNED_TO_EMAIL, assignedEmail);
                if (Task.isRealUserId(assignedId))
                    ;
                data.putExtra(TOKEN_ASSIGNED_TO_ID, assignedId);
            }
            if (showRepeatAlert) {
                data.putExtra(TOKEN_NEW_REPEATING_TASK, model);
            }
            data.putExtra(TOKEN_TAGS_CHANGED, tagsChanged);
            getActivity().setResult(Activity.RESULT_OK, data);

        } else {
            // Notify task list fragment in multi-column case
            // since the activity isn't actually finishing
            TaskListActivity tla = (TaskListActivity) getActivity();
            if (!isAssignedToMe)
                tla.taskAssignedTo(assignedTo, assignedEmail, assignedId);
            else if (showRepeatAlert)
                DateChangedAlerts.showRepeatChangedDialog(tla, model);

            if (tagsChanged)
                tla.tagsChanged();
            tla.refreshTaskList();
        }

        removeExtrasFromIntent(getActivity().getIntent());
        shouldSaveState = false;
        getActivity().onBackPressed();

    }
}

From source file:com.digitalarx.android.authentication.AuthenticatorActivity.java

@Override
public void onSsoFinished(String sessionCookie) {
    if (sessionCookie != null && sessionCookie.length() > 0) {
        Log_OC.d(TAG, "Successful SSO - time to save the account");
        mAuthToken = sessionCookie;//w w  w .j  ava2s .  c  om
        getRemoteUserNameOperation(sessionCookie, true);
        Fragment fd = getSupportFragmentManager().findFragmentByTag(SAML_DIALOG_TAG);
        if (fd != null && fd instanceof SherlockDialogFragment) {
            Dialog d = ((SherlockDialogFragment) fd).getDialog();
            if (d != null && d.isShowing()) {
                d.dismiss();
            }
        }

    } else {
        // TODO - show fail
        Log_OC.d(TAG, "SSO failed");
    }

}

From source file:com.cerema.cloud2.authentication.AuthenticatorActivity.java

@Override
public void onSsoFinished(String sessionCookie) {
    if (sessionCookie != null && sessionCookie.length() > 0) {
        Log_OC.d(TAG, "Successful SSO - time to save the account");
        mAuthToken = sessionCookie;//from w  w w  . ja  v a  2s.  c  o m
        getRemoteUserNameOperation(sessionCookie);
        Fragment fd = getSupportFragmentManager().findFragmentByTag(SAML_DIALOG_TAG);
        if (fd != null && fd instanceof DialogFragment) {
            Dialog d = ((DialogFragment) fd).getDialog();
            if (d != null && d.isShowing()) {
                d.dismiss();
            }
        }

    } else {
        // TODO - show fail
        Log_OC.d(TAG, "SSO failed");
    }

}