public void prevactivity_skipping(View view) {

    if (skip_pressed == true) {
      SharedPreferences.Editor editor = sharedpreferences.edit();
      editor.putString("Radiobuttonteaming1", "NA");
      editor.putString("Radiobuttonteaming2", "NA");
      editor.putString("Teamingskipped", "skipped");
      editor.commit();
      Intent intent = new Intent(this, RecordSkipping.class);
      intent.putExtra("activity", "prevskipping");
      intent.putExtra("TesterName", user_name);
      startActivity(intent);
    } else {
      rgrp1 = (RadioGroup) findViewById(R.id.rgrp1);
      radioButtonID1 = rgrp1.getCheckedRadioButtonId();

      rgrp2 = (RadioGroup) findViewById(R.id.rgrp2);
      radioButtonID2 = rgrp2.getCheckedRadioButtonId();
      //            if (radioButtonID1 == -1 || radioButtonID2 == -1)
      //                Toast.makeText(getBaseContext(), "Please select one option from each type
      // !", Toast.LENGTH_LONG).show();
      //            else {
      SharedPreferences.Editor editor = sharedpreferences.edit();
      editor.putInt("teamingidround1", radioButtonID1);
      editor.putInt("teamingidround2", radioButtonID2);
      editor.putString("Teamingskipped", "notskipped");
      editor.commit();
      Intent intent = new Intent(this, RecordSkipping.class);
      intent.putExtra("activity", "prevskipping");
      intent.putExtra("TesterName", user_name);
      startActivity(intent);
      // }
    }
  }
Esempio n. 2
0
  @Override
  public void onClick(View v) {
    if (v == mBtnSet) {
      int seIdx = SE_MODE_STATUS_OFF;
      if (mGpSE1.isEnabled()) {
        seIdx = getSEIdx(mGpSE1.getCheckedRadioButtonId());
      } else if (mGpSE2.isEnabled()) {
        seIdx = getSEIdx(mGpSE2.getCheckedRadioButtonId());
      } else {
        return;
      }
      int setSeResult = setSEOption(seIdx);
      if (NfcCommonDef.ERROR_OK == setSeResult) {
        Toast.makeText(getApplicationContext(), android.R.string.ok, Toast.LENGTH_LONG).show();

      } else if (NfcCommonDef.ERROR_ERROR == setSeResult) {
        Toast.makeText(getApplicationContext(), "Response is null.", Toast.LENGTH_LONG).show();
      } else {
        // Set Error. return status != 0.
        Toast.makeText(
                getApplicationContext(), "Response status is: " + setSeResult, Toast.LENGTH_LONG)
            .show();
      }
    }
  }
Esempio n. 3
0
  /** Save results of the current view(question) into the result array. */
  private void saveResult() throws IllegalArgumentException {

    switch (viewTypeArray[currentView - 1]) {
      case MCQuestion:
        RadioGroup radioGroup = (RadioGroup) findViewById(R.id.mcRadioGroup);
        resultList[currentView - 1] = new ArrayList<Integer>();
        if (radioGroup.getCheckedRadioButtonId() == -1) throw new IllegalArgumentException();
        else
          resultList[currentView - 1].add(
              radioGroup.indexOfChild(findViewById(radioGroup.getCheckedRadioButtonId())));
        break;
      case ScalarQuestion:
        SeekBar seekBar = (SeekBar) findViewById(R.id.scalarSeekBar);
        resultList[currentView - 1] = new ArrayList<Integer>();
        resultList[currentView - 1].add(seekBar.getProgress() + 1);
        break;
      case MAQuestion:
        LinearLayout checkBoxView = (LinearLayout) findViewById(R.id.ma_checkBoxView);

        resultList[currentView - 1] = new ArrayList<Integer>();
        for (int i = 0; i < checkBoxView.getChildCount(); i++) {
          if (((CheckBox) checkBoxView.getChildAt(i)).isChecked())
            resultList[currentView - 1].add(i);
        }
        break;
      default:
        throw new IllegalArgumentException("Unknown view type");
    }
  }
Esempio n. 4
0
 public void startPvE(View v) {
   RadioButton Easy = (RadioButton) findViewById(R.id.Easy);
   RadioButton Normal = (RadioButton) findViewById(R.id.Normal);
   RadioButton Hard = (RadioButton) findViewById(R.id.Hard);
   RadioButton Player = (RadioButton) findViewById(R.id.Player);
   RadioButton AI = (RadioButton) findViewById(R.id.AI);
   int checkedId = Difficulty.getCheckedRadioButtonId();
   int checkedSh = Shot.getCheckedRadioButtonId();
   // find which radioButton is checked by id
   if (checkedId == Easy.getId() && checkedSh == Player.getId()) {
     Intent intent = new Intent(MainConfig.this, Easy.class);
     startActivity(intent);
   } else if (checkedId == Normal.getId() && checkedSh == Player.getId()) {
     Intent intent = new Intent(MainConfig.this, Normal.class);
     startActivity(intent);
   } else if (checkedId == Hard.getId() && checkedSh == Player.getId()) {
     Intent intent = new Intent(MainConfig.this, Hard.class);
     startActivity(intent);
   } else if (checkedId == Easy.getId() && checkedSh == AI.getId()) {
     Intent intent = new Intent(MainConfig.this, EasyAI.class);
     startActivity(intent);
   } else if (checkedId == Normal.getId() && checkedSh == AI.getId()) {
     Intent intent = new Intent(MainConfig.this, NormalAI.class);
     startActivity(intent);
   } else if (checkedId == Hard.getId() && checkedSh == AI.getId()) {
     /*Toast.makeText(getApplicationContext(), "choice: Hard+AI",
     Toast.LENGTH_SHORT).show();*/
     Intent intent = new Intent(MainConfig.this, HardAI.class);
     startActivity(intent);
   }
 }
Esempio n. 5
0
  private boolean validar() {

    if (miembrohogar.EdadAnios > 5) {

      if (rgOcupacion.getCheckedRadioButtonId() == -1) {

        Toast.makeText(getBaseContext(), "Ocupación es Requerida", Toast.LENGTH_LONG).show();
        return false;

      } else {

        if (conecciondb.getCodigoOcupacionesById(rgOcupacion.getCheckedRadioButtonId()) == 5
            || conecciondb.getCodigoOcupacionesById(rgOcupacion.getCheckedRadioButtonId()) == 11
            || conecciondb.getCodigoOcupacionesById(rgOcupacion.getCheckedRadioButtonId()) == 12) {
          // Es Femenina , Responder Sexo
          if (rgMotivoNoTrabajo.getCheckedRadioButtonId() == -1) {

            Toast.makeText(
                    getBaseContext(), "Motivo de No Trabajo es Obligatorio", Toast.LENGTH_LONG)
                .show();
            return false;

          } else {
            return true;
          }

        } else {
          return true;
        }
      }

    } else {
      return true;
    }
  }
Esempio n. 6
0
  public void onClickAdd(View v) {

    // prepare parameters
    int floorId = floorGroup.getCheckedRadioButtonId();
    int roomId;
    try {
      roomId = Integer.parseInt(roomNbr.getText().toString());
    } catch (NumberFormatException e) {
      roomId = 0;
    }
    int capacity = capacityGroup.getCheckedRadioButtonId();

    editor = new RoomEditor();
    switch (editor.generateNewRoom(this, floorId, roomId, capacity)) {
      case RoomEditor.ROOM_CREATED:
        finish();
        startActivity(new Intent(this, FloorChooserActivity.class));
        Toast.makeText(this, R.string.room_successfully_created, Toast.LENGTH_SHORT).show();
        break;
      case RoomEditor.ROOM_EXISTS:
        Toast.makeText(this, R.string.room_already_exists, Toast.LENGTH_SHORT).show();
        break;
      case RoomEditor.ROOM_FAIL:
        Toast.makeText(this, R.string.empty_fields, Toast.LENGTH_SHORT).show();
        break;
      default:
        Toast.makeText(this, "An error occured...", Toast.LENGTH_SHORT).show();
        break;
    }
  }
Esempio n. 7
0
 @Override
 public void onClick(View view) {
   if (!Util.isNetworkConnected(getActivity())) {
     showToastMsg("当前未联网,请检查网络设置");
     return;
   }
   switch (view.getId()) {
     case R.id.iv_publish:
       // 发布新的旅行
       if (radioGroup.getCheckedRadioButtonId() == R.id.tab1) {
         Intent publishTogetherIntent =
             new Intent(getActivity(), PublishTogetherStep1Activity.class);
         startActivity(publishTogetherIntent);
       } else if (radioGroup.getCheckedRadioButtonId() == R.id.tab2) {
         Intent publishCustomIntent = new Intent(getActivity(), PublishCustomTourActivity.class);
         startActivity(publishCustomIntent);
       }
       break;
     case R.id.layout_search:
       Intent intent = new Intent(getActivity(), SearchActivity.class);
       startActivity(intent);
       break;
     case R.id.tv_right:
       Intent intent1 = new Intent(getActivity(), CityListActivity.class);
       startActivityForResult(intent1, 1);
       break;
   }
 }
  /**
   * 情報を保存する.
   *
   * @param outState バンドル
   * @param activity アクティビティ
   */
  private void saveInfo(final Bundle outState, final IRKitSettingActivity activity) {

    View root = getView();
    if (root == null) {
      return;
    }

    EditText ssidText = (EditText) root.findViewById(R.id.inputSSID);
    EditText passwordText = (EditText) root.findViewById(R.id.inputPassword);
    RadioGroup radioGroup = (RadioGroup) root.findViewById(R.id.radioGroupSecurity);

    if (activity != null) {
      activity.setSSID(ssidText.getText().toString().trim());
      activity.setPassword(passwordText.getText().toString());
      WiFiSecurityType type = null;
      int typeId = radioGroup.getCheckedRadioButtonId();
      switch (typeId) {
        case R.id.radioButton1:
          type = WiFiSecurityType.NONE;
          break;
        case R.id.radioButton2:
          type = WiFiSecurityType.WEP;
          break;
        case R.id.radioButton3:
        default:
          type = WiFiSecurityType.WPA2;
          break;
      }
      activity.setSecType(type);
    } else {
      outState.putString(KEY_SSID, ssidText.getText().toString().trim());
      outState.putString(KEY_TYPE, passwordText.getText().toString());
      outState.putInt(KEY_TYPE, radioGroup.getCheckedRadioButtonId());
    }
  }
  public void onSubmit(View v) {
    RadioButton rb1 = (RadioButton) radioGroup1.findViewById(radioGroup1.getCheckedRadioButtonId());
    Toast.makeText(CreditsDebits.this, rb1.getText(), Toast.LENGTH_SHORT).show();

    RadioButton rb2 = (RadioButton) radioGroup2.findViewById(radioGroup2.getCheckedRadioButtonId());
    Toast.makeText(CreditsDebits.this, rb2.getText(), Toast.LENGTH_SHORT).show();
  }
 private void toPreference() {
   preferences.favoriteCharacter = characterName.getText().toString();
   preferences.dark = dark.isChecked();
   preferences.light = light.isChecked();
   int checkedRadioButtonId = droid.getCheckedRadioButtonId();
   if (checkedRadioButtonId >= 0) preferences.droid = DROIDS.indexOf(checkedRadioButtonId);
   int checkedSpaceShipId = spaceship.getCheckedRadioButtonId();
   if (checkedSpaceShipId >= 0) preferences.spaceship = SPACESHIPS.indexOf(checkedSpaceShipId);
   preferences.apply();
 }
  public void button1_onClick(View v) {
    String customerName = edittext1.getText().toString();
    String customerEstablishmentName = edittext2.getText().toString();
    String customerAddress = edittext3.getText().toString();
    String customerContactNumber = edittext4.getText().toString();
    String customerEmail = edittext5.getText().toString();
    String customerCity = edittext6.getText().toString();
    String employeeName = autocompletetextview1.getText().toString();
    String productName = autocompletetextview2.getText().toString();
    String customerInTime = edittext7.getText().toString();
    String customerOutTime = edittext8.getText().toString();
    String followUpDate = edittext9.getText().toString();
    StringTokenizer st = new StringTokenizer(followUpDate, "-");
    day1 = st.nextToken();
    month1 = st.nextToken();
    year1 = st.nextToken();
    DecimalFormat dformat = new DecimalFormat("00");
    month1 = dformat.format(Double.valueOf(month1));
    day1 = dformat.format(Double.valueOf(day1));
    String customerFollowUpDate = year1 + month1 + day1;
    String customerRemark = edittext10.getText().toString();
    RadioButton radiobutton1 =
        (RadioButton) findViewById(radiobuttongroup1.getCheckedRadioButtonId());
    String customerHasComputer = radiobutton1.getText().toString();
    RadioButton radiobutton2 =
        (RadioButton) findViewById(radiobuttongroup2.getCheckedRadioButtonId());
    String customerHasInternet = radiobutton2.getText().toString();
    RadioButton radiobutton3 =
        (RadioButton) findViewById(radiobuttongroup3.getCheckedRadioButtonId());
    String customerUsesSoftware = radiobutton3.getText().toString();

    DatabaseHandler obj = new DatabaseHandler(this);
    List<String> employeeIdList = obj.getEmployeeId(employeeName);
    String employeeId = employeeIdList.get(0);
    List<String> productIdList = obj.getProductId(productName);
    String productId = productIdList.get(0);
    obj.updateDoctorInfo(
        customerName,
        customerEstablishmentName,
        customerAddress,
        customerContactNumber,
        customerEmail,
        customerCity,
        employeeId,
        productId,
        customerInTime,
        customerOutTime,
        customerHasComputer,
        customerUsesSoftware,
        customerHasInternet,
        customerFollowUpDate,
        customerRemark);
    Toast.makeText(getBaseContext(), "Customer record updated", Toast.LENGTH_SHORT).show();
    finish();
  }
Esempio n. 12
0
  public void nextactivity_visualdiscrimination(View view) {
    rgrp1 = (RadioGroup) findViewById(R.id.rgrp1);
    radioButtonID1 = rgrp1.getCheckedRadioButtonId();
    rgrp2 = (RadioGroup) findViewById(R.id.rgrp2);
    radioButtonID2 = rgrp2.getCheckedRadioButtonId();
    int radioId1 = 0;
    int radioId2 = 0;
    if (!skip_pressed) {
      //            if (radioButtonID1 <= 0 || radioButtonID2 <= 0) {
      //                // Toast.makeText(getBaseContext(), "Please select one option from each type
      // !", Toast.LENGTH_LONG).show();
      //                if(radioButtonID1 <= 0)
      //                    radioButton1 = "NA";
      //                if(radioButtonID2 <= 0)
      //                     radioButton2 ="NA";
      //            }
      //            else {
      RadioButton checkedbutton = (RadioButton) findViewById(radioButtonID1);
      radioId1 = rgrp1.getCheckedRadioButtonId();
      if (radioId1 <= 0) radioButton1 = "NA";
      else radioButton1 = checkedbutton.getText().toString();

      RadioButton checkedbutton1 = (RadioButton) findViewById(radioButtonID2);
      radioId2 = rgrp2.getCheckedRadioButtonId();

      if (radioId2 <= 0) radioButton2 = "NA";
      else radioButton2 = checkedbutton1.getText().toString();

      //     }
      SharedPreferences.Editor editor = sharedpreferences.edit();
      editor.putString("Radiobuttonteaming1", radioButton1);
      editor.putString("Radiobuttonteaming2", radioButton2);
      editor.putInt("teamingidround1", radioId1);
      editor.putInt("teamingidround2", radioId2);
      editor.putString("Teamingskipped", "notskipped");
      editor.commit();
      Intent intent = new Intent(this, RecordVisualDiscrimination.class);
      intent.putExtra("activity", "nextvisualdiscrimination");
      intent.putExtra("TesterName", user_name);
      startActivity(intent);

      //    }
    } else {
      SharedPreferences.Editor editor = sharedpreferences.edit();
      editor.putString("Radiobuttonteaming1", "NA");
      editor.putString("Radiobuttonteaming2", "NA");
      editor.putString("Teamingskipped", "skipped");
      editor.commit();
      Intent intent = new Intent(this, RecordVisualDiscrimination.class);
      intent.putExtra("activity", "nextvisualdiscrimination");
      intent.putExtra("TesterName", user_name);
      startActivity(intent);
    }
  }
Esempio n. 13
0
  // @Override
  public void onClick(View v) {
    Context context = getApplicationContext();

    switch (v.getId()) {
      case R.id.btnPronto:
        RadioGroup tipo = (RadioGroup) findViewById(R.id.rGroupTipo);
        RadioButton tipoSelected = (RadioButton) findViewById(tipo.getCheckedRadioButtonId());

        RadioGroup tamanho = (RadioGroup) findViewById(R.id.rGroupTamanho);
        RadioButton tamanhoSelected = (RadioButton) findViewById(tamanho.getCheckedRadioButtonId());

        EditText fone = (EditText) findViewById(R.id.tbxFone);

        CheckBox EmConstrucao = (CheckBox) findViewById(R.id.ckbEmConstrucao);

        /*pegar coordenada GPS*/
        LocationManager locManager = (LocationManager) getSystemService(LOCATION_SERVICE);
        Location location = locManager.getLastKnownLocation(LocationManager.GPS_PROVIDER);
        locManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 100, 1, this);

        try {

          db_imovel = new EstateData(this);

          SQLiteDatabase db = db_imovel.getWritableDatabase();

          ContentValues values = new ContentValues();

          values.put(TYPE, tipoSelected.getText().toString());
          values.put(SIZE, tamanhoSelected.getText().toString());
          values.put(STATUS, EmConstrucao.isChecked() ? "1" : "0");
          values.put(PHONE, Integer.parseInt(fone.getText().toString()));
          values.put(LATITUDE, location.getLatitude());
          values.put(LONGITUDE, location.getLongitude());

          db.insertOrThrow(TABLE_NAME, null, values);

          Toast toast = Toast.makeText(context, R.string.InfoSucess, Toast.LENGTH_SHORT);
          toast.show();

        } catch (NumberFormatException e) {

          Toast toast = Toast.makeText(context, R.string.ErrorNumber, Toast.LENGTH_SHORT);
          toast.show();
        }

        break;
    }
  }
        public void onClick(View v) {
          Restaurant r = new Restaurant();
          EditText name = (EditText) findViewById(R.id.name);
          EditText address = (EditText) findViewById(R.id.addr);

          r.setName(name.getText().toString());
          r.setAddress(address.getText().toString());

          RadioGroup types = (RadioGroup) findViewById(R.id.types);

          switch (types.getCheckedRadioButtonId()) {
            case R.id.sit_down:
              r.setType("sit_down");
              break;

            case R.id.take_out:
              r.setType("take_out");
              break;

            case R.id.delivery:
              r.setType("delivery");
              break;
          }

          adapter.add(r);
        }
Esempio n. 15
0
  @OnClick({R.id.negative, R.id.positive})
  @Override
  public void onClick(View view) {
    switch (view.getId()) {
      case R.id.negative:
        dismiss(null, null);
        break;

      case R.id.positive:
        RedditSort sort =
            mSortRG.getCheckedRadioButtonId() == R.id.newestRB ? RedditSort.TIME : RedditSort.TOP;

        ImgurFilters.TimeSort topSort;
        int position = mSeekBar.getProgress();

        if (position <= 10) {
          topSort = ImgurFilters.TimeSort.DAY;
        } else if (position <= 30) {
          topSort = ImgurFilters.TimeSort.WEEK;
        } else if (position <= 50) {
          topSort = ImgurFilters.TimeSort.MONTH;
        } else if (position <= 70) {
          topSort = ImgurFilters.TimeSort.YEAR;
        } else {
          topSort = ImgurFilters.TimeSort.ALL;
        }

        dismiss(sort, topSort);
        break;
    }
  }
  private BallType getBallType() {
    int checkedExtra = extrasGroup.getCheckedRadioButtonId();

    BallType ballType;

    switch (checkedExtra) {
      case R.id.wideRadioButton:
        ballType = BallType.WIDE;
        break;
      case R.id.noBallExtraRadioButton:
        ballType = BallType.NO_BALL_EXTRA;
        break;
      case R.id.noBallRunRadioButton:
        ballType = BallType.NO_BALL_RUN;
        break;
      case R.id.byeRadioButton:
        ballType = BallType.BYE;
        break;
      case R.id.legByeRadioButton:
        ballType = BallType.LEG_BYE;
        break;
      default:
        ballType = BallType.SCORING;
    }
    return ballType;
  }
  private int getRuns() {
    int checkedRun = runGroup.getCheckedRadioButtonId();

    if (checkedRun == -1) {
      return 0;
    }

    int runs;

    switch (checkedRun) {
      case R.id.oneRun:
        runs = 1;
        break;
      case R.id.twoRuns:
        runs = 2;
        break;
      case R.id.threeRuns:
        runs = 3;
        break;
      case R.id.fourRuns:
        runs = 4;
        break;
      case R.id.fiveRuns:
        runs = 5;
        break;
      case R.id.sixRuns:
        runs = 6;
        break;
      default:
        runs = 0;
    }
    return runs;
  }
Esempio n. 18
0
  public void searchBoard() {
    RadioGroup rdoGrpSearch = (RadioGroup) findViewById(R.id.rdoGrpSearch);

    int selectedId = rdoGrpSearch.getCheckedRadioButtonId();

    String keyWordType = "";

    if (selectedId == R.id.rdoByContent) keyWordType = "CONTENT";
    else keyWordType = "AUTHOR";

    EditText edtSearchBox = (EditText) findViewById(R.id.edtSearchBox);

    rdoGrpSearch.setVisibility(View.GONE);
    webView.setVisibility(View.VISIBLE);
    String url = "web/mobile/board/searchBoard.php";
    String postData =
        "searchKeywordType="
            + keyWordType
            + "&searchKeyword="
            + edtSearchBox.getText().toString()
            + "&udid="
            + getUniqueDeviceID()
            + "&userID="
            + getMetaInfoString("USER_ID")
            + "&boardName="
            + boardName
            + "&osType="
            + getOSType();

    pd = ProgressDialog.show(this, "", "로딩중...", true);

    webView.postUrl(serverURL + url, EncodingUtils.getBytes(postData, "base64"));

    hideSoftKeyboard();
  }
Esempio n. 19
0
  private void startActivity() {

    Intent intent = new Intent(this, MapActivity.class);
    if (null != findViewById(R.id.radio_group)) {
      RadioGroup radioGroup = (RadioGroup) this.findViewById(R.id.radio_group);
      switch (radioGroup.getCheckedRadioButtonId()) {
        case R.id.btn_service:
          intent.putExtra("type", "service");
          break;
        case R.id.btn_shopping:
          intent.putExtra("type", "trade");
          break;
        case R.id.btn_food:
          intent.putExtra("type", "food");
          break;
        case R.id.btn_drink:
          intent.putExtra("type", "drink");
          break;
        case R.id.btn_live:
          intent.putExtra("type", "live");
          break;
      }
    }
    startActivity(intent);
    overridePendingTransition(R.anim.zoom_enter, R.anim.zoom_exit); // 淡出淡入动画效果
  }
 @Override
 public void reset() {
   RadioButton radio = (RadioButton) view.findViewById(view.getCheckedRadioButtonId());
   if (radio != null) {
     radio.setTextColor(mColor);
   }
 }
Esempio n. 21
0
  @Override
  public void onClick(View v) {
    switch (v.getId()) {
      case R.id.okbtn:
        LoginActivity.isSound = isbgSoundCb.isChecked();
        // Log.d("tong", "isbgSoundCb 1 :" + LoginActivity.isSound);
        Constants.isGameSound = isoundCb.isChecked();
        LoginActivity.isSave = isautologinCb.isChecked();

        if (isoundCb.isChecked() != LoginActivity.isSave) {
          SharedPreferences spf = c.getPreferences(Activity.MODE_PRIVATE);
          SharedPreferences.Editor edit = spf.edit();
          edit.putBoolean("isautoLogin", isautologinCb.isChecked());
          edit.commit();
        }

        View sv = findViewById(rg.getCheckedRadioButtonId());
        int index = rg.indexOfChild(sv);
        // ClientThread.sendMsg("update$" + emailtx.getText().toString() + "$"
        //			+ schooltx.getText().toString() + "$" + index);
        this.cancel();
        break;

      case R.id.cancelbtn:
        this.dismiss();
        break;
    }
  }
Esempio n. 22
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    searchEditText = (EditText) findViewById(R.id.etSearch);
    moviesSearchRadioButton = (RadioButton) findViewById(R.id.rMovie);
    peopleSearchRadioButton = (RadioButton) findViewById(R.id.rPeople);
    searchRadioGroup = (RadioGroup) findViewById(R.id.rgSelector);
    searchButton = (Button) findViewById(R.id.bSearch);
    searchTypeTextView = (TextView) findViewById(R.id.search_type_text_view);

    moviesSearchRadioButton.setOnClickListener(radioButtonListener);
    peopleSearchRadioButton.setOnClickListener(radioButtonListener);

    searchButton.setOnClickListener(
        new OnClickListener() {
          @Override
          public void onClick(View v) {
            String query = searchEditText.getText().toString();
            if (moviesSearchRadioButton.isChecked()) {
              longToast(moviesSearchRadioButton.getText() + " " + query);
            } else if (peopleSearchRadioButton.isChecked()) {
              longToast(peopleSearchRadioButton.getText() + " " + query);
            }
          }
        });

    searchEditText.setOnFocusChangeListener(new DftTextOnFocusListener("Search"));

    int id = searchRadioGroup.getCheckedRadioButtonId();
    RadioButton radioButton = (RadioButton) findViewById(id);
    searchTypeTextView.setText(radioButton.getText());
  }
Esempio n. 23
0
  private ContentValues getContent() {
    ContentValues content = new ContentValues();
    EditText aux;

    Long id = getId();
    if (id != -1) {
      content.put("_id", id);
    }

    // date
    DatePicker dp = (DatePicker) findViewById(R.id.date);
    GregorianCalendar date = new GregorianCalendar(dp.getYear(), dp.getMonth(), dp.getDayOfMonth());
    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
    content.put("date", sdf.format(date.getTime()));

    // km
    aux = (EditText) findViewById(R.id.km);
    content.put("odometer", Float.parseFloat(aux.getText().toString()));

    // liters
    aux = (EditText) findViewById(R.id.liters);
    content.put("liters", Float.parseFloat(aux.getText().toString()));

    // type
    RadioGroup aux2 = (RadioGroup) findViewById(R.id.type);
    RadioButton aux3 = (RadioButton) findViewById(aux2.getCheckedRadioButtonId());
    content.put("fuel", aux3.getText().toString());

    return content;
  }
Esempio n. 24
0
  @Override
  public void onClick(View v) {
    String stu_name = day03_02_edi_01.getText().toString().trim();
    String stu_age = day03_02_edi_02.getText().toString().trim();
    if (TextUtils.isEmpty(stu_name) || TextUtils.isEmpty(stu_age)) {
      Toast.makeText(Day03_02.this, "姓名或年龄不能为空。", Toast.LENGTH_SHORT).show();
      return;
    }
    String gender = null;
    int id = day03_02_rad_01.getCheckedRadioButtonId();
    if (id == R.id.rb_male) { // 选中男性
      gender = "男";
    } else { // 女性
      gender = "女";
    }

    switch (v.getId()) {
      case R.id.day03_02_but_01:
        dao.insert(stu_name, stu_age, gender);
        // 清空
        day03_02_edi_01.setText("");
        day03_02_edi_02.setText("");
        // 刷新
        refreshData();
        break;
        //            case R.id.day03_02_but_02:
        //                break;
        //            case R.id.day03_02_but_03:
        //                break;
    }
  }
  private boolean checkNull() {
    int checkedId = editSex.getCheckedRadioButtonId();
    switch (checkedId) {
      case R.id.sex_nan:
        sex = "男";
        break;
      case R.id.sex_nv:
        sex = "女";
        break;

      default:
        sex = "";
        break;
    }
    mobilePhone = editMobilePhone.getText().toString();
    phone = editPhone.getText().toString();
    org = editOrg.getText().toString();
    postion = editPostion.getText().toString();
    if (sex.equals("")) {
      Toast.makeText(getActivity(), "性别必须选择!", Toast.LENGTH_SHORT).show();
      return false;
    } else if (mobilePhone.equals("")) {
      Toast.makeText(getActivity(), "手机号必须填写!", Toast.LENGTH_SHORT).show();
      return false;
    } else if (org.equals("")) {
      Toast.makeText(getActivity(), "二级部门必须填写!", Toast.LENGTH_SHORT).show();
      return false;
    } else if (postion.equals("")) {
      Toast.makeText(getActivity(), "职位必须填写!", Toast.LENGTH_SHORT).show();
      return false;
    } else {
      return true;
    }
  }
Esempio n. 26
0
        public void onClick(View v) {
          String type = null;

          switch (types.getCheckedRadioButtonId()) {
            case R.id.sit_down:
              type = "sit_down";
              break;
            case R.id.take_out:
              type = "take_out";
              break;
            case R.id.delivery:
              type = "delivery";
              break;
          }

          if (restaurantId == null) {
            helper.insert(
                name.getText().toString(),
                address.getText().toString(),
                type,
                notes.getText().toString());
          } else {
            helper.update(
                restaurantId,
                name.getText().toString(),
                address.getText().toString(),
                type,
                notes.getText().toString());
          }

          finish();
        }
Esempio n. 27
0
  public void salvarViagem(View view) {
    SQLiteDatabase db = helper.getWritableDatabase();

    ContentValues values = new ContentValues();
    values.put("DESTINO", destino.getText().toString());
    values.put("DATA_CHEGADA", dataChegada.getTime());
    values.put("DATA_SAIDA", dataSaida.getTime());
    values.put("ORCAMENTO", orcamento.getText().toString());
    values.put("QUANTIDADE_PESSOAS", quantidadePessoas.getText().toString());

    int tipo = radioGroup.getCheckedRadioButtonId();

    if (tipo == R.id.lazer) {
      values.put("tipo_viagem", Constantes.VIAGEM_LAZER);
    } else {
      values.put("tipo_viagem", Constantes.VIAGEM_NEGOCIOS);
    }

    long resultado;

    if (id == null) {
      resultado = db.insert("VIAGEM", null, values);
    } else {
      resultado = db.update("VIAGEM", values, "_ID = ?", new String[] {id});
    }

    if (resultado != -1) {
      Toast.makeText(this, getString(R.string.registro_salvo), Toast.LENGTH_SHORT).show();
    } else {
      Toast.makeText(this, getString(R.string.erro_salvar), Toast.LENGTH_SHORT).show();
    }
  }
  @Override
  public void onCreate(Bundle savedInstanceState) {

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

    this.findAllViewsById();

    moviesSearchRadioButton.setOnClickListener(radioButtonListener);
    peopleSearchRadioButton.setOnClickListener(radioButtonListener);

    searchButton.setOnClickListener(
        new OnClickListener() {
          @Override
          public void onClick(View v) {
            String query = searchEditText.getText().toString();
            if (moviesSearchRadioButton.isChecked()) {
              longToast(moviesSearchRadioButton.getText() + " " + query);
            } else if (peopleSearchRadioButton.isChecked()) {
              longToast(peopleSearchRadioButton.getText() + " " + query);
            }
          }
        });

    searchEditText.setOnFocusChangeListener(new DftTextOnFocusListener(getString(R.string.search)));

    int id = searchRadioGroup.getCheckedRadioButtonId();
    RadioButton radioButton = (RadioButton) findViewById(id);
    searchTypeTextView.setText(radioButton.getText());
  }
Esempio n. 29
0
  @Override
  public boolean onOptionsItemSelected(MenuItem item) {
    // Handle action bar item clicks here. The action bar will
    // automatically handle clicks on the Home/Up button, so long
    // as you specify a parent activity in AndroidManifest.xml.
    int id = item.getItemId();

    //noinspection SimplifiableIfStatement
    if (id == R.id.action_settings) {
      return true;
    }

    if (id == R.id.confirm_create_group) {
      if (groupNameText.getText().toString().length() > 0
          && cityText.getText().toString().length() > 0) {
        nome = groupNameText.getText().toString();
        city = cityText.getText().toString();
        int selectedId = groupType.getCheckedRadioButtonId();
        if (selectedId == R.id.group_closed_radio) aperto = false;

        InfoGruppoBean gruppoBean = new InfoGruppoBean();
        gruppoBean.setNome(nome);
        gruppoBean.setCitta(city);
        gruppoBean.setAperto(aperto);
        if (checkNetwork())
          new CreaGruppoAT(getApplicationContext(), this, this, idSessione, gruppoBean).execute();

      } else {
        Toast.makeText(getApplicationContext(), "Compilare tutti i campi!", Toast.LENGTH_LONG)
            .show();
      }
    }

    return super.onOptionsItemSelected(item);
  }
Esempio n. 30
0
 @Override
 public void onCheckedChanged(RadioGroup group, int checkedId) {
   etInput.setInputType(InputType.TYPE_CLASS_NUMBER); // 确保用户输入框输入类型为数字。
   switch (group.getCheckedRadioButtonId()) {
     case R.id.rbBin:
       MainActivity.etInput.setHint("请输入一个二进制数字……");
       radioId = 2;
       etInput.setText("");
       break;
     case R.id.rbOct:
       MainActivity.etInput.setHint("请输入一个八进制数字……");
       radioId = 8;
       etInput.setText("");
       break;
     case R.id.rbDec:
       MainActivity.etInput.setHint("请输入一个十进制数字……");
       radioId = 10;
       etInput.setText("");
       break;
     default:
       MainActivity.etInput.setHint("请输入一个十六进制数字……");
       radioId = 16;
       etInput.setText("");
       etInput.setInputType(InputType.TYPE_CLASS_TEXT);
       break;
   }
 }