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:com.linkbubble.util.Util.java

static public void showThemedDialog(Dialog dialog) {
    dialog.show();/*ww w  .  j a v  a 2 s  .  c  om*/

    Resources resources = dialog.getContext().getResources();
    int color = resources.getColor(
            Settings.get().getDarkThemeEnabled() ? R.color.color_primary_bright : R.color.color_primary);

    int dividerId = resources.getIdentifier("android:id/titleDivider", null, null);
    if (dividerId > 0) {
        View divider = dialog.findViewById(dividerId);
        if (divider != null) {
            divider.setBackgroundColor(color);
        }
    }

    int titleTextViewId = resources.getIdentifier("android:id/alertTitle", null, null);
    if (titleTextViewId > 0) {
        TextView textView = (TextView) dialog.findViewById(titleTextViewId);
        if (textView != null) {
            textView.setTextColor(color);
        }
    }
}

From source file:com.sentaroh.android.TaskAutomation.Config.ProfileMaintenanceTimeProfile.java

final static private boolean isValidDayOfTheWeek(final GlobalParameters mGlblParms, Dialog dialog, String rt) {
    boolean result = false;
    if (rt.equals(PROFILE_DATE_TIME_TYPE_DAY_OF_THE_WEEK)) {
        CheckBox cb_dw_mon = (CheckBox) dialog.findViewById(R.id.edit_profile_time_day_of_the_week_monday);
        CheckBox cb_dw_tue = (CheckBox) dialog.findViewById(R.id.edit_profile_time_day_of_the_week_tuesday);
        CheckBox cb_dw_wed = (CheckBox) dialog.findViewById(R.id.edit_profile_time_day_of_the_week_wedsday);
        CheckBox cb_dw_thu = (CheckBox) dialog.findViewById(R.id.edit_profile_time_day_of_the_week_thursday);
        CheckBox cb_dw_fri = (CheckBox) dialog.findViewById(R.id.edit_profile_time_day_of_the_week_friday);
        CheckBox cb_dw_sat = (CheckBox) dialog.findViewById(R.id.edit_profile_time_day_of_the_week_satday);
        CheckBox cb_dw_sun = (CheckBox) dialog.findViewById(R.id.edit_profile_time_day_of_the_week_sunday);

        if (cb_dw_mon.isChecked() || cb_dw_tue.isChecked() || cb_dw_wed.isChecked() || cb_dw_thu.isChecked()
                || cb_dw_fri.isChecked() || cb_dw_sat.isChecked() || cb_dw_sun.isChecked())
            result = true;/*from w  w w . j  ava 2s. c  o m*/
    } else
        result = true;
    mGlblParms.util.addDebugMsg(1, "I", "isValidDayOfTheWeek result=" + result + ", repeat=" + rt);
    return result;
}

From source file:com.vrem.wifianalyzer.wifi.filter.EnumFilter.java

EnumFilter(@NonNull Map<T, Integer> ids, @NonNull U filter, @NonNull Dialog dialog, int id) {
    this.filter = filter;
    IterableUtils.forEach(ids.keySet(), new EnumFilterClosure(ids, dialog));
    dialog.findViewById(id).setVisibility(View.VISIBLE);
}

From source file:com.booksaround.me.title.LoginDialogFragment.java

/**
 * Show error message//from w  w w .  j ava 2 s . c  o  m
 * @param message is error message
 */
void showErrorMessage(String message) {
    Dialog dialog = getDialog();
    if (dialog == null) {
        return;
    }
    TextView text = (TextView) dialog.findViewById(R.id.text_message);
    text.setVisibility(View.VISIBLE);
    text.setText(message);
}

From source file:org.zakky.memopad.MyDialogFragment.java

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    final Dialog dialog = super.onCreateDialog(savedInstanceState);
    dialog.setContentView(R.layout.dialog);
    dialog.setTitle(R.string.app_name);//from w  w  w  .ja  v a2  s  . c  om

    dialog.findViewById(R.id.ok_button).setOnClickListener(new OnClickListener() {
        public void onClick(View v) {
            v.setEnabled(false);
            final CheckBox box = (CheckBox) dialog.findViewById(R.id.show_this_dialog_at_startup);

            final SharedPreferences pref = dialog.getContext().getSharedPreferences(PREF_FILE_NAME,
                    Context.MODE_PRIVATE);
            final Editor editor = pref.edit();
            try {
                editor.putBoolean(PREF_KEY_SHOW_AT_STARTUP, box.isChecked());
            } finally {
                editor.commit();
            }
            dialog.dismiss();
        }
    });
    return dialog;
}

From source file:by.android.dailystatus.dialog.LicenseDialog.java

public Dialog onCreateDialog(Bundle savedInstanceState) {
    final FragmentActivity activity = getActivity();
    final Dialog dialog = new Dialog(activity);
    dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
    dialog.setContentView(R.layout.dialog_license);
    TextView description = (TextView) dialog.findViewById(R.id.txt_dialog_version_description);
    if (text != null && !TextUtils.isEmpty(text)) {
        description.setText(text);/*from w w  w .java2s  . c  om*/
    }

    dialog.findViewById(R.id.but_dialog_version_ok).setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            dismiss();

        }
    });

    return dialog;
}

From source file:com.vrem.wifianalyzer.wifi.filter.SSIDFilter.java

SSIDFilter(@NonNull BasicFilterAdapter<String> filterAdapter, @NonNull Dialog dialog) {
    this.filterAdapter = filterAdapter;

    String value = StringUtils.join(filterAdapter.getValues(), SEPARATOR_CHAR);

    EditText editText = (EditText) dialog.findViewById(R.id.filterSSIDtext);
    editText.setText(value);/*from  ww w.  j a  v a 2 s.c o  m*/
    editText.addTextChangedListener(new onChange());

    dialog.findViewById(R.id.filterSSID).setVisibility(View.VISIBLE);
}

From source file:com.aqnote.app.wifianalyzer.wifi.AccessPointsDetail.java

@NonNull
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   w  w  w.ja v  a 2  s  .com*/
    setView(context.getResources(), view, wiFiDetail, false);
    dialog.findViewById(R.id.popupButton).setOnClickListener(new PopupDialogListener(dialog));
    return dialog;
}

From source file:cn.studyjams.s2.sj0132.bowenyan.mygirlfriend.nononsenseapps.notepad.ui.common.DialogPasswordSettings.java

@Override
public void onStart() {
    super.onStart();
    Dialog dialog = getDialog();
    currentPasswordText = (EditText) dialog.findViewById(R.id.currentPassword);
    newPasswordText = (EditText) dialog.findViewById(R.id.tempPassword1);
    confirmPasswordText = (EditText) dialog.findViewById(R.id.tempPassword2);

    currentPasswordLabel = (TextInputLayout) dialog.findViewById(R.id.currentPasswordLabel);

    confirmPasswordLabel = (TextInputLayout) dialog.findViewById(R.id.tempPassword2Label);

    currentPasswordText.addTextChangedListener(new TextWatcher() {
        @Override//from  w ww .ja  v a  2 s . c o  m
        public void beforeTextChanged(CharSequence s, int start, int count, int after) {
        }

        @Override
        public void onTextChanged(CharSequence s, int start, int before, int count) {
        }

        @Override
        public void afterTextChanged(Editable s) {
            currentPasswordLabel.setError(null);
        }
    });

    confirmPasswordText.addTextChangedListener(new TextWatcher() {
        @Override
        public void beforeTextChanged(CharSequence s, int start, int count, int after) {
        }

        @Override
        public void onTextChanged(CharSequence s, int start, int before, int count) {
        }

        @Override
        public void afterTextChanged(Editable s) {
            confirmPasswordLabel.setError(null);
        }
    });
}

From source file:ca.cmput301w14t09.PopUpEdit.java

/**
 * Creates a popup edit window with the given input parameters.
 * @param comment - edited comment./*from w ww . ja v a2s  .c o m*/
 */
public void popUpEdit(final Comment comment) {
    //Creates a dialog box
    final Dialog dialog = new Dialog(caller);
    dialog.setContentView(R.layout.pop_up_edit);
    dialog.setTitle("Comment Text");

    Button Submit = (Button) dialog.findViewById(R.id.Submit);
    final EditText commentText = (EditText) dialog.findViewById(R.id.editComment);

    commentText.setHint(comment.getCommentText());
    dialog.show();

    Submit.setOnClickListener(new View.OnClickListener() {

        //when submit is pressed everything is pused to the server
        @Override
        public void onClick(View v) {
            String str = "commentText = \\\"" + commentText.getText() + "\\\"\"";

            if (Server.getInstance().isServerReachable(caller)) {
                try {
                    ElasticSearchOperations.updateComment(comment, str);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                } catch (ClientProtocolException e) {
                    e.printStackTrace();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            dialog.dismiss();
        }
    });
}