use of android.widget.EditText in project MusicDNA by harjot-oberai.
the class HomeActivity method showSaveQueueDialog.
public void showSaveQueueDialog() {
final Dialog dialog = new Dialog(ctx);
dialog.setContentView(R.layout.add_to_playlist_dialog);
dialog.setTitle("Save Queue");
ListView lv = (ListView) dialog.findViewById(R.id.playlist_list);
lv.setVisibility(GONE);
// set the custom dialog components - text, image and button
final EditText text = (EditText) dialog.findViewById(R.id.new_playlist_name);
ImageView image = (ImageView) dialog.findViewById(R.id.confirm_button);
// if button is clicked, close the custom dialog
image.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
boolean isNameRepeat = false;
if (text.getText().toString().trim().equals("")) {
text.setError("Enter Playlist Name!");
} else {
for (int i = 0; i < allPlaylists.getPlaylists().size(); i++) {
if (text.getText().toString().equals(allPlaylists.getPlaylists().get(i).getPlaylistName())) {
isNameRepeat = true;
text.setError("Playlist with same name exists!");
break;
}
}
if (!isNameRepeat) {
Playlist pl = new Playlist(text.getText().toString());
for (int i = 0; i < queue.getQueue().size(); i++) {
pl.getSongList().add(queue.getQueue().get(i));
}
allPlaylists.addPlaylist(pl);
playlistsRecycler.setVisibility(View.VISIBLE);
playlistNothingText.setVisibility(View.INVISIBLE);
pAdapter.notifyDataSetChanged();
new SavePlaylists().executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
Toast.makeText(HomeActivity.this, "Queue saved!", Toast.LENGTH_SHORT).show();
dialog.dismiss();
}
}
}
});
dialog.show();
}
use of android.widget.EditText in project AndroidSDK-RecipeBook by gabu.
the class Login method onResume.
@Override
protected void onResume() {
super.onResume();
// ホームボタンで戻ってから起動すると
// 入力したパスワードが残って表示されてしまうので
// 明示的に空文字をセットしてクリアする
EditText text = (EditText) findViewById(R.id.EditText1);
text.setText("");
}
use of android.widget.EditText in project AndroidSDK-RecipeBook by gabu.
the class Login method onClick.
public void onClick(View v) {
// プリファレンスを取得
SharedPreferences sp;
sp = PreferenceManager.getDefaultSharedPreferences(this);
// パスワードのキーを取得
String key = getResources().getString(R.string.real_password_key);
// パスワードを取得
// プリファレンスに保存されていない場合は
// DEFAULT_PASSWORDが返る
String password = sp.getString(key, DEFAULT_PASSWORD);
// 入力されたパスワードを取得
EditText text = (EditText) findViewById(R.id.EditText1);
String input = text.getText().toString();
// パスワードがデフォルトだったら暗号化しない
if (!DEFAULT_PASSWORD.equals(password)) {
// 入力されたパスワードを
// SHA-256で暗号化
input = MyPreferenceActivity.sha256(input);
}
// パスワードをチェック
if (password.equals(input)) {
// パスワードが等しければ
// 次の画面へ
Intent intent = new Intent(this, Success.class);
startActivity(intent);
} else {
// 等しくなければアラートダイアログを表示
new AlertDialog.Builder(this).setTitle("Can't login.").setMessage("Password Error...").setPositiveButton("OK", null).create().show();
}
}
use of android.widget.EditText in project FBReaderJ by geometer.
the class SearchDialogUtil method showDialog.
public static void showDialog(final Activity activity, final Class<? extends Activity> clazz, final String initialPattern, DialogInterface.OnCancelListener listener, final Bundle bundle) {
final AlertDialog.Builder builder = new AlertDialog.Builder(activity);
builder.setTitle(ZLResource.resource("menu").getResource("search").getValue());
final EditText input = new EditText(activity);
input.setInputType(InputType.TYPE_CLASS_TEXT);
input.setText(initialPattern);
builder.setView(input);
final ZLResource dialogResource = ZLResource.resource("dialog").getResource("button");
builder.setPositiveButton(dialogResource.getResource("ok").getValue(), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
activity.startActivity(new Intent(Intent.ACTION_SEARCH).setClass(activity, clazz).putExtra(SearchManager.QUERY, input.getText().toString()).putExtra(SearchManager.APP_DATA, bundle));
}
});
builder.setNegativeButton(dialogResource.getResource("cancel").getValue(), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.cancel();
}
});
if (listener != null) {
builder.setOnCancelListener(listener);
}
AlertDialog dialog = builder.create();
dialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE);
dialog.show();
}
use of android.widget.EditText in project MusicDNA by harjot-oberai.
the class ViewSavedDNA method showDialog.
public void showDialog(int type) {
if (type == 0) {
final Dialog dialog = new Dialog(getContext());
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
dialog.setContentView(R.layout.save_image_dialog);
TextView titleText = (TextView) dialog.findViewById(R.id.dialog_title);
titleText.setText("Save as Image");
if (SplashActivity.tf4 != null)
titleText.setTypeface(SplashActivity.tf4);
// set the custom dialog components - text, image and button
final EditText text = (EditText) dialog.findViewById(R.id.save_image_filename_text);
text.setText(HomeActivity.tempSavedDNA.getName());
text.setBackgroundTintList(ColorStateList.valueOf(HomeActivity.themeColor));
Button btn = (Button) dialog.findViewById(R.id.save_image_btn);
btn.setBackgroundColor(HomeActivity.themeColor);
CheckBox cb = (CheckBox) dialog.findViewById(R.id.text_checkbox);
cb.setChecked(addTextToImage);
cb.setButtonTintList(ColorStateList.valueOf(HomeActivity.themeColor));
cb.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
addTextToImage = isChecked;
}
});
// if button is clicked, close the custom dialog
btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (text.getText().toString().trim().equals("")) {
text.setError("Enter Filename");
} else {
mVisualizerView2.drawText(text.getText().toString(), addTextToImage);
mVisualizerView2.setDrawingCacheEnabled(true);
FileUtils.saveBitmapAsImage(mVisualizerView2.getDrawingCache(), text.getText().toString());
mVisualizerView2.dropText();
mVisualizerView2.setDrawingCacheEnabled(false);
dialog.dismiss();
}
}
});
dialog.show();
} else if (type == 1) {
final Dialog dialog = new Dialog(getContext());
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
dialog.setContentView(R.layout.save_image_dialog);
TextView titleText = (TextView) dialog.findViewById(R.id.dialog_title);
titleText.setText("Share as Image");
if (SplashActivity.tf4 != null)
titleText.setTypeface(SplashActivity.tf4);
// set the custom dialog components - text, image and button
final EditText text = (EditText) dialog.findViewById(R.id.save_image_filename_text);
text.setText(HomeActivity.tempSavedDNA.getName());
text.setBackgroundTintList(ColorStateList.valueOf(HomeActivity.themeColor));
Button btn = (Button) dialog.findViewById(R.id.save_image_btn);
btn.setBackgroundColor(HomeActivity.themeColor);
btn.setText("SHARE");
CheckBox cb = (CheckBox) dialog.findViewById(R.id.text_checkbox);
cb.setChecked(addTextToImage);
cb.setButtonTintList(ColorStateList.valueOf(HomeActivity.themeColor));
cb.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
addTextToImage = isChecked;
}
});
// if button is clicked, close the custom dialog
btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (text.getText().toString().trim().equals("")) {
text.setError("Enter Text");
} else {
mVisualizerView2.drawText(text.getText().toString(), addTextToImage);
mVisualizerView2.setDrawingCacheEnabled(true);
FileUtils.shareBitmapAsImage(mVisualizerView2.getDrawingCache(), text.getText().toString(), getContext());
mVisualizerView2.dropText();
mVisualizerView2.setDrawingCacheEnabled(false);
dialog.dismiss();
}
}
});
dialog.show();
}
}
Aggregations