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();
  }
 /*
  * This method loads the data from the appropriate xml file
  */
 public void prepareData() {
   AssetManager manager = getAssets();
   InputStream is = null;
   int[] selectedIntValues =
       new int[] {
         categorySpinner.getSelectedItemPosition(), subcategorySpinner.getSelectedItemPosition()
       };
   String[] selectedStringValues = new String[selectedIntValues.length];
   for (int i = 0; i < selectedIntValues.length; i++) {
     if (selectedIntValues[i] < 10) {
       selectedStringValues[i] = "0" + selectedIntValues[i];
     } else {
       selectedStringValues[i] = "" + selectedIntValues[i];
     }
   }
   try {
     is =
         manager.open(
             "Category_"
                 + selectedStringValues[0]
                 + "/Shoplist_"
                 + selectedStringValues[1]
                 + ".xml");
   } catch (Exception e) {
     try {
       is = manager.open("empty_shoplist.xml");
     } catch (Exception e1) {
       // handle later
     }
   }
   handler = new MyXMLHandler(is);
 }
  /**
   * Attempts to sign in or register the account specified by the login form. If there are form
   * errors (invalid email, missing fields, etc.), the errors are presented and no actual login
   * attempt is made.
   */
  private void attemptLogin() {
    if (mAuthTask != null) {
      return;
    }

    // Reset errors.
    mNameView.setError(null);
    mZipCodeView.setError(null);

    // Store values at the time of the login attempt.
    String name = mNameView.getText().toString();
    String phone = mPhoneView.getText().toString();
    String bloodgroup = adapter.getItem(mBloodGroupsView.getSelectedItemPosition()).toString();
    String zipcode = mZipCodeView.getText().toString();

    boolean cancel = false;
    View focusView = null;

    // Check for a valid password, if the user entered one.
    if (TextUtils.isEmpty(zipcode) || !isZipCodeValid(zipcode)) {
      mZipCodeView.setError("Invalid Zip Code");
      focusView = mZipCodeView;
      cancel = true;
    }

    // Check for a valid email address.
    if (TextUtils.isEmpty(name)) {
      mNameView.setError(getString(R.string.error_field_required));
      focusView = mNameView;
      cancel = true;
    } else if (isEmailValid(name)) {
      mNameView.setError("Invalid Name");
      focusView = mNameView;
      cancel = true;
    }
    if (TextUtils.isEmpty(phone)) {
      mPhoneView.setError("This field is required");
      focusView = mPhoneView;
      cancel = true;
    }

    if (mBloodGroupsView.getSelectedItemPosition() < 1) {
      Snackbar.make(mBloodGroupsView, "Choose your Blood Group", Snackbar.LENGTH_SHORT).show();
      focusView = mBloodGroupsView;
      cancel = true;
    }

    if (cancel) {
      // There was an error; don't attempt login and focus the first
      // form field with an error.
      focusView.requestFocus();
    } else {
      // Show a progress spinner, and kick off a background task to
      // perform the user login attempt.
      showProgress(true);
      mAuthTask = new UserLoginTask(name, phone, bloodgroup, zipcode);
      // showProgress(true);
      mAuthTask.execute((Void) null);
    }
  }
Beispiel #4
0
  // Go Back to Title Screen
  @Override
  public void onBackPressed() {

    // Get New Values
    int theme = themeSpinner.getSelectedItemPosition();
    int controls = controlsSpinner.getSelectedItemPosition();
    int view = viewSpinner.getSelectedItemPosition();
    int speed = speedSpinner.getSelectedItemPosition();

    // Save in Settings
    // Speed Setting is Stored in a Different File Because It Should Not Be Synced Across Devices
    userPreferencesEditor = userPreferences.edit();
    userPreferencesEditor.putInt("theme", theme);
    userPreferencesEditor.putInt("controls", controls);
    userPreferencesEditor.putInt("view", view);
    speedSettingEditor = speedSetting.edit();
    speedSettingEditor.putInt("speed", speed);
    userPreferencesEditor.commit();
    speedSettingEditor.commit();

    // Call for Backup
    BackupManager backupManager = new BackupManager(this);
    backupManager.dataChanged();

    // Go Home & Close Options Screen
    Intent intent = new Intent(this, TitleScreen.class);
    startActivity(intent);
    this.finish();
  }
 private void validateBeaconData() {
   boolean isValid =
       mAdvertisedIdEditText.getText().length() > 0
           && mBeaconStatusSpinner.getSelectedItemPosition() > 0;
   mAdvertisedIdErrorMessage.setVisibility(
       mAdvertisedIdEditText.getText().length() > 0 ? View.INVISIBLE : View.VISIBLE);
   mStatusErrorMessage.setVisibility(
       mBeaconStatusSpinner.getSelectedItemPosition() > 0 ? View.INVISIBLE : View.VISIBLE);
   String latitude = mLatitudeEditText.getText().toString();
   String longitude = mLongitudeEditText.getText().toString();
   if (latitude.length() > 0) {
     if (!DataUtils.isStringDoubleValue(latitude)) {
       isValid = false;
       mLatitudeErrorMessage.setVisibility(View.VISIBLE);
     } else {
       mLatitudeErrorMessage.setVisibility(View.INVISIBLE);
     }
   } else {
     mLatitudeErrorMessage.setVisibility(View.INVISIBLE);
   }
   if (longitude.length() > 0) {
     if (!DataUtils.isStringDoubleValue(longitude)) {
       isValid = false;
       mLongitudeErrorMessage.setVisibility(View.VISIBLE);
     } else {
       mLongitudeErrorMessage.setVisibility(View.INVISIBLE);
     }
   } else {
     mLongitudeErrorMessage.setVisibility(View.INVISIBLE);
   }
   if (isValid) saveBeacon(buildBeaconObject());
 }
 public User getUser() {
   User user = new User();
   user.setId(
       (String)
           SPUtil.get(getActivity(), MyApp.PREF_TYPE_LOGIN, MyApp.LOGIN_ID, "", String.class));
   user.setUserName(userName.getText().toString());
   user.setTimeZone(0);
   user.setGender(userGender.getText().toString());
   String ageTxt = userAge.getText().toString();
   int age = 0;
   try {
     age = Integer.parseInt(ageTxt);
   } catch (NumberFormatException e) {
     age = 0;
   }
   user.setAge(age);
   user.setBirthday("");
   user.setCountryId(0);
   int homeId = originSpinner.getSelectedItemPosition() + 1;
   user.setHomeId(homeId);
   user.setBio(userBio.getText().toString());
   user.setSthInteresting(userDNA.getText().toString());
   user.setAmzExp(userTrophy.getText().toString());
   user.setToDo(userTodo.getText().toString());
   user.setPhilosophy(userPhilo.getText().toString());
   user.setFriendsDesc(userDesc.getText().toString());
   user.setInterest(userInterest.getText().toString());
   user.setLittleSecret(userSec.getText().toString());
   int langId = langSpinner.getSelectedItemPosition() + 1;
   user.setLangId(langId);
   user.setLocale("");
   return user;
 }
  private void getUserDetails() {
    CharSequence cs;
    firstname = edit_firstname.getText().toString().trim();
    lastname = edit_lastname.getText().toString().trim();
    username = edit_username.getText().toString().trim();
    email = edit_email.getText().toString().trim();
    dob = text_dob.getText().toString().trim();
    password = edit_password.getText().toString().trim();

    cs = (CharSequence) email;

    if (firstname.length() < 4) {
      edit_firstname.setError("Enter atleast 4 characters");
    }
    if (username.length() < 6) {
      edit_username.setError("Enter atleast 6 characters");
    }
    if (password.length() < 6) {
      edit_password.setError("Enter atleast 6 characters");
    }
    if (!isEmailValid(cs)) {
      edit_email.setError("Enter a valid email");
    }

    if (spinner_gender.getSelectedItemPosition() <= 0) {
      Toast.makeText(RegisterNormal.this, "Please select the gender", Toast.LENGTH_SHORT).show();
    }

    if (dob.length() <= 0) {
      Toast.makeText(RegisterNormal.this, "Please select the DOB", Toast.LENGTH_SHORT).show();
    }

    if (firstname.length() > 4
        && (username.length() >= 6)
        && (password.length() >= 6)
        && (isEmailValid(cs))
        && (spinner_gender.getSelectedItemPosition() > 0)
        && dob.length() > 0) {
      if (terms_check.isChecked()) {
        // call for async for registering the user
        ConnectionDetector conn = new ConnectionDetector(RegisterNormal.this);
        if (conn.isConnectingToInternet()) {
          new Register().execute();
        } else {
          Crouton.makeText(RegisterNormal.this, getString(R.string.crouton_message), Style.ALERT)
              .show();
        }
      } else {
        Toast.makeText(RegisterNormal.this, "Accept the terms and conditions", Toast.LENGTH_SHORT)
            .show();
      }
    } else {
      // Toast.makeText(RegisterNormal.this,"Enter valid details",Toast.LENGTH_LONG).show();
    }
  }
  private void savePreferences() {
    int updateIndex = updateFreqSpinner.getSelectedItemPosition();
    int minMagIndex = magnitudeSpinner.getSelectedItemPosition();
    boolean autoUpdateChecked = autoUpdate.isChecked();

    SharedPreferences.Editor editor = prefs.edit();
    editor.putBoolean(PREF_AUTO_UPDATE, autoUpdateChecked);
    editor.putInt(PREF_UPDATE_FREQ_INDEX, updateIndex);
    editor.putInt(PREF_MIN_MAG_INDEX, minMagIndex);
    editor.apply();
  }
  @Override
  public void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);

    if (leftSpinner != null || rightSpinner != null) {

      outState.putParcelableArrayList(SAConstants.STATE_CHANGED, adds);
      outState.putInt(SAConstants.LEFT_SPINNER, leftSpinner.getSelectedItemPosition());
      outState.putInt(SAConstants.RIGHT_SPINNER, rightSpinner.getSelectedItemPosition());
    }
  }
 @Override
 public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
   Spinner spinner = (Spinner) parent;
   if (parent.getId() == R.id.listEncoders) {
     mSelectedEncoder = mEncodersNames[spinner.getSelectedItemPosition()];
     Log.d(TAG, "onItemSelected - encoder: " + mSelectedEncoder);
   } else if (parent.getId() == R.id.listFiles) {
     mSelectedFile = mFilesNames[spinner.getSelectedItemPosition()];
     Log.d(TAG, "onItemSelected - file: " + mSelectedFile);
   }
 }
Beispiel #11
0
  public int getValue() {
    int value = 0;
    if (during.isChecked()) value |= Task.NOTIFY_AT_DEADLINE;
    if (after.isChecked()) value |= Task.NOTIFY_AFTER_DEADLINE;

    value &= ~(Task.NOTIFY_MODE_FIVE | Task.NOTIFY_MODE_NONSTOP);
    if (mode.getSelectedItemPosition() == 2) value |= Task.NOTIFY_MODE_NONSTOP;
    else if (mode.getSelectedItemPosition() == 1) value |= Task.NOTIFY_MODE_FIVE;

    return value;
  }
  public void saveSettings() {
    SharedPreferences settings = getActivity().getSharedPreferences(PREF_TITLE, 0);
    SharedPreferences.Editor editor = settings.edit();
    StringBuilder sb = new StringBuilder();

    if (verify() == true) {
      sb = new StringBuilder();

      String url = sb.append(et_serv.getText()).toString();
      sb.setLength(0);
      String user = sb.append(et_user.getText()).toString();
      sb.setLength(0);
      String pass = sb.append(et_pass.getText()).toString();
      sb.setLength(0);
      int threads = Integer.parseInt(sb.append(et_thread.getText()).toString());
      sb.setLength(0);
      float throttle = (float) sb_throttle.getProgress() / 100;
      sb.setLength(0);
      long scantime = Long.parseLong(sb.append(et_scanTime.getText()).toString());
      sb.setLength(0);
      long retrypause = Long.parseLong(sb.append(et_retryPause.getText()).toString());

      settings = getActivity().getSharedPreferences(PREF_TITLE, 0);
      editor = settings.edit();
      editor.putString(PREF_URL, url);
      editor.putString(PREF_USER, user);
      editor.putString(PREF_PASS, pass);
      editor.putInt(PREF_THREAD, threads);
      Log.i("LC", "Settings: Throttle: " + throttle);
      editor.putFloat(PREF_THROTTLE, throttle);
      editor.putLong(PREF_SCANTIME, scantime);
      editor.putLong(PREF_RETRYPAUSE, retrypause);
      editor.putBoolean(PREF_BACKGROUND, cb_service.isChecked());
      editor.putBoolean(PREF_DONATE, cb_donate.isChecked());

      Log.i("LC", "Settings: Pri " + (String) spn_priority.getSelectedItem());
      if (spn_priority.getSelectedItemPosition() == 0) {
        editor.putInt(PREF_PRIORITY, Thread.MIN_PRIORITY);
      }
      if (spn_priority.getSelectedItemPosition() == 1) {
        editor.putInt(PREF_PRIORITY, Thread.NORM_PRIORITY);
      }
      if (spn_priority.getSelectedItemPosition() == 2) {
        editor.putInt(PREF_PRIORITY, Thread.MAX_PRIORITY);
      }
      Log.i("LC", "Settings: Settings saved");
      editor.commit();
      Toast.makeText(getActivity(), "Settings Saved", Toast.LENGTH_SHORT).show();
    } else {
      Log.i("LC", "Settings: Invalid Input");
      Toast.makeText(getActivity(), "Settings: Errors changed to red", Toast.LENGTH_SHORT).show();
    }
    editor.commit();
  }
  /**
   * Returns the content of an EditText. If the Spinner is has {@link #POS_CONTAINS} selected, the
   * content is wrapped in '{@code %} '-wildcards
   *
   * @param editText the EditText
   * @param spinner the Spinner
   * @return the content of an EditText
   */
  private String readEditText(EditText editText, Spinner spinner) {
    assert spinner.getSelectedItemPosition() == POS_CONTAINS
        || spinner.getSelectedItemPosition() == POS_EQUALS;

    String text = editText.getText().toString().trim();

    if (text.length() > 0 && spinner.getSelectedItemPosition() == POS_CONTAINS) {
      text = "%" + text + "%";
    }

    return text;
  }
  private void refreshSpinners() {
    // reload the spinners to make sure all refs are in the right sequence
    m_spinnerFromAdapter.refreshFromSpinner(this);
    m_spinnerToAdapter.filterToSpinner(m_refFromName, this);
    // after we reloaded the spinners we need to reset the selections
    Spinner spinnerStatTypeFrom = (Spinner) findViewById(R.id.spinnerStatType);
    Spinner spinnerStatTypeTo = (Spinner) findViewById(R.id.spinnerStatSampleEnd);
    Log.i(
        TAG,
        "refreshSpinners: reset spinner selections: from='"
            + m_refFromName
            + "', to='"
            + m_refToName
            + "'");
    Log.i(
        TAG,
        "refreshSpinners Spinner values: SpinnerFrom="
            + m_spinnerFromAdapter.getNames()
            + " SpinnerTo="
            + m_spinnerToAdapter.getNames());
    Log.i(
        TAG,
        "refreshSpinners: request selections: from='"
            + m_spinnerFromAdapter.getPosition(m_refFromName)
            + "', to='"
            + m_spinnerToAdapter.getPosition(m_refToName)
            + "'");

    // restore positions
    spinnerStatTypeFrom.setSelection(m_spinnerFromAdapter.getPosition(m_refFromName), true);
    if (spinnerStatTypeTo.isShown()) {
      spinnerStatTypeTo.setSelection(m_spinnerToAdapter.getPosition(m_refToName), true);
    } else {
      spinnerStatTypeTo.setSelection(
          m_spinnerToAdapter.getPosition(Reference.CURRENT_REF_FILENAME), true);
    }
    Log.i(
        TAG,
        "refreshSpinners result positions: from='"
            + spinnerStatTypeFrom.getSelectedItemPosition()
            + "', to='"
            + spinnerStatTypeTo.getSelectedItemPosition()
            + "'");

    if ((spinnerStatTypeFrom.getSelectedItemPosition() == -1)
        || (spinnerStatTypeTo.getSelectedItemPosition() == -1)) {
      Toast.makeText(
              StatsActivity.this,
              "Selected 'from' or 'to' reference could not be loaded. Please refresh",
              Toast.LENGTH_LONG)
          .show();
    }
  }
Beispiel #15
0
 protected void onListItemClick(ListView listView, View view, int position, long id) {
   File file = fileListAdapter.getItem(position);
   if (file.isDirectory()) {
     showFileList(file);
   } else {
     mIntent.putExtra("file", file.getPath());
     mIntent.putExtra("linebreak", linebreakSpinner.getSelectedItemPosition());
     mIntent.putExtra("encoding", encoding_list.getSelectedItemPosition());
     setResult(RESULT_OK, mIntent);
     finish();
   }
 }
Beispiel #16
0
  private void getValue() {

    userID = Integer.toString(Backend.USERID);

    idTempat = tempat.getSelectedItemPosition() + 1;
    idKesalahan = kesalahan.getSelectedItemPosition() + 1;
    strTempat = Integer.toString(idTempat);
    strKesalahan = Integer.toString(idKesalahan);

    strNoMatrik = nomatrik.getText().toString();
    strNoPlat = noplat.getText().toString();
    strCatatan = catatan.getText().toString();
  }
  public void run(View view) {

    mydb.insertGood(
        name.getText().toString(),
        null,
        Long.valueOf(placeList.get(spinner.getSelectedItemPosition()).getID()).intValue(),
        Long.valueOf(typeList.get(typeSpinner.getSelectedItemPosition()).getID()).intValue(),
        "Тестовый",
        image);
    Toast.makeText(getApplicationContext(), "Сохранено успешно!", Toast.LENGTH_SHORT).show();
    name.setText(null);
    image = null;
    imgView.setImageResource(R.drawable.ic_action_camera);
  }
  private void startAddEntryScreen() {
    Intent intent = new Intent(this, AddSalesScreen.class);

    Customer customer = customers.get(customerView.getSelectedItemPosition());
    intent.putExtra(EXTRA_CUSTOMER_ID, customer.getCustomerId());

    Salesman salesman = salesmans.get(salesmanView.getSelectedItemPosition());
    intent.putExtra(EXTRA_SALESMAN_ID, salesman.getSalesmanId());

    String key = customer.getCustomerName() + salesman.getSalesmanName();
    tempSales.setKey(key);

    startActivity(intent);
  }
 // 提交数据到数据库
 public void saveSQLite() {
   ContentValues values = new ContentValues();
   values.put("year", TimeHelper.year);
   values.put("month", TimeHelper.month);
   values.put("day", TimeHelper.day);
   values.put("hour", TimeHelper.hour);
   values.put("minute", TimeHelper.minute);
   values.put("longitude", MapHelper.longitude);
   values.put("latitude", MapHelper.latitude);
   values.put("model", spnModel.getSelectedItemPosition());
   values.put("category", spnMalCategory.getSelectedItemPosition());
   values.put("name", spnMalName.getSelectedItemPosition());
   values.put("staff", edtStaff.getText().toString());
   SQLiteHelper.db.insert(SQLite.DB_NAME, null, values);
 }
  @Override
  public void updateData() {
    int vendorSpinnerSelectedPos = mVendorSpinner.getSelectedItemPosition();

    setVendorSpinnerDatas();
    setCaseSpinnerDatas(
        vendorSpinnerSelectedPos == Spinner.INVALID_POSITION || vendorSpinnerSelectedPos == 0
            ? WorkingData.getInstance(mContext).getCases()
            : mVendorSpinnerData.get(mVendorSpinner.getSelectedItemPosition()).getCases());
    setFactorySpinnerDatas();

    mCaseAdapter.notifyDataSetChanged();
    for (WorkerFragment workerFragment : mWorkerPageList) {
      workerFragment.notifyDataSetChanged();
    }
  }
Beispiel #21
0
 public int getValue() {
   int value = 0;
   if (during.isChecked()) value |= Task.NOTIFY_AT_DEADLINE;
   if (after.isChecked()) value |= Task.NOTIFY_AFTER_DEADLINE;
   if (mode.getSelectedItemPosition() == 1) value |= Task.NOTIFY_NONSTOP;
   return value;
 }
  private void setContactInfo(String content) {
    final FeedbackAgent fb = new FeedbackAgent(mContext);
    UserInfo userInfo = fb.getUserInfo();
    if (userInfo == null) {
      userInfo = new UserInfo();
    }
    Map<String, String> contact = userInfo.getContact();
    if (contact == null || contact.isEmpty()) {
      contact = new HashMap<String, String>();
    }
    int position = spContactType.getSelectedItemPosition();
    contact.put(keys[position], content);
    userInfo.setContact(contact);
    fb.setUserInfo(userInfo);

    new Thread(
            new Runnable() {
              @Override
              public void run() {
                fb.updateUserInfo();
              }
            })
        .start();
    types[position] = content;
    showContactInfo();
  }
 @Override
 public String getCurrency() {
   if (currencySpinner.getSelectedItemPosition() == 0) return null;
   String selected = (String) currencySpinner.getSelectedItem();
   if (selected.equals(CURRENCY_UNSPECIFIED)) return null;
   else return selected.toLowerCase();
 }
  @Override
  public void onClick(DialogInterface dialogInterface, int i) {
    switch (i) {
      case DialogInterface.BUTTON_POSITIVE:
        User user = mUser.isPresent() ? mUser.get() : new User();
        user.setName(mName.getText().toString())
            .setSpecialty(mSpecialty.getText().toString())
            .setSponsor(mSponsorAdapter.getItem(mSponsor.getSelectedItemPosition()))
            .saveLater();

        dismiss();
        break;
      case DialogInterface.BUTTON_NEUTRAL:
        getDialog().cancel();
        break;
      case DialogInterface.BUTTON_NEGATIVE:
        new AlertDialog.Builder(getActivity())
            .setTitle(R.string.confirm_delete)
            .setMessage(R.string.confirm_delete_message)
            .setPositiveButton(
                android.R.string.yes,
                new DialogInterface.OnClickListener() {
                  @Override
                  public void onClick(DialogInterface dialogInterface, int i) {
                    mUser.get().deleteEventually();
                    dialogInterface.dismiss();
                  }
                })
            .setNegativeButton(android.R.string.cancel, null)
            .show();
        break;
    }
  }
  private void showProxyFields() {
    WifiConfiguration config = null;

    mView.findViewById(R.id.proxy_settings_fields).setVisibility(View.VISIBLE);

    if (mAccessPoint != null && mAccessPoint.networkId != INVALID_NETWORK_ID) {
      config = mAccessPoint.getConfig();
    }

    if (mProxySettingsSpinner.getSelectedItemPosition() == PROXY_STATIC) {
      mView.findViewById(R.id.proxy_warning_limited_support).setVisibility(View.VISIBLE);
      mView.findViewById(R.id.proxy_fields).setVisibility(View.VISIBLE);
      if (mProxyHostView == null) {
        mProxyHostView = (TextView) mView.findViewById(R.id.proxy_hostname);
        mProxyHostView.addTextChangedListener(this);
        mProxyPortView = (TextView) mView.findViewById(R.id.proxy_port);
        mProxyPortView.addTextChangedListener(this);
        mProxyExclusionListView = (TextView) mView.findViewById(R.id.proxy_exclusionlist);
        mProxyExclusionListView.addTextChangedListener(this);
      }
      if (config != null) {
        ProxyProperties proxyProperties = config.linkProperties.getHttpProxy();
        if (proxyProperties != null) {
          mProxyHostView.setText(proxyProperties.getHost());
          mProxyPortView.setText(Integer.toString(proxyProperties.getPort()));
          mProxyExclusionListView.setText(proxyProperties.getExclusionList());
        }
      }
    } else {
      mView.findViewById(R.id.proxy_warning_limited_support).setVisibility(View.GONE);
      mView.findViewById(R.id.proxy_fields).setVisibility(View.GONE);
    }
  }
  WpsInfo getWpsConfig() {
    WpsInfo config = new WpsInfo();
    switch (mNetworkSetupSpinner.getSelectedItemPosition()) {
      case WPS_PBC:
        config.setup = WpsInfo.PBC;
        break;
      case WPS_KEYPAD:
        config.setup = WpsInfo.KEYPAD;
        break;
      case WPS_DISPLAY:
        config.setup = WpsInfo.DISPLAY;
        break;
      default:
        config.setup = WpsInfo.INVALID;
        Log.e(TAG, "WPS not selected type");
        return config;
    }
    config.pin = ((TextView) mView.findViewById(R.id.wps_pin)).getText().toString();
    config.BSSID = (mAccessPoint != null) ? mAccessPoint.bssid : null;

    config.proxySettings = mProxySettings;
    config.ipAssignment = mIpAssignment;
    config.linkProperties = new LinkProperties(mLinkProperties);
    return config;
  }
Beispiel #27
0
  public void guardarGasto(View view) {
    if (tvMonto.getText().toString().equals("")) return;

    int monto = Integer.parseInt(tvMonto.getText().toString());
    Spinner spinnerCategoria = (Spinner) findViewById(R.id.categoria);
    Categoria categoria = categorias.get(spinnerCategoria.getSelectedItemPosition());
    TextView tvSubcategoria = (TextView) findViewById(R.id.subcategoria);
    String subcategoria = tvSubcategoria.getText().toString();

    subcategoria = subcategoria.toLowerCase();
    subcategoria = subcategoria.trim();

    gasto.setMonto(monto);
    gasto.setCategoria(categoria);
    gasto.setSubcategoria(subcategoria);
    gasto.setSincronizado(false);

    GastosDbAdapter gastosDbAdapter = new GastosDbAdapter(this);
    gastosDbAdapter.abrir();
    gastosDbAdapter.actualizarGasto(gasto);
    gastosDbAdapter.cerrar();

    tvMonto.setText("");
    spinnerCategoria.setSelection(0);
    tvSubcategoria.setText("");

    tvMonto.clearFocus();

    Toast.makeText(this, "Gasto guardado ", Toast.LENGTH_LONG).show();
    this.finish();
  }
Beispiel #28
0
 @Override
 protected void onSaveInstanceState(Bundle outState) {
   // store position state of listview
   outState.putInt("listviewSelection", getListView().getFirstVisiblePosition());
   outState.putInt("spinnerSelection", spin_buslines.getSelectedItemPosition());
   Log.d(TAG, getListView().getFirstVisiblePosition() + " listview pos");
 }
Beispiel #29
0
 @Override
 public String writeToModel(Task task) {
   UrgencyValue item = urgencyAdapter.getItem(spinner.getSelectedItemPosition());
   if (item.dueDate != SPECIFIC_DATE) // user canceled specific date
   task.setValue(Task.DUE_DATE, item.dueDate);
   return null;
 }
  /*
   * Called when the movie Spinner gets touched.
   */
  @Override
  public void onItemSelected(AdapterView<?> parent, View view, int pos, long id) {
    Spinner spinner = (Spinner) parent;
    mSelectedMovie = spinner.getSelectedItemPosition();

    Log.d(TAG, "onItemSelected: " + mSelectedMovie + " '" + mMovieFiles[mSelectedMovie] + "'");
  }