List of usage examples for android.app AlertDialog.Builder setView
public void setView(View view)
From source file:com.aniruddhc.acemusic.player.Dialogs.ID3sArtistEditorDialog.java
@Override public Dialog onCreateDialog(Bundle savedInstanceState) { mContext = getActivity();/*from w ww. ja v a 2 s .c o m*/ parentActivity = getActivity(); dialogFragment = this; //Get the artist name. ARTIST = getArguments().getString("ARTIST"); rootView = (View) parentActivity.getLayoutInflater().inflate(R.layout.fragment_edit_id3_artist_album_dialog, null); titleText = (TextView) rootView.findViewById(R.id.edit_title_text); artistText = (TextView) rootView.findViewById(R.id.edit_artist_text); albumText = (TextView) rootView.findViewById(R.id.edit_album_text); albumArtistText = (TextView) rootView.findViewById(R.id.edit_album_artist_text); genreText = (TextView) rootView.findViewById(R.id.edit_genre_text); producerText = (TextView) rootView.findViewById(R.id.edit_producer_text); yearText = (TextView) rootView.findViewById(R.id.edit_year_text); trackText = (TextView) rootView.findViewById(R.id.edit_track_text); ofText = (TextView) rootView.findViewById(R.id.text_of); commentsText = (TextView) rootView.findViewById(R.id.edit_comment_text); titleEditText = (EditText) rootView.findViewById(R.id.edit_title_field); artistEditText = (EditText) rootView.findViewById(R.id.edit_artist_field); albumEditText = (EditText) rootView.findViewById(R.id.edit_album_field); albumArtistEditText = (EditText) rootView.findViewById(R.id.edit_album_artist_field); genreEditText = (EditText) rootView.findViewById(R.id.edit_genre_field); producerEditText = (EditText) rootView.findViewById(R.id.edit_producer_field); yearEditText = (EditText) rootView.findViewById(R.id.edit_year_field); trackEditText = (EditText) rootView.findViewById(R.id.edit_track_field); trackTotalEditText = (EditText) rootView.findViewById(R.id.edit_track_total_field); commentsEditText = (EditText) rootView.findViewById(R.id.edit_comment_field); titleCheckbox = (CheckBox) rootView.findViewById(R.id.title_checkbox); artistCheckbox = (CheckBox) rootView.findViewById(R.id.artist_checkbox); albumCheckbox = (CheckBox) rootView.findViewById(R.id.album_checkbox); albumArtistCheckbox = (CheckBox) rootView.findViewById(R.id.album_artist_checkbox); genreCheckbox = (CheckBox) rootView.findViewById(R.id.genre_checkbox); producerCheckbox = (CheckBox) rootView.findViewById(R.id.producer_checkbox); yearCheckbox = (CheckBox) rootView.findViewById(R.id.year_checkbox); trackCheckbox = (CheckBox) rootView.findViewById(R.id.track_checkbox); commentCheckbox = (CheckBox) rootView.findViewById(R.id.comment_checkbox); titleText.setTypeface(TypefaceHelper.getTypeface(parentActivity, "RobotoCondensed-Light")); artistText.setTypeface(TypefaceHelper.getTypeface(parentActivity, "RobotoCondensed-Light")); albumText.setTypeface(TypefaceHelper.getTypeface(parentActivity, "RobotoCondensed-Light")); albumArtistText.setTypeface(TypefaceHelper.getTypeface(parentActivity, "RobotoCondensed-Light")); genreText.setTypeface(TypefaceHelper.getTypeface(parentActivity, "RobotoCondensed-Light")); producerText.setTypeface(TypefaceHelper.getTypeface(parentActivity, "RobotoCondensed-Light")); yearText.setTypeface(TypefaceHelper.getTypeface(parentActivity, "RobotoCondensed-Light")); trackText.setTypeface(TypefaceHelper.getTypeface(parentActivity, "RobotoCondensed-Light")); ofText.setTypeface(TypefaceHelper.getTypeface(parentActivity, "RobotoCondensed-Light")); commentsText.setTypeface(TypefaceHelper.getTypeface(parentActivity, "RobotoCondensed-Light")); titleText.setPaintFlags(titleText.getPaintFlags() | Paint.ANTI_ALIAS_FLAG | Paint.SUBPIXEL_TEXT_FLAG | Paint.FAKE_BOLD_TEXT_FLAG); artistText.setPaintFlags(titleText.getPaintFlags() | Paint.ANTI_ALIAS_FLAG | Paint.SUBPIXEL_TEXT_FLAG | Paint.FAKE_BOLD_TEXT_FLAG); albumText.setPaintFlags(titleText.getPaintFlags() | Paint.ANTI_ALIAS_FLAG | Paint.SUBPIXEL_TEXT_FLAG | Paint.FAKE_BOLD_TEXT_FLAG); albumArtistText.setPaintFlags(titleText.getPaintFlags() | Paint.ANTI_ALIAS_FLAG | Paint.SUBPIXEL_TEXT_FLAG | Paint.FAKE_BOLD_TEXT_FLAG); genreText.setPaintFlags(titleText.getPaintFlags() | Paint.ANTI_ALIAS_FLAG | Paint.SUBPIXEL_TEXT_FLAG | Paint.FAKE_BOLD_TEXT_FLAG); producerText.setPaintFlags(titleText.getPaintFlags() | Paint.ANTI_ALIAS_FLAG | Paint.SUBPIXEL_TEXT_FLAG | Paint.FAKE_BOLD_TEXT_FLAG); yearText.setPaintFlags(titleText.getPaintFlags() | Paint.ANTI_ALIAS_FLAG | Paint.SUBPIXEL_TEXT_FLAG | Paint.FAKE_BOLD_TEXT_FLAG); trackText.setPaintFlags(titleText.getPaintFlags() | Paint.ANTI_ALIAS_FLAG | Paint.SUBPIXEL_TEXT_FLAG | Paint.FAKE_BOLD_TEXT_FLAG); ofText.setPaintFlags(titleText.getPaintFlags() | Paint.ANTI_ALIAS_FLAG | Paint.SUBPIXEL_TEXT_FLAG | Paint.FAKE_BOLD_TEXT_FLAG); commentsText.setPaintFlags(titleText.getPaintFlags() | Paint.ANTI_ALIAS_FLAG | Paint.SUBPIXEL_TEXT_FLAG | Paint.FAKE_BOLD_TEXT_FLAG); titleEditText.setTypeface(TypefaceHelper.getTypeface(parentActivity, "RobotoCondensed-Light")); artistEditText.setTypeface(TypefaceHelper.getTypeface(parentActivity, "RobotoCondensed-Light")); albumEditText.setTypeface(TypefaceHelper.getTypeface(parentActivity, "RobotoCondensed-Light")); albumArtistEditText.setTypeface(TypefaceHelper.getTypeface(parentActivity, "RobotoCondensed-Light")); genreEditText.setTypeface(TypefaceHelper.getTypeface(parentActivity, "RobotoCondensed-Light")); producerEditText.setTypeface(TypefaceHelper.getTypeface(parentActivity, "RobotoCondensed-Light")); yearEditText.setTypeface(TypefaceHelper.getTypeface(parentActivity, "RobotoCondensed-Light")); trackEditText.setTypeface(TypefaceHelper.getTypeface(parentActivity, "RobotoCondensed-Light")); trackTotalEditText.setTypeface(TypefaceHelper.getTypeface(parentActivity, "RobotoCondensed-Light")); commentsEditText.setTypeface(TypefaceHelper.getTypeface(parentActivity, "RobotoCondensed-Light")); titleEditText.setPaintFlags(titleText.getPaintFlags() | Paint.ANTI_ALIAS_FLAG | Paint.SUBPIXEL_TEXT_FLAG); artistEditText.setPaintFlags(titleText.getPaintFlags() | Paint.ANTI_ALIAS_FLAG | Paint.SUBPIXEL_TEXT_FLAG); albumEditText.setPaintFlags(titleText.getPaintFlags() | Paint.ANTI_ALIAS_FLAG | Paint.SUBPIXEL_TEXT_FLAG); albumArtistEditText .setPaintFlags(titleText.getPaintFlags() | Paint.ANTI_ALIAS_FLAG | Paint.SUBPIXEL_TEXT_FLAG); genreEditText.setPaintFlags(titleText.getPaintFlags() | Paint.ANTI_ALIAS_FLAG | Paint.SUBPIXEL_TEXT_FLAG); producerEditText .setPaintFlags(titleText.getPaintFlags() | Paint.ANTI_ALIAS_FLAG | Paint.SUBPIXEL_TEXT_FLAG); yearEditText.setPaintFlags(titleText.getPaintFlags() | Paint.ANTI_ALIAS_FLAG | Paint.SUBPIXEL_TEXT_FLAG); trackEditText.setPaintFlags(titleText.getPaintFlags() | Paint.ANTI_ALIAS_FLAG | Paint.SUBPIXEL_TEXT_FLAG); trackTotalEditText .setPaintFlags(titleText.getPaintFlags() | Paint.ANTI_ALIAS_FLAG | Paint.SUBPIXEL_TEXT_FLAG); commentsEditText .setPaintFlags(titleText.getPaintFlags() | Paint.ANTI_ALIAS_FLAG | Paint.SUBPIXEL_TEXT_FLAG); //Keep all the fields locked by default. titleCheckbox.setChecked(false); artistCheckbox.setChecked(false); albumCheckbox.setChecked(false); albumArtistCheckbox.setChecked(false); genreCheckbox.setChecked(false); producerCheckbox.setChecked(false); yearCheckbox.setChecked(false); trackCheckbox.setChecked(false); commentCheckbox.setChecked(false); //Disable all EditTexts by default. titleEditText.setEnabled(false); artistEditText.setEnabled(false); albumEditText.setEnabled(false); albumArtistEditText.setEnabled(false); genreEditText.setEnabled(false); producerEditText.setEnabled(false); yearEditText.setEnabled(false); trackEditText.setEnabled(false); commentsEditText.setEnabled(false); //Register click registers on each checkbox. titleCheckbox.setOnCheckedChangeListener(new OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton checkbox, boolean checked) { if (checked == true) { titleEdited = true; titleEditText.setEnabled(true); } else { titleEdited = false; titleEditText.setEnabled(false); } } }); artistCheckbox.setOnCheckedChangeListener(new OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton checkbox, boolean checked) { if (checked == true) { artistEdited = true; artistEditText.setEnabled(true); ; } else { artistEdited = false; artistEditText.setEnabled(false); } } }); albumArtistCheckbox.setOnCheckedChangeListener(new OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton checkbox, boolean checked) { if (checked == true) { albumEdited = true; albumEditText.setEnabled(true); ; } else { albumEdited = false; albumEditText.setEnabled(false); } } }); albumCheckbox.setOnCheckedChangeListener(new OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton checkbox, boolean checked) { if (checked == true) { albumArtistEdited = true; albumArtistEditText.setEnabled(true); ; } else { albumArtistEdited = false; albumArtistEditText.setEnabled(false); } } }); genreCheckbox.setOnCheckedChangeListener(new OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton checkbox, boolean checked) { if (checked == true) { genreEdited = true; genreEditText.setEnabled(true); ; } else { genreEdited = false; genreEditText.setEnabled(false); } } }); producerCheckbox.setOnCheckedChangeListener(new OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton checkbox, boolean checked) { if (checked == true) { producerEdited = true; producerEditText.setEnabled(true); ; } else { producerEdited = false; producerEditText.setEnabled(false); } } }); yearCheckbox.setOnCheckedChangeListener(new OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton checkbox, boolean checked) { if (checked == true) { yearEdited = true; yearEditText.setEnabled(true); ; } else { yearEdited = false; yearEditText.setEnabled(false); } } }); trackCheckbox.setOnCheckedChangeListener(new OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton checkbox, boolean checked) { if (checked == true) { trackEdited = true; trackEditText.setEnabled(true); ; } else { trackEdited = false; trackEditText.setEnabled(false); } } }); commentCheckbox.setOnCheckedChangeListener(new OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton checkbox, boolean checked) { if (checked == true) { commentEdited = true; commentsEditText.setEnabled(true); ; } else { commentEdited = false; commentsEditText.setEnabled(false); } } }); if (ARTIST != null) { songURIsList = getAllSongsByArtist(ARTIST); //Populate the ArrayLists with the song tags. try { getSongTags(songURIsList); } catch (CannotReadException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (TagException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (ReadOnlyFileException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (InvalidAudioFrameException e) { // TODO Auto-generated catch block e.printStackTrace(); } //Now check if any of the ArrayLists contain the same exact elements. boolean titlesSame = checkIfAllElementsEqual(titlesList); boolean artistsSame = checkIfAllElementsEqual(artistsList); boolean albumsSame = checkIfAllElementsEqual(albumsList); boolean albumArtistsSame = checkIfAllElementsEqual(albumArtistsList); boolean genresSame = checkIfAllElementsEqual(genresList); boolean producersSame = checkIfAllElementsEqual(producersList); boolean yearsSame = checkIfAllElementsEqual(yearsList); boolean tracksSame = checkIfAllElementsEqual(trackNumbersList); boolean totalTracksSame = checkIfAllElementsEqual(totalTracksList); boolean commentsSame = checkIfAllElementsEqual(commentsList); //Populate the EditTexts. setEditorFields(titlesSame, titlesList, titleEditText); setEditorFields(artistsSame, artistsList, artistEditText); setEditorFields(albumsSame, albumsList, albumEditText); setEditorFields(albumArtistsSame, albumArtistsList, albumArtistEditText); setEditorFields(genresSame, genresList, genreEditText); setEditorFields(producersSame, producersList, producerEditText); setEditorFields(yearsSame, yearsList, yearEditText); setEditorFields(tracksSame, trackNumbersList, trackEditText); setEditorFields(totalTracksSame, totalTracksList, trackTotalEditText); setEditorFields(commentsSame, commentsList, commentsEditText); } AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); //Set the dialog title. builder.setTitle(R.string.edit_tags); builder.setView(rootView); builder.setPositiveButton(R.string.save, new OnClickListener() { @Override public void onClick(DialogInterface arg0, int arg1) { dialogFragment.dismiss(); AsyncSaveArtistTagsTask asyncSaveArtistTagsTask = new AsyncSaveArtistTagsTask(getActivity(), getActivity()); asyncSaveArtistTagsTask.execute(); } }); builder.setNegativeButton(R.string.cancel, new OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }); return builder.create(); }
From source file:com.docd.purefm.ui.dialogs.FilePropertiesDialog.java
@Override public Dialog onCreateDialog(Bundle savedInstanceState) { final Activity activity = getActivity(); if (activity == null || activity.isFinishing()) { return null; }//from w w w . j a v a 2 s. c om final AlertDialog.Builder builder = new AlertDialog.Builder(activity); mAdapter = new PropertiesAdapter(activity, file); builder.setIcon(ThemeUtils.getDrawableNonNull(activity, R.attr.ic_menu_info)); builder.setTitle(file.getName()); builder.setNeutralButton(R.string.close, null); builder.setPositiveButton(R.string.apply, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { final FilePermissionsPagerItem fragment = (FilePermissionsPagerItem) mAdapter.getItem(1); fragment.applyPermissions(getActivity()); } }); //noinspection InflateParams final View content = activity.getLayoutInflater().inflate(R.layout.dialog_properties_container, null); if (content == null) { throw new RuntimeException("Inflated view is null"); } this.initView(content); builder.setView(content); final AlertDialog dialog = builder.create(); dialog.setOnShowListener(new DialogInterface.OnShowListener() { @Override public void onShow(final DialogInterface dialog) { final Button button = ((AlertDialog) dialog).getButton(DialogInterface.BUTTON_POSITIVE); if (button == null) { throw new RuntimeException("Can't get positive button"); } button.setVisibility(View.GONE); } }); return dialog; }
From source file:au.com.wallaceit.reddinator.SubredditSelectActivity.java
private void showMultiEditDialog(final String multiPath) { JSONObject multiObj = global.getSubredditManager().getMultiData(multiPath); @SuppressLint("InflateParams") LinearLayout dialogView = (LinearLayout) getLayoutInflater().inflate(R.layout.dialog_multi_edit, null); // passing null okay for dialog final Button saveButton = (Button) dialogView.findViewById(R.id.multi_save_button); final Button renameButton = (Button) dialogView.findViewById(R.id.multi_rename_button); multiName = (TextView) dialogView.findViewById(R.id.multi_pname); final EditText displayName = (EditText) dialogView.findViewById(R.id.multi_name); final EditText description = (EditText) dialogView.findViewById(R.id.multi_description); final EditText color = (EditText) dialogView.findViewById(R.id.multi_color); final Spinner icon = (Spinner) dialogView.findViewById(R.id.multi_icon); final Spinner visibility = (Spinner) dialogView.findViewById(R.id.multi_visibility); final Spinner weighting = (Spinner) dialogView.findViewById(R.id.multi_weighting); ArrayAdapter<CharSequence> iconAdapter = ArrayAdapter.createFromResource(SubredditSelectActivity.this, R.array.multi_icons, android.R.layout.simple_spinner_item); iconAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); icon.setAdapter(iconAdapter);// w ww .j a v a2 s . co m ArrayAdapter<CharSequence> visibilityAdapter = ArrayAdapter.createFromResource(SubredditSelectActivity.this, R.array.multi_visibility, android.R.layout.simple_spinner_item); visibilityAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); visibility.setAdapter(visibilityAdapter); ArrayAdapter<CharSequence> weightsAdapter = ArrayAdapter.createFromResource(SubredditSelectActivity.this, R.array.multi_weights, android.R.layout.simple_spinner_item); weightsAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); weighting.setAdapter(weightsAdapter); try { multiName.setText(multiObj.getString("name")); displayName.setText(multiObj.getString("display_name")); description.setText(multiObj.getString("description_md")); color.setText(multiObj.getString("key_color")); String iconName = multiObj.getString("icon_name"); icon.setSelection(iconAdapter.getPosition(iconName.equals("") ? "none" : iconName)); visibility.setSelection(iconAdapter.getPosition(multiObj.getString("visibility"))); weighting.setSelection(iconAdapter.getPosition(multiObj.getString("weighting_scheme"))); } catch (JSONException e) { e.printStackTrace(); } ViewPager pager = (ViewPager) dialogView.findViewById(R.id.multi_pager); LinearLayout tabsWidget = (LinearLayout) dialogView.findViewById(R.id.multi_tab_widget); pager.setAdapter(new SimpleTabsAdapter(new String[] { "Subreddits", "Settings" }, new int[] { R.id.multi_subreddits, R.id.multi_settings }, SubredditSelectActivity.this, dialogView)); SimpleTabsWidget simpleTabsWidget = new SimpleTabsWidget(SubredditSelectActivity.this, tabsWidget); simpleTabsWidget.setViewPager(pager); ThemeManager.Theme theme = global.mThemeManager.getActiveTheme("appthemepref"); int headerColor = Color.parseColor(theme.getValue("header_color")); int headerText = Color.parseColor(theme.getValue("header_text")); simpleTabsWidget.setBackgroundColor(headerColor); simpleTabsWidget.setTextColor(headerText); simpleTabsWidget.setInidicatorColor(Color.parseColor(theme.getValue("tab_indicator"))); ListView subList = (ListView) dialogView.findViewById(R.id.multi_subredditList); multiSubsAdapter = new SubsListAdapter(SubredditSelectActivity.this, multiPath); subList.setAdapter(multiSubsAdapter); renameButton.getBackground().setColorFilter(headerColor, PorterDuff.Mode.MULTIPLY); renameButton.setTextColor(headerText); renameButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { showMultiRenameDialog(multiPath); } }); saveButton.getBackground().setColorFilter(headerColor, PorterDuff.Mode.MULTIPLY); saveButton.setTextColor(headerText); saveButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View view) { System.out.println("Save multi"); JSONObject multiObj = new JSONObject(); try { multiObj.put("decription_md", description.getText().toString()); multiObj.put("display_name", displayName.getText().toString()); multiObj.put("icon_name", icon.getSelectedItem().toString().equals("none") ? "" : icon.getSelectedItem().toString()); multiObj.put("key_color", color.getText().toString()); multiObj.put("subreddits", global.getSubredditManager().getMultiData(multiPath).getJSONArray("subreddits")); multiObj.put("visibility", visibility.getSelectedItem().toString()); multiObj.put("weighting_scheme", weighting.getSelectedItem().toString()); new SubscriptionEditTask(SubscriptionEditTask.ACTION_MULTI_EDIT).execute(multiPath, multiObj); } catch (JSONException e) { e.printStackTrace(); } } }); AlertDialog.Builder builder = new AlertDialog.Builder(SubredditSelectActivity.this); multiDialog = builder.setView(dialogView).show(); }
From source file:color.kidpaint.com.kidpaintcolor.dialog.DialogTermsOfUseAndService.java
@TargetApi(Build.VERSION_CODES.HONEYCOMB) @Override/*w ww. j a v a 2 s . co m*/ public Dialog onCreateDialog(Bundle savedInstanceState) { LayoutInflater inflater = getActivity().getLayoutInflater(); AlertDialog.Builder builder = new CustomAlertDialogBuilder(getActivity()); builder.setTitle(R.string.terms_of_use_and_service_title); View view = inflater.inflate(R.layout.dialog_terms_of_use_and_service, null); TextView termsOfUseAndServiceTextView = (TextView) view .findViewById(R.id.terms_of_use_and_service_tview_Text); termsOfUseAndServiceTextView.setText(R.string.terms_of_use_and_service_content); TextView termsOfUseAndServiceUrlTextView = (TextView) view .findViewById(R.id.terms_of_use_and_service_tview_Url); termsOfUseAndServiceUrlTextView.setMovementMethod(LinkMovementMethod.getInstance()); Resources resources = getActivity().getResources(); String paintroidTermsOfUseAndService = String.format( resources.getString(R.string.terms_of_use_and_service_link_template), resources.getString(R.string.terms_of_use_and_service_url), resources.getString(R.string.terms_of_use_and_service_url_text)); termsOfUseAndServiceUrlTextView.append(Html.fromHtml(paintroidTermsOfUseAndService)); termsOfUseAndServiceUrlTextView.append("\n\n"); String aboutCatroid = String.format(resources.getString(R.string.about_link_template), resources.getString(R.string.catroid_url), resources.getString(R.string.about_catroid_url_text)); termsOfUseAndServiceUrlTextView.append(Html.fromHtml(aboutCatroid)); termsOfUseAndServiceUrlTextView.append("\n"); builder.setView(view); builder.setNeutralButton(R.string.done, this); return builder.create(); }
From source file:com.aniruddhc.acemusic.player.Dialogs.ID3sAlbumEditorDialog.java
@Override public Dialog onCreateDialog(Bundle savedInstanceState) { mApp = (Common) getActivity().getApplicationContext(); parentActivity = getActivity();/*from w w w .j a v a 2 s . com*/ dialogFragment = this; titlesList = new ArrayList<String>(); artistsList = new ArrayList<String>(); albumsList = new ArrayList<String>(); albumArtistsList = new ArrayList<String>(); genresList = new ArrayList<String>(); producersList = new ArrayList<String>(); yearsList = new ArrayList<String>(); trackNumbersList = new ArrayList<String>(); totalTracksList = new ArrayList<String>(); commentsList = new ArrayList<String>(); songURIsList = new ArrayList<String>(); songSourcesList = new ArrayList<String>(); songIdsList = new ArrayList<String>(); rootView = (View) parentActivity.getLayoutInflater().inflate(R.layout.fragment_edit_id3_artist_album_dialog, null); titleText = (TextView) rootView.findViewById(R.id.edit_title_text); artistText = (TextView) rootView.findViewById(R.id.edit_artist_text); albumText = (TextView) rootView.findViewById(R.id.edit_album_text); albumArtistText = (TextView) rootView.findViewById(R.id.edit_album_artist_text); genreText = (TextView) rootView.findViewById(R.id.edit_genre_text); producerText = (TextView) rootView.findViewById(R.id.edit_producer_text); yearText = (TextView) rootView.findViewById(R.id.edit_year_text); trackText = (TextView) rootView.findViewById(R.id.edit_track_text); ofText = (TextView) rootView.findViewById(R.id.text_of); commentsText = (TextView) rootView.findViewById(R.id.edit_comment_text); titleEditText = (EditText) rootView.findViewById(R.id.edit_title_field); artistEditText = (EditText) rootView.findViewById(R.id.edit_artist_field); albumEditText = (EditText) rootView.findViewById(R.id.edit_album_field); albumArtistEditText = (EditText) rootView.findViewById(R.id.edit_album_artist_field); genreEditText = (EditText) rootView.findViewById(R.id.edit_genre_field); producerEditText = (EditText) rootView.findViewById(R.id.edit_producer_field); yearEditText = (EditText) rootView.findViewById(R.id.edit_year_field); trackEditText = (EditText) rootView.findViewById(R.id.edit_track_field); trackTotalEditText = (EditText) rootView.findViewById(R.id.edit_track_total_field); commentsEditText = (EditText) rootView.findViewById(R.id.edit_comment_field); titleCheckbox = (CheckBox) rootView.findViewById(R.id.title_checkbox); artistCheckbox = (CheckBox) rootView.findViewById(R.id.artist_checkbox); albumCheckbox = (CheckBox) rootView.findViewById(R.id.album_checkbox); albumArtistCheckbox = (CheckBox) rootView.findViewById(R.id.album_artist_checkbox); genreCheckbox = (CheckBox) rootView.findViewById(R.id.genre_checkbox); producerCheckbox = (CheckBox) rootView.findViewById(R.id.producer_checkbox); yearCheckbox = (CheckBox) rootView.findViewById(R.id.year_checkbox); trackCheckbox = (CheckBox) rootView.findViewById(R.id.track_checkbox); commentCheckbox = (CheckBox) rootView.findViewById(R.id.comment_checkbox); titleText.setTypeface(TypefaceHelper.getTypeface(parentActivity, "RobotoCondensed-Light")); artistText.setTypeface(TypefaceHelper.getTypeface(parentActivity, "RobotoCondensed-Light")); albumText.setTypeface(TypefaceHelper.getTypeface(parentActivity, "RobotoCondensed-Light")); albumArtistText.setTypeface(TypefaceHelper.getTypeface(parentActivity, "RobotoCondensed-Light")); genreText.setTypeface(TypefaceHelper.getTypeface(parentActivity, "RobotoCondensed-Light")); producerText.setTypeface(TypefaceHelper.getTypeface(parentActivity, "RobotoCondensed-Light")); yearText.setTypeface(TypefaceHelper.getTypeface(parentActivity, "RobotoCondensed-Light")); trackText.setTypeface(TypefaceHelper.getTypeface(parentActivity, "RobotoCondensed-Light")); ofText.setTypeface(TypefaceHelper.getTypeface(parentActivity, "RobotoCondensed-Light")); commentsText.setTypeface(TypefaceHelper.getTypeface(parentActivity, "RobotoCondensed-Light")); titleText.setPaintFlags(titleText.getPaintFlags() | Paint.ANTI_ALIAS_FLAG | Paint.SUBPIXEL_TEXT_FLAG | Paint.FAKE_BOLD_TEXT_FLAG); artistText.setPaintFlags(titleText.getPaintFlags() | Paint.ANTI_ALIAS_FLAG | Paint.SUBPIXEL_TEXT_FLAG | Paint.FAKE_BOLD_TEXT_FLAG); albumText.setPaintFlags(titleText.getPaintFlags() | Paint.ANTI_ALIAS_FLAG | Paint.SUBPIXEL_TEXT_FLAG | Paint.FAKE_BOLD_TEXT_FLAG); albumArtistText.setPaintFlags(titleText.getPaintFlags() | Paint.ANTI_ALIAS_FLAG | Paint.SUBPIXEL_TEXT_FLAG | Paint.FAKE_BOLD_TEXT_FLAG); genreText.setPaintFlags(titleText.getPaintFlags() | Paint.ANTI_ALIAS_FLAG | Paint.SUBPIXEL_TEXT_FLAG | Paint.FAKE_BOLD_TEXT_FLAG); producerText.setPaintFlags(titleText.getPaintFlags() | Paint.ANTI_ALIAS_FLAG | Paint.SUBPIXEL_TEXT_FLAG | Paint.FAKE_BOLD_TEXT_FLAG); yearText.setPaintFlags(titleText.getPaintFlags() | Paint.ANTI_ALIAS_FLAG | Paint.SUBPIXEL_TEXT_FLAG | Paint.FAKE_BOLD_TEXT_FLAG); trackText.setPaintFlags(titleText.getPaintFlags() | Paint.ANTI_ALIAS_FLAG | Paint.SUBPIXEL_TEXT_FLAG | Paint.FAKE_BOLD_TEXT_FLAG); ofText.setPaintFlags(titleText.getPaintFlags() | Paint.ANTI_ALIAS_FLAG | Paint.SUBPIXEL_TEXT_FLAG | Paint.FAKE_BOLD_TEXT_FLAG); commentsText.setPaintFlags(titleText.getPaintFlags() | Paint.ANTI_ALIAS_FLAG | Paint.SUBPIXEL_TEXT_FLAG | Paint.FAKE_BOLD_TEXT_FLAG); titleEditText.setTypeface(TypefaceHelper.getTypeface(parentActivity, "RobotoCondensed-Light")); artistEditText.setTypeface(TypefaceHelper.getTypeface(parentActivity, "RobotoCondensed-Light")); albumEditText.setTypeface(TypefaceHelper.getTypeface(parentActivity, "RobotoCondensed-Light")); albumArtistEditText.setTypeface(TypefaceHelper.getTypeface(parentActivity, "RobotoCondensed-Light")); genreEditText.setTypeface(TypefaceHelper.getTypeface(parentActivity, "RobotoCondensed-Light")); producerEditText.setTypeface(TypefaceHelper.getTypeface(parentActivity, "RobotoCondensed-Light")); yearEditText.setTypeface(TypefaceHelper.getTypeface(parentActivity, "RobotoCondensed-Light")); trackEditText.setTypeface(TypefaceHelper.getTypeface(parentActivity, "RobotoCondensed-Light")); trackTotalEditText.setTypeface(TypefaceHelper.getTypeface(parentActivity, "RobotoCondensed-Light")); commentsEditText.setTypeface(TypefaceHelper.getTypeface(parentActivity, "RobotoCondensed-Light")); titleEditText.setPaintFlags(titleText.getPaintFlags() | Paint.ANTI_ALIAS_FLAG | Paint.SUBPIXEL_TEXT_FLAG); artistEditText.setPaintFlags(titleText.getPaintFlags() | Paint.ANTI_ALIAS_FLAG | Paint.SUBPIXEL_TEXT_FLAG); albumEditText.setPaintFlags(titleText.getPaintFlags() | Paint.ANTI_ALIAS_FLAG | Paint.SUBPIXEL_TEXT_FLAG); albumArtistEditText .setPaintFlags(titleText.getPaintFlags() | Paint.ANTI_ALIAS_FLAG | Paint.SUBPIXEL_TEXT_FLAG); genreEditText.setPaintFlags(titleText.getPaintFlags() | Paint.ANTI_ALIAS_FLAG | Paint.SUBPIXEL_TEXT_FLAG); producerEditText .setPaintFlags(titleText.getPaintFlags() | Paint.ANTI_ALIAS_FLAG | Paint.SUBPIXEL_TEXT_FLAG); yearEditText.setPaintFlags(titleText.getPaintFlags() | Paint.ANTI_ALIAS_FLAG | Paint.SUBPIXEL_TEXT_FLAG); trackEditText.setPaintFlags(titleText.getPaintFlags() | Paint.ANTI_ALIAS_FLAG | Paint.SUBPIXEL_TEXT_FLAG); trackTotalEditText .setPaintFlags(titleText.getPaintFlags() | Paint.ANTI_ALIAS_FLAG | Paint.SUBPIXEL_TEXT_FLAG); commentsEditText .setPaintFlags(titleText.getPaintFlags() | Paint.ANTI_ALIAS_FLAG | Paint.SUBPIXEL_TEXT_FLAG); //Keep all the fields locked by default. titleCheckbox.setChecked(false); artistCheckbox.setChecked(false); albumCheckbox.setChecked(false); albumArtistCheckbox.setChecked(false); genreCheckbox.setChecked(false); producerCheckbox.setChecked(false); yearCheckbox.setChecked(false); trackCheckbox.setChecked(false); commentCheckbox.setChecked(false); //Disable all EditTexts by default. titleEditText.setEnabled(false); artistEditText.setEnabled(false); albumEditText.setEnabled(false); albumArtistEditText.setEnabled(false); genreEditText.setEnabled(false); producerEditText.setEnabled(false); yearEditText.setEnabled(false); trackEditText.setEnabled(false); commentsEditText.setEnabled(false); //Register click registers on each checkbox. titleCheckbox.setOnCheckedChangeListener(new OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton checkbox, boolean checked) { if (checked == true) { titleEdited = true; titleEditText.setEnabled(true); } else { titleEdited = false; titleEditText.setEnabled(false); } } }); artistCheckbox.setOnCheckedChangeListener(new OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton checkbox, boolean checked) { if (checked == true) { artistEdited = true; artistEditText.setEnabled(true); ; } else { artistEdited = false; artistEditText.setEnabled(false); } } }); albumArtistCheckbox.setOnCheckedChangeListener(new OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton checkbox, boolean checked) { if (checked == true) { albumEdited = true; albumEditText.setEnabled(true); ; } else { albumEdited = false; albumEditText.setEnabled(false); } } }); albumCheckbox.setOnCheckedChangeListener(new OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton checkbox, boolean checked) { if (checked == true) { albumArtistEdited = true; albumArtistEditText.setEnabled(true); ; } else { albumArtistEdited = false; albumArtistEditText.setEnabled(false); } } }); genreCheckbox.setOnCheckedChangeListener(new OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton checkbox, boolean checked) { if (checked == true) { genreEdited = true; genreEditText.setEnabled(true); ; } else { genreEdited = false; genreEditText.setEnabled(false); } } }); producerCheckbox.setOnCheckedChangeListener(new OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton checkbox, boolean checked) { if (checked == true) { producerEdited = true; producerEditText.setEnabled(true); ; } else { producerEdited = false; producerEditText.setEnabled(false); } } }); yearCheckbox.setOnCheckedChangeListener(new OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton checkbox, boolean checked) { if (checked == true) { yearEdited = true; yearEditText.setEnabled(true); ; } else { yearEdited = false; yearEditText.setEnabled(false); } } }); trackCheckbox.setOnCheckedChangeListener(new OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton checkbox, boolean checked) { if (checked == true) { trackEdited = true; trackEditText.setEnabled(true); ; } else { trackEdited = false; trackEditText.setEnabled(false); } } }); commentCheckbox.setOnCheckedChangeListener(new OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton checkbox, boolean checked) { if (checked == true) { commentEdited = true; commentsEditText.setEnabled(true); ; } else { commentEdited = false; commentsEditText.setEnabled(false); } } }); //Get the album and artist name. ARTIST = getArguments().getString("ARTIST"); ALBUM = getArguments().getString("ALBUM"); CALLING_FRAGMENT = getArguments().getString("CALLING_FRAGMENT"); if (ARTIST != null && ALBUM != null) { songURIsList = getAllSongsInAlbum(ALBUM, ARTIST); //Populate the ArrayLists with the song tags. try { getSongTags(songURIsList); } catch (CannotReadException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (TagException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (ReadOnlyFileException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (InvalidAudioFrameException e) { // TODO Auto-generated catch block e.printStackTrace(); } //Now check if any of the ArrayLists contain the same exact elements. boolean titlesSame = checkIfAllElementsEqual(titlesList); boolean artistsSame = checkIfAllElementsEqual(artistsList); boolean albumsSame = checkIfAllElementsEqual(albumsList); boolean albumArtistsSame = checkIfAllElementsEqual(albumArtistsList); boolean genresSame = checkIfAllElementsEqual(genresList); boolean producersSame = checkIfAllElementsEqual(producersList); boolean yearsSame = checkIfAllElementsEqual(yearsList); boolean tracksSame = checkIfAllElementsEqual(trackNumbersList); boolean totalTracksSame = checkIfAllElementsEqual(totalTracksList); boolean commentsSame = checkIfAllElementsEqual(commentsList); //Populate the EditTexts. setEditorFields(titlesSame, titlesList, titleEditText); setEditorFields(artistsSame, artistsList, artistEditText); setEditorFields(albumsSame, albumsList, albumEditText); setEditorFields(albumArtistsSame, albumArtistsList, albumArtistEditText); setEditorFields(genresSame, genresList, genreEditText); setEditorFields(producersSame, producersList, producerEditText); setEditorFields(yearsSame, yearsList, yearEditText); setEditorFields(tracksSame, trackNumbersList, trackEditText); setEditorFields(totalTracksSame, totalTracksList, trackTotalEditText); setEditorFields(commentsSame, commentsList, commentsEditText); } AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); //Set the dialog title. builder.setTitle(R.string.edit_tags); builder.setView(rootView); builder.setNeutralButton(R.string.save, new OnClickListener() { @Override public void onClick(DialogInterface arg0, int arg1) { AsyncSaveAlbumTagsTask asyncSaveAlbumTagsTask = new AsyncSaveAlbumTagsTask(getActivity(), getActivity()); asyncSaveAlbumTagsTask.execute(); } }); builder.setNegativeButton(R.string.cancel, new OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { clearArrayLists(); dialogFragment.dismiss(); } }); return builder.create(); }
From source file:com.color.kid.kidpaint.dialog.DialogTermsOfUseAndService.java
@TargetApi(Build.VERSION_CODES.HONEYCOMB) @Override/* ww w . j a v a 2s .c o m*/ public Dialog onCreateDialog(Bundle savedInstanceState) { LayoutInflater inflater = getActivity().getLayoutInflater(); AlertDialog.Builder builder = new CustomAlertDialogBuilder(getActivity()); builder.setTitle(R.string.terms_of_use_and_service_title); View view = inflater.inflate(R.layout.dialog_terms_of_use_and_service, null); TextView termsOfUseAndServiceTextView = (TextView) view .findViewById(R.id.terms_of_use_and_service_tview_Text); termsOfUseAndServiceTextView.setText(R.string.terms_of_use_and_service_content); TextView termsOfUseAndServiceUrlTextView = (TextView) view .findViewById(R.id.terms_of_use_and_service_tview_Url); termsOfUseAndServiceUrlTextView.setMovementMethod(LinkMovementMethod.getInstance()); Resources resources = getActivity().getResources(); String paintroidTermsOfUseAndService = String.format( resources.getString(R.string.terms_of_use_and_service_link_template), resources.getString(R.string.terms_of_use_and_service_url), resources.getString(R.string.terms_of_use_and_service_url_text)); termsOfUseAndServiceUrlTextView.append(Html.fromHtml(paintroidTermsOfUseAndService)); termsOfUseAndServiceUrlTextView.append("\n\n"); String aboutCatroid = String.format( /*resources.getString(R.string.about_link_template), resources.getString(R.string.catroid_url),*/ resources.getString(R.string.about_catroid_url_text)); termsOfUseAndServiceUrlTextView.append(Html.fromHtml(aboutCatroid)); termsOfUseAndServiceUrlTextView.append("\n"); builder.setView(view); builder.setNeutralButton(R.string.done, this); return builder.create(); }
From source file:com.cl.slack.gesture.GestureBuilderActivity.java
private Dialog createRenameDialog() { final View layout = View.inflate(this, R.layout.dialog_rename, null); mInput = (EditText) layout.findViewById(R.id.name); ((TextView) layout.findViewById(R.id.label)).setText(R.string.gestures_rename_label); AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setIcon(0);// ww w . j a va 2s .co m builder.setTitle(getString(R.string.gestures_rename_title)); builder.setCancelable(true); builder.setOnCancelListener(new Dialog.OnCancelListener() { public void onCancel(DialogInterface dialog) { cleanupRenameDialog(); } }); builder.setNegativeButton(getString(R.string.cancel_action), new Dialog.OnClickListener() { public void onClick(DialogInterface dialog, int which) { cleanupRenameDialog(); } }); // builder.setNeutralButton(getString(R.string.cancel_action), // new Dialog.OnClickListener() { // public void onClick(DialogInterface dialog, int which) { // cleanupRenameDialog(); // } // } // ); builder.setPositiveButton(getString(R.string.rename_action), new Dialog.OnClickListener() { public void onClick(DialogInterface dialog, int which) { changeGestureName(); } }); builder.setView(layout); return builder.create(); }
From source file:com.hackensack.umc.activity.DependentDetailsActivity.java
private void showGenderDialog() { if (!isFinishing()) { AlertDialog.Builder builder = new AlertDialog.Builder(DependentDetailsActivity.this); LayoutInflater inflater = this.getLayoutInflater(); View dialogView = inflater.inflate(R.layout.dialog_custom_list, null); builder.setView(dialogView); ((TextView) dialogView.findViewById(R.id.dialog_title)).setText("Gender"); dialogView.findViewById(R.id.progress_bar).setVisibility(View.GONE); ((RelativeLayout) dialogView.findViewById(R.id.relative_dialog_button)).setVisibility(View.GONE); mDialogListView = (ListView) dialogView.findViewById(R.id.list_specialty); mDialogListView.setAdapter(mGenderAdapter); ((ListView) dialogView.findViewById(R.id.list_specialty)) .setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override/*from ww w . j ava 2s.c o m*/ public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) { mGender.setText(mGenderArray[i]); alert.dismiss(); mDialogListView = null; } }); alert = builder.show(); } }
From source file:com.gmail.nagamatu.radiko.installer.RadikoInstallerActivity.java
private Dialog onCreatePasswdDialog() { final AlertDialog.Builder ab = new AlertDialog.Builder(this); ab.setPositiveButton(R.string.ok, new OnClickListener() { @Override/*from w w w. j a va2 s .co m*/ public void onClick(DialogInterface dialog, int which) { if (dialog instanceof AlertDialog) { final AlertDialog dlg = (AlertDialog) dialog; final EditText passwd = (EditText) dlg.findViewById(R.id.dialog_text); if (passwd == null) { return; } mPasswd = passwd.getText().toString(); updateMessage(R.string.login_google, null); new Thread(new Runnable() { public void run() { login(); } }).start(); } } }); ab.setNegativeButton(R.string.cancel, new OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { finish(); } }); ab.setTitle("Password for " + mAccount.name); final LayoutInflater inflator = getLayoutInflater(); ab.setView(inflator.inflate(R.layout.passwd, null)); return ab.create(); }
From source file:com.cw.litenote.config.Config.java
void selectStyleDialog(View view) { mContext = getActivity();/*w w w. ja v a 2 s . c o m*/ AlertDialog.Builder builder = new AlertDialog.Builder(mContext); builder.setTitle(R.string.config_set_style_title).setPositiveButton(R.string.btn_OK, listener_ok) .setNegativeButton(R.string.btn_Cancel, null); // inflate select style layout mInflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE); view = mInflater.inflate(R.layout.select_style, null); RadioGroup RG_view = (RadioGroup) view.findViewById(R.id.radioGroup1); setButtonColor((RadioButton) RG_view.findViewById(R.id.radio0), 0); setButtonColor((RadioButton) RG_view.findViewById(R.id.radio1), 1); setButtonColor((RadioButton) RG_view.findViewById(R.id.radio2), 2); setButtonColor((RadioButton) RG_view.findViewById(R.id.radio3), 3); setButtonColor((RadioButton) RG_view.findViewById(R.id.radio4), 4); setButtonColor((RadioButton) RG_view.findViewById(R.id.radio5), 5); setButtonColor((RadioButton) RG_view.findViewById(R.id.radio6), 6); setButtonColor((RadioButton) RG_view.findViewById(R.id.radio7), 7); setButtonColor((RadioButton) RG_view.findViewById(R.id.radio8), 8); setButtonColor((RadioButton) RG_view.findViewById(R.id.radio9), 9); builder.setView(view); RadioGroup radioGroup = (RadioGroup) RG_view.findViewById(R.id.radioGroup1); radioGroup.setOnCheckedChangeListener(new OnCheckedChangeListener() { @Override public void onCheckedChanged(RadioGroup RG, int id) { mStyle = RG.indexOfChild(RG.findViewById(id)); } }); dialog = builder.create(); dialog.show(); }