Example usage for android.support.v4.app DialogFragment getDialog

List of usage examples for android.support.v4.app DialogFragment getDialog

Introduction

In this page you can find the example usage for android.support.v4.app DialogFragment getDialog.

Prototype

public Dialog getDialog() 

Source Link

Usage

From source file:org.wahtod.wififixer.ui.BaseDialogFragment.java

protected static void setDialog(DialogFragment f) {
    Dialog d = f.getDialog();
    if (d != null) {
        d.setCanceledOnTouchOutside(true);
        d.getWindow().getAttributes().softInputMode = WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN;
    }//from   w  w w. ja v  a 2s  .c om
}

From source file:org.solovyev.android.calculator.App.java

public static void hideIme(@NonNull DialogFragment fragment) {
    final Dialog dialog = fragment.getDialog();
    if (dialog == null) {
        return;/* www .j av a2s  .c o m*/
    }
    final View focusedView = dialog.getCurrentFocus();
    if (focusedView == null) {
        return;
    }
    hideIme(focusedView);
}

From source file:com.example.dididoit.app.MainActivity.java

@Override
public void onDialogDoneClick(DialogFragment dialog) {
    Editable newItemText = ((EditText) dialog.getDialog().findViewById(R.id.item_name)).getText();
    String newItem;//  w  w w  .j a va  2s.com
    // TODO: this should be handled more gracefully by only enabling done button when there
    // is text
    if (null == newItemText) {
        return;
    } else {
        newItem = newItemText.toString();
    }
    // TODO: add to adapter
}

From source file:com.facebook.react.tests.DatePickerDialogTestCase.java

public void testPresetDate() {
    final WritableMap options = new WritableNativeMap();
    options.putDouble("date", getDateInMillis(2020, 5, 6));

    final DialogFragment datePickerFragment = showDialog(options);
    final DatePicker datePicker = ((DatePickerDialog) datePickerFragment.getDialog()).getDatePicker();

    assertEquals(2020, datePicker.getYear());
    assertEquals(5, datePicker.getMonth());
    assertEquals(6, datePicker.getDayOfMonth());
}

From source file:com.shalzz.attendance.activity.LoginActivity.java

@Override
public void onDialogPositiveClick(DialogFragment dialog) {

    Dialog dialogView = dialog.getDialog();
    final EditText Captxt = (EditText) dialogView.findViewById(R.id.etCapTxt);

    if (data.isEmpty())
        getHiddenData();/*from ww w .j a  v  a  2s .c  o m*/

    // workaround for enrollment number.
    String sapid = etSapid.getText().toString();
    if (sapid.length() == 10 && sapid.charAt(0) == '#')
        sapid = sapid.replaceFirst("#", "R");

    new UserAccount(LoginActivity.this).Login(sapid, etPass.getText().toString(), Captxt.getText().toString(),
            data);
    Miscellaneous.closeKeyboard(this, Captxt);
    dialog.dismiss();
}

From source file:com.facebook.react.tests.DatePickerDialogTestCase.java

public void testDismissCallback() throws Throwable {
    final DialogFragment datePickerFragment = showDialog(null);

    runTestOnUiThread(new Runnable() {
        @Override/*  ww w.j a  v a2  s  .c  o m*/
        public void run() {
            datePickerFragment.getDialog().dismiss();
        }
    });

    getInstrumentation().waitForIdleSync();
    waitForBridgeAndUIIdle();

    assertEquals(0, mRecordingModule.getErrors());
    assertEquals(0, mRecordingModule.getDates().size());
    assertEquals(1, mRecordingModule.getDismissed());
}

From source file:com.facebook.react.tests.DatePickerDialogTestCase.java

public void testCallback() throws Throwable {
    final WritableMap options = new WritableNativeMap();
    options.putDouble("date", getDateInMillis(2020, 5, 6));

    final DialogFragment datePickerFragment = showDialog(options);

    runTestOnUiThread(new Runnable() {
        @Override/*  w ww  .  jav a 2 s  .  co m*/
        public void run() {
            ((DatePickerDialog) datePickerFragment.getDialog()).getButton(DialogInterface.BUTTON_POSITIVE)
                    .performClick();
        }
    });

    getInstrumentation().waitForIdleSync();
    waitForBridgeAndUIIdle();

    assertEquals(0, mRecordingModule.getErrors());
    assertEquals(1, mRecordingModule.getDates().size());
    assertEquals(2020, (int) mRecordingModule.getDates().get(0)[0]);
    assertEquals(5, (int) mRecordingModule.getDates().get(0)[1]);
    assertEquals(6, (int) mRecordingModule.getDates().get(0)[2]);
}

From source file:com.facebook.react.tests.TimePickerDialogTestCase.java

public void testDismissCallback() throws Throwable {
    final DialogFragment fragment = showDialog(null);

    assertEquals(0, mRecordingModule.getDismissed());

    runTestOnUiThread(new Runnable() {
        @Override//from w  w  w .  ja  v  a2  s.co  m
        public void run() {
            fragment.getDialog().dismiss();
        }
    });

    getInstrumentation().waitForIdleSync();
    waitForBridgeAndUIIdle();

    assertEquals(0, mRecordingModule.getErrors());
    assertEquals(0, mRecordingModule.getTimes().size());
    assertEquals(1, mRecordingModule.getDismissed());
}

From source file:com.vinidsl.navigationviewdemo.MainActivity.java

@Override
public void onDialogClick(DialogFragment dialog) {

    TextView rfcTV = (TextView) dialog.getDialog().findViewById(R.id.perfil_rfc);
    TextView rsTV = (TextView) dialog.getDialog().findViewById(R.id.perfil_rs);
    TextView calleFacTV = (TextView) dialog.getDialog().findViewById(R.id.perfil_calle_fac);
    TextView numExtTV = (TextView) dialog.getDialog().findViewById(R.id.perfil_num_ext_fac);
    TextView numIntTV = (TextView) dialog.getDialog().findViewById(R.id.perfil_num_int_fac);
    TextView coloniaFacTV = (TextView) dialog.getDialog().findViewById(R.id.perfil_colonia_fac);
    TextView delegacionFacTV = (TextView) dialog.getDialog().findViewById(R.id.perfil_delegacion_fac);
    TextView cpFacTV = (TextView) dialog.getDialog().findViewById(R.id.perfil_codigo_postal_fac);
    TextView estadoTV = (TextView) dialog.getDialog().findViewById(R.id.perfil_estado_fac);

    /*/*from  w  w  w . j  ava 2 s. c  om*/
            
    id_usuario|rfc|razon_social|calle|noext|
    noint|colonia|cp|municipio|poblacion|
    estado
            
     */

    String idPerfil = "17";
    String parametro;

    String rfc = rfcTV.getText().toString();
    String rs = rsTV.getText().toString();
    String calle = calleFacTV.getText().toString();
    String numExt = numExtTV.getText().toString();
    String numInt = numIntTV.getText().toString();
    String colonia = coloniaFacTV.getText().toString();
    String cp = cpFacTV.getText().toString();
    String municipio = delegacionFacTV.getText().toString();
    String estado = estadoTV.getText().toString();
    String poblacion = "";

    parametro = idPerfil + "|" + rfc + "|" + rs + "|" + calle + "|" + numExt + "|" + numInt + "|" + colonia
            + "|" + cp + "|" + municipio + "|" + poblacion + "|" + estado;

    DatosFactura df = new DatosFactura(0, rfc, rs, calle, numInt, numExt, colonia, cp, municipio, estado);

    GuardarDatosFacturaTask task = new GuardarDatosFacturaTask(this);
    task.setDatoFactura(df);
    task.execute(parametro);

    dialog.dismiss();

}

From source file:com.m3sys.proxlock.MainActivity.java

public void onDialogPositiveClick(DialogFragment dialog) {
    // User touched the dialog's positive button
    EditText t = (EditText) dialog.getDialog().findViewById(R.id.name);

    if (mLastLocation == null)
        return;/*  w  w w  . j av  a  2 s .  c  o m*/

    if (t.getText().toString().isEmpty()) {
        Toast.makeText(getApplicationContext(), "No name entered!", Toast.LENGTH_SHORT).show();
        return;
    }

    dB.insertLocation(t.getText().toString(), mLastLocation.getLatitude(), mLastLocation.getLongitude(), true,
            PLocation.LATLONG);

    updateGui(mLastLocation);
    Toast.makeText(getApplicationContext(), "Home Saved!", Toast.LENGTH_SHORT).show();
    Log.d(TAG, "saving " + t.getText().toString());
}