Ejemplo n.º 1
0
  public void register(View view) {

    if (user.getText().toString().equals("")
        || email.getText().toString().equals("")
        || pass.getText().toString().equals("")) {
      UI.showAlertDialog(
          getString(android.R.string.dialog_alert_title),
          "Favor de llenar todos los campos solicitados",
          getString(android.R.string.ok),
          context,
          null);
    } else {

      Bundle b = new Bundle();
      b.putBoolean("REGISTER", true);
      b.putString(USER, user.getText().toString());
      b.putString(EMAIL, email.getText().toString());
      b.putString(PASS, pass.getText().toString());

      String country =
          getResources()
              .getStringArray(R.array.country_arrays_values)[(int) countries.getSelectedItemId()];
      b.putString(COUNTRY, country);
      b.putString(SEX, sex.isChecked() ? "H" : "M");

      setResult(Activity.RESULT_OK, new Intent().putExtras(b));
      finish();

      // TODO
    }
  }
Ejemplo n.º 2
0
  private Style getSelectedStyleFromSpinner() {
    Spinner styleSpinner = (Spinner) findViewById(R.id.spinner_style);

    switch ((int) styleSpinner.getSelectedItemId()) {
      case 0:
        {
          return Style.ALERT;
        }

      case 1:
        {
          return Style.CONFIRM;
        }

      case 2:
        {
          return Style.INFO;
        }

      default:
        {
          return null;
        }
    }
  }
Ejemplo n.º 3
0
  private void saveState() {
    Long schemeId = schemeSpinner.getSelectedItemId();
    String otherScheme = otherSchemeText.getText().toString();
    String feedback = feedbackText.getText().toString();

    // only save if either summary or description
    // is available

    if (feedback.length() == 0 && otherScheme.length() == 0) {
      return;
    }

    ContentValues values = new ContentValues();
    values.put(SchemeFeedbackContract.Feedback.COLUMN_SCHEME_ID, schemeId);
    values.put(SchemeFeedbackContract.Feedback.COLUMN_OTHER_SCHEME, otherScheme);
    values.put(SchemeFeedbackContract.Feedback.COLUMN_FEEDBACK, feedback);

    if (feedbackUri == null) {
      // New todo
      feedbackUri =
          getContentResolver().insert(SchemeFeedbackContract.Feedback.CONTENT_URI, values);
    } else {
      // Update todo
      getContentResolver().update(feedbackUri, values, null, null);
    }
  }
 private void doSearch() {
   if (isFinishing()) return;
   final String query = ParseUtils.parseString(mSearchQuery.getText());
   if (TextUtils.isEmpty(query)) return;
   final long accountId = mAccountSpinner.getSelectedItemId();
   Utils.openSearch(this, accountId, query);
   finish();
 }
Ejemplo n.º 5
0
 /** 添加一条处方信息 */
 private void addNewChuFang() {
   if (spinnerTellMedical10.getSelectedItemId() != 0) {
     LifeGuiding_Submit guiding = new LifeGuiding_Submit();
     guiding.setId(CommonUtil.generateGUID());
     guiding.setMedicalRecordID(SysApplication.getInstance().getMedicalRecord().getId());
     guiding.setLifeGuidingID(((LifeGuiding) spinnerTellMedical10.getSelectedItem()).getId());
     new SingleFetcher(String.class)
         .addMedicalRecord_lifeguiding(getActivity(), "正在提交...", guiding);
   }
   if (spinnerTellMedical11.getSelectedItemId() != 0) {
     LifeGuiding_Submit guiding = new LifeGuiding_Submit();
     guiding.setId(CommonUtil.generateGUID());
     guiding.setMedicalRecordID(SysApplication.getInstance().getMedicalRecord().getId());
     guiding.setLifeGuidingID(((LifeGuiding) spinnerTellMedical11.getSelectedItem()).getId());
     new SingleFetcher(String.class)
         .addMedicalRecord_lifeguiding(getActivity(), "正在提交...", guiding);
   }
 }
  public void btnSolicitarTaxi_Click(View view) {
    boolean ok = true;
    try {
      String direccionOrigen = txtDireccionOrigen.getText().toString();
      String direccionDestino = txtDireccionDestino.getText().toString();
      String emailAlterno = txtEmailAlterno.getText().toString();
      String observaciones = txtObservaciones.getText().toString();
      int distritoOrigenID = Integer.valueOf((int) spinDistritoOrigen.getSelectedItemId());
      int distritoDestinoID = Integer.valueOf((int) spinDistritoDestino.getSelectedItemId());
      String fechaReserva = mDateDisplay.getText().toString();
      String horaReserva = mTimeDisplay.getText().toString();

      String usuario;
      SharedPreferences prefs = getSharedPreferences("MisPreferencias", Context.MODE_PRIVATE);
      usuario = prefs.getString("usuario", "");

      Reserva res =
          new Reserva(
              usuario,
              distritoOrigenID,
              direccionOrigen,
              distritoDestinoID,
              direccionDestino,
              emailAlterno,
              observaciones,
              fechaReserva,
              horaReserva,
              0,
              0);
      dbHelper.AddReserva(res);
    } catch (Exception ex) {
      ok = false;
      CatchError(ex.toString());
    } finally {
      if (ok) {
        // NotifyEmpAdded();
        Alerts.ShowRegistrarReserva(this);
        Intent i = new Intent(this, GridReserva.class);
        startActivity(i);
        // txtEmps.setText("Numero de Reservas: "+String.valueOf(dbHelper.getReservaCount()));
      }
    }
  }
Ejemplo n.º 7
0
  private void saveShader() {
    String src = shaderEditor.getCleanText();

    if (!compileOnChange) {
      loadShader(src);
      shaderEditor.refresh();
    }

    dataSource.update(shaderSpinner.getSelectedItemId(), src, shaderView.renderer.getThumbnail());

    updateAdapter();
  }
  public void trackingStartStop(View view) {
    try {

      if (TRACKING_FLAG == false) {
        Log.d(getString(R.string.maps_activity), "Tracking started");
        Spinner spinner = (Spinner) findViewById(R.id.durationSpinner);

        // startLocationUpdates();
        /**
         * Because we are getting back the index not the value. So if we need 60, we will get 5 ,
         * because 5 is the index of 60
         */
        displayToast(String.valueOf(spinner.getSelectedItemId()));
        long trackDuration = ((spinner.getSelectedItemId() + 1) * 30) * 60;
        if (((getUnixTime() - getTrackingStartTime()) / (60 * 60)) < 24) {
          confirmationDialogBoxForShareOptions(trackDuration);
        } else {

          setTrackingStartTime();
          setTrackingDurationTime(trackDuration);
          startBackgroundServiceSequence();

          setUpStopButton();
          openShareOptions();
        }

        // startBackgroundServiceSequence(view, 10);

      } else {
        Log.d(getString(R.string.maps_activity), "Tracking paused");
        setUpStartButton();
        // stopLocationUpdates();
        stopBackgroundServiceSequence();
        resetTrackDurationTime();
      }
    } catch (Exception e) {
      Log.d(getString(R.string.maps_activity), e.getMessage());
    }
  }
Ejemplo n.º 9
0
  // ボタンクリックのディスパッチ
  public void onClick(View v) {

    if (v == mWdgDirectBtn) {
      // Log.d(TAG, "click:direct");
      //
      mWdgSpinnerBrowsers = (Spinner) findViewById(R.id.SpinnerBrowsers);
      long itemid = mWdgSpinnerBrowsers.getSelectedItemId();
      String[] app = {
        mSuitableApps.get((int) itemid).get("packageName"),
        mSuitableApps.get((int) itemid).get("activityInfo")
      };
      startBrowserApp("", app[0], app[1]);

    } else if (v == mWdgConvertBtn) {
      // Log.d(TAG, "click:convert");
      //
      mWdgSpinnerBrowsers = (Spinner) findViewById(R.id.SpinnerBrowsers);
      long itemid = mWdgSpinnerBrowsers.getSelectedItemId();
      String[] app = {
        mSuitableApps.get((int) itemid).get("packageName"),
        mSuitableApps.get((int) itemid).get("activityInfo")
      };
      //
      mWdgSpinnerConverters = (Spinner) findViewById(R.id.SpinnerConverters);
      long cnvkey = mWdgSpinnerConverters.getSelectedItemId();
      String cnv = mConverters.get((int) cnvkey).get("url");
      Log.d(TAG, "onClick:wdgSpnCnv.getSelectedItemId-key/url:" + cnvkey + " / " + cnv);
      startBrowserApp(cnv, app[0], app[1]);

    } else if (v == mWdgSettingBtn) {
      startConverterlistActivity();

    } else if (v == mWdgHistoryBtn) {
      startHistoryActivity();
    }

    return;
  }
  public void OnButtonOkClick(View v) {

    long deckId = mDecks.getSelectedItemId();

    String cardCount = mCardCount.getText().toString();

    if (cardCount.length() > 0) {
      DatabaseHelper.addDeckCard(deckId, mCardId, mCardType, Integer.parseInt(cardCount));

      DatabaseHelper.LAST_SELECTED_DECK = deckId;
    }

    finish();
  }
Ejemplo n.º 11
0
  private void calculate() {
    String[] tempArray;
    String resultString;
    massConvert = new MassConverter();

    dataIn = (EditText) findViewById(R.id.TextInput);
    try {
      input = Double.valueOf(dataIn.getText().toString());

      int fromType = (int) spinnerFrom.getSelectedItemId();
      int toType = (int) spinnerTo.getSelectedItemId();

      output = massConvert.convert(fromType, toType, input);

      tempArray = getResources().getStringArray(R.array.weights);
      resultString = new DecimalFormat("#.########").format(output);
      resultString = (resultString + " " + tempArray[toType]);
      System.out.println(resultString);
      displayResult(resultString, context);
    } catch (NumberFormatException e) {
      displayNotice("Invalid Input");
    }
  }
Ejemplo n.º 12
0
  private void doSaveAction() {
    mPoiPoint.Title = mTitle.getText().toString();
    mPoiPoint.CategoryId = (int) mSpinner.getSelectedItemId();
    mPoiPoint.Descr = mDescr.getText().toString();
    mPoiPoint.GeoPoint =
        GeoPoint.fromDouble(
            CoordFormatter.convert(mLat.getText().toString()),
            CoordFormatter.convert(mLon.getText().toString()));
    mPoiPoint.Hidden = mHidden.isChecked();
    try {
      mPoiPoint.Alt = Double.parseDouble(mAlt.getText().toString());
    } catch (NumberFormatException e) {
    }

    mPoiManager.updatePoi(mPoiPoint);
    finish();

    Toast.makeText(PoiActivity.this, R.string.message_saved, Toast.LENGTH_SHORT).show();
  }
  void updateResult() {
    Intent intent = new Intent();

    long id = mSpinnerAction.getSelectedItemId();
    if (id == 0) {
      intent.putExtra(ShoppingListIntents.EXTRA_ACTION, ShoppingListIntents.TASK_CLEAN_UP_LIST);
    }
    intent.putExtra(ShoppingListIntents.EXTRA_DATA, mUri.toString());

    String description = mDescriptionAction + ": " + mDescriptionShoppingList;
    intent.putExtra(AutomationIntents.EXTRA_DESCRIPTION, description);

    if (debug) {
      Log.i(TAG, "Created intent (URI)   : " + intent.toURI());
    }
    if (debug) {
      Log.i(TAG, "Created intent (String): " + intent.toString());
    }

    setResult(RESULT_OK, intent);
  }
 private long getAccountId() {
   return mAccountSpinner.getSelectedItemId();
 }
  @Override
  protected void onPause() {
    super.onPause();

    if (mBlogDeleted || mIsViewingAdmin) return;

    blog.setUsername(mUsernameET.getText().toString());
    blog.setPassword(mPasswordET.getText().toString());
    blog.setHttpuser(mHttpUsernameET.getText().toString());
    blog.setHttppassword(mHttpPasswordET.getText().toString());

    blog.setFullSizeImage(mFullSizeCB.isChecked());
    blog.setScaledImage(mScaledCB.isChecked());
    if (blog.isScaledImage()) {
      EditText scaledImgWidth = (EditText) findViewById(R.id.scaledImageWidth);

      boolean error = false;
      int width = 0;
      try {
        width = Integer.parseInt(scaledImgWidth.getText().toString().trim());
      } catch (NumberFormatException e) {
        error = true;
      }

      if (width == 0) error = true;

      if (error) {
        AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(BlogPreferencesActivity.this);
        dialogBuilder.setTitle(getResources().getText(R.string.error));
        dialogBuilder.setMessage(getResources().getText(R.string.scaled_image_error));
        dialogBuilder.setPositiveButton(
            "OK",
            new DialogInterface.OnClickListener() {
              public void onClick(DialogInterface dialog, int whichButton) {}
            });
        dialogBuilder.setCancelable(true);
        dialogBuilder.create().show();
        return;
      } else {
        blog.setScaledImageWidth(width);
      }
    }

    blog.setMaxImageWidth(mImageWidthSpinner.getSelectedItem().toString());

    long maxImageWidthId = mImageWidthSpinner.getSelectedItemId();
    int maxImageWidthIdInt = (int) maxImageWidthId;

    blog.setMaxImageWidthId(maxImageWidthIdInt);

    blog.setLocation(mLocationCB.isChecked());

    blog.save(originalUsername);

    if (WordPress.getCurrentBlog().getId() == blog.getId()) WordPress.currentBlog = blog;

    // exit settings screen
    Bundle bundle = new Bundle();

    bundle.putString("returnStatus", "SAVE");
    Intent mIntent = new Intent();
    mIntent.putExtras(bundle);
    setResult(RESULT_OK, mIntent);
    finish();
  }
Ejemplo n.º 16
-1
  private void updateWallpaper() {
    ShaderRenderer renderer = ShaderWallpaperService.renderer;

    if (renderer != null) renderer.fragmentShader = shaderEditor.getCleanText();

    ShaderListPreference.saveShader(getSharedPreferences(), shaderSpinner.getSelectedItemId());
  }