Example usage for android.app DialogFragment show

List of usage examples for android.app DialogFragment show

Introduction

In this page you can find the example usage for android.app DialogFragment show.

Prototype

public int show(FragmentTransaction transaction, String tag) 

Source Link

Document

Display the dialog, adding the fragment using an existing transaction and then committing the transaction.

Usage

From source file:paarmann.physikprofil.MainActivity.java

private void askForUpdate(int newVersionCode, String newVersionName) {
    DialogFragment dialog = new UpdateDialog().setVersionName(newVersionName);
    dialog.show(getFragmentManager(), "updateDialog");
}

From source file:com.keithcassidy.finishline.HomeActivity.java

private void showAbout() {
    // Create and show the dialog.
    DialogFragment newFragment = AboutDialog.newInstance();
    newFragment.show(getFragmentManager(), "aboutdialog");
}

From source file:com.sean.takeastand.ui.ScheduleListActivity.java

private void showTimePickerDialog(boolean startOrEndTime, boolean newAlarm) {
    Bundle args = new Bundle();
    args.putBoolean("StartOrEndButton", startOrEndTime);
    args.putBoolean("NewAlarm", newAlarm);
    DialogFragment timePickerFragment = new TimePickerFragment();
    timePickerFragment.setArguments(args);
    try {//from www . j a va2 s.com
        timePickerFragment.show(getFragmentManager(), "timePicker");
    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:com.optimusinfo.elasticpath.cortex.common.EPFragmentActivity.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
    case android.R.id.home:
        // Incase user presses back button from top navigation
        if (getFragmentManager().getBackStackEntryCount() > 1) {
            onBackPressed();/*w  ww  .  j  av a2  s  . c  o  m*/
        }
        break;
    case R.id.action_cart:
        if (getCurrentFragment() instanceof CartFragment) {

        } else if (getCurrentFragment() instanceof CheckoutFragment) {
            onBackPressed();
        } else {
            getCurrentFragment().detachChildFragments();
            // Start the product details activity
            CartFragment mObjFragment = new CartFragment(null, null);
            addFragmentToBreadCrumb("Cart", R.id.fragment_container, mObjFragment);
        }
        break;
    case R.id.action_login:
        getCurrentFragment().detachChildFragments();
        Intent mAuthIntent = new Intent(this, AuthenticationActivity.class);
        startActivityForResult(mAuthIntent, REQUEST_CODE_AUTHENTICATION);
        break;
    case R.id.action_logout:
        // Create an instance of the dialog fragment and show it
        DialogFragment dialog = new LogoutFragment();
        dialog.show(getFragmentManager(), "Logout");
        break;
    case R.id.action_refresh:
        onRefreshData();
        break;
    case R.id.action_profile:
        if (getCurrentFragment() instanceof ProfileFragment) {

        } else {
            getCurrentFragment().detachChildFragments();
            ProfileFragment objFragment = new ProfileFragment();
            addFragmentToBreadCrumb("Profile", R.id.fragment_container, objFragment);
        }
        break;
    }
    return true;
}

From source file:de.uulm.graphicalpasswords.openuyi.UYICreatePasswordActivity.java

public void submit(View view) {
    SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(this);
    SharedPreferences.Editor edit = sharedPref.edit();
    edit.putString("uyi_pw", Picture.distortedToSortedString(selectedPictures));
    edit.commit();//from  w  w w  .  j a  v a  2 s . c  o m

    Bundle bundle = new Bundle();
    bundle.putIntArray("input", Picture.distortedToIntArray(selectedPictures));
    DialogFragment dialog = new RememberPasswordDialogFragment();
    dialog.setArguments(bundle);
    dialog.show(getFragmentManager(), "remember");
}

From source file:mx.openpay.android.example.AddCardActivity.java

private void addCard() {
    Openpay openpay = ((OpenPayAppExample) this.getApplication()).getOpenpay();
    Card card = new Card();
    boolean isValid = true;

    final EditText holderNameEt = ((EditText) this.findViewById(R.id.holder_name));
    final String holderName = holderNameEt.getText().toString();
    card.holderName(holderName);//from  w  w  w . jav a2  s .c om
    if (!CardValidator.validateHolderName(holderName)) {
        holderNameEt.setError(this.getString(R.string.invalid_holder_name));
        isValid = false;
    }

    final EditText cardNumberEt = ((EditText) this.findViewById(R.id.card_number));
    final String cardNumber = cardNumberEt.getText().toString();
    card.cardNumber(cardNumber);
    if (!CardValidator.validateNumber(cardNumber)) {
        cardNumberEt.setError(this.getString(R.string.invalid_card_number));
        isValid = false;
    }

    EditText cvv2Et = ((EditText) this.findViewById(R.id.cvv2));
    String cvv = cvv2Et.getText().toString();
    card.cvv2(cvv);
    if (!CardValidator.validateCVV(cvv, cardNumber)) {
        cvv2Et.setError(this.getString(R.string.invalid_cvv));
        isValid = false;
    }

    Integer year = this
            .getInteger(((Spinner) this.findViewById(R.id.year_spinner)).getSelectedItem().toString());

    Integer month = this
            .getInteger(((Spinner) this.findViewById(R.id.month_spinner)).getSelectedItem().toString());

    if (!CardValidator.validateExpiryDate(month, year)) {
        DialogFragment fragment = MessageDialogFragment.newInstance(R.string.error,
                this.getString(R.string.invalid_expire_date));
        fragment.show(this.getFragmentManager(), "Error");
        isValid = false;
    }

    card.expirationMonth(month);
    card.expirationYear(year);

    if (isValid) {
        this.progressFragment.show(this.getSupportFragmentManager(), "progress");
        openpay.createCard(card, this);
    }

}

From source file:mx.openpay.android.example.AddCardActivity.java

private void addToken() {
    Openpay openpay = ((OpenPayAppExample) this.getApplication()).getOpenpay();
    Card card = new Card();
    boolean isValid = true;

    final EditText holderNameEt = ((EditText) this.findViewById(R.id.holder_name));
    final String holderName = holderNameEt.getText().toString();
    card.holderName(holderName);/*from www.j a  v a 2s  .c  o m*/
    if (!CardValidator.validateHolderName(holderName)) {
        holderNameEt.setError(this.getString(R.string.invalid_holder_name));
        isValid = false;
    }

    final EditText cardNumberEt = ((EditText) this.findViewById(R.id.card_number));
    final String cardNumber = cardNumberEt.getText().toString();
    card.cardNumber(cardNumber);
    if (!CardValidator.validateNumber(cardNumber)) {
        cardNumberEt.setError(this.getString(R.string.invalid_card_number));
        isValid = false;
    }

    EditText cvv2Et = ((EditText) this.findViewById(R.id.cvv2));
    String cvv = cvv2Et.getText().toString();
    card.cvv2(cvv);
    if (!CardValidator.validateCVV(cvv, cardNumber)) {
        cvv2Et.setError(this.getString(R.string.invalid_cvv));
        isValid = false;
    }

    Integer year = this
            .getInteger(((Spinner) this.findViewById(R.id.year_spinner)).getSelectedItem().toString());

    Integer month = this
            .getInteger(((Spinner) this.findViewById(R.id.month_spinner)).getSelectedItem().toString());

    if (!CardValidator.validateExpiryDate(month, year)) {
        DialogFragment fragment = MessageDialogFragment.newInstance(R.string.error,
                this.getString(R.string.invalid_expire_date));
        fragment.show(this.getFragmentManager(), "Error");
        isValid = false;
    }

    card.expirationMonth(month);
    card.expirationYear(year);

    if (isValid) {
        this.progressFragment.show(this.getSupportFragmentManager(), "progress");
        openpay.createToken(card, this);
    }

}

From source file:de.uulm.graphicalpasswords.opentapi.TAPILoginActivity.java

public void submit(View view) {
    DialogFragment dialog;
    if (password.equals(TAPICreatePasswordActivity.arrayToString(input))) {
        dialog = new ResultOKDialog();
    } else {/* ww  w.j  a  v  a  2 s.  c  om*/
        dialog = new WrongResultDialog();
    }
    dialog.show(getFragmentManager(), "result");
}

From source file:com.lovejoy777sarootool.rootool.fragments.BrowserFragment.java

@Override
public boolean onMenuItemClick(MenuItem item) {
    switch (item.getItemId()) {
    case R.id.createfile:
        final DialogFragment dialog1 = new CreateFileDialog();
        dialog1.show(fm, BrowserActivity.TAG_DIALOG);
        return true;
    case R.id.createfolder:
        final DialogFragment dialog2 = new CreateFolderDialog();
        dialog2.show(fm, BrowserActivity.TAG_DIALOG);
        return true;
    default:/*from   www  .  j a v  a2 s  . com*/
        return false;
    }
}

From source file:com.android.mail.browse.AttachmentActionHandler.java

/**
 * Displays a loading dialog to be used for downloading attachments.
 * Must be called on the UI thread.// ww  w.  j a  v  a2  s.c  o  m
 */
public void showDownloadingDialog() {
    final FragmentTransaction ft = mFragmentManager.beginTransaction();
    final Fragment prev = mFragmentManager.findFragmentByTag(PROGRESS_FRAGMENT_TAG);
    if (prev != null) {
        ft.remove(prev);
    }
    ft.addToBackStack(null);

    // Create and show the dialog.
    final DialogFragment newFragment = AttachmentProgressDialogFragment.newInstance(mAttachment);
    newFragment.show(ft, PROGRESS_FRAGMENT_TAG);
}