Example usage for android.app Dialog findViewById

List of usage examples for android.app Dialog findViewById

Introduction

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

Prototype

@Nullable
public <T extends View> T findViewById(@IdRes int id) 

Source Link

Document

Finds the first descendant view with the given ID or null if the ID is invalid (< 0), there is no matching view in the hierarchy, or the dialog has not yet been fully created (for example, via #show() or #create() ).

Usage

From source file:net.evendanan.android.thumbremote.ui.FragmentAlertDialogSupport.java

private Dialog createMediaTimeSeekDialog() {
    final Dialog seeker = new Dialog(getActivity(), R.style.Popup);
    seeker.setContentView(R.layout.custom_time_selection);
    seeker.findViewById(R.id.seeker_close_button).setOnClickListener(new OnClickListener() {
        @Override//from ww w .jav  a  2s  . c om
        public void onClick(View v) {
            seeker.dismiss();
        }
    });
    seeker.setOnDismissListener(new OnDismissListener() {
        @Override
        public void onDismiss(DialogInterface dialog) {
            ((RemoteUiActivity) getActivity()).mMediaSeekBar = null;
        }
    });

    SeekBar seekBar = (SeekBar) seeker.findViewById(R.id.time_seek_bar);
    seekBar.setOnSeekBarChangeListener((RemoteUiActivity) getActivity());

    return seeker;
}

From source file:com.vrem.wifianalyzer.wifi.AccessPointsDetail.java

public Dialog popupDialog(@NonNull Context context, @NonNull LayoutInflater inflater,
        @NonNull WiFiDetail wiFiDetail) {
    View view = inflater.inflate(R.layout.access_points_details_popup, null);
    Dialog dialog = new Dialog(context);
    dialog.setContentView(view);//from   www .j  a  va2  s  .co  m
    setView(context.getResources(), view, wiFiDetail, false, true);
    dialog.findViewById(R.id.popupButton).setOnClickListener(new PopupDialogListener(dialog));
    return dialog;
}

From source file:com.example.stefan.movies.Fragments.Others.OpenSourceLicenses.java

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {

    final Dialog dialog = new Dialog(getActivity());

    dialog.getWindow().requestFeature(Window.FEATURE_NO_TITLE);
    dialog.setContentView(R.layout.fragment_opensource_licenses);

    searchTitleIcon = (ImageView) dialog.findViewById(R.id.searchTitleProfile);
    searchTitleIcon.setImageResource(R.drawable.ic_security_black_24dp);
    searchTitleIcon.setColorFilter(ContextCompat.getColor(getContext(), R.color.redOrange));

    searchTitleName = (TextView) dialog.findViewById(R.id.searchTitleName);
    searchTitleName.setText(R.string.licenses_header_title);

    // Closes the Dialog
    Button dialogBtnCancel = (Button) dialog.findViewById(R.id.license_BtnCancel);
    dialogBtnCancel.setOnClickListener(new View.OnClickListener() {
        @Override/*www .j a v a2s.  c  om*/
        public void onClick(View v) {
            dialog.dismiss();
        }
    });

    dialog.show();
    return dialog;
}

From source file:dk.tinytree.reader.Fragments.Others.OpenSourceLicenses.java

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {

    final Dialog dialog = new Dialog(getActivity());

    dialog.getWindow().requestFeature(Window.FEATURE_NO_TITLE);
    dialog.setContentView(R.layout.fragment_opensource_licenses);

    searchTitleIcon = (ImageView) dialog.findViewById(R.id.searchTitleProfile);
    searchTitleIcon.setImageResource(R.drawable.ic_material_security_black_24dp);
    searchTitleIcon.setColorFilter(ContextCompat.getColor(getContext(), R.color.redOrange));

    searchTitleName = (TextView) dialog.findViewById(R.id.searchTitleName);
    searchTitleName.setText(R.string.licenses_header_title);

    // Closes the Dialog
    Button dialogBtnCancel = (Button) dialog.findViewById(R.id.license_BtnCancel);
    dialogBtnCancel.setOnClickListener(new View.OnClickListener() {
        @Override/*  w ww.ja  v a 2s. c  o  m*/
        public void onClick(View v) {
            dialog.dismiss();
        }
    });

    dialog.show();
    return dialog;
}

From source file:dk.tinytree.flashlight.fragments.others.OpenSourceLicenses.java

@NonNull
@Override/*from   w  w  w .jav a2s . c  o  m*/
public Dialog onCreateDialog(Bundle savedInstanceState) {

    final Dialog dialog = new Dialog(getActivity());

    dialog.getWindow().requestFeature(Window.FEATURE_NO_TITLE);
    dialog.setContentView(R.layout.fragment_opensource_licenses);

    searchTitleIcon = (ImageView) dialog.findViewById(R.id.searchTitleProfile);
    searchTitleIcon.setImageResource(R.drawable.ic_material_security_black_24dp);
    searchTitleIcon.setColorFilter(ContextCompat.getColor(getContext(), R.color.redOrange));

    searchTitleName = (TextView) dialog.findViewById(R.id.searchTitleName);
    searchTitleName.setText(R.string.licenses_header_title);

    // Closes the Dialog
    Button dialogBtnCancel = (Button) dialog.findViewById(R.id.license_BtnCancel);
    dialogBtnCancel.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            dialog.dismiss();
        }
    });

    dialog.show();
    return dialog;
}

From source file:me.lehrner.newsgroupsndy.view.AddServerDialogFragment.java

private String getStringFromEditText(int viewId) {
    EditText editText;/*  ww w  .  j  a v a  2  s  . c  o m*/

    Dialog dialog = getDialog();

    if (dialog != null) {
        editText = (EditText) dialog.findViewById(viewId);
    } else {
        editText = (EditText) getActivity().findViewById(viewId);
    }

    return editText.getText().toString();
}

From source file:dk.tinytree.bulldog.Fragments.Other.OpenSourceLicenses.java

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {

    final Dialog dialog = new Dialog(getActivity());

    dialog.getWindow().requestFeature(Window.FEATURE_NO_TITLE);
    dialog.setContentView(R.layout.fragment_dialog_opensource_licenses);

    searchTitleIcon = (ImageView) dialog.findViewById(R.id.searchTitleProfile);
    searchTitleIcon.setImageResource(R.drawable.ic_material_security_black_24dp);
    searchTitleIcon.setColorFilter(ContextCompat.getColor(getContext(), R.color.redOrange));

    searchTitleName = (TextView) dialog.findViewById(R.id.searchTitleName);
    searchTitleName.setText(R.string.licenses_header_title);

    // Closes the Dialog
    Button dialogBtnCancel = (Button) dialog.findViewById(R.id.license_BtnCancel);
    dialogBtnCancel.setOnClickListener(new View.OnClickListener() {
        @Override/*from ww  w .j  ava2 s .  c  om*/
        public void onClick(View v) {
            dialog.dismiss();
        }
    });

    dialog.show();
    return dialog;
}

From source file:me.lehrner.newsgroupsndy.view.AddServerDialogFragment.java

private void setStringInEditText(int viewId, final String s) {
    final EditText editText;

    Dialog dialog = getDialog();

    if (dialog != null) {
        editText = (EditText) dialog.findViewById(viewId);
    } else {// w w  w . j  av  a2  s  .co m
        editText = (EditText) getActivity().findViewById(viewId);
    }

    getActivity().runOnUiThread(new Runnable() {
        public void run() {
            editText.setText(s);
        }
    });
}

From source file:com.qjdchina.qjdsale.MemberPictureFragment.java

@Override
public void onClick(View v) {
    switch (v.getId()) {
    case R.id.btn_company_license:
        // ??  sdcard
        Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
        if (Utils.isHasSdcard()) {
            intent.putExtra(MediaStore.EXTRA_OUTPUT,
                    Uri.fromFile(new File(SAVE_PATH_IN_SDCARD, IMAGE_CAPTURE_NAME)));
        } else {//w w  w . j  a  v  a  2  s.  co  m
            Toast.makeText(getActivity(), "SD?", Toast.LENGTH_SHORT).show();
        }
        startActivityForResult(intent, REQUEST_CODE_TAKE_PICTURE);
        break;
    case R.id.iv_comany_license:
        Dialog dialog = new MemberPictureDialog(getActivity(), R.style.dialog_full_screen);
        ImageView iv = (ImageView) dialog.findViewById(R.id.iv_dialog_member);
        iv.setImageBitmap(getImage(SAVE_PATH_IN_SDCARD + IMAGE_CAPTURE_NAME, 1024));
        dialog.show();
        break;
    }
}

From source file:fi.loezi.unifud.MainActivity.java

public void showAboutDialog() {

    final Dialog dialog = new Dialog(this);
    dialog.setContentView(R.layout.dialog_fragment);
    dialog.setTitle("UniFud");

    final TextView text = (TextView) dialog.findViewById(R.id.dialogText);
    text.setText(/* ww  w.  j  a  va 2  s  .co  m*/
            "Created by Leo Leppnen (leo.leppanen@helsinki.fi)\n" + "\n" + "Data provided by HYY Ravintolat\n"
                    + "\n" + "Icons by Freepik and Icon Works from www.flaticon.com, licensed under CC BY 3.0");

    String version = null;
    try {
        version = getPackageManager().getPackageInfo(getPackageName(), 0).versionName;
    } catch (PackageManager.NameNotFoundException exception) {
        version = "unknown";
    }

    text.append("\n\nVersion " + version);

    final Button dialogButton = (Button) dialog.findViewById(R.id.dialogButtonOK);

    dialogButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            dialog.dismiss();
        }
    });

    dialog.show();
}