use of android.widget.EditText in project JamsMusicPlayer by psaravan.
the class EqualizerActivity method buildSavePresetDialog.
/**
* Builds the "Save Preset" dialog. Does not call the show() method, so you
* should do this manually when calling this method.
*
* @return A fully built AlertDialog reference.
*/
private AlertDialog buildSavePresetDialog() {
AlertDialog.Builder builder = new AlertDialog.Builder(this);
View dialogView = getLayoutInflater().inflate(R.layout.add_new_equalizer_preset_dialog_layout, null);
final EditText newPresetNameField = (EditText) dialogView.findViewById(R.id.new_preset_name_text_field);
newPresetNameField.setTypeface(TypefaceHelper.getTypeface(mContext, "Roboto-Light"));
newPresetNameField.setPaintFlags(newPresetNameField.getPaintFlags() | Paint.ANTI_ALIAS_FLAG | Paint.SUBPIXEL_TEXT_FLAG);
//Set the dialog title.
builder.setTitle(R.string.save_preset);
builder.setView(dialogView);
builder.setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int arg1) {
dialog.dismiss();
}
});
builder.setPositiveButton(R.string.done, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
//Get the preset name from the text field.
String presetName = newPresetNameField.getText().toString();
//Add the preset and it's values to the DB.
mApp.getDBAccessHelper().addNewEQPreset(presetName, fiftyHertzLevel, oneThirtyHertzLevel, threeTwentyHertzLevel, eightHundredHertzLevel, twoKilohertzLevel, fiveKilohertzLevel, twelvePointFiveKilohertzLevel, (short) virtualizerSeekBar.getProgress(), (short) bassBoostSeekBar.getProgress(), (short) reverbSpinner.getSelectedItemPosition());
Toast.makeText(mContext, R.string.preset_saved, Toast.LENGTH_SHORT).show();
dialog.dismiss();
}
});
return builder.create();
}
use of android.widget.EditText in project JamsMusicPlayer by psaravan.
the class AddMusicLibraryDialog method onCreateDialog.
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
libraryLabelID = "circle_blue_dark";
View rootView = getActivity().getLayoutInflater().inflate(R.layout.dialog_add_music_library, null);
TextView instructions = (TextView) rootView.findViewById(R.id.add_music_library_instructions);
instructions.setTypeface(TypefaceHelper.getTypeface(getActivity(), "RobotoCondensed-Light"));
instructions.setPaintFlags(instructions.getPaintFlags() | Paint.ANTI_ALIAS_FLAG | Paint.SUBPIXEL_TEXT_FLAG);
final ImageButton labelButton = (ImageButton) rootView.findViewById(R.id.add_music_library_label_button);
final EditText musicLibraryName = (EditText) rootView.findViewById(R.id.add_music_library_text_field);
musicLibraryName.setTypeface(TypefaceHelper.getTypeface(getActivity(), "RobotoCondensed-Light"));
musicLibraryName.setPaintFlags(musicLibraryName.getPaintFlags() | Paint.ANTI_ALIAS_FLAG | Paint.SUBPIXEL_TEXT_FLAG);
labelButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
//Create a new array with a list of all the library labels.
final Drawable[] labelsArray = { getActivity().getResources().getDrawable(R.drawable.circle_blue_dark), getActivity().getResources().getDrawable(R.drawable.circle_blue_light), getActivity().getResources().getDrawable(R.drawable.circle_green_dark), getActivity().getResources().getDrawable(R.drawable.circle_green_light), getActivity().getResources().getDrawable(R.drawable.circle_purple_dark), getActivity().getResources().getDrawable(R.drawable.circle_purple_light), getActivity().getResources().getDrawable(R.drawable.circle_red_dark), getActivity().getResources().getDrawable(R.drawable.circle_red_light), getActivity().getResources().getDrawable(R.drawable.circle_yellow_dark), getActivity().getResources().getDrawable(R.drawable.circle_yellow_light) };
//Create a new array with a list of all the library labels.
final String[] labelsIdsArray = { "circle_blue_dark", "circle_blue_light", "circle_green_dark", "circle_green_light", "circle_purple_dark", "circle_purple_light", "circle_red_dark", "circle_red_light", "circle_yellow_dark", "circle_yellow_light" };
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
builder.setTitle(R.string.music_library_label);
ArrayList<String> labelTitles = new ArrayList<String>();
labelTitles.addAll(Arrays.asList(getActivity().getResources().getStringArray(R.array.library_labels)));
builder.setAdapter(new LibraryLabelsAdapter(getActivity(), labelTitles), new OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
libraryLabelID = labelsIdsArray[which];
labelButton.setImageDrawable(labelsArray[which]);
}
});
builder.create().show();
}
});
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
//Set the dialog title.
builder.setTitle(R.string.add_music_library);
builder.setView(rootView);
builder.setPositiveButton(R.string.ok, new OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int arg1) {
String libraryName = musicLibraryName.getText().toString();
Intent intent = new Intent(getActivity(), MusicLibraryEditorActivity.class);
Bundle bundle = new Bundle();
bundle.putString("LIBRARY_NAME", libraryName);
bundle.putString("LIBRARY_ICON", libraryLabelID);
intent.putExtras(bundle);
startActivity(intent);
dialog.dismiss();
getActivity().finish();
}
});
builder.setNegativeButton(R.string.cancel, new OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int arg1) {
dialog.dismiss();
getActivity().finish();
}
});
return builder.create();
}
use of android.widget.EditText in project weiciyuan by qii.
the class AddGroupDialog method onCreateDialog.
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
name = new EditText(getActivity());
name.addTextChangedListener(new WordLengthLimitWatcher(name));
if (savedInstanceState != null) {
name.append(savedInstanceState.getString("name"));
}
builder.setView(name).setTitle(getString(R.string.input_group_name)).setPositiveButton(getString(R.string.add), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
String word = name.getText().toString().trim();
if (!TextUtils.isEmpty(word)) {
ManageGroupActivity.ManageGroupFragment fragment = (ManageGroupActivity.ManageGroupFragment) getTargetFragment();
fragment.addGroup(word);
}
}
}).setNegativeButton(getString(R.string.cancel), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
}
});
AlertDialog dialog = builder.create();
dialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE);
return dialog;
}
use of android.widget.EditText in project weiciyuan by qii.
the class ModifyGroupDialog method onCreateDialog.
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
if (savedInstanceState != null) {
idstr = savedInstanceState.getString("idstr");
oriName = savedInstanceState.getString("oriName");
}
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
name = new EditText(getActivity());
name.setHint(oriName);
name.addTextChangedListener(new WordLengthLimitWatcher(name));
if (savedInstanceState != null) {
name.append(savedInstanceState.getString("name"));
}
builder.setView(name).setTitle(getString(R.string.modify_group_name)).setPositiveButton(getString(R.string.modify), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
String name = ModifyGroupDialog.this.name.getText().toString().trim();
if (!TextUtils.isEmpty(name)) {
ManageGroupActivity.ManageGroupFragment fragment = (ManageGroupActivity.ManageGroupFragment) getTargetFragment();
fragment.modifyGroupName(idstr, name);
}
}
}).setNegativeButton(getString(R.string.cancel), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
}
});
AlertDialog dialog = builder.create();
dialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE);
return dialog;
}
use of android.widget.EditText in project weiciyuan by qii.
the class UpdateRemarkDialog method onCreateDialog.
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
final EditText et = new EditText(getActivity());
et.setHint(getString(R.string.new_remark));
builder.setView(et).setTitle(getString(R.string.remark)).setPositiveButton(getString(R.string.modify), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
String word = et.getText().toString().trim();
if (!TextUtils.isEmpty(word)) {
UserInfoActivity activity = (UserInfoActivity) getActivity();
activity.updateRemark(word);
}
}
}).setNegativeButton(getString(R.string.cancel), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
}
});
return builder.create();
}
Aggregations