/** @return */
  protected boolean onItemLongClick() {
    context = (Activity) vciv.getContext();

    dialog = new Dialog(context);
    AlertDialog.Builder builder =
        new AlertDialog.Builder(
            new ContextThemeWrapper(context, android.R.style.Theme_Holo_Dialog));
    builder.setTitle(context.getString(R.string.video_options));

    ListView modeList = new ListView(context);
    modeList.setSelector(R.drawable.menu_item_selector);
    ArrayList<DialogMenuItem> options = addMenuOptions();

    ArrayAdapter<DialogMenuItem> modeAdapter =
        new ArrayAdapter<DialogMenuItem>(
            context, R.layout.simple_list_item, R.id.list_item_text, options);

    modeList.setAdapter(modeAdapter);
    modeList.setOnItemClickListener(getDialogSelectedListener());

    builder.setView(modeList);
    dialog = builder.create();
    dialog.show();

    return true;
  }
  private void confirmDeleteDialog(OnClickListener listener) {
    AlertDialog.Builder builder = new AlertDialog.Builder(this);

    View contents = View.inflate(this, R.layout.delete_thread_dialog_view, null);
    TextView msg = (TextView) contents.findViewById(R.id.message);
    msg.setText(R.string.confirm_delete_selected_messages);

    final CheckBox checkbox = (CheckBox) contents.findViewById(R.id.delete_locked);

    if (mSelectedLockedUris.size() == 0) {
      checkbox.setVisibility(View.GONE);
    } else {
      checkbox.setOnClickListener(
          new View.OnClickListener() {
            @Override
            public void onClick(View v) {
              mIsDeleteLockChecked = checkbox.isChecked();
            }
          });
    }
    builder.setTitle(R.string.confirm_dialog_title);
    builder.setIconAttribute(android.R.attr.alertDialogIcon);
    builder.setCancelable(true);
    builder.setPositiveButton(R.string.yes, listener);
    builder.setNegativeButton(R.string.no, null);
    builder.setView(contents);
    builder.show();
  }
Пример #3
0
  @SuppressLint("InflateParams")
  private void quickEdit(
      final String previousValue, final OnValueEdited callback, boolean password) {
    AlertDialog.Builder builder = new AlertDialog.Builder(this);
    View view = getLayoutInflater().inflate(R.layout.quickedit, null);
    final EditText editor = (EditText) view.findViewById(R.id.editor);
    OnClickListener mClickListener =
        new OnClickListener() {

          @Override
          public void onClick(DialogInterface dialog, int which) {
            String value = editor.getText().toString();
            if (!previousValue.equals(value) && value.trim().length() > 0) {
              callback.onValueEdited(value);
            }
          }
        };
    if (password) {
      editor.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD);
      editor.setHint(R.string.password);
      builder.setPositiveButton(R.string.accept, mClickListener);
    } else {
      builder.setPositiveButton(R.string.edit, mClickListener);
    }
    editor.requestFocus();
    editor.setText(previousValue);
    builder.setView(view);
    builder.setNegativeButton(R.string.cancel, null);
    builder.create().show();
  }
  @Override
  public Dialog onCreateDialog(Bundle savedInstanceState) {

    // Get latitude and longitude
    double lat = getArguments().getDouble(BUNDLE_KEY_LAT);
    double lng = getArguments().getDouble(BUNDLE_KEY_LNG);
    loc = new LatLng(lat, lng);

    // Create the builder
    AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());

    // Set the title
    builder.setTitle("Pin a New Tak");

    // Set the main content view
    LayoutInflater inflater = getActivity().getLayoutInflater();
    View v = inflater.inflate(R.layout.fragment_createtak, null);
    builder.setView(v);

    // Set positive and negative buttons
    builder.setPositiveButton("Pin", this);
    builder.setNegativeButton("Cancel", this);

    // Get widgets on the dialog fragment
    etTakName = (EditText) v.findViewById(R.id.addtak_et_takname);
    etTakDesc = (EditText) v.findViewById(R.id.addtak_et_description);
    etLat = (EditText) v.findViewById(R.id.addtak_et_lat);
    etLng = (EditText) v.findViewById(R.id.addtak_et_lng);

    // Add location passed in to the edit texts
    etLat.setText("" + loc.latitude);
    etLng.setText("" + loc.longitude);

    return builder.create();
  }
  public void showEditDialog(
      Context context, String hintText, String OKText, final DialogCallBack callBack) {
    final EditText et_search;
    AlertDialog.Builder dialog = new AlertDialog.Builder(context);
    LayoutInflater inflater =
        (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    LinearLayout layout = (LinearLayout) inflater.inflate(R.layout.dialog_view, null);
    dialog.setView(layout);
    et_search = (EditText) layout.findViewById(R.id.searchC);
    et_search.setHint(hintText);
    dialog.setPositiveButton(
        OKText,
        new DialogInterface.OnClickListener() {
          public void onClick(DialogInterface dialog, int which) {
            String s = et_search.getText().toString().trim();
            callBack.exectEditEvent(s);
          }
        });

    dialog.setNegativeButton(
        R.string.cancel,
        new DialogInterface.OnClickListener() {
          public void onClick(DialogInterface dialog, int which) {}
        });
    dialog.show();
  }
  @Override
  public void OnAlimentClick(Aliment choix) {

    // AlertDialog
    AlertDialog.Builder builder = new AlertDialog.Builder(this);
    String message =
        getResources().getString(R.string.enter_quantity_label) + choix.getTypeMesure();
    builder.setMessage(message);
    EditText input = new EditText(this);
    input.setInputType(InputType.TYPE_CLASS_NUMBER);
    builder.setView(input);
    builder.setPositiveButton(
        "OK",
        new DialogInterface.OnClickListener() {
          @Override
          public void onClick(DialogInterface dialog, int which) {
            quantity = Integer.parseInt(input.getText().toString());

            DetailsRepas detailsRepas =
                (DetailsRepas) getFragmentManager().findFragmentById(R.id.DetailsRepas);
            detailsRepas.AjouterAliment(choix, quantity);
          }
        });
    builder.show();
  }
  // Other
  // ==============================================================================================
  private void displayOptions() {
    final AlertDialog.Builder alertDialog = new AlertDialog.Builder(FlightControlsActivity.this);
    LayoutInflater inflater = getLayoutInflater();
    View convertView = (View) inflater.inflate(R.layout.popup_flight_options, null);
    alertDialog.setView(convertView);
    alertDialog.setTitle("Options:");
    alertDialog.setPositiveButton(
        "Continue",
        new DialogInterface.OnClickListener() {
          @Override
          public void onClick(DialogInterface dialog, int which) {}
        });

    final AlertDialog alert = alertDialog.create();
    alert.show();

    final CheckBox chkDirectional = (CheckBox) alert.findViewById(R.id.chkDirectional);
    final CheckBox chkRotation = (CheckBox) alert.findViewById(R.id.chkRotation);
    final CheckBox chkAltitude = (CheckBox) alert.findViewById(R.id.chkAltitude);

    chkDirectional.setOnCheckedChangeListener(this);
    chkRotation.setOnCheckedChangeListener(this);
    chkAltitude.setOnCheckedChangeListener(this);

    chkDirectional.setChecked(controls_directional);
    chkRotation.setChecked(controls_rotation);
    chkAltitude.setChecked(controls_altitude);
  }
Пример #8
0
 void changeNickName() {
   AlertDialog.Builder alertDialog = new AlertDialog.Builder(this);
   final EditText editText = new EditText(this);
   alertDialog.setTitle("Nickname");
   alertDialog.setView(editText);
   editText.setText(AppToServer.getNickName());
   editText.setHint("< nickname >");
   editText.setSingleLine();
   alertDialog.setNegativeButton("No Change", null);
   final Activity activity = this;
   alertDialog.setPositiveButton(
       "Change",
       new DialogInterface.OnClickListener() {
         @Override
         public void onClick(DialogInterface dialog, int which) {
           AppToServer.changeMyDetails(
               activity,
               editText.getText().toString(),
               null,
               null,
               new Callable<Void>() {
                 @Override
                 public Void call() throws Exception {
                   setOfflineData();
                   return null;
                 }
               });
         }
       });
   alertDialog.show();
 }
  void heightf() {

    final EditText input = new EditText(InputHeightWeight.this);
    LinearLayout.LayoutParams lp =
        new LinearLayout.LayoutParams(
            LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT);
    input.setLayoutParams(lp);

    AlertDialog.Builder builder = new AlertDialog.Builder(this);
    builder.setTitle("Height (cm)");
    // builder.setMessage("Which creature has one voice and yet becomes four-footed and two-footed
    // and three-footed?");
    builder.setView(input);
    builder.setPositiveButton(
        "OK",
        new DialogInterface.OnClickListener() {
          @Override
          public void onClick(DialogInterface dialog, int id) {

            String s = input.getText().toString() + " cm";
            Container.height = input.getText().toString();
            TextView height_log = (TextView) findViewById(R.id.height_log);
            height_log.setText(s);

            //  Your code when user clicked on OK
            //  You can write the code  to save the selected item here
          }
        });
    builder.setNegativeButton("CANCEL", null);

    builder.show();
  }
Пример #10
0
  private void editEmailId() {
    final AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(MainActivity.this);

    View view = getLayoutInflater().inflate(R.layout.email_dialog, null);
    dialogBuilder.setView(view);
    final AlertDialog alertDialog = dialogBuilder.create();
    Button post = (Button) view.findViewById(R.id.button_post);
    SharedPreferences settings = getSharedPreferences(PREFS_NAME, 0);
    String email = settings.getString("email", "*****@*****.**");
    user_id = (EditText) view.findViewById(R.id.status);
    user_id.setText(email);
    post.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            //     adapter.addPost(status.getText().toString());
            if (user_id.getText().toString().trim().length() > 0) {
              SharedPreferences settings = getSharedPreferences(PREFS_NAME, 0);
              SharedPreferences.Editor editor = settings.edit();
              editor.putString("email", user_id.getText().toString().trim().toLowerCase());
              editor.commit();
              alertDialog.dismiss();
            }
          }
        });

    alertDialog.show();
  }
  private void obterSenha() {
    final String saida = "";
    AlertDialog.Builder alert = new AlertDialog.Builder(this);
    Resources res = getResources();

    alert.setMessage(res.getString(R.string.msg_informar_senha_backup));

    // Set an EditText view to get user input
    final EditText input = new EditText(this.getApplicationContext());
    input.setTransformationMethod(android.text.method.PasswordTransformationMethod.getInstance());
    alert.setView(input);

    alert.setPositiveButton(
        res.getString(R.string.opc_ok),
        new DialogInterface.OnClickListener() {
          public void onClick(DialogInterface dialog, int whichButton) {
            Editable value = input.getText();
            comandarRestaurar(value.toString());
          }
        });

    alert.setNegativeButton(
        res.getString(R.string.opc_cancelar),
        new DialogInterface.OnClickListener() {
          public void onClick(DialogInterface dialog, int whichButton) {
            // Canceled.
          }
        });

    alert.show();
  }
Пример #12
0
  public void addTea(View view) {
    AlertDialog.Builder builder = new AlertDialog.Builder(this);

    final EditText input = new EditText(this);
    input.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_CAP_WORDS);

    builder
        .setView(input)
        .setMessage(R.string.enter_tea)
        .setPositiveButton(
            R.string.create_tea,
            new DialogInterface.OnClickListener() {
              @Override
              public void onClick(DialogInterface dialogInterface, int i) {
                String addedTea = input.getText().toString();
                teas.add(addedTea);
                updateTeas();
              }
            })
        .setNegativeButton(
            R.string.cancel_tea,
            new DialogInterface.OnClickListener() {
              @Override
              public void onClick(DialogInterface dialogInterface, int i) {}
            });

    builder.show();
  }
 private void startAddOptionDialog() {
   AlertDialog.Builder builder = new AlertDialog.Builder(getContext());
   final View dialogView =
       LayoutInflater.from(getContext())
           .inflate(R.layout.pref_add_message_dialog_content, (LinearLayout) this.view, false);
   builder.setTitle(R.string.pref_new_apology_dialog_title);
   builder.setView(dialogView);
   builder.setPositiveButton(
       R.string.pref_new_apology_positive_button,
       new DialogInterface.OnClickListener() {
         @Override
         public void onClick(DialogInterface dialog, int which) {
           EditText inputText = (EditText) dialogView.findViewById(R.id.new_apology_message_field);
           String content = inputText.getText().toString().trim();
           if (content.length() == 0) {
             return;
           }
           app.settings().addMessageOption(content);
           updateUI();
         }
       });
   builder.setNegativeButton(
       R.string.pref_new_apology_negative_button,
       new DialogInterface.OnClickListener() {
         @Override
         public void onClick(DialogInterface dialog, int which) {}
       });
   builder.show();
 }
Пример #14
0
  public void onTextButtonClicked(View v) {
    AlertDialog.Builder alert = new AlertDialog.Builder(this);

    alert.setTitle("请输入文字");
    alert.setMessage("   ");

    // Set an EditText view to get user input
    final EditText input = new EditText(this);
    alert.setView(input);

    alert.setPositiveButton(
        "Ok",
        new DialogInterface.OnClickListener() {
          public void onClick(DialogInterface dialog, int whichButton) {

            // Do something with value!
            addTextViewResources(input.getText().toString());
          }
        });

    alert.setNegativeButton(
        "Cancel",
        new DialogInterface.OnClickListener() {
          public void onClick(DialogInterface dialog, int whichButton) {
            // Canceled.
          }
        });

    alert.show();
  }
Пример #15
0
  private void showPasswordDialog() {
    AlertDialog.Builder alert = new AlertDialog.Builder(this);

    alert.setTitle("Password");
    alert.setMessage("Enter password again to view file");

    // Set an EditText view to get user input
    final EditText input = new EditText(this);
    alert.setView(input);

    alert.setPositiveButton(
        "Ok",
        new DialogInterface.OnClickListener() {
          public void onClick(DialogInterface dialog, int whichButton) {
            password = input.getText().toString();
          }
        });

    alert.setNegativeButton(
        "Cancel",
        new DialogInterface.OnClickListener() {
          public void onClick(DialogInterface dialog, int whichButton) {
            Toast.makeText(
                    getApplicationContext(), getString(R.string.noPassword), Toast.LENGTH_LONG)
                .show();
            finish();
          }
        });

    alert.show();
  }
Пример #16
0
  public void showalert(int id, String path) {
    AlertDialog.Builder alert = new AlertDialog.Builder(mcontext);

    alert.setMessage("path to install");

    // Set an EditText view to get user input
    final EditText input = new EditText(mcontext);
    input.setId(id);
    input.setText(path);
    alert.setView(input);

    alert.setPositiveButton(
        "save",
        new DialogInterface.OnClickListener() {
          public void onClick(DialogInterface dialog, int whichButton) {
            Editor edit = sharedP.edit();
            edit.putString("path" + input.getId(), input.getText().toString());
            edit.commit();
            madapt.notifyDataSetChanged();
          }
        });

    alert.setNegativeButton(
        "Cancel",
        new DialogInterface.OnClickListener() {
          public void onClick(DialogInterface dialog, int whichButton) {
            // Canceled.
          }
        });

    alert.show();
  }
  public void doThis(final Button button) {
    AlertDialog.Builder alert = new AlertDialog.Builder(this);
    alert.setTitle("What do you want to do?");
    LinearLayout llAlert = new LinearLayout(this);
    llAlert.setOrientation(1);
    alert.setView(llAlert);

    alert.setPositiveButton(
        "Edit",
        new DialogInterface.OnClickListener() {
          public void onClick(DialogInterface dialog, int whichButton) {
            edit(button);
          }
        });

    alert.setNegativeButton(
        "Delete",
        new DialogInterface.OnClickListener() {
          public void onClick(DialogInterface dialog, int whichButton) {
            delete(button);
          }
        });

    alert.show();
  }
Пример #18
0
  public void showCommentDialog(InstagramImage image) {
    final InstagramImage finalImage = image;

    AlertDialog.Builder alert = new AlertDialog.Builder(this);

    alert.setTitle("Comment");

    // Set an EditText view to get user input
    final EditText input = new EditText(this);
    alert.setView(input);

    alert.setPositiveButton(
        "Ok",
        new DialogInterface.OnClickListener() {
          public void onClick(DialogInterface dialog, int whichButton) {
            String comment = input.getText().toString();
            postComment(comment, finalImage);
          }
        });

    alert.setNegativeButton(
        "Cancel",
        new DialogInterface.OnClickListener() {
          public void onClick(DialogInterface dialog, int whichButton) {
            // Canceled.
          }
        });

    alert.show();
  }
  @Override
  public Dialog onCreateDialog(Bundle savedInstanceState) {
    AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
    LayoutInflater inflater = getActivity().getLayoutInflater();

    this.dialView = inflater.inflate(R.layout.means_select_color, null);

    Spinner lsColors = (Spinner) dialView.findViewById(R.id.lstColors);
    lsColors.setAdapter(new SpinnerColorAdapter(this.getContext(), null));

    final Button validMean = (Button) this.dialView.findViewById(R.id.btn_valid_color);
    validMean.setOnClickListener(
        new View.OnClickListener() {
          public void onClick(View v) {
            Spinner lsColors = (Spinner) dialView.findViewById(R.id.lstColors);
            String slcType = (String) lsColors.getSelectedItem();
            updateColor(slcType);
            dismiss();
          }
        });

    final Button cancelColor = (Button) this.dialView.findViewById(R.id.btn_cancel_color);
    cancelColor.setOnClickListener(
        new View.OnClickListener() {
          public void onClick(View v) {
            dismiss();
          }
        });

    builder.setView(this.dialView);
    return builder.create();
  }
    @Override
    public android.app.Dialog onCreateDialog(Bundle savedInstanceState) {

      AlertDialog.Builder mBuilder = new AlertDialog.Builder(getActivity());

      mLayoutInflater = getActivity().getLayoutInflater();

      mBuilder.setView(mLayoutInflater.inflate(layout.dialog, null));
      mBuilder.setTitle("The Result");

      DecimalFormat df = new DecimalFormat("###,###,###");
      mBuilder.setMessage(f1 + " : " + df.format(re1) + " VS " + f2 + " : " + df.format(re2));

      // set the AlertDialog's negative Button
      mBuilder.setPositiveButton(
          "Okay",
          new DialogInterface.OnClickListener() {
            // called when "Cancel" Button is clicked
            public void onClick(DialogInterface dialog, int id) {
              dialog.cancel(); // dismiss dialog
            }
          });

      return mBuilder.create();
    }
Пример #21
0
  private void promptScoutName() {
    AlertDialog.Builder builder = new AlertDialog.Builder(this);
    builder.setTitle("Enter your name");
    builder.setCancelable(false);

    // Set up the input
    final EditText input = new EditText(this);
    input.setInputType(InputType.TYPE_CLASS_TEXT);
    builder.setView(input);

    // Affirmative response
    builder.setPositiveButton(
        "OK",
        new DialogInterface.OnClickListener() {
          @Override
          public void onClick(DialogInterface dialog, int which) {
            scout = input.getText().toString().toUpperCase();
            if (scout.equals("")) promptScoutName();
            else {
              getPreferences(MODE_PRIVATE)
                  .edit()
                  .putString(getString(R.string.preference_scout), scout)
                  .apply();
              updateNameField();
            }
          }
        });
    builder.show();
  }
  public Dialog createDialog() {
    LayoutInflater inflater = this.getLayoutInflater();
    View neverShow = inflater.inflate(R.layout.never_show, null);
    checkbox = (CheckBox) neverShow.findViewById(R.id.checkbox);

    // Use the Builder class for convenient dialog construction
    AlertDialog.Builder builder = new AlertDialog.Builder(this);
    builder
        .setView(neverShow)
        .setTitle(R.string.location_settings_title)
        .setMessage(R.string.location_instructions)
        .setPositiveButton(
            R.string.location_settings,
            new DialogInterface.OnClickListener() {
              public void onClick(DialogInterface dialog, int id) {
                if (checkbox.isChecked()) {
                  doNotShowAgain();
                }
                Intent myIntent = new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS);
                startActivity(myIntent);
              }
            })
        .setNegativeButton(
            R.string.location_skip,
            new DialogInterface.OnClickListener() {
              public void onClick(DialogInterface dialog, int id) {
                // User cancelled the dialog
                if (checkbox.isChecked()) {
                  doNotShowAgain();
                }
              }
            });
    // Create the AlertDialog object and return it
    return builder.create();
  }
  private void ShowCustomAlertDialog() {

    final AlertDialog.Builder builder = new AlertDialog.Builder(this);
    LayoutInflater layoutInflater = LayoutInflater.from(this);
    View view = layoutInflater.inflate(R.layout.p005customalertdialog, null);
    builder.setView(view);

    final AlertDialog alertDialog = builder.create();
    builder.setTitle("Are you sure!");
    builder.show();
    Button buttonSaveP005 = (Button) view.findViewById(R.id.buttonSaveP005);
    Button buttonCancelP005 = (Button) view.findViewById(R.id.buttonCancelP005);

    buttonSaveP005.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            textViewP005.setText(R.string.successful);
            alertDialog.dismiss();
            alertDialog.cancel();
          }
        });
    buttonCancelP005.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            textViewP005.setText(R.string.failed);
            alertDialog.cancel();
            alertDialog.dismiss();
          }
        });
  }
Пример #24
0
  @Override
  public Dialog onCreateDialog(Bundle savedInstanceState) {
    final AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());

    LayoutInflater inflater = getActivity().getLayoutInflater();

    final View view = inflater.inflate(R.layout.fragment_walk_dialog, null);

    Bundle arguments = getArguments();
    final Trip trip = (Trip) arguments.getSerializable(MainActivity.SELECTED_TRIP_KEY);

    final EditText editText = (EditText) view.findViewById(R.id.walk_entered);
    editText.setText(Double.toString(trip.getDistance()));

    builder
        .setView(view)
        .setPositiveButton(R.string.ok, okButtonClickListener(trip, editText))
        .setNegativeButton(
            R.string.cancel,
            new DialogInterface.OnClickListener() {
              public void onClick(DialogInterface dialog, int id) {
                TripUpdateDialogFragment.this.getDialog().cancel();
              }
            });
    return builder.create();
  }
Пример #25
0
 public static void doodleAddText(final Context context, final DoodleView doodleView) {
   AlertDialog.Builder builder = new AlertDialog.Builder(context);
   builder.setTitle("请输入文字");
   final EditText editText = new EditText(context);
   builder.setView(editText);
   builder.setPositiveButton(
       "确定",
       new DialogInterface.OnClickListener() {
         @Override
         public void onClick(DialogInterface dialog, int which) {
           String text = editText.getText().toString();
           doodleView.setMode(DoodleView.Mode.TEXT_MODE);
           doodleView.addTextAction(text);
           Toast.makeText(
                   context,
                   context.getString(R.string.set_doodle_font_size_and_position),
                   Toast.LENGTH_LONG)
               .show();
         }
       });
   builder.setNegativeButton(
       "取消",
       new DialogInterface.OnClickListener() {
         @Override
         public void onClick(DialogInterface dialog, int which) {}
       });
   builder.show();
 }
  public void onClick(View view) {
    final Context context = view.getContext();

    AlertDialog.Builder dialog = new AlertDialog.Builder(context);
    final EditText input = new EditText(context);
    input.setText(String.valueOf(degrees));
    input.setInputType(InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_FLAG_DECIMAL);
    input.setSelectAllOnFocus(true);
    dialog.setView(input);
    dialog.setOnCancelListener((OnCancelListener) context);
    dialog.setPositiveButton(
        context.getString(R.string.ok),
        new DialogInterface.OnClickListener() {
          public void onClick(DialogInterface dialog, int which) {
            try {
              degrees = Double.parseDouble(input.getText().toString());
            } catch (NumberFormatException exception) {
              Toast.makeText(context, R.string.error_no_number_entered, Toast.LENGTH_SHORT).show();
            }
            dialog.cancel();
          }
        });
    dialog.setNeutralButton(
        context.getString(R.string.cancel_button),
        new DialogInterface.OnClickListener() {
          public void onClick(DialogInterface dialog, int which) {
            dialog.cancel();
          }
        });

    AlertDialog finishedDialog = dialog.create();
    finishedDialog.setOnShowListener(Utils.getBrickDialogOnClickListener(context, input));

    finishedDialog.show();
  }
Пример #27
0
  private void handleGevondenAlert(final Clue selectedClue, final Clue currentTargetClue) {
    AlertDialog.Builder alert = new AlertDialog.Builder(context);

    alert.setTitle("Gevonden: " + currentTargetClue.getName());
    alert.setMessage("Woord");

    // Set an EditText view to get user input
    final EditText input = new EditText(context);
    alert.setView(input);

    alert.setPositiveButton(
        "Versturen",
        new DialogInterface.OnClickListener() {
          public void onClick(DialogInterface dialog, int whichButton) {
            String word = input.getText().toString();
            new GevondenTask(context, huntedService, word, selectedClue.getName()).execute(null);
            //				map.createMapOverlay();
            //				map.moveMapToClue(selectedClue);
            // Do something with value!
          }
        });

    alert.setNegativeButton(
        "Cancel",
        new DialogInterface.OnClickListener() {
          public void onClick(DialogInterface dialog, int whichButton) {
            // Canceled.
          }
        });

    alert.show();
  }
Пример #28
0
  public void photoNameInputAlert() {
    AlertDialog.Builder alert = new AlertDialog.Builder(this);
    alert.setTitle(getString(R.string.app_name));

    answerText = new EditText(this);
    answerText.setHint("Answer Here");
    answerText.setTextSize(20);
    answerText.setWidth(ViewGroup.LayoutParams.MATCH_PARENT);
    answerText.setHeight(ViewGroup.LayoutParams.WRAP_CONTENT);

    alert.setView(answerText);

    alert.setPositiveButton(
        "Okay",
        new DialogInterface.OnClickListener() {
          public void onClick(DialogInterface dialog, int whichButton) {
            checkAnswer(answerText.getText().toString());
          }
        });
    alert.setNegativeButton(
        "Cancel",
        new DialogInterface.OnClickListener() {
          public void onClick(DialogInterface dialog, int whichButton) {
            // Canceled.
          }
        });
    alert.setNeutralButton(
        "Say It!",
        new DialogInterface.OnClickListener() {
          public void onClick(DialogInterface dialog, int whichButton) {
            startVoiceRecognitionActivity();
          }
        });
    alert.show();
  }
Пример #29
0
  @Override
  public Dialog onCreateDialog(Bundle savedInstanceState) {
    AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());

    View view = getActivity().getLayoutInflater().inflate(R.layout.marker_upload, null);
    final EditText txtName = (EditText) view.findViewById(R.id.txtName);

    builder
        .setView(view)
        .setTitle("Upload Markers")
        .setPositiveButton(
            "Upload",
            new DialogInterface.OnClickListener() {
              @Override
              public void onClick(DialogInterface dialog, int which) {
                mListener.onUploadDialogPositiveClick(txtName.getText().toString());
              }
            })
        .setNegativeButton(
            "Cancel",
            new DialogInterface.OnClickListener() {
              @Override
              public void onClick(DialogInterface dialog, int which) {
                dismiss();
              }
            });

    return builder.create();
  }
Пример #30
0
  @Override
  public Dialog onCreateDialog(Bundle savedInstanceState) {
    db = new QueryFactory(context);

    AlertDialog.Builder builder = new AlertDialog.Builder(context);
    LayoutInflater inflater = getActivity().getLayoutInflater();
    View view = inflater.inflate(R.layout.dialog_add_edit_exercise, null);

    exerciseName = (MaterialEditText) view.findViewById(R.id.exerciseName);
    exerciseType = (MaterialSpinner) view.findViewById(R.id.exerciseType);
    Button yes = (Button) view.findViewById(R.id.btn_yes);
    Button no = (Button) view.findViewById(R.id.btn_no);

    exerciseName.setText(getArguments().getString("EXERCISE_NAME"));
    exerciseType.setSelection(getArguments().getInt("EXERCISE_TYPE"));
    exerciseId = getArguments().getInt("EXERCISE_ID");

    yes.setOnClickListener(this);
    no.setOnClickListener(this);
    Init();

    builder.setView(view);

    alertDialog = builder.create();
    alertDialog.show();

    return alertDialog;
  }