Ejemplo n.º 1
0
  private void verifyBluetooth() {

    try {
      if (!BeaconManager.getInstanceForApplication(getApplicationContext()).checkAvailability()) {
        final AlertDialog.Builder builder = new AlertDialog.Builder(getApplicationContext());
        builder.setTitle("Bluetooth not enabled");
        builder.setMessage("Please enable bluetooth in settings and restart this application.");
        builder.setPositiveButton(android.R.string.ok, null);
        builder.setOnDismissListener(
            new DialogInterface.OnDismissListener() {
              @Override
              public void onDismiss(DialogInterface dialog) {
                System.exit(0);
              }
            });
        builder.show();
      }
    } catch (RuntimeException e) {
      final AlertDialog.Builder builder = new AlertDialog.Builder(getApplicationContext());
      builder.setTitle("Bluetooth LE not available");
      builder.setMessage("Sorry, this device does not support Bluetooth LE.");
      builder.setPositiveButton(android.R.string.ok, null);
      builder.setOnDismissListener(
          new DialogInterface.OnDismissListener() {

            @Override
            public void onDismiss(DialogInterface dialog) {
              System.exit(0);
            }
          });
      builder.show();
    }
  }
Ejemplo n.º 2
0
  public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
    if (arg2 == 0) {
      AlertDialog.Builder raumDialog = new AlertDialog.Builder(this);
      raumDialog.setTitle("Informationen zum Raum " + nummer);
      raumDialog.setMessage("Hier stehen alle Informationen zum Raum.");
      raumDialog.setNeutralButton(
          "ok",
          new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface arg0, int arg1) {}
          });
      raumDialog.show();
    }

    if (arg2 == 1) {
      AlertDialog.Builder raumDialog = new AlertDialog.Builder(this);
      raumDialog.setTitle("" + nummer);
      raumDialog.setIcon(R.drawable.raum_foto);
      raumDialog.setNeutralButton(
          "ok",
          new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface arg0, int arg1) {}
          });
      raumDialog.show();
    }

    if (arg2 == 2) {
      Intent intent = new Intent(CamNavSicht.this, WebSicht.class);
      startActivity(intent);
    }
    if (arg2 == 3) {
      flip.setDisplayedChild(2);
    }
  }
  public void onButtonPayWithCreditCardClicked(View view) {
    final PayPalCard lastUsedCard = PayPalCard.getLastUsedCard(this);
    if (lastUsedCard != null && !lastUsedCard.hasVaultStorageExpired()) {
      AlertDialog.Builder builder = new AlertDialog.Builder(this);
      if (this.paypalEnvironment == PayPalCard.Environment.SANDBOX) {
        builder.setTitle("Payment Source (Sandbox)");
      } else {
        builder.setTitle("Payment Source");
      }

      builder.setItems(
          new String[] {"Pay with new card", "Pay with card ending " + lastUsedCard.getLastFour()},
          new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialogInterface, int itemIndex) {
              if (itemIndex == 0) {
                payWithNewCard();
              } else {
                payWithExistingCard(lastUsedCard);
              }
            }
          });
      builder.show();
    } else {
      payWithNewCard();
    }
  }
Ejemplo n.º 4
0
  @Override
  protected Dialog onCreateDialog(int id, Bundle args) {

    // final String [] didYouKnow = getResources().getStringArray(R.array.did_you_know);

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

    switch (RunProcessor.Mode.values()[id]) {
      case LOAD:
        builder.setTitle("Loading Image");
        break;
      case LOAD_ALIGN:
        builder.setTitle(getResources().getString(R.string.aligning_form));
        break;
      case PROCESS:
        builder.setTitle(getResources().getString(R.string.processing_form));
        builder.setMessage(
            "The first time you use a template this will be slow because the classifier is being trained.");
        break;
      default:
        return null;
    }
    builder.setCancelable(false);
    //		.setMessage("Did you know... \n " + didYouKnow[(new Random()).nextInt(didYouKnow.length)]);

    return builder.create();
  }
Ejemplo n.º 5
0
  /** Create AlertDialogs used on all the activity */
  private void initAllAlertDialogs() {
    Resources res = getResources();

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

    builder.setTitle(res.getString(R.string.connection_error_title));
    builder.setIcon(android.R.drawable.ic_dialog_alert);
    builder.setMessage(res.getString(R.string.connection_needed));
    builder.setPositiveButton(res.getString(R.string.ok), null);
    mNoConnectionAlert = builder.create();

    builder.setTitle(res.getString(R.string.log_in));
    builder.setIcon(android.R.drawable.ic_dialog_alert);
    builder.setMessage(res.getString(R.string.invalid_username_password));
    mInvalidUserPassAlert = builder.create();

    builder.setTitle(res.getString(R.string.connection_error_title));
    builder.setIcon(android.R.drawable.ic_dialog_alert);
    builder.setMessage(res.getString(R.string.connection_error_message));
    builder.setPositiveButton(
        res.getString(R.string.retry),
        new DialogInterface.OnClickListener() {

          public void onClick(DialogInterface dialog, int which) {
            login();
          }
        });
    builder.setNegativeButton(res.getString(R.string.cancel), null);
    mConnectionErrorAlert = builder.create();
  }
    @Override
    protected void onPostExecute(Object backresult) {
      super.onPostExecute(backresult);
      try {
        String error = newsLetterObject.getString("status");

        progress.dismiss();
        AlertDialog.Builder alert = new AlertDialog.Builder(mContext);
        if (error.equalsIgnoreCase("1")) {
          alert.setTitle("Success");

        } else alert.setTitle(mContext.getResources().getString(R.string.Error));
        alert.setNegativeButton(
            mContext.getResources().getString(android.R.string.ok),
            new DialogInterface.OnClickListener() {
              @Override
              public void onClick(DialogInterface dialog, int which) {
                dialog.dismiss();
              }
            });
        alert.setMessage(R.string.your_product_is_successfully_added_to_your_wishlist).show();
      } catch (Exception e) {
        Log.d("Alert JSON ERROR", e + "");
      }
    }
  @Override
  public void onFilePicked(String path, String mode) {
    Log.i(TAG, "selected dir path = " + path);

    mContext = this;

    if ("restore".equals(mode)) {
      final File file = new File(path);
      final AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(this);
      alertDialogBuilder.setTitle(file.getName());
      alertDialogBuilder.setMessage(R.string.do_restore);
      alertDialogBuilder.setPositiveButton(
          android.R.string.yes,
          new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int which) {
              SystemCommand.restore_rom(file.getPath());
              SystemCommand.reboot("recovery");
            }
          });
      alertDialogBuilder.setNegativeButton(android.R.string.no, null);
      alertDialogBuilder.create().show();
    } else if ("manage".equals(mode)) {
      final AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(this);
      final CharSequence[] actions = {
        getText(R.string.backup_manage_rename), getText(R.string.backup_manage_delete)
      };

      mSelectedDir = new File(path);
      alertDialogBuilder.setTitle(mSelectedDir.getName());
      alertDialogBuilder.setItems(actions, mOnClickListener);
      alertDialogBuilder.create().show();
    }
  }
  public void Activar(View view) {
    String codigo = editCodigoActivacion.getText().toString();

    if (codigo.equalsIgnoreCase(Codigo.codigo)) {
      SharedPreferences.Editor editor = Codigo.prefs.edit();
      editor.putString("Activacion", "Activado");
      editor.commit();

      AlertDialog.Builder alerta = new AlertDialog.Builder(CodigoActivacion.this);
      alerta.setTitle("Activado");
      alerta.setMessage("El producto se ha activado satisfactoriamente");
      alerta.setPositiveButton(
          "Aceptar",
          new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialogInterface, int i) {
              Intent intent = new Intent(CodigoActivacion.this, MenuPrincipal.class);
              startActivity(intent);
              finish();
            }
          });
      alerta.setCancelable(false);
      alerta.show();

    } else {
      AlertDialog.Builder alerta = new AlertDialog.Builder(CodigoActivacion.this);
      alerta.setTitle("Código");
      alerta.setMessage("El código ingresado no es correcto, debe ingresar un código valido");
      alerta.setPositiveButton("Aceptar", null);
      alerta.setCancelable(false);
      alerta.show();
    }
  }
  private void prompt_confirm(final String station, final String city, final boolean set_result) {
    AlertDialog.Builder builder = new AlertDialog.Builder(mContext);
    if (station.equals(city)) {
      builder.setTitle(station);
    } else {
      builder.setTitle(station + ", " + city);
    }
    builder.setPositiveButton(
        android.R.string.ok,
        new OnClickListener() {
          @Override
          public void onClick(DialogInterface dialog, int which) {
            if (set_result) {
              Bundle b = new Bundle();
              b.putString("station", station);
              b.putString("city", city);

              Intent i = new Intent();
              i.putExtras(b);

              MapActivity ma = (MapActivity) mContext;
              ma.setResult(Activity.RESULT_OK, i);
              ma.finish();
            }
          }
        });
    builder.setNegativeButton(
        android.R.string.cancel,
        new OnClickListener() {
          @Override
          public void onClick(DialogInterface dialog, int which) {}
        });
    AlertDialog alert = builder.create();
    alert.show();
  }
Ejemplo n.º 10
0
  // Alert dialog block
  public void onButtonClick(View v) {
    final AlertDialog.Builder builder = new AlertDialog.Builder(this);
    if (spnService.getSelectedItem().toString().equalsIgnoreCase("cafe")) {
      builder.setTitle("Cafe List");
      servList = cafeList;
    } else if (spnService.getSelectedItem().toString().equalsIgnoreCase("pho")) {
      builder.setTitle("Pho List");
      servList = cafeList;
    } else if (spnService.getSelectedItem().toString().equalsIgnoreCase("ATM")) {
      builder.setTitle("ATM List");
      servList = ATMList;
    } else if (spnService.getSelectedItem().toString().equalsIgnoreCase("Fuel")) {
      builder.setTitle("Fuel List");
      servList = fuelList;
    }

    builder.setSingleChoiceItems(
        servList,
        -1,
        new DialogInterface.OnClickListener() {
          public void onClick(DialogInterface dialog, int which) {
            checkedItem = which;
            selectedPlace = servList[which].toString();
            dialog.cancel();
            if (selectedPlace.equalsIgnoreCase("cafe1")) {
              if (curLocation == null) {
                Log.d("Veng", "GPS not found");
                AlertDialog.Builder warn = new AlertDialog.Builder(QTPlaceActivity.this);
                warn.setTitle("GPS Error!")
                    .setMessage("Your GPS is not enabled")
                    .setPositiveButton(
                        "OK",
                        new DialogInterface.OnClickListener() {
                          public void onClick(DialogInterface dialog, int which) {
                            dialog.cancel();
                          }
                        });
                warn.show();

              } else {
                OverlayItem overlayItem = new OverlayItem(curLocation, "Hello", "You're here!");
                itemizeOverlay.AddOverlay(overlayItem);
                mapOverlays.add(itemizeOverlay);
                mapController.animateTo(curLocation);
                Route route =
                    directions(
                        curLocation,
                        new GeoPoint((int) (37.422006 * 1E6), (int) (-122.074095 * 1E6)));
                RouteOverlay routeOverlay = new RouteOverlay(route, Color.RED);
                mapView.getOverlays().add(routeOverlay);
                Log.d("VenG", "distance");
                txtDistance.setText(Integer.toString(route.getDistance()));
              }
            }
          }
        });
    AlertDialog alert_dialog = builder.create();
    alert_dialog.show();
    alert_dialog.getListView().setItemChecked(checkedItem, true);
  }
Ejemplo n.º 11
0
 @Override
 protected void onPostExecute(final ConfInfo[] possibleRecip) {
   mDialog.dismiss();
   if (possibleRecip == null || possibleRecip.length == 0) {
     final AlertDialog.Builder builder = new AlertDialog.Builder(mActivity);
     builder.setTitle(mActivity.getString(R.string.im_no_such_recipient) + mRecip);
     builder.setPositiveButton(mActivity.getString(R.string.alert_dialog_ok), null);
     builder.create().show();
   } else if (possibleRecip.length == 1) {
     if (mRunnable != null) {
       mRunnable.run(possibleRecip[0]);
     }
   } else {
     final String[] items = new String[possibleRecip.length];
     for (int i = 0; i < items.length; ++i) {
       items[i] = possibleRecip[i].getNameString();
     }
     final AlertDialog.Builder builder = new AlertDialog.Builder(mActivity);
     builder.setTitle(mActivity.getString(R.string.pick_a_name));
     builder.setSingleChoiceItems(
         items,
         -1,
         new DialogInterface.OnClickListener() {
           public void onClick(final DialogInterface dialog, final int item) {
             dialog.dismiss();
             if (mRunnable != null) {
               mRunnable.run(possibleRecip[item]);
             }
           }
         });
     builder.create().show();
   }
 }
Ejemplo n.º 12
0
 @Override
 protected Dialog onCreateDialog(int id) {
   Dialog dialog = null;
   AlertDialog.Builder builder = null;
   if (id == DIALOG_USB_WARNING) {
     builder = new AlertDialog.Builder(this);
     builder.setTitle(R.string.uart_usb_switch_dialog_title);
     builder.setCancelable(false);
     builder.setMessage(getString(R.string.uart_usb_switch_warning));
     builder.setPositiveButton(R.string.ok, null);
     dialog = builder.create();
   } else if (id == DIALOG_USB_CONNECT_WARNING) {
     builder = new AlertDialog.Builder(this);
     builder.setTitle(R.string.uart_usb_switch_dialog_title_error);
     builder.setCancelable(false);
     builder.setMessage(getString(R.string.uart_usb_switch_dialog_usb_error));
     builder.setPositiveButton(
         R.string.ok,
         new DialogInterface.OnClickListener() {
           public void onClick(DialogInterface dialog, int which) {
             finish();
           }
         });
     dialog = builder.create();
   }
   return dialog;
 }
Ejemplo n.º 13
0
  public static Dialog createFromException(
      Exception e, String title, final Context ctx, boolean finish) {
    AlertDialog.Builder builder = new AlertDialog.Builder(ctx);

    builder.setCancelable(false);
    if (title == null) {
      builder.setTitle(R.string.dialog_error_title);
    } else {
      builder.setTitle(title);
    }
    builder.setMessage(e.getLocalizedMessage());

    if (finish) {
      builder.setNeutralButton(
          R.string.ok,
          new DialogInterface.OnClickListener() {

            @Override
            public void onClick(DialogInterface dialog, int which) {
              ((Activity) ctx).finish();
            }
          });
    } else {
      builder.setNeutralButton(
          R.string.ok,
          new DialogInterface.OnClickListener() {

            @Override
            public void onClick(DialogInterface dialog, int which) {}
          });
    }

    return builder.create();
  }
  // Adding photo to a contact.
  public void addPhoto() {
    // Button for the alert dialog
    final CharSequence[] items = {"Choose from Library", "Cancel"};
    AlertDialog.Builder builder = new AlertDialog.Builder(context);
    // If editing the add photo will be edit photo
    if (updatingContact) {
      builder.setTitle("Edit Photo");
    } else {
      builder.setTitle("Add Photo");
    }
    builder.setItems(
        items,
        new DialogInterface.OnClickListener() {

          @Override
          public void onClick(DialogInterface dialog, int item) {
            if (items[item].equals("Choose from Library")) {
              // Open the library and filter the content only to images
              Intent intent =
                  new Intent(
                      Intent.ACTION_PICK,
                      android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
              intent.setType("image/*");
              ((CreateContactActivity) context)
                  .startActivityForResult(
                      Intent.createChooser(intent, "Select File"), REQUEST_LIBRARY);
            } else if (items[item].equals("Cancel")) {
              // Dismiss the dialog when a user presses cancel.
              dialog.dismiss();
            }
          }
        });
    // Showing the alert dialog
    builder.show();
  }
Ejemplo n.º 15
0
  public void AddLesionClicked(MenuItem item) {

    if (!isNetworkAvailable()) {
      AlertDialog.Builder alertbox = new AlertDialog.Builder(this);
      alertbox
          .setTitle("Your Internet Connection is not online")
          .setMessage("Check your internet settings before proceeding.")
          .setNeutralButton("OK", null)
          .show();
      return;
    }
    EditText myEditText = (EditText) findViewById(R.id.lesionNumberInput);
    // InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
    // imm.hideSoftInputFromWindow(myEditText.getWindowToken(), 0);
    String lnum = myEditText.getText().toString();
    if (lnum.length() < 1) {
      AlertDialog.Builder alertbox = new AlertDialog.Builder(LesionAdd.this);
      alertbox
          .setTitle("Lesion number must be entered")
          .setMessage("Please enter lesion number")
          .setNeutralButton("OK", null)
          .show();
      return;
    }
    EditText myEditText2 = (EditText) findViewById(R.id.lesionSize);
    String lsize = myEditText2.getText().toString();
    if (lsize.length() < 1) {
      AlertDialog.Builder alertbox = new AlertDialog.Builder(LesionAdd.this);
      alertbox
          .setTitle("Lesion size must be entered")
          .setMessage("Please Correct Size")
          .setNeutralButton("OK", null)
          .show();
      return;
    }
    EditText myEditText3 = (EditText) findViewById(R.id.lesionDescription);
    String ldesc = myEditText3.getText().toString();
    if (ldesc.length() < 1) {
      myEditText3.setText("n/a");
    }
    // check media type for valid suffix
    EditText ftype = (EditText) findViewById(R.id.fileType);
    String ft = ftype.getText().toString();
    if (fileTypes.contains(ft)) {
      // normal
    } else {
      AlertDialog.Builder alertbox = new AlertDialog.Builder(LesionAdd.this);
      alertbox
          .setTitle("File type must ba a valid type")
          .setMessage("Choose, jpg,png,doc,pdf,html")
          .setNeutralButton("OK", null)
          .show();
      return;
    }

    TextView message = (TextView) findViewById(R.id.makeChanges);
    message.setText("Adding Lesion");
    new AddLesion().execute();
  }
  private void getAdUnitId(final MainActivity mainActivity, final AdTracker.AdTrackerType adType) {

    AlertDialog.Builder builder = new AlertDialog.Builder(this);
    switch (adType) {
      case Banner:
        builder.setTitle("Enter banner AdUnitId");
        break;
      case Interstitial:
        builder.setTitle("Enter interstitial AdUnitId");
        break;
      case NativeContentAd:
        builder.setTitle("Enter native AdUnitId");
        break;
      default:
        throw new IllegalArgumentException("adType " + adType.name() + " unsupported");
    }

    final EditText input = new EditText(this);

    input.setInputType(InputType.TYPE_CLASS_TEXT);
    builder.setView(input);

    builder.setPositiveButton(
        "OK",
        new DialogInterface.OnClickListener() {
          @Override
          public void onClick(DialogInterface dialog, int which) {
            String adUnitId = input.getText().toString();

            switch (adType) {
              case Banner:
                Intent bannerIntent = new Intent(mainActivity, BannerActivity.class);
                bannerIntent.putExtra("adUnitId", adUnitId);
                mainActivity.startActivity(bannerIntent);
                break;
              case Interstitial:
                loadInterstitialWithAdUnitId(adUnitId);
                break;
              case NativeContentAd:
                Intent nativeIntent = new Intent(mainActivity, NativeActivity.class);
                nativeIntent.putExtra("adUnitId", adUnitId);
                mainActivity.startActivity(nativeIntent);
                break;
              default:
                throw new IllegalArgumentException("adType " + adType.name() + " unsupported");
            }
          }
        });
    builder.setNegativeButton(
        "Cancel",
        new DialogInterface.OnClickListener() {
          @Override
          public void onClick(DialogInterface dialog, int which) {
            dialog.cancel();
          }
        });

    builder.show();
  }
Ejemplo n.º 17
0
        @Override
        public void onSuccess(int statusCode, Header[] headers, JSONObject response) {
          super.onSuccess(statusCode, headers, response);

          int result = 0;

          try {
            result = Integer.valueOf(response.getString("result"));

          } catch (NumberFormatException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
          } catch (JSONException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
          }
          if (result == 1 && statusCode == 200) {

            loadingPDialog.dismiss();

            AlertDialog.Builder builder = new Builder(getActivity());
            builder.setTitle("签到成功");

            builder.setNegativeButton(
                "确认",
                new DialogInterface.OnClickListener() {

                  public void onClick(DialogInterface dialog, int which) {
                    profile_check.setImageResource(R.drawable.profile_checked);
                    HttpUtils.refreshUserInfo(res_refresh);
                  }
                });
            builder.create().show();

          } else {
            loadingPDialog.dismiss();
            String message = "";
            try {
              message = response.getString("message");
            } catch (JSONException e) {
              // TODO Auto-generated catch block
              e.printStackTrace();
            }
            AlertDialog.Builder builder = new Builder(getActivity());
            builder.setTitle(message);

            builder.setNegativeButton(
                "确认",
                new DialogInterface.OnClickListener() {

                  public void onClick(DialogInterface dialog, int which) {}
                });
            builder.create().show();
            Log.i("check_fail", response.toString());
          }
        }
Ejemplo n.º 18
0
        @Override
        public void onSuccess(int statusCode, Header[] headers, JSONObject response) {
          super.onSuccess(statusCode, headers, response);

          int result = 0;

          try {
            result = Integer.valueOf(response.getString("result"));
          } catch (NumberFormatException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
          } catch (JSONException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
          }
          if (result == 1 && statusCode == 200) {

            AlertDialog.Builder builder = new Builder(E8_ResetPwdActivity.this);
            builder.setTitle("修改成功");

            builder.setNegativeButton(
                "确认",
                new DialogInterface.OnClickListener() {

                  public void onClick(DialogInterface dialog, int which) {
                    dialog.dismiss();
                    finish();
                    overridePendingTransition(R.anim.push_left_in, R.anim.push_left_out);
                  }
                });
            builder.create().show();

          } else {
            Log.i("reset_pwd", response.toString());
            try {
              String message = response.getString("message");
              AlertDialog.Builder builder = new Builder(E8_ResetPwdActivity.this);
              builder.setTitle(message);

              builder.setNegativeButton(
                  "确认",
                  new DialogInterface.OnClickListener() {

                    public void onClick(DialogInterface dialog, int which) {
                      dialog.dismiss();
                      finish();
                      overridePendingTransition(R.anim.push_left_in, R.anim.push_left_out);
                    }
                  });
              builder.create().show();
            } catch (JSONException e) {
              // TODO Auto-generated catch block
              e.printStackTrace();
            }
          }
        }
Ejemplo n.º 19
0
    protected void onPostExecute(Void paramVoid) {

      Log.i("staut===", "====" + statut);
      if (this.statut.equalsIgnoreCase("1")) {
        Paiment.this.ad.dismiss();
        run_statut = true;

        try {
          AlertDialog.Builder localBuilder = new AlertDialog.Builder(Paiment.this);
          localBuilder.setTitle("Your taxi is ordered, follow him on your phone.");
          localBuilder
              .setCancelable(false)
              .setPositiveButton(
                  "Ok",
                  new DialogInterface.OnClickListener() {
                    public void onClick(
                        DialogInterface paramAnonymousDialogInterface, int paramAnonymousInt) {
                      Paiment.this.finish();
                      Intent localIntent = new Intent(Paiment.this, Sui_taxi.class);
                      mp.stop();
                      startActivity(localIntent);
                      paramAnonymousDialogInterface.cancel();
                    }
                  });
          localBuilder.create().show();
          mp.start();
          return;
        } catch (Exception ae) {

        }
      } else if (this.statut.equalsIgnoreCase("-1")) {
        Paiment.this.ad.dismiss();
        try {
          AlertDialog.Builder localBuilder = new AlertDialog.Builder(Paiment.this);
          localBuilder.setTitle("Your request is declined.Please try for another taxi.");
          localBuilder
              .setCancelable(false)
              .setPositiveButton(
                  "Ok",
                  new DialogInterface.OnClickListener() {
                    public void onClick(
                        DialogInterface paramAnonymousDialogInterface, int paramAnonymousInt) {
                      Paiment.this.finish();
                      Intent localIntent = new Intent(Paiment.this, Taxi_map.class);
                      startActivity(localIntent);
                      paramAnonymousDialogInterface.cancel();
                    }
                  });
          localBuilder.create().show();
          return;
        } catch (Exception ae) {

        }
      }
      this.statut.equalsIgnoreCase("fail_connection");
    }
Ejemplo n.º 20
0
  @OnClick(R.id.editGroupSaveButton)
  public void editGroup() {
    myProgressBar.setVisibility(View.VISIBLE);

    final ParseObject groupObject = TheGroupUtil.getCurrentGroup();

    if (editValid()) {
      groupObject.put(TheGroupUtil.GROUP_NAME, myName.getText().toString());
      groupObject.put(TheGroupUtil.GROUP_TYPE, getGroupType());
      groupObject.put(TheGroupUtil.GROUP_ONE_WORD, myOneWord.getText().toString());
      groupObject.put(TheGroupUtil.GROUP_LENGTHY_DESCRIPTION, myDescription.getText().toString());
      groupObject.put(TheGroupUtil.GROUP_BLOG_EXIST, getBlogCheck());
      groupObject.put(TheGroupUtil.GROUP_CALENDAR_EXIST, getCalendarCheck());

      if (TheNetUtil.isNetworkAvailable(this)) {
        groupObject.saveInBackground(
            new SaveCallback() {
              @Override
              public void done(ParseException e) {
                myProgressBar.setVisibility(View.INVISIBLE);
                if (e == null) {
                  // send user to the group looker page.
                  Intent intent = new Intent(EditGroupActivity.this, ViewGroupActivity.class);
                  startActivity(intent);
                }
              }
            });
      } else {
        myProgressBar.setVisibility(View.INVISIBLE);
        AlertDialog.Builder builder = new AlertDialog.Builder(this);
        builder
            .setTitle("Network is currently unavailable")
            .setMessage(
                "This group will be updated and shared with the world automatically once network is connected!");
        builder.setPositiveButton(
            android.R.string.ok,
            new DialogInterface.OnClickListener() {
              @Override
              public void onClick(DialogInterface dialog, int which) {
                groupObject.saveEventually();
              }
            });
        builder.setNegativeButton(android.R.string.cancel, null);
        builder.show();
      }
    } else {
      myProgressBar.setVisibility(View.INVISIBLE);
      AlertDialog.Builder builder = new AlertDialog.Builder(this);
      builder
          .setTitle("Cannot create group")
          .setMessage("Please make sure all of the information is filled out");
      builder.setPositiveButton(android.R.string.ok, null);
      builder.show();
    }
  }
Ejemplo n.º 21
0
 @Override
 public boolean onOptionsItemSelected(MenuItem item) {
   AlertDialog.Builder helpBuilder = new AlertDialog.Builder(this);
   AlertDialog helpDialog = null;
   switch (item.getItemId()) {
     case R.id.about:
       helpBuilder.setTitle(getString(string.beercount_2013));
       helpBuilder.setMessage(getString(string.license));
       helpBuilder.setPositiveButton(
           getString(string.ok),
           new DialogInterface.OnClickListener() {
             @Override
             public void onClick(DialogInterface dialog, int which) {
               // Do nothing but close the dialog
             }
           });
       helpDialog = helpBuilder.create();
       helpDialog.show();
       return true;
     case R.id.reset:
       helpBuilder.setTitle(getString(string.confirmation));
       helpBuilder.setMessage(getString(string.confirm_erase_local));
       helpBuilder.setPositiveButton(
           getString(string.yes),
           new DialogInterface.OnClickListener() {
             @Override
             public void onClick(DialogInterface dialog, int which) {
               try {
                 file.close();
                 tempfile = openFileOutput(FILENAME, Context.MODE_PRIVATE);
                 /* Update beer counts */
                 updateBeerCounts();
                 pintView.setText(getString(R.string.pints, pintCount));
                 bottleView.setText(getString(R.string.bottles, bottleCount));
                 halfView.setText(getString(R.string.halfs, halfCount));
               } catch (IOException e) {
                 e.printStackTrace();
               }
             }
           });
       helpBuilder.setNegativeButton(
           getString(string.no),
           new DialogInterface.OnClickListener() {
             @Override
             public void onClick(DialogInterface dialog, int which) {
               // Do nothing but close the dialog
             }
           });
       helpDialog = helpBuilder.create();
       helpDialog.show();
       return true;
     default:
       return super.onOptionsItemSelected(item);
   }
 }
Ejemplo n.º 22
0
  @Override
  protected Dialog onCreateDialog(int id) {
    switch (id) {
      case DIALOG_ABOUT:
        return ActivityUtils.getAboutDialog(this);
      case DIALOG_NOT_MANAGED:
        String message =
            "This application was not created by this client.\n\nYou can manage it through the dashboard on the Touchatag website";

        AlertDialog.Builder builder = new AlertDialog.Builder(this);
        builder
            .setTitle("Info") //
            .setIcon(android.R.drawable.ic_dialog_info) //
            .setMessage(message) //
            .setCancelable(false) //
            .setPositiveButton(
                "Close",
                new DialogInterface.OnClickListener() {
                  public void onClick(DialogInterface dialog, int id) {
                    dialog.dismiss();
                  }
                });
        return builder.create();
      case DIALOG_DELETE_APP:
        message = "Are you sure you want to delete application " + appToRemove.getId();
        builder = new AlertDialog.Builder(this);
        builder
            .setTitle("Confirm") //
            .setIcon(android.R.drawable.ic_dialog_info) //
            .setMessage(message) //
            .setCancelable(false) //
            .setPositiveButton(
                "Delete",
                new DialogInterface.OnClickListener() {
                  public void onClick(DialogInterface dialog, int id) {
                    DeleteApplicationAsyncTask task =
                        new DeleteApplicationAsyncTask(
                            "Deleting Application...",
                            "Failed to delete application.",
                            AppsActivity.this);
                    task.execute(appToRemove);
                    appToRemove = null;
                  }
                })
            .setNegativeButton(
                "Cancel",
                new DialogInterface.OnClickListener() {
                  public void onClick(DialogInterface dialog, int id) {
                    dialog.dismiss();
                  }
                });
        return builder.create();
    }
    return super.onCreateDialog(id);
  }
Ejemplo n.º 23
0
  @Override
  protected Dialog onCreateDialog(int id) {
    Dialog dialog = null;

    switch (id) {
      case DIALOG_NUM_STRINGS:
        // define dialog

        AlertDialog.Builder builder = new AlertDialog.Builder(this);
        builder.setTitle("Select Number of Strings");
        StringNumChangeListener listener = new StringNumChangeListener(this);
        builder.setSingleChoiceItems(Fretboard.stringNumOpts, -1, listener);

        dialog = builder.create();
        listener.setSender(dialog);

        break;
      case DIALOG_TUNING:
        // define dialog
        AlertDialog.Builder builder1 = new AlertDialog.Builder(this);
        builder1.setTitle("Enter Six String Tuning");

        final EditText input = new EditText(this);
        input.setText(this._fretboard.getTuning());
        TuningListener listener1 = new TuningListener(this, input);

        builder1.setView(input);

        builder1.setPositiveButton("OK", listener1);
        builder1.setNegativeButton(
            "Cancel",
            new DialogInterface.OnClickListener() {

              public void onClick(DialogInterface dialog, int which) {
                // cancelled
              }
            });

        dialog = builder1.create();
        break;
      case DIALOG_FRET_RANGE:
        // define dialog
        AlertDialog.Builder builder2 = new AlertDialog.Builder(this);
        builder2.setTitle("Select First Display Fret");
        FretRangeChangeListener listener2 = new FretRangeChangeListener(this);
        builder2.setSingleChoiceItems(Fretboard.fretRangeOpts, -1, listener2);

        dialog = builder2.create();
        listener2.setSender(dialog);
        break;
    }

    return dialog;
  }
  private Builder createAlert(Context context, String title, String message) {

    AlertDialog.Builder dialog =
        new AlertDialog.Builder(
            new ContextThemeWrapper(context, android.R.style.Theme_Holo_Light_Dialog));
    dialog.setIcon(R.drawable.ic_launcher);
    if (title != null) dialog.setTitle(title);
    else dialog.setTitle("Information");
    dialog.setMessage(message);
    dialog.setCancelable(false);
    return dialog;
  }
 @Override
 public void onPrepareDialogBuilder(AlertDialog.Builder builder) {
   PreyConfig preyConfig = PreyConfig.getPreyConfig(ctx);
   if (preyConfig.isFroyoOrAbove()) {
     if (FroyoSupport.getInstance(ctx).isAdminActive()) {
       builder.setTitle(R.string.preferences_admin_enabled_dialog_title);
       builder.setMessage(R.string.preferences_admin_enabled_dialog_message);
     } else {
       builder.setTitle(R.string.preferences_admin_disabled_dialog_title);
       builder.setMessage(R.string.preferences_admin_disabled_dialog_message);
     }
   }
 }
Ejemplo n.º 26
0
    @Override
    protected void onPostExecute(Object content) {
      if (error) {
        // Log.i(TAG, "Error occurred");
        AlertDialog.Builder alertbox = new AlertDialog.Builder(DoctorEdit.this);
        alertbox
            .setTitle("An internet error occurred")
            .setMessage("Try going to another TEAM screen via the menu to reset the connection.")
            .setNeutralButton("OK", null)
            .show();
      } else {
        // Log.i(TAG, "Post exexs content=" + content);
        String s = content.toString();
        try {
          processXMLDoctor(s);
          // check succeed for Y

          int myint = succeed.length;

          if (myint < 1) {
            AlertDialog.Builder alertbox = new AlertDialog.Builder(DoctorEdit.this);
            alertbox
                .setTitle("TEAM Server Problem")
                .setMessage("Please Contact Tom")
                .setNeutralButton("OK", null)
                .show();
            return;
          }
          if (succeed[0].equals("1")) {
            // all ok
          } else {
            AlertDialog.Builder alertbox = new AlertDialog.Builder(DoctorEdit.this);
            alertbox
                .setTitle("Could not update this Doctor")
                .setMessage("Doctor may have been deleted")
                .setNeutralButton("OK", null)
                .show();
            return;
          }
          TextView message = (TextView) findViewById(R.id.makeChanges);
          message.setText("Enter Changes...then hit save icon");
        } catch (ClientProtocolException e) {
          // TODO Auto-generated catch block
          e.printStackTrace();
        } catch (IOException e) {
          // TODO Auto-generated catch block
          e.printStackTrace();
        }
      }
      setProgressBarIndeterminateVisibility(false);
    }
Ejemplo n.º 27
0
  public void treatContactPickerPositiveResult(
      final Context ctxt, final String contactId, final OnPhoneNumberSelected l) {
    ArrayList<Phone> phones = getPhoneNumbers(ctxt, contactId);

    if (phones.size() == 0) {
      final AlertDialog.Builder builder = new AlertDialog.Builder(ctxt);
      builder.setPositiveButton(R.string.ok, null);
      builder.setTitle(R.string.choose_phone);
      builder.setMessage(R.string.no_phone_found);
      AlertDialog dialog = builder.create();
      dialog.show();
    } else if (phones.size() == 1) {
      if (l != null) {
        l.onTrigger(formatNumber(phones.get(0).getNumber(), phones.get(0).getType()));
      }
    } else {
      final AlertDialog.Builder builder = new AlertDialog.Builder(ctxt);

      ArrayList<String> entries = new ArrayList<String>();
      for (Phone phone : phones) {
        entries.add(formatNumber(phone.getNumber(), phone.getType()));
      }

      final ArrayAdapter<String> phoneChoiceAdapter =
          new ArrayAdapter<String>(ctxt, android.R.layout.simple_dropdown_item_1line, entries);

      builder.setTitle(R.string.choose_phone);
      builder.setAdapter(
          phoneChoiceAdapter,
          new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialog, int which) {
              if (l != null) {
                l.onTrigger(phoneChoiceAdapter.getItem(which));
              }
            }
          });
      builder.setCancelable(true);
      builder.setNeutralButton(
          R.string.cancel,
          new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialog, int which) {
              // Nothing to do
              dialog.dismiss();
            }
          });
      AlertDialog dialog = builder.create();
      dialog.show();
    }
  }
Ejemplo n.º 28
0
  public void showAlert(final PatientPOJO pObj) {

    // patientId = pObj.getPatientId();
    patientIdRemove = pObj.getPatientId();
    ;
    Log.d("demo", String.valueOf(patientIdRemove));
    AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(SearchPatientByAdmin.this);

    // set title
    if ("Inactive".equals(pObj.getStatus())) {
      alertDialogBuilder.setTitle("Do you want to make the Patient Active");
    } else {
      alertDialogBuilder.setTitle("Do you want to make the Patient Inactive");
    }

    // set dialog message
    alertDialogBuilder
        .setCancelable(false)
        .setPositiveButton(
            "Yes",
            new DialogInterface.OnClickListener() {
              public void onClick(DialogInterface dialog, int id) {
                // if this button is clicked, close
                // current activity
                if ("Inactive".equals(pObj.getStatus())) {
                  activePatientData();
                  pObj.setStatus("Active");
                } else {
                  inactivePatientData();
                  pObj.setStatus("Inactive");
                }

                adapter.notifyDataSetChanged();
              }
            })
        .setNegativeButton(
            "No",
            new DialogInterface.OnClickListener() {
              public void onClick(DialogInterface dialog, int id) {
                // if this button is clicked, just close
                // the dialog box and do nothing
                dialog.cancel();
              }
            });

    // create alert dialog
    AlertDialog alertDialog = alertDialogBuilder.create();

    // show it
    alertDialog.show();
  }
Ejemplo n.º 29
0
  // Notification quand on perd
  public void testNbEssais(View view) {
    if (nb_essais == 0) {
      AlertDialog.Builder builder = new AlertDialog.Builder(this);
      builder
          .setTitle(R.string.perdu)
          .setPositiveButton(
              R.string.ok,
              new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int id) {
                  dialog.cancel();
                }
              })
          .setNegativeButton(
              R.string.restart,
              new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int id) {
                  restart();
                }
              });

      AlertDialog dialog = builder.create();
      dialog.show();
    } else {
      AlertDialog.Builder builder = new AlertDialog.Builder(this);
      builder
          .setTitle("Raté!")
          .setMessage("Il vous reste " + nb_essais + " essais...")
          .setPositiveButton(
              R.string.continuer,
              new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int id) {
                  dialog.cancel();
                }
              })
          .setNegativeButton(
              R.string.restart,
              new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int id) {
                  restart();
                }
              });

      AlertDialog dialog = builder.create();
      dialog.show();
    }
  }
Ejemplo n.º 30
0
    @Override
    protected void onPostExecute(final Provider data) {
      mAuthTask = null;

      if (data == null) {
        AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());

        builder
            .setTitle(R.string.no_network)
            .setMessage(R.string.error_no_network)
            .setNeutralButton(R.string.close_button, null);

        mAD = builder.create();
        mAD.setOnDismissListener(
            new DialogInterface.OnDismissListener() {
              public void onDismiss(DialogInterface dialog) {
                getActivity().finish();
              }
            });
        mAD.show();
        return;
      }
      Cache.provider = data;

      if (Cache.provider.isDemo && mAD == null) {
        AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());

        builder
            .setTitle(R.string.no_campus)
            .setMessage(R.string.error_no_campus)
            .setNeutralButton(R.string.continue_button, null);

        mAD = builder.create();
        mAD.show();
      }

      // TODO: make sure we still exist
      getActivity().setTitle(Cache.provider.name);
      setListAdapter(new LocationArrayAdapter(getActivity(), Cache.provider.locations));

      EasyTracker.getTracker()
          .sendEvent(
              "dataLoad",
              "provider",
              Cache.provider.name + " - " + Cache.provider.locations.size() + " locs",
              0L);
      EasyTracker.getTracker()
          .sendTiming(
              "dataLoad", System.currentTimeMillis() - startTime, "provider", Cache.provider.name);
    }