public void UpdateExistingDetails() {

    TextView email = (TextView) findViewById(R.id.txtViewEmail);
    EditText firstName = (EditText) findViewById(R.id.editTextFirstName);
    EditText lastName = (EditText) findViewById(R.id.editTextLastName);
    EditText nickName = (EditText) findViewById(R.id.editTextNickName);
    EditText age = (EditText) findViewById(R.id.editTextAge);
    Spinner spinner = (Spinner) findViewById(R.id.spinnerLang);
    email.setText(this.user.email);
    firstName.setText(this.user.firstName);
    lastName.setText(this.user.lastName);
    nickName.setText(this.user.nickName);
    age.setText(this.user.Age);
    ArrayAdapter<String> spinnerAdapter = (ArrayAdapter<String>) spinner.getAdapter();
    spinner.setSelection(spinnerAdapter.getPosition(this.user.lang));
    Spinner spinner2 = (Spinner) findViewById(R.id.PerrmissionSpinner);
    TextView Perr = (TextView) findViewById(R.id.txtPerr);
    if (perrmission.equals("2")) {

      ArrayAdapter<String> spinnerAdapter2 = (ArrayAdapter<String>) spinner2.getAdapter();
      if (user.Permission.equals("1")) {

        spinner.setSelection(spinnerAdapter2.getPosition("Basic User"));
      } else {
        spinner.setSelection(spinnerAdapter2.getPosition("Admin"));
      }
      Perr.setVisibility(View.VISIBLE);
      spinner2.setVisibility(View.VISIBLE);
    } else {
      spinner2.setVisibility(View.GONE);
      Perr.setVisibility(View.GONE);
    }
  }
예제 #2
0
  private void showCustomEndpointDialog(final int originalSelection, String defaultUrl) {
    View view = LayoutInflater.from(app).inflate(R.layout.debug_drawer_network_endpoint, null);
    final EditText url = findById(view, R.id.debug_drawer_network_endpoint_url);
    url.setText(defaultUrl);
    url.setSelection(url.length());

    new AlertDialog.Builder(getContext()) //
        .setTitle("Set Network Endpoint")
        .setView(view)
        .setNegativeButton(
            "Cancel",
            (dialog, i) -> {
              endpointView.setSelection(originalSelection);
              dialog.cancel();
            })
        .setPositiveButton(
            "Use",
            (dialog, i) -> {
              String theUrl = url.getText().toString();
              if (!Strings.isBlank(theUrl)) {
                setEndpointAndRelaunch(theUrl);
              } else {
                endpointView.setSelection(originalSelection);
              }
            })
        .setOnCancelListener(
            (dialogInterface) -> {
              endpointView.setSelection(originalSelection);
            })
        .show();
  }
예제 #3
0
  private void setSpinnerSelection(Spinner spinner) {
    final ArrayList<Sprite> spriteList =
        (ArrayList<Sprite>) ProjectManager.getInstance().getCurrentProject().getSpriteList();

    if (spriteList.contains(pointedObject)) {
      oldSelectedObject = pointedObject.getName();
      spinner.setSelection(
          ((SpinnerAdapterWrapper) spinner.getAdapter())
              .getAdapter()
              .getPosition(pointedObject.getName()),
          true);
    } else {
      if (oldSelectedObject != null && !oldSelectedObject.equals("")) {
        spinner.setSelection(
            ((SpinnerAdapterWrapper) spinner.getAdapter())
                .getAdapter()
                .getPosition(this.oldSelectedObject),
            true);
      } else {
        if (spinner.getAdapter().getCount() > 1) {
          spinner.setSelection(1, true);
        } else {
          spinner.setSelection(0, true);
        }
      }
    }
  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_add_event);

    // get edit texts
    event_name = (EditText) findViewById(R.id.event_name);
    location = (AutoCompleteTextView) findViewById(R.id.autoCompleteTextLocation);
    Start_Date = (EditText) findViewById(R.id.Start_Date);
    Start_Time = (EditText) findViewById(R.id.Start_Time);
    End_Date = (EditText) findViewById(R.id.End_Date);
    End_Time = (EditText) findViewById(R.id.End_Time);
    description = (EditText) findViewById(R.id.description);

    // AutoComplete TextView
    AutoCompleteTextView autoCompleteTextViewLocation =
        (AutoCompleteTextView) findViewById(R.id.autoCompleteTextLocation);
    autoCompleteTextViewLocation.setAdapter(
        new GooglePlacesAutocompleteAdapter(this, R.layout.activity_add_event_location_list));
    autoCompleteTextViewLocation.setOnItemClickListener(this);

    // spinnerCategory
    spinnerCategory = (Spinner) findViewById(R.id.category);
    spinnerCategory.setSelection(0);
    arrayAdapterCategory =
        ArrayAdapter.createFromResource(this, R.array.category_names, R.layout.spinner_item);
    spinnerCategory.setAdapter(arrayAdapterCategory);
    // spinnerType
    spinnerType = (Spinner) findViewById(R.id.type);
    spinnerType.setSelection(0);
    arrayAdapterType =
        ArrayAdapter.createFromResource(this, R.array.type_names, R.layout.spinner_item);
    spinnerType.setAdapter(arrayAdapterType);
  }
예제 #5
0
  @Override
  public void initView() {
    // TODO Auto-generated method stub
    initBaseView("电台参数设置");
    Btn_Left.setOnClickListener(this);
    Btn_Right.setBackgroundResource(R.drawable.btsure);
    Btn_Right.setOnClickListener(this);

    edit_senddelay = (EditText) findViewById(R.id.edit_senddelay);
    edit_recvdelay = (EditText) findViewById(R.id.edit_recedelay);
    sp_type = (Spinner) findViewById(R.id.sp_casttype);
    sp_power = (Spinner) findViewById(R.id.sp_casrpower);

    ArrayAdapter<String> typeadapter =
        new ArrayAdapter<String>(mContext, android.R.layout.simple_spinner_dropdown_item, Type);
    sp_type.setAdapter(typeadapter);

    ArrayAdapter<String> poweradapter =
        new ArrayAdapter<String>(mContext, android.R.layout.simple_spinner_dropdown_item, Power);
    sp_power.setAdapter(poweradapter);

    edit_senddelay.setText(sp.getString(senddeley, ""));
    edit_recvdelay.setText(sp.getString(recvdeley, ""));

    sp_power.setSelection(sp.getInt(powerindex, 0));
    sp_type.setSelection(sp.getInt(typeindex, 0));
  }
  public void setSelectedInfo(String provinceId, String cityId) {
    if (this.dtoList == null) return;

    try {
      for (int i = 0; i < this.dtoList.size(); i++) {
        if (this.dtoList.get(i).getId() == Integer.parseInt(provinceId)) {
          provinceSpinner.setSelection(i);
          provinceTextView.setText(this.dtoList.get(i).getName());

          provinceSelectedIndex = i;

          List<TreeNodeAppDto> childList = this.dtoList.get(i).getChilds();
          for (int j = 0; j < childList.size(); j++) {
            if (childList.get(j).getId() == Integer.parseInt(cityId)) {
              citySelectedIndex = j;

              citySpinner.setSelection(j);
              cityTextView.setText(childList.get(j).getName());

              return;
            }
          }
        }
      }
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
  @Override
  public void onResume() {
    super.onResume();
    if (mode == Mode.STANDARD) {
      sharedPreferences =
          getSharedPreferences(
              Constants.LOG_TAG + "_preferences", MODE_MULTI_PROCESS | MODE_PRIVATE);
      if (sharedPreferences.getBoolean(Constants.PREFERENCE_TASKER_SET, false)) {
        tvTaskerNotice.setVisibility(View.VISIBLE);
      }
      spMode.setSelection(
          sharedPreferences.getInt(Constants.PREFERENCE_MODE, Constants.Mode.OFF.ordinal()));

      // legacy preference handler
      if (sharedPreferences.contains(Constants.PREFERENCE_EXCLUDE_MODE)) {
        if (sharedPreferences.getBoolean(Constants.PREFERENCE_EXCLUDE_MODE, false)) {
          spMode.setSelection(Constants.Mode.INCLUDE.ordinal());
        } else {
          spMode.setSelection(Constants.Mode.EXCLUDE.ordinal());
        }
      }
    } else if (mode == Mode.LOCALE) {
      if (localeBundle != null) {
        spMode.setSelection(
            localeBundle.getInt(Constants.BUNDLE_EXTRA_INT_MODE, Constants.Mode.OFF.ordinal()));
      }
    }
    checkAccessibilityService();

    if (findViewById(R.id.listPackages).isEnabled()) {
      new LoadAppsTask().execute();
    }
  }
예제 #8
0
 private void loadFromMembers() {
   editName.setText(((memberVariables) ((Activity) this).getApplication()).getName());
   editAmount.setText(((memberVariables) ((Activity) this).getApplication()).getSize());
   oCategorySpinner.setSelection(
       categorySpinnerAdapter.getPosition(
           ((memberVariables) ((Activity) this).getApplication()).getCategory()));
   oPositionSpinner.setSelection(
       positionSpinnerAdapter.getPosition(
           ((memberVariables) ((Activity) this).getApplication()).getPosition()));
   oUnitsSpinner.setSelection(
       unitSpinnerAdapter.getPosition(
           ((memberVariables) ((Activity) this).getApplication()).getUnit()));
   // additionalInformation.setText(((memberVariables) ((Activity)
   // this).getApplication()).getAdditional());
   int duration;
   if (((memberVariables) ((Activity) this).getApplication()).getDuration() != null) {
     duration =
         Integer.parseInt(((memberVariables) ((Activity) this).getApplication()).getDuration());
     duration =
         Integer.parseInt(((memberVariables) ((Activity) this).getApplication()).getDuration());
     long millis = System.currentTimeMillis();
     long durationInMillis = duration * 24 * 60 * 60 * 1000;
     SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
     Date expireDate = new Date();
     expireDate.setTime(durationInMillis + millis);
     String expireDateFormatted = sdf.format(expireDate);
     dateEdit.setText(expireDateFormatted);
   }
 }
예제 #9
0
  @Override
  public void onCreate(Bundle savedInstanceState) {

    // Grab Existing Settings
    // Speed Setting is Stored in a Different File Because It Should Not Be Synced Across Devices
    userPreferences = getSharedPreferences("settings", 0);
    int theme = userPreferences.getInt("theme", 0);
    int controls = userPreferences.getInt("controls", 0);
    int view = userPreferences.getInt("view", 0);
    speedSetting = getSharedPreferences("speed", 0);
    int speed = speedSetting.getInt("speed", 0);

    // Set Dark Theme
    if (theme == 1) setTheme(android.R.style.Theme_Holo);

    super.onCreate(savedInstanceState);
    setContentView(R.layout.options);

    // Grab Settings Spinners
    themeSpinner = (Spinner) findViewById(R.id.spinnerTheme);
    controlsSpinner = (Spinner) findViewById(R.id.spinnerControls);
    viewSpinner = (Spinner) findViewById(R.id.spinnerView);
    speedSpinner = (Spinner) findViewById(R.id.spinnerSpeed);

    // Set Spinner Current Values
    themeSpinner.setSelection(theme);
    controlsSpinner.setSelection(controls);
    viewSpinner.setSelection(view);
    speedSpinner.setSelection(speed);
  }
  public void loadSettings() {
    // if does not exist load default
    SharedPreferences settings = getActivity().getSharedPreferences(PREF_TITLE, 0);
    StringBuilder sb = new StringBuilder();
    et_serv.setText(settings.getString(PREF_URL, DEFAULT_URL));
    et_user.setText(settings.getString(PREF_USER, DEFAULT_USER));
    et_pass.setText(settings.getString(PREF_PASS, DEFAULT_PASS));
    et_thread.setText(sb.append(settings.getInt(PREF_THREAD, DEFAULT_THREAD)).toString());
    sb.setLength(0);
    sb_throttle.setProgress((int) (settings.getFloat(PREF_THROTTLE, DEFAULT_THROTTLE) * 100));
    et_scanTime.setText(sb.append(settings.getLong(PREF_SCANTIME, DEFAULT_SCANTIME)).toString());
    sb.setLength(0);
    et_retryPause.setText(
        sb.append(settings.getLong(PREF_RETRYPAUSE, DEFAULT_RETRYPAUSE)).toString());
    cb_service.setChecked(settings.getBoolean(PREF_BACKGROUND, DEFAULT_BACKGROUND));
    cb_donate.setChecked(settings.getBoolean(PREF_DONATE, DEFAULT_DONATE));

    if (settings.getInt(PREF_PRIORITY, DEFAULT_PRIORITY) == Thread.MIN_PRIORITY) {
      spn_priority.setSelection(0);
    }
    if (settings.getInt(PREF_PRIORITY, DEFAULT_PRIORITY) == Thread.NORM_PRIORITY) {
      spn_priority.setSelection(1);
    }
    if (settings.getInt(PREF_PRIORITY, DEFAULT_PRIORITY) == Thread.MAX_PRIORITY) {
      spn_priority.setSelection(2);
    }

    Toast.makeText(getActivity(), "Settings Loaded", Toast.LENGTH_SHORT).show();
  }
  @Override
  public void updateView() {
    if (spinnerSetGov == null) {
      // we have no been created yet
      return;
    }
    IGovernorModel governorModel = getGovernorModel();
    String curGov = governorModel.getGov();
    if (spinnerSetGov == null) {
      // we have no been created yet
      return;
    }
    for (int i = 0; i < availCpuGovs.length; i++) {
      if (curGov.equals(availCpuGovs[i])) {
        spinnerSetGov.setSelection(i);
      }
    }
    tvExplainGov.setText(GuiUtils.getExplainGovernor(getActivity(), curGov));
    if (SettingsStorage.getInstance().isPowerUser()) {
      etScript.setText(governorModel.getScript());
    }
    sbPowersaveBias.setProgress(governorModel.getPowersaveBias());
    updateGovernorFeatures();

    int position = numberOfCpus - governorModel.getUseNumberOfCpus();
    if (spUseCpus != null && position < spUseCpus.getAdapter().getCount()) {
      spUseCpus.setSelection(position);
    }
  }
 public void setData(Bundle savedInstanceState) {
   if (savedInstanceState == null) {
     spnModel.setSelection(pref.getInt(Malfunction.PREF_MODEL, 0));
   } else {
     spnModel.setSelection(savedInstanceState.getInt(Malfunction.PREF_MODEL, 0));
   }
   edtStaff.setText(pref.getString(Malfunction.PREF_STAFF, ""));
 }
예제 #13
0
  public void setValue(int flags) {
    during.setChecked((flags & Task.NOTIFY_AT_DEADLINE) > 0);
    after.setChecked((flags & Task.NOTIFY_AFTER_DEADLINE) > 0);

    if ((flags & Task.NOTIFY_MODE_NONSTOP) > 0) mode.setSelection(2);
    else if ((flags & Task.NOTIFY_MODE_FIVE) > 0) mode.setSelection(1);
    else mode.setSelection(0);
  }
예제 #14
0
 /**
  * Setzt die input felder auf den aktuellen Wert, falls einer vorhanden ist.
  *
  * @throws SQLException
  */
 private void setSettings() throws SQLException {
   etName.setText(kvr.getKeyValue("userName").getString(1));
   if (kvr.getKeyValue("userGender").getString(1) == "Male") {
     spGender.setSelection(0);
   } else {
     spGender.setSelection(1);
   }
 }
  private void populateFillIn() {
    String databaseString;
    // Sets CharacterName
    databaseString = player.getName();
    if (databaseString != null) {
      EditText characterName = (EditText) findViewById(R.id.editText_character_name);
      characterName.setText(databaseString);
    }

    // Sets PlayerName
    databaseString = player.getPlayerName();
    if (databaseString != null) {
      EditText playerName = (EditText) findViewById(R.id.editText_player_name);
      playerName.setText(databaseString);
    }

    // Sets religion
    databaseString = player.getReligion();
    if (databaseString != null) {
      EditText religion = (EditText) findViewById(R.id.editText_religion);
      religion.setText(databaseString);
    }

    // sets class
    databaseString = player.getClassName();
    if (databaseString != null) {
      int spinnerPosition = ClassAdapter.getPosition(databaseString);
      Class_spinner.setSelection(spinnerPosition);
    }

    // sets race
    databaseString = player.getRace();
    if (databaseString != null) {
      int spinnerPosition = RaceAdapter.getPosition(databaseString);
      Race_spinner.setSelection(spinnerPosition);
    }

    // sets alignment
    databaseString = player.getAlignment();
    if (databaseString != null) {
      int spinnerPosition = AlignmentAdapter.getPosition(databaseString);
      Alignment_spinner.setSelection(spinnerPosition);
    }

    // Sets Height
    databaseString = player.getHeight();
    if (databaseString != null) {
      EditText height = (EditText) findViewById(R.id.editText_Height);
      height.setText(databaseString);
    }

    // sets weight
    databaseString = player.getWeight();
    if (databaseString != null) {
      EditText weight = (EditText) findViewById(R.id.editText_Weight);
      weight.setText(databaseString);
    }
  }
  private void updateUIFromPrefernces() {
    boolean autoUpChecked = prefs.getBoolean(PREF_AUTO_UPDATE, false);
    int updateFreqIndex = prefs.getInt(PREF_UPDATE_FREQ_INDEX, 2);
    int minMagIndex = prefs.getInt(PREF_MIN_MAG_INDEX, 0);

    updateFreqSpinner.setSelection(updateFreqIndex);
    magnitudeSpinner.setSelection(minMagIndex);
    autoUpdate.setChecked(autoUpChecked);
  }
 /**
  * Build the current label state based on selected {@link EditType} and possible custom label
  * string.
  */
 private void rebuildLabel() {
   mEditTypeAdapter = new EditTypeAdapter(mContext);
   mLabel.setAdapter(mEditTypeAdapter);
   if (mEditTypeAdapter.hasCustomSelection()) {
     mLabel.setSelection(mEditTypeAdapter.getPosition(CUSTOM_SELECTION));
   } else {
     mLabel.setSelection(mEditTypeAdapter.getPosition(mType));
   }
 }
예제 #18
0
  /** Performs all necessary processing when this activity is started or resumed. */
  @Override()
  protected void onResume() {
    logEnter(LOG_TAG, "onResume");

    super.onResume();

    setContentView(R.layout.layout_define_server);
    setTitle(R.string.activity_label);

    // Populate the server ID and make it disabled so it cannot be edited.
    final EditText idField = (EditText) findViewById(R.id.layout_define_server_field_id);
    idField.setText(id);
    idField.setEnabled(false);

    // Populate the server address.
    final EditText hostField = (EditText) findViewById(R.id.layout_define_server_field_host);
    hostField.setText(host);

    // Populate the server port.
    final EditText portField = (EditText) findViewById(R.id.layout_define_server_field_port);
    portField.setText(String.valueOf(port));

    // Populate the list of available security mechanisms.
    final Spinner secSpinner = (Spinner) findViewById(R.id.layout_define_server_spinner_security);
    final ArrayAdapter<CharSequence> secAdapter =
        ArrayAdapter.createFromResource(
            this, R.array.edit_server_security_type_list, android.R.layout.simple_spinner_item);
    secAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    secSpinner.setAdapter(secAdapter);
    if (useSSL) {
      secSpinner.setSelection(1);
    } else if (useStartTLS) {
      secSpinner.setSelection(2);
    } else {
      secSpinner.setSelection(0);
    }

    // Populate the bind DN.
    final EditText bindDNField = (EditText) findViewById(R.id.layout_define_server_field_bind_dn);
    bindDNField.setText(bindDN);

    // Populate the bind Password.
    final EditText bindPWField = (EditText) findViewById(R.id.layout_define_server_field_bind_pw);
    bindPWField.setText(bindPW);

    // Populate the base DN.
    final EditText baseDNField = (EditText) findViewById(R.id.layout_define_server_field_base);
    baseDNField.setText(baseDN);

    // Add an on-click listener to the test and save buttons.
    final Button testButton = (Button) findViewById(R.id.layout_define_server_button_server_test);
    testButton.setOnClickListener(this);

    final Button saveButton = (Button) findViewById(R.id.layout_define_server_button_server_save);
    saveButton.setOnClickListener(this);
  }
예제 #19
0
  @SuppressWarnings("unchecked")
  private void markTodayMonthYearSelected() {
    Calendar today = Calendar.getInstance();

    ArrayAdapter<String> yearSpinnerAdapter = (ArrayAdapter<String>) yearSpinner.getAdapter();
    int spinnerPosition = yearSpinnerAdapter.getPosition(String.valueOf(today.get(Calendar.YEAR)));
    yearSpinner.setSelection(spinnerPosition);

    monthSpinner.setSelection(today.get(Calendar.MONTH)); // Van de 0 a 11 las dos cosas...
  }
 private void m86a(View view, DeviceConfiguration deviceConfiguration) {
   Spinner spinner = (Spinner) view.findViewById(R.id.choiceSpinner_analogOutput);
   ArrayAdapter arrayAdapter = (ArrayAdapter) spinner.getAdapter();
   if (deviceConfiguration.isEnabled()) {
     spinner.setSelection(arrayAdapter.getPosition(deviceConfiguration.getType().toString()));
   } else {
     spinner.setSelection(0);
   }
   spinner.setOnItemSelectedListener(this.f125e);
 }
  private void a(View var1, DeviceConfiguration var2) {
    Spinner var3 = (Spinner) var1.findViewById(R.id.choiceSpinner_digital_device);
    ArrayAdapter var4 = (ArrayAdapter) var3.getAdapter();
    if (var2.isEnabled()) {
      var3.setSelection(var4.getPosition(var2.getType().toString()));
    } else {
      var3.setSelection(0);
    }

    var3.setOnItemSelectedListener(this.k);
  }
예제 #22
0
 public void reset(View view) {
   mEmailView.setText("");
   mUserNameView.setText("");
   mPasswordView.setText("");
   mManagerEmailView.setText("");
   mEmailView.setError(null);
   mUserNameView.setError(null);
   mPasswordView.setError(null);
   mManagerEmailView.setError(null);
   mRoleSpinner.setSelection(0);
   mTeamSpinner.setSelection(0);
 }
예제 #23
0
 /*
  * update the screen to match the value stored in mbackgroundColor
  */
 private void updateColor() {
   mBackgroundColorLabel.setText(mBackgroundColor);
   if (mBackgroundColor.equals("Red")) {
     mColorSpinner.setSelection(0);
   } else if (mBackgroundColor.equals("Green")) {
     mColorSpinner.setSelection(1);
   } else if (mBackgroundColor.equals("Blue")) {
     mColorSpinner.setSelection(2);
   } else if (mBackgroundColor.equals("Yellow")) {
     mColorSpinner.setSelection(3);
   }
 }
예제 #24
0
 private void setSpinnerSelection(Spinner spinner, long[] ids, Long id) {
   if (id == null || id == 0) {
     spinner.setSelection(0);
   } else {
     for (int i = 1; i < ids.length; i++) {
       if (ids[i] == id) {
         spinner.setSelection(i);
         break;
       }
     }
   }
 }
예제 #25
0
  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();
    }
  }
예제 #26
0
  public void setCurrentTime() {

    LocalTime nowHours = new LocalTime();
    LocalDate nowDate = new LocalDate();

    try {
      // TODO - Fetch the preference for this boolean
      typeHour = mPrefs.getTypeHourPlan();
      boolean biHour = (new TypeHourEnum(typeHour)).isBiHour();

      Period s = edp.checkCurrentPeriod(nowHours, nowDate, selectedPlan, biHour);
      PricePlan price = s.getPrice();

      if (biHour == false) {
        makeAllVisible();
        if (price.isVazio()) {
          highlight(tvVazio);
        } else if (price.isCheia()) {
          highlight(tvCheia);
        } else if (price.isPonta()) {
          highlight(tvPonta);
        }
      } else if (biHour == true) {
        erase(tvCheia);
        if (price.isVazio()) {
          highlight(tvVazio);
        } else {
          highlight(tvPonta);
        }
      }

      if (selectedPlan.equals("BTN Ciclo Semanal")) {
        spinner.setSelection(0);
      } else {
        spinner.setSelection(1);
      }

      int startHour = s.getHours().getStartHour();
      int startMinute = s.getHours().getStartMinute();
      int endHour = s.getHours().getEndHour();
      int endMinute = s.getHours().getEndMinute();

      tvStart.setText(String.format(Locale.US, "%02dh%02dm", startHour, startMinute));
      tvEnd.setText(String.format(Locale.US, "%02dh%02dm", endHour, endMinute));
      Log.e(Constants.LOG, String.format(Locale.US, "Period: %s", s.toString()));

    } catch (DayWithoutPlanException e) {
      Log.e(Constants.LOG, e.getMessage());
    } catch (PlanNotFoundException e) {
      Log.e(Constants.LOG, e.getMessage());
    }
  }
예제 #27
0
    @Override
    public View onCreateView(
        LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
      View rootView = inflater.inflate(R.layout.fragment_pingandconnect, container, false);
      // rootView.setBackgroundColor(Color.MAGENTA);

      _networkController = ((MainActivity) getActivity()).networkController;
      // _networkTimeTextView = (TextView)rootView.findViewById(R.id.textView2);
      _listView = (ListView) rootView.findViewById(R.id.listView1);
      _adapter =
          new ArrayAdapter<String>(
              getActivity(), android.R.layout.simple_list_item_1, _userNamesList);
      _listView.setAdapter(_adapter);
      _enablePingAndConnectSwitch = (Switch) rootView.findViewById(R.id.switch1);

      _enablePingAndConnectSwitch.setOnCheckedChangeListener(
          new OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
              _networkController.pingAndConnectManager.setEnabled(isChecked);
            }
          });

      Spinner spinner = (Spinner) rootView.findViewById(R.id.playernumber_spinner);
      // Create an ArrayAdapter using the string array and a default spinner layout
      String[] spinnerStrings =
          new String[] {
            "server", "none", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13",
            "14", "15", "16"
          };
      ArrayAdapter<String> adapter =
          new ArrayAdapter<String>(
              getActivity(), android.R.layout.simple_spinner_item, spinnerStrings);
      // Specify the layout to use when the list of choices appears
      adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
      // Apply the adapter to the spinner
      spinner.setAdapter(adapter);
      spinner.setSelection(1); // default = 1 = "none"
      spinner.setOnItemSelectedListener(this);

      // set checked state in case we arriving and ping and connect is running.
      if (_networkController.pingAndConnectManager.isEnabled()) {
        _enablePingAndConnectSwitch.setChecked(true);
        // refresh my player number
        int num = _networkController.pingAndConnectManager.getPlayerNumber();
        spinner.setSelection(num + 1);
        _networkController.pingAndConnectManager.updateUserState(); // send me a user update
      }

      return rootView;
    }
예제 #28
0
 private void showEpdgConfig() {
   EpdgConfig epdgConfig = mEpdgManager.getConfiguration(mEpdgApnType);
   mEpdgAuthType = epdgConfig.authType;
   mEdpgAuthSpinner.setSelection(epdgConfig.authType - 1);
   mEpdgSimIndex = epdgConfig.simIndex;
   mEpdgSimSpinner.setSelection(epdgConfig.simIndex - 1);
   mEpdgMobiltyProtcol = epdgConfig.mobilityProtocol;
   mEpdgMpSpinner.setSelection(epdgConfig.mobilityProtocol - 1);
   mEdpgServerAddress.setText(epdgConfig.edpgServerAddress);
   mEpdgCertPath.setText(epdgConfig.certPath);
   mEpdgIkeAlgo.setText(epdgConfig.ikeaAlgo);
   mEpdgEspAlgo.setText(epdgConfig.espAlgo);
   Log.i(TAG, "epdgConfig:" + epdgConfig);
 }
  private void detect() {
    String[] segs;
    FileReader fstream;
    long Read;

    try {
      fstream = new FileReader(path);
      Log.d("VselCalc_AutoD", "Opened '" + path + "' file correctly");
    } catch (FileNotFoundException e) {
      Toast.makeText(getApplicationContext(), "Could not read " + path, Toast.LENGTH_LONG).show();
      stop = true;
      return;
    }

    BufferedReader in = new BufferedReader(fstream, 500);
    String line;
    try {
      while ((line = in.readLine()) != null) {

        Log.d("VselCalc_AutoD", "line read:" + line);
        segs = line.trim().split(" ");
        Log.d("VselCalc_AutoD", "segs length: " + segs.length);
        Read = Long.parseLong(segs[0]);
        Log.d("VselCalc_AutoD", "Auto-Detect freq. Read1: " + Read);
        detected_freq1 = (int) Read / 1000;
        Read = Long.parseLong(segs[1]);
        Log.d("VselCalc_AutoD", "Auto-Detect freq. Read2: " + Read);
        detected_freq2 = (int) Read / 1000;
        Read = Long.parseLong(segs[2]);
        Log.d("VselCalc_AutoD", "Auto-Detect freq. Read3: " + Read);
        detected_freq3 = (int) Read / 1000;
        Log.d("VselCalc_AutoD", "freq4 or not: " + freq4ornot);
        hide_row4();
        spinner.setSelection(0);
        if (segs.length == 4) {
          Read = Long.parseLong(segs[3]);
          Log.d("VselCalc_AutoD", "Freq4 exists. Auto-Detect freq. Read4: " + Read);
          detected_freq4 = (int) Read / 1000;
          freq4ornot = true;
          spinner.setSelection(1);
          Log.d("VselCalc_AutoD", "freq4ornot changed to true after auto-detect");
          show_row4();
        }
      }
    } catch (IOException e) {
      Log.e("readfile", e.toString());
    }
    return;
  }
예제 #30
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    setContentView(R.layout.repoconfig);
    Spinner repositoriesSpinner = (Spinner) findViewById(R.id.repositories);
    ArrayAdapter<CharSequence> repositories =
        ArrayAdapter.createFromResource(
            this, R.array.repositories, android.R.layout.simple_spinner_item);
    repositories.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    repositoriesSpinner.setAdapter(repositories);
    repositoriesSpinner.setSelection(repositories.getPosition(MinistroService.getRepository(this)));
    repositoriesSpinner.setOnItemSelectedListener(
        new OnItemSelectedListener() {
          public void onItemSelected(AdapterView<?> parent, View view, int pos, long id) {
            Toast.makeText(
                    parent.getContext(),
                    getResources()
                        .getString(
                            R.string.ministro_repository_msg,
                            parent.getItemAtPosition(pos).toString()),
                    Toast.LENGTH_SHORT)
                .show();
            MinistroService.setRepository(
                MinistroConfigActivity.this, parent.getItemAtPosition(pos).toString());
          }

          public void onNothingSelected(AdapterView<?> arg0) {}
        });

    Spinner checkFrequencySpinner = (Spinner) findViewById(R.id.check_frequency);
    ArrayAdapter<CharSequence> checkFrequency =
        ArrayAdapter.createFromResource(
            this, R.array.check_frequency, android.R.layout.simple_spinner_item);
    checkFrequency.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    checkFrequencySpinner.setAdapter(checkFrequency);
    checkFrequencySpinner.setSelection(
        checkFrequency.getPosition(MinistroService.getCheckFrequency(this).toString()));
    checkFrequencySpinner.setOnItemSelectedListener(
        new OnItemSelectedListener() {
          public void onItemSelected(AdapterView<?> parent, View view, int pos, long id) {
            MinistroService.setCheckFrequency(
                MinistroConfigActivity.this,
                Long.parseLong(parent.getItemAtPosition(pos).toString()));
          }

          public void onNothingSelected(AdapterView<?> arg0) {}
        });
    super.onCreate(savedInstanceState);
  }