Search in sources :

Example 46 with EditText

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();
}
Also used : EditText(android.widget.EditText) Playlist(com.sdsmdg.harjot.MusicDNA.models.Playlist) ListView(android.widget.ListView) Dialog(android.app.Dialog) CustomLocalBottomSheetDialog(com.sdsmdg.harjot.MusicDNA.custombottomsheets.CustomLocalBottomSheetDialog) CustomGeneralBottomSheetDialog(com.sdsmdg.harjot.MusicDNA.custombottomsheets.CustomGeneralBottomSheetDialog) ImageView(android.widget.ImageView) CircleImageView(de.hdodenhof.circleimageview.CircleImageView) ImageView(android.widget.ImageView) VisualizerView(com.sdsmdg.harjot.MusicDNA.visualizers.VisualizerView) RecyclerView(android.support.v7.widget.RecyclerView) NavigationView(android.support.design.widget.NavigationView) SearchView(android.support.v7.widget.SearchView) CircleImageView(de.hdodenhof.circleimageview.CircleImageView) ShowcaseView(com.github.amlcurran.showcaseview.ShowcaseView) View(android.view.View) AdapterView(android.widget.AdapterView) TextView(android.widget.TextView) WheelView(com.lantouzi.wheelview.WheelView) ListView(android.widget.ListView)

Example 47 with EditText

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("");
}
Also used : EditText(android.widget.EditText)

Example 48 with EditText

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();
    }
}
Also used : EditText(android.widget.EditText) AlertDialog(android.app.AlertDialog) SharedPreferences(android.content.SharedPreferences) Intent(android.content.Intent)

Example 49 with EditText

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();
}
Also used : EditText(android.widget.EditText) DialogInterface(android.content.DialogInterface) ZLResource(org.geometerplus.zlibrary.core.resources.ZLResource) Intent(android.content.Intent)

Example 50 with EditText

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();
    }
}
Also used : EditText(android.widget.EditText) ImageView(android.widget.ImageView) ShowcaseView(com.github.amlcurran.showcaseview.ShowcaseView) View(android.view.View) RecyclerView(android.support.v7.widget.RecyclerView) TextView(android.widget.TextView) Button(android.widget.Button) CompoundButton(android.widget.CompoundButton) Dialog(android.app.Dialog) CheckBox(android.widget.CheckBox) TextView(android.widget.TextView) CompoundButton(android.widget.CompoundButton)

Aggregations

EditText (android.widget.EditText)655 View (android.view.View)309 TextView (android.widget.TextView)220 DialogInterface (android.content.DialogInterface)143 AlertDialog (android.app.AlertDialog)126 Button (android.widget.Button)126 Intent (android.content.Intent)99 LinearLayout (android.widget.LinearLayout)79 ImageView (android.widget.ImageView)61 AlertDialog (android.support.v7.app.AlertDialog)54 ScrollView (android.widget.ScrollView)52 LayoutInflater (android.view.LayoutInflater)48 AdapterView (android.widget.AdapterView)46 ViewGroup (android.view.ViewGroup)42 Editable (android.text.Editable)41 Context (android.content.Context)40 RecyclerView (android.support.v7.widget.RecyclerView)40 ListView (android.widget.ListView)39 Dialog (android.app.Dialog)36 Bundle (android.os.Bundle)36