public void saveInspection() {
    String exception = "";
    if (edtException.getText().toString().length() > 0) {
      exception = edtException.getText().toString();
    }
    if (exception.length() > 200) {
      Toast.makeText(
              getApplicationContext(),
              "Exception must be less then 200 character.",
              Toast.LENGTH_LONG)
          .show();
      return;
    }
    String currentDateTimeString = DateFormat.getDateTimeInstance().format(new Date());
    inspection.deleteRelatedPestsRecords();
    if (isCleanInspection) {
      m_inspectionPests = new ArrayList<InspectionPest>();
      inspection.evidence = "";
    }

    inspection.trap_number = trapscan_info.number;
    inspection.trap_type_id = trapscan_info.trap_type_id;
    int bait = 0, trap = 0;
    if (!spnBaitCondition.getSelectedItem().toString().equalsIgnoreCase("Bait Conditions")) {
      bait = BaitConditionsInfo.getIdByName(spnBaitCondition.getSelectedItem().toString());
    }
    if (!spnTrapCondition.getSelectedItem().toString().equalsIgnoreCase("Trap Conditions")) {
      trap = TrapConditionsInfo.getIdByName(spnTrapCondition.getSelectedItem().toString());
    }
    inspection.bait_condition_id = bait;
    inspection.trap_condition_id = trap;
    currentDateTimeString =
        Utils.Instance()
            .getFormatedDate(
                currentDateTimeString, "MMM dd, yyyy hh:mm:ss a", "yyyy-MM-dd hh:mm a");
    inspection.exception = exception;
    inspection.removed = isRemoved;
    inspection.scanned_on = currentDateTimeString;
    try {
      inspection.save();
    } catch (ActiveRecordException e) {
      e.printStackTrace();
    }

    AddTraps(m_inspectionPests, inspection);
    // if (m_list.size() == 1) {
    // if (m_list.get(0).count == 0 && m_list.get(0).pest_type_id == 0) {
    // m_list = new ArrayList<InspectionPest>();
    // AddTraps(m_list, inspection);
    // } else {
    // AddTraps(m_list, inspection);
    // }
    // } else {
    // }
  }
  /**
   * Method fired when "add" button is clicked.
   *
   * @param v add button's <tt>View</tt>
   */
  public void onAddClicked(View v) {
    Spinner accountsSpiner = (Spinner) findViewById(R.id.selectAccountSpinner);

    Account selectedAcc = (Account) accountsSpiner.getSelectedItem();
    if (selectedAcc == null) {
      logger.error("No account selected");
      return;
    }

    ProtocolProviderService pps = selectedAcc.getProtocolProvider();
    if (pps == null) {
      logger.error("No provider registered for account " + selectedAcc.getAccountName());
      return;
    }

    View content = findViewById(android.R.id.content);
    String contactAddress = ViewUtil.getTextViewValue(content, R.id.editContactName);

    String displayName = ViewUtil.getTextViewValue(content, R.id.editDisplayName);
    if (displayName != null && displayName.length() > 0) {
      addRenameListener(pps, null, contactAddress, displayName);
    }

    Spinner groupSpinner = (Spinner) findViewById(R.id.selectGroupSpinner);
    ContactListUtils.addContact(
        pps, (MetaContactGroup) groupSpinner.getSelectedItem(), contactAddress);
    finish();
  }
Exemplo n.º 3
0
        @Override
        public void onClick(View v) {

          if (spinner.getSelectedItem() != null)
            MyService.deleteRun(spinner.getSelectedItem().toString());
          loadSpinner();
        }
Exemplo n.º 4
0
  /**
   * @param text
   * @return
   */
  private boolean startConsoleActivity() {
    Uri uri =
        TransportFactory.getUri(
            (String) transportSpinner.getSelectedItem(), quickconnect.getText().toString());

    if (uri == null) {
      quickconnect.setError(
          getString(
              R.string.list_format_error,
              TransportFactory.getFormatHint(
                  (String) transportSpinner.getSelectedItem(), HostListActivity.this)));
      return false;
    }

    HostBean host = TransportFactory.findHost(hostdb, uri);
    if (host == null) {
      host = TransportFactory.getTransport(uri.getScheme()).createHost(uri);
      host.setColor(HostDatabase.COLOR_GRAY);
      host.setPubkeyId(HostDatabase.PUBKEYID_ANY);
      hostdb.saveHost(host);
    }

    Intent intent = new Intent(HostListActivity.this, ConsoleActivity.class);
    intent.setData(uri);
    startActivity(intent);

    return true;
  }
Exemplo n.º 5
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);
  }
Exemplo n.º 6
0
  @Override
  public boolean onTouch(View v, MotionEvent event) {
    Path temp = new Path();
    float rx = event.getX();
    float ry = event.getY();
    mNodes =
        mGraph.getShortestPath(
            fromSpin.getSelectedItem().toString(), toSpin.getSelectedItem().toString());
    // temp.rMoveTo(rx, ry);

    float x, y;
    String res = " ";
    for (int i = 0; i < mNodes.size(); i++) {
      x = (float) mNodes.get(i).getX();
      y = (float) mNodes.get(i).getY();
      res += mNodes.get(i).getLabel() + " ";
      if (i != 0) {
        temp.lineTo(x, y);
      }

      temp.moveTo(x, y);
    }
    Log.d("Path", res);
    myMap.setMap(temp, 2, rx, ry);
    return true;
  }
 @Override
 public void onClick(DialogInterface dialog, int which) {
   super.onClick(dialog, which);
   switch (which) {
     case DialogInterface.BUTTON_POSITIVE:
       final boolean isEditing = !isIncomplete();
       final SubtypeLocaleItem locale =
           (SubtypeLocaleItem) mSubtypeLocaleSpinner.getSelectedItem();
       final KeyboardLayoutSetItem layout =
           (KeyboardLayoutSetItem) mKeyboardLayoutSetSpinner.getSelectedItem();
       final InputMethodSubtype subtype =
           AdditionalSubtype.createAdditionalSubtype(locale.first, layout.first, ASCII_CAPABLE);
       setSubtype(subtype);
       notifyChanged();
       if (isEditing) {
         mProxy.onSavePressed(this);
       } else {
         mProxy.onAddPressed(this);
       }
       break;
     case DialogInterface.BUTTON_NEUTRAL:
       // Nothing to do
       break;
     case DialogInterface.BUTTON_NEGATIVE:
       mProxy.onRemovePressed(this);
       break;
   }
 }
Exemplo n.º 8
0
 public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) {
   if (spTipo.getSelectedItem().equals("Celular")) {
     etContato.setInputType(InputType.TYPE_CLASS_PHONE);
   } else if (spTipo.getSelectedItem().equals("E-mail")) {
     etContato.setInputType(InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS);
   }
 }
Exemplo n.º 9
0
  @Override
  public void onClick(View v) {
    // TODO Auto-generated method stub
    switch (v.getId()) {
      case R.id.detect_start_localize_button:
        ConnectivityManager cm =
            (ConnectivityManager)
                this.getApplicationContext().getSystemService(CONNECTIVITY_SERVICE);
        NetworkInfo networkInfo = cm.getActiveNetworkInfo();
        if (networkInfo == null || !networkInfo.isConnected()) {
          myHandler.post(new FailConnectInternet());
          return;
        }

        if (((String) listTypeSpinner.getSelectedItem()).equals("GPS")) {
          LocationManager locationManager =
              (LocationManager) getSystemService(Context.LOCATION_SERVICE);
          if (!locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER)) {
            Toast.makeText(getApplicationContext(), "Gps Disabled", Toast.LENGTH_SHORT).show();

            return;
          }
        }

        startLocalizeButton.setEnabled(false);
        startLocalizeButton.setFocusable(false);
        stopLocalizeButton.setEnabled(true);
        stopLocalizeButton.setFocusable(true);
        listTypeSpinner.setEnabled(false);
        listTypeSpinner.setFocusable(false);

        countInt = 0;

        if (((String) listTypeSpinner.getSelectedItem()).equals("WIFI")) {
          wifiDetector.setConvert(convertCheckbox.isChecked());
          wifiDetector.startDetectLocation();
        } else {
          gpsDetector.startDetectLocation();
        }
        break;

      case R.id.detect_stop_localize_button:
        startLocalizeButton.setEnabled(true);
        startLocalizeButton.setFocusable(true);
        stopLocalizeButton.setEnabled(false);
        stopLocalizeButton.setFocusable(false);
        listTypeSpinner.setEnabled(true);
        listTypeSpinner.setFocusable(true);

        if (((String) listTypeSpinner.getSelectedItem()).equals("WIFI")) {
          wifiDetector.stopDectectLocation();
        } else {
          gpsDetector.stopDectectLocation();
        }
        break;

      default:
        break;
    }
  }
Exemplo n.º 10
0
  private Beacon buildBeaconObject() {
    AdvertisedId advertisedId =
        new AdvertisedId(
            DataUtils.base64Encode(mAdvertisedIdEditText.getText().toString().getBytes()),
            AdvertisedId.Type.fromString(mBeaconTypeSpinner.getSelectedItem().toString()));
    String latitude = mLatitudeEditText.getText().toString();
    String longitude = mLatitudeEditText.getText().toString();
    LatLng latLng = new LatLng();
    if (latitude.length() > 0) latLng.latitude = Double.valueOf(latitude);
    if (longitude.length() > 0) latLng.longitude = Double.valueOf(latitude);

    return new Beacon.BeaconBuilder(advertisedId)
        .status(
            mBeaconStatusSpinner.getSelectedItemPosition() > 0
                ? Status.fromString(mBeaconStatusSpinner.getSelectedItem().toString())
                : null)
        .stability(
            mBeaconStabilitySpinner.getSelectedItemPosition() > 0
                ? Stability.fromString(mBeaconStabilitySpinner.getSelectedItem().toString())
                : null)
        .description(mDescriptionEditText.getText().toString())
        .placeId(mPlaceIdEditText.getText().toString())
        .latLng(latLng)
        .build();
  }
 public void calculateConversion() {
   if (!value.getText().toString().isEmpty()) {
     double conversion = 0;
     DecimalFormat decimalFormat = new DecimalFormat();
     decimalFormat.setDecimalSeparatorAlwaysShown(false);
     switch (getArguments().getInt(ARG_SECTION_NUMBER)) {
       case 0:
         DryConverter startDryConverter =
             new DryConverter(startSpinner.getSelectedItem().toString());
         conversion = startDryConverter.toCups(Double.parseDouble(value.getText().toString()));
         DryConverter endDryConverter =
             new DryConverter(endSpinner.getSelectedItem().toString());
         conversion = endDryConverter.fromCups(conversion);
         break;
       case 1:
         LiquidConverter startLiquidConverter =
             new LiquidConverter(startSpinner.getSelectedItem().toString());
         conversion =
             startLiquidConverter.toFluidOunces(Double.parseDouble(value.getText().toString()));
         break;
       case 2:
         WeightConverter startWeightConverter =
             new WeightConverter(startSpinner.getSelectedItem().toString());
         conversion =
             startWeightConverter.toOunces(Double.parseDouble(value.getText().toString()));
         WeightConverter endWeightConverter =
             new WeightConverter(endSpinner.getSelectedItem().toString());
         conversion = endWeightConverter.fromOunces(conversion);
         break;
     }
     result.setText(decimalFormat.format(conversion));
   }
 }
Exemplo n.º 12
0
  private boolean valid() {
    boolean valid = true;
    String errorMessage = "";

    if (start == null || end == null) {
      errorMessage += "Missing Dates\n".toUpperCase();
      valid = false;
    } else {
      if (start.after(end)) {
        errorMessage += "Drop off Date Must be After Pick Up Date\n".toUpperCase();
        valid = false;
      }
    }
    if (customers.getSelectedItem().toString().equals("SELECT A CUSTOMER")) {
      errorMessage += "Select a Customer\n".toUpperCase();
      valid = false;
    }
    if (vehicles.getSelectedItem().toString().equals("SELECT A VEHICLE")) {
      errorMessage += "Select a Vehicle\n".toUpperCase();
      valid = false;
    }

    if (!valid) ApplicationHelper.toastShort(getApplicationContext(), "ERRORS\n" + errorMessage);

    return valid;
  }
Exemplo n.º 13
0
  @Override
  public String writeToModel(Task task) {
    Metadata metadata = ProducteevDataService.getInstance().getTaskMetadata(task.getId());
    try {
      if (metadata == null) {
        metadata = new Metadata();
        metadata.setValue(Metadata.KEY, ProducteevTask.METADATA_KEY);
        metadata.setValue(Metadata.TASK, task.getId());
        metadata.setValue(ProducteevTask.ID, 0L);
      }

      ProducteevDashboard dashboard = (ProducteevDashboard) dashboardSelector.getSelectedItem();
      metadata.setValue(ProducteevTask.DASHBOARD_ID, dashboard.getId());

      ProducteevUser responsibleUser = (ProducteevUser) responsibleSelector.getSelectedItem();

      if (responsibleUser == null) metadata.setValue(ProducteevTask.RESPONSIBLE_ID, 0L);
      else metadata.setValue(ProducteevTask.RESPONSIBLE_ID, responsibleUser.getId());

      // Erase PDTV-repeating-info if task itself is repeating with Astrid-repeat
      if (task.containsNonNullValue(Task.RECURRENCE)
          && task.getValue(Task.RECURRENCE).length() > 0) {
        metadata.setValue(ProducteevTask.REPEATING_SETTING, "");
      }

      if (metadata.getSetValues().size() > 0) {
        metadataService.save(metadata);
        task.setValue(Task.MODIFICATION_DATE, DateUtilities.now());
      }
    } catch (Exception e) {
      Log.e("error-saving-pdv", "Error Saving Metadata", e); // $NON-NLS-1$ //$NON-NLS-2$
    }
    return null;
  }
Exemplo n.º 14
0
  // User Generated Methods
  boolean validateForm() {

    String category = (String) spnProductCategory.getSelectedItem();
    String type = (String) spnProductType.getSelectedItem();
    if (!category.equals(PocketTrader.PRODUCT_CATEGORY) && !type.equals(PocketTrader.PRODUCT_TYPE))
      return true;
    else return false;
  }
Exemplo n.º 15
0
 public void searchTransactions(View v) {
   Intent intent = new Intent(this, ListTransactions.class);
   intent.putExtra("fromdate", editFromDate.getText().toString());
   intent.putExtra("todate", editToDate.getText().toString());
   intent.putExtra("fromamount", editFromAmount.getSelectedItem().toString());
   intent.putExtra("toamount", editToAmount.getSelectedItem().toString());
   startActivity(intent);
 }
Exemplo n.º 16
0
 public void btnFifteenPerTip(View v) {
   tipsPerentage = Double.parseDouble(etFoodCost.getText().toString()) * .15;
   totalFoodCost = Double.parseDouble(etFoodCost.getText().toString()) + tipsPerentage;
   etTipPercent.setText("15");
   etTipPrice.setText(spCurrncy.getSelectedItem() + " " + String.format("%.02f", tipsPerentage));
   etTotalPrice.setText(spCurrncy.getSelectedItem() + " " + String.format("%.02f", totalFoodCost));
   tipBar.setProgress(15);
 }
 public void guardarDatos() {
   Bundle b = new Bundle();
   Intent intent = new Intent(getApplicationContext(), MainActivity.class);
   b.putString("nombre", "" + textnombre.getText());
   b.putString("provincia", spnProvincia.getSelectedItem().toString());
   b.putString("localidad", spnLocalidad.getSelectedItem().toString());
   intent.putExtras(b);
   // startActivityForResult(intent, 0);
 }
Exemplo n.º 18
0
 public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) {
   // TODO Auto-generated method stub
   TextView myText = (TextView) view;
   Toast.makeText(this, " You have chosen " + myText.getText(), Toast.LENGTH_SHORT).show();
   final MediaPlayer mp = MediaPlayer.create(this, R.raw.mjuz);
   mp.start();
   sp1 = sprvi.getSelectedItem().toString();
   sp2 = sdrugi.getSelectedItem().toString();
 }
  /**
   * Collect user input to fill value of parameter.
   *
   * @return true if all data are will entered
   */
  @SuppressWarnings("unchecked")
  private boolean collectInputs() {
    LinearLayout root = (LinearLayout) findViewById(R.id.root);
    int indexView = 1;

    for (Parameter param : parameters) {

      switch (param.getType()) {
        case DATE_PICKER:
          Spinner dp = (Spinner) root.getChildAt(indexView);
          param.setValue(dp.getSelectedItem());
          break;
        case FIELD_SEPARATOR:
          Spinner spf = (Spinner) root.getChildAt(indexView);
          param.setValue(spf.getSelectedItem());
          break;
        case DECIMAL_SEPARATOR:
          Spinner sp = (Spinner) root.getChildAt(indexView);
          param.setValue(sp.getSelectedItem());
          break;
        case BOOLEAN:
          CheckBox chk = (CheckBox) root.getChildAt(indexView);
          param.setValue(chk.isChecked());
          break;
        case DATE_FORMAT:
          Spinner spd = (Spinner) root.getChildAt(indexView);
          param.setValue(spd.getSelectedItem());
          break;
        case FILE_URI:
          Button bt = (Button) root.getChildAt(indexView);
          boolean ok = false;
          try {
            URI uri = new URI("" + bt.getText());
            if (new File(uri).exists()) {
              param.setValue(uri);
              ok = true;
            }
          } catch (Throwable e) {
          }
          if (!ok) {
            Toast.makeText(
                    this,
                    getResources()
                        .getString(
                            R.string.mandatory_field,
                            ((TextView) root.getChildAt(indexView - 1)).getText()),
                    Toast.LENGTH_LONG)
                .show();

            return false;
          }
          break;
      }
      indexView += 3;
    }
    return true;
  }
Exemplo n.º 20
0
        @Override
        public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {

          if (!spnrAccnt.getSelectedItem().toString().equals(textSender)) {
            setTextSender(spnrAccnt.getSelectedItem().toString());
            GoogleAuthUtil.invalidateToken(mContext, authToken);
            setAuthToken(null);
            putPrefs();
          }
        }
Exemplo n.º 21
0
 @Override
 public void onClick(View v) {
   if (v.getId() == R.id.button1) {
     Toast t =
         Toast.makeText(
             getApplicationContext(), spinner2.getSelectedItem().toString(), Toast.LENGTH_LONG);
     t.show();
     editText1.setText(spinner2.getSelectedItem().toString());
   }
 }
Exemplo n.º 22
0
  public void calculateCurrency(
      EditText leftCurrencyText,
      TextView rightCurrencyText,
      Spinner leftCurrencySpinner,
      Spinner rightCurrencySpinner) {

    // Instantiate values
    double amount = 0;
    String leftSpinner = leftCurrencySpinner.getSelectedItem().toString();
    String rightSpinner = rightCurrencySpinner.getSelectedItem().toString();

    // Change the leftCurrencyText to double
    try {
      amount = Double.parseDouble(leftCurrencyText.getText().toString());
    } catch (Exception args) {
      amount = 0;
    }

    double result = 0;

    // Calculate money based on conversion rate
    // 1USD = 1062.80WON
    // 1USD = .62BPS
    // 1GBP = 1711.75WON

    if (leftSpinner.equals("United States")) {
      if (rightSpinner.equals("United States")) {
        result = amount;
      } else if (rightSpinner.equals("Korea")) {
        result = amount * 1062.80;
      } else if (rightSpinner.equals("United Kingdom")) {
        result = amount * .62;
      }
    } else if (leftSpinner.equals("Korea")) {
      if (rightSpinner.equals("United States")) {
        result = amount / 1062.80;
      } else if (rightSpinner.equals("Korea")) {
        result = amount;
      } else if (rightSpinner.equals("United Kingdom")) {
        result = amount / 1711.75;
      }
    }
    if (leftSpinner.equals("United Kingdom")) {
      if (rightSpinner.equals("United States")) {
        result = amount / .62;
      } else if (rightSpinner.equals("Korea")) {
        result = amount * 1711.75;
      } else if (rightSpinner.equals("United Kingdom")) {
        result = amount;
      }
    }

    // Log.d("WWWWWWWWWWWWWWWWWWWWW",String.format("%.02f",result));
    rightCurrencyText.setText(String.format("%.02f", result));
  }
    @Override
    public void onClick(View v) {

      if (v.getId() == R.id.btnConfirmar) {

        String nome, email, senha, confSenha, cpf, telefone, tipoSocio, sexo, numCartao;

        nome = etNome.getText().toString();
        email = etEmail.getText().toString();
        senha = etSenha.getText().toString();
        confSenha = etConfSenha.getText().toString();
        cpf = etCPF.getText().toString();
        telefone = etTelefone.getText().toString();
        tipoSocio = spTipoSocio.getSelectedItem().toString();
        sexo = spSexo.getSelectedItem().toString();
        numCartao = etNumCartao.getText().toString();

        if (TelaCadastro.isEditar()) {
          Socio socio =
              new Socio(nome, email, senha, confSenha, cpf, telefone, tipoSocio, sexo, 0, 0);
          Banco banco = new Banco(getActivity());
          System.out.println(Socio.getSocioLogado().getEmail());
          banco.editarSocio(socio, banco.usuarioGetId(Socio.getSocioLogado().getEmail()));
          AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
          builder.setMessage("Cadastro Editado com Sucesso").setTitle("Editado");
          AlertDialog dialog = builder.create();
          dialog.show();

          Intent intent = new Intent(getActivity(), TelaLogin.class);
          startActivity(intent);
        } else {
          CartaoDAO cDAO = new CartaoDAO(getActivity());

          if (cDAO.validarCartaoCadastro(numCartao, cpf)) {
            Socio socio =
                new Socio(nome, email, senha, confSenha, cpf, telefone, tipoSocio, sexo, 0, 0);
            SocioDAO banco = new SocioDAO(getActivity());
            banco.cadastrarSocio(socio);
            cDAO.inserirIdSocioCartao(socio);
            AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
            builder.setMessage(" Parabéns! Você se associou!").setTitle("Parabéns");
            AlertDialog dialog = builder.create();
            dialog.show();

            Intent intent = new Intent(getActivity(), TelaLogin.class);
            startActivity(intent);
          } else {
            AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
            builder.setMessage("Cartão inválido ou não pertence ao sócio").setTitle("Inválido");
            AlertDialog dialog = builder.create();
            dialog.show();
          }
        }
      }
    }
Exemplo n.º 24
0
  private void updatePlot(SeriesSize seriesSize) {

    // Remove all current series from each plot
    plot.clear();

    // Setup our Series with the selected number of elements
    series1 =
        new SimpleXYSeries(
            Arrays.asList(series1Numbers), SimpleXYSeries.ArrayFormat.Y_VALS_ONLY, "Us");
    series2 =
        new SimpleXYSeries(
            Arrays.asList(series2Numbers), SimpleXYSeries.ArrayFormat.Y_VALS_ONLY, "Them");

    plot.setDomainBoundaries(-1, series1.size(), BoundaryMode.FIXED);
    plot.setRangeUpperBoundary(
        SeriesUtils.minMax(series1, series2).getMaxY().doubleValue() + 1, BoundaryMode.FIXED);

    if (seriesSize != null) {
      switch (seriesSize) {
        case TEN:
          plot.setDomainStep(StepMode.INCREMENT_BY_VAL, 2);
          break;
        case TWENTY:
          plot.setDomainStep(StepMode.INCREMENT_BY_VAL, 4);
          break;
        case SIXTY:
          plot.setDomainStep(StepMode.INCREMENT_BY_VAL, 6);
          break;
      }
    }

    // add a new series' to the xyplot:
    if (series1CheckBox.isChecked()) plot.addSeries(series1, formatter1);
    if (series2CheckBox.isChecked()) plot.addSeries(series2, formatter2);

    // Setup the BarRenderer with our selected options
    MyBarRenderer renderer = plot.getRenderer(MyBarRenderer.class);
    renderer.setBarOrientation((BarRenderer.BarOrientation) spRenderStyle.getSelectedItem());
    final BarRenderer.BarGroupWidthMode barGroupWidthMode =
        (BarRenderer.BarGroupWidthMode) spWidthStyle.getSelectedItem();
    renderer.setBarGroupWidth(
        barGroupWidthMode,
        barGroupWidthMode == BarRenderer.BarGroupWidthMode.FIXED_WIDTH
            ? sbFixedWidth.getProgress()
            : sbVariableWidth.getProgress());

    if (BarRenderer.BarOrientation.STACKED.equals(spRenderStyle.getSelectedItem())) {
      plot.getInnerLimits().setMaxY(15);
    } else {
      plot.getInnerLimits().setMaxY(0);
    }

    plot.redraw();
  }
        @Override
        public void onClick(DialogInterface dialog, int which) {
          final String language = spin_changeRegistration_language.getSelectedItem().toString();
          final String hmiLanguage =
              spin_changeRegistration_hmiLanguage.getSelectedItem().toString();

          RPCRequest result =
              SdlRequestFactory.changeRegistration(
                  Language.valueForString(language), Language.valueForString(hmiLanguage));
          notifyListener(result);
        }
Exemplo n.º 26
0
  protected void apply_leave() {
    // TODO Auto-generated method stub
    JsonObjectRequest jsonObjectRequest =
        new JsonObjectRequest(
            Const.Leave.URL_COMPENSATORY_OFF_p1
                + Const.Leave.URL_COMPENSATORY_OFF_p1_p2
                + employeeID
                + Const.Leave.URL_COMPENSATORY_OFF_p1_p3
                + companyID
                + Const.Leave.URL_COMPENSATORY_OFF_p1_p4
                + getLeaveTypeID()
                + Const.Leave.URL_COMPENSATORY_OFF_p1_p5
                + Leavedate.getText()
                + Const.Leave.URL_COMPENSATORY_OFF_p1_p6
                + sessioncompo.getSelectedItem().toString()
                + Const.Leave.URL_COMPENSATORY_OFF_p1_p7
                + totaldayscompo.getText()
                + Const.Leave.URL_COMPENSATORY_OFF_p1_p8
                + compodate.getSelectedItem().toString()
                + Const.Leave.URL_COMPENSATORY_OFF_p1_p9
                + leavereasoncompo.getText(),
            null,
            new Listener<JSONObject>() {

              @Override
              public void onResponse(JSONObject response) {
                // TODO Auto-generated method stub
                // LeaveCategory
                try {
                  JSONArray jsonArray = response.getJSONArray("applyCompOffResult");

                  JSONObject jsonObj = jsonArray.getJSONObject(0);
                  if (jsonObj.getString("result").equals("1")) {
                    Custom_alert("Comp-off applied!..");
                  } else if (jsonObj.getString("result").equals("2")) {
                    Custom_alert("Sorry cannot apply for Comp-off!..");
                  }
                } catch (JSONException e) {
                  // TODO Auto-generated catch block
                  e.printStackTrace();
                }
              }
            },
            new Response.ErrorListener() {

              @Override
              public void onErrorResponse(VolleyError error) {
                VolleyLog.d("JSON", "Error: " + error.getMessage());
                // hideProgressDialog();
              }
            });
    AppController.getInstance().addToRequestQueue(jsonObjectRequest, tag_json_obj);
  }
  /** Alert the user about subscription */
  private void notificationAlert() {

    Bundle bundle = new Bundle();

    String left = leftSpinner.getSelectedItem().toString();
    String right = rightSpinner.getSelectedItem().toString();

    bundle.putString(SAConstants.ALERT_TEXT, left + " : " + right);
    SimpleSubscriptionAlertDialog subscriptionAlert = new SimpleSubscriptionAlertDialog();
    subscriptionAlert.setArguments(bundle);
    subscriptionAlert.setTargetFragment(this, 0);
    subscriptionAlert.show(getActivity().getSupportFragmentManager(), "");
  }
  public void btnOkClick(View v) {
    if (validarEmprestimo()) {
      Intent data = new Intent();

      data.putExtra("catg", ne_catg.getSelectedItem().toString());
      data.putExtra("desc", ne_desc.getText().toString());
      data.putExtra("nome", ne_nome.getSelectedItem().toString());
      data.putExtra("data", ne_data.getText().toString());

      setResult(RESULT_OK, data);

      finish();
    }
  }
  private List<Map<String, Object>> listarCategorias() {
    List<Categoria> listaDeCategorias = null;

    if (spnTipoCategoria.getSelectedItemPosition() == 0) {
      listaDeCategorias = categoriasDAO.listarTodos();
    } else if (spnTipoCategoria
        .getSelectedItem()
        .toString()
        .equals(Constantes.DESCRICAO_TIPO_CATEGORIA_DESPESA)) {
      listaDeCategorias =
          categoriasDAO.listarTodosPorFiltro(
              "tipo = ?", new String[] {String.valueOf(Constantes.ID_TIPO_CATEGORIA_DESPESA)});
    } else if (spnTipoCategoria
        .getSelectedItem()
        .toString()
        .equals(Constantes.DESCRICAO_TIPO_CATEGORIA_RECEITA)) {
      listaDeCategorias =
          categoriasDAO.listarTodosPorFiltro(
              "tipo = ?", new String[] {String.valueOf(Constantes.ID_TIPO_CATEGORIA_RECEITA)});
    }

    categorias = new ArrayList<Map<String, Object>>();

    for (Categoria categoria : listaDeCategorias) {
      Map<String, Object> item = new HashMap<String, Object>();

      String id = categoria.getId().toString();
      String descricao = categoria.getDescricao();
      int tipo = categoria.getTipo();

      String descricaoTipoCategoria;

      if (tipo == Constantes.ID_TIPO_CATEGORIA_DESPESA) {
        descricaoTipoCategoria = Constantes.DESCRICAO_TIPO_CATEGORIA_DESPESA;
      } else {
        descricaoTipoCategoria = Constantes.DESCRICAO_TIPO_CATEGORIA_RECEITA;
      }

      item.put(DatabaseHelper.Categoria._ID, id);
      item.put(DatabaseHelper.Categoria.DESCRICAO, descricao);
      item.put(DatabaseHelper.Categoria.TIPO, tipo);
      item.put("VisualizacaoDaDescricao", descricao);
      item.put("VisualizacaoDoTipo", "Categoria: " + descricaoTipoCategoria);

      categorias.add(item);
    }
    return categorias;
  }
Exemplo n.º 30
-2
 @Override
 protected void filter() {
   activity.setSearchString(editText.getText().toString());
   activity.setGenre((Genre) genreSpinnerView.getSelectedItem());
   activity.setYear((Year) yearSpinnerView.getSelectedItem());
   activity.clearAndReOrderItems();
 }