@NonNull @Override public Dialog onCreateDialog(final Bundle savedInstanceState) { final Context wrapped = ThemeUtils.getDialogThemedContext(getActivity()); final AlertDialog.Builder builder = new AlertDialog.Builder(wrapped); final ParcelableUserList userList = getUserList(); if (userList != null) { builder.setTitle(getString(R.string.delete_user_list, userList.name)); builder.setMessage(getString(R.string.delete_user_list_confirm_message, userList.name)); } builder.setPositiveButton(android.R.string.ok, this); builder.setNegativeButton(android.R.string.cancel, null); return builder.create(); }
@NonNull @Override public Dialog onCreateDialog(final Bundle savedInstanceState) { final Context wrapped = ThemeUtils.getDialogThemedContext(getActivity()); final AlertDialog.Builder builder = new AlertDialog.Builder(wrapped); final View view = LayoutInflater.from(wrapped).inflate(R.layout.dialog_auto_complete_textview, null); builder.setView(view); mEditText = (AutoCompleteTextView) view.findViewById(R.id.edit_text); if (savedInstanceState != null) { mEditText.setText(savedInstanceState.getCharSequence(EXTRA_TEXT)); } mUserAutoCompleteAdapter = new ComposeAutoCompleteAdapter(wrapped); final Bundle args = getArguments(); mUserAutoCompleteAdapter.setAccountId(args.getLong(EXTRA_ACCOUNT_ID)); mEditText.setAdapter(mUserAutoCompleteAdapter); mEditText.setThreshold(1); mEditText.setFilters(new InputFilter[] {new InputFilter.LengthFilter(20)}); builder.setTitle(R.string.screen_name); builder.setPositiveButton(android.R.string.ok, this); builder.setNegativeButton(android.R.string.cancel, this); return builder.create(); }
@NonNull @Override public Dialog onCreateDialog(final Bundle savedInstanceState) { final FragmentActivity activity = getActivity(); final Context wrapped = ThemeUtils.getDialogThemedContext(activity); final AlertDialog.Builder builder = new AlertDialog.Builder(wrapped); final ParcelableUser user = getUser(); if (user != null) { final UserColorNameManager manager = UserColorNameManager.getInstance(activity); final SharedPreferencesWrapper prefs = SharedPreferencesWrapper.getInstance( activity, SharedPreferencesWrapper.SHARED_PREFERENCES_NAME, Context.MODE_PRIVATE, SharedPreferenceConstants.class); final boolean nameFirst = prefs.getBoolean(KEY_NAME_FIRST); final String displayName = manager.getDisplayName(user, nameFirst, false); builder.setTitle(getString(R.string.report_user, displayName)); builder.setMessage(getString(R.string.report_user_confirm_message, displayName)); } builder.setPositiveButton(android.R.string.ok, this); builder.setNegativeButton(android.R.string.cancel, null); return builder.create(); }