예제 #1
0
  @Override
  public void onClick(View v) {
    Boolean wantToCloseDialog = true;
    switch (v.getId()) {
      case R.id.btn_yes:
        if (exerciseName.getText().toString().compareTo("") != 0) {
          db.Open();
          db.UpdateExercise(
              exerciseName.getText().toString(),
              ((ExerciseType) exerciseType.getSelectedItem()).Id,
              exerciseId);
          db.Close();
        } else {
          wantToCloseDialog = false;
        }

        if (wantToCloseDialog) {
          parent.OnUpdated(
              new ExerciseDto(
                  exerciseId,
                  exerciseName.getText().toString(),
                  ((ExerciseType) exerciseType.getSelectedItem()).Id));
          alertDialog.dismiss();
        }
        break;
      case R.id.btn_no:
        alertDialog.dismiss();
        break;
    }
  }
예제 #2
0
  private void register() {
    final String username = mEditUsername.getText().toString();
    final String email = mEditEmail.getText().toString();
    final String password = mEditPassword.getText().toString();

    if (!TextUtils.isEmpty(username)) {
      if (!TextUtils.isEmpty(email)) {
        if (!TextUtils.isEmpty(password)) {
          if (isTakeAvatar) {
            // 保存账号和密码
            SharedPreferences sharedPreferences = getSharedPreferences("login", MODE_PRIVATE);
            SharedPreferences.Editor editor = sharedPreferences.edit();
            editor.putString("username", username);
            editor.putString("password", password);
            editor.commit();
            registerToLeanclound(username, email, password);
          } else {
            SnackbarUtils.showSnackbar(
                mCoordinatorLayout, getString(R.string.error_register_take_gender_null));
          }
        } else {
          SnackbarUtils.showSnackbar(
              mCoordinatorLayout, getString(R.string.error_register_password_null));
        }
      } else {
        SnackbarUtils.showSnackbar(
            mCoordinatorLayout, getString(R.string.error_register_email_address_null));
      }
    } else {
      SnackbarUtils.showSnackbar(
          mCoordinatorLayout, getString(R.string.error_register_user_name_null));
    }
  }
예제 #3
0
  public void saveCase1() {
    if (case1 != null) {
      shoushuriqi = shouShuRiQi.getText().toString();
      shoushubianhao = shouShuBianHao.getText().toString();
      shuzhe = shuZhe.getText().toString();
      shisuleixing = shiSuLeiXing.getText().toString();
      shisubingcheng = shiSuBingCheng.getText().toString();
      linchuangxinlvshichangzhenduan = linChuangXinLvShiChangZhenDuan.getText().toString();

      buwei = buWei.getText().toString();
      case1.setOperationNumber(shoushubianhao);
      case1.setOperatorName(shuzhe);
      case1.setVtType(spinnertext);
      case1.setVtFrequency(pindutext);
      case1.setVtEveryAttackTime(meicifazuochixushijiantext);
      case1.setVtLastAttackTime(zuijinfazuochixushijiantext);
      case1.setPrematureBeatLoad(zaobofuhetext);
      case1.setCardioversionMethod(cengyongzhuanfufangfatext);
      case1.setCardioversionMedication(zhuanlvyongyaotext);
      case1.setVtCourseDisease(shisubingcheng);
      case1.setArrhythmiaDiagnose(linchuangxinlvshichangzhenduan);
      case1.setElectrophysiologyDiagnose(dianshenlijianchazhenduan);
      case1.setPostoperationDiagnose(shuhouzhenduan);
      case1.setMechanism(jizhi);
      case1.setPart(buwei);
      case1DataChangedListener.OnCase1DataChanged(case1);
    }
  }
  /** @Description: 初始化闲置物品信息 */
  private void initSecondHandInfo() {
    titleET.setText(secondHandInfo.getTitle());
    typeSp.setText(secondHandInfo.getType());
    priceET.setText(secondHandInfo.getPrice());
    describeET.setText(secondHandInfo.getDescribe());
    picFileList = secondHandInfo.getPicFileList();
    if (null == picFileList || 1 > picFileList.size()) {

    } else {
      for (BmobFile bmobFile : picFileList) {
        if (null != bmobFile) {
          ImageItem item = new ImageItem();
          item.setIsLocalPic(false);
          item.setFileName(bmobFile.getFilename());
          item.setImagePath(bmobFile.getFileUrl(AddSecondHandActivity.this));
          picList.add(item);
        }
      }
      editGridAdapter.notifyDataSetChanged();
    }
    if (secondHandInfo.getBargain()) {
      bargainSp.setText("可议价");
    } else {
      bargainSp.setText("不可议价");
    }
    qqET.setText(secondHandInfo.getQq());
    phoneET.setText(secondHandInfo.getPhone());
  }
  @Override
  public void onViewStateRestored(@Nullable Bundle savedInstanceState) {
    super.onViewStateRestored(savedInstanceState);
    if (!isInActivity) {
      isInActivity = true;
      shouShuRiQi.setText("");
      shouShuBianHao.setText("");
      shuZhe.setText("");
      shiSuLeiXing.setText("");
      shiSuBingCheng.setText("");
      linChuangXinLvShiChangZhenDuan.setText("");
      dianShengLiJianChaZhenDuan.setText("");
      shuHouZhenDuan.setText("");

      DateFormat dateFormat = DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.MEDIUM);
      if (case3.getOperationData() != 0) {
        shouShuRiQi.setText(dateFormat.format(new Date(case3.getOperationData())));
      }
      if (case3.getOperationNumber() != null) {
        shouShuBianHao.setText(case3.getOperationNumber());
      }
      if (case3.getOperatorName() != null) {
        shuZhe.setText(case3.getOperatorName());
      }
      if (case3.getAfType() != null && !case3.getAfType().equals("")) {
        shiSuLeiXing.setText(
            "类型:"
                + case3.getAfType()
                + "\n\n"
                + "频度:"
                + case3.getAfFrequency()
                + "\n\n"
                + "每次发作持续时间:"
                + case3.getAfEveryAttackTime()
                + "\n\n"
                + "最近发作持续时间:"
                + case3.getAfLastAttackTime()
                + "\n\n"
                + "曾用转复方法:"
                + case3.getCardioversionMethod()
                + "\n\n"
                + "转律用药:"
                + case3.getCardioversionMedication());
      }
      if (case3.getAfCourseDisease() != null) {
        shiSuBingCheng.setText(case3.getAfCourseDisease());
      }
      if (case3.getArrhythmiaDiagnose() != null) {
        linChuangXinLvShiChangZhenDuan.setText(case3.getArrhythmiaDiagnose());
      }
      if (case3.getElectrophysiologyDiagnose() != null) {
        dianShengLiJianChaZhenDuan.setText(case3.getElectrophysiologyDiagnose());
      }
      if (case3.getPostoperationDiagnose() != null) {
        shuHouZhenDuan.setText(case3.getPostoperationDiagnose());
      }
    }
  }
예제 #6
0
 @Override
 public boolean onKey(View v, int keyCode, KeyEvent event) {
   if (keyCode == KeyEvent.KEYCODE_ENTER) {
     switch (event.getAction()) {
       case KeyEvent.ACTION_UP: // 键盘松开
         presenter.loadDetailCargo(customerId, unRemoveEt.getText().toString());
         unRemoveEt.requestFocus();
         break;
       case KeyEvent.ACTION_DOWN: // 键盘按下
         break;
     }
     return true;
   }
   return false;
 }
예제 #7
0
  @Override
  public void onViewStateRestored(@Nullable Bundle savedInstanceState) {
    super.onViewStateRestored(savedInstanceState);
    if (!isInActivity) {
      isInActivity = true;
      shouShuRiQi.setText("");
      shouShuBianHao.setText("");
      shuZhe.setText("");
      shiSuLeiXing.setText("");
      shiSuBingCheng.setText("");
      linChuangXinLvShiChangZhenDuan.setText("");

      buWei.setText("");
    }
  }
예제 #8
0
  @Override
  public Dialog onCreateDialog(Bundle savedInstanceState) {
    db = new QueryFactory(context);

    AlertDialog.Builder builder = new AlertDialog.Builder(context);
    LayoutInflater inflater = getActivity().getLayoutInflater();
    View view = inflater.inflate(R.layout.dialog_add_edit_exercise, null);

    exerciseName = (MaterialEditText) view.findViewById(R.id.exerciseName);
    exerciseType = (MaterialSpinner) view.findViewById(R.id.exerciseType);
    Button yes = (Button) view.findViewById(R.id.btn_yes);
    Button no = (Button) view.findViewById(R.id.btn_no);

    exerciseName.setText(getArguments().getString("EXERCISE_NAME"));
    exerciseType.setSelection(getArguments().getInt("EXERCISE_TYPE"));
    exerciseId = getArguments().getInt("EXERCISE_ID");

    yes.setOnClickListener(this);
    no.setOnClickListener(this);
    Init();

    builder.setView(view);

    alertDialog = builder.create();
    alertDialog.show();

    return alertDialog;
  }
예제 #9
0
 @Override
 public void reInit() {
   initUserInfo();
   unRemoveEt.setText("");
   mListView.clearAll();
   presenter.initCargoOrder(customerId);
 }
예제 #10
0
 @Override
 public void onScrollChanged(int scrollY, boolean firstScroll, boolean dragging) {
   float alpha = 1 - (float) Math.max(0, mParallaxImageHeight - scrollY) / mParallaxImageHeight;
   setToolBarBackgroundAlpha(mToolbar, alpha, primaryColor);
   setStatusBarBackgroundAlpha(statusBar, alpha + 0.2f, ActionBarView.darkenColor(primaryColor));
   note.setAlpha(1 - alpha);
   date.setAlpha(1 - alpha);
   ViewHelper.setTranslationY(mImageView, scrollY / 2);
 }
  private void validateSubmit() {
    hideToolTip();

    if (CustomInputValidator.checkError(mEtDeviceName)) return;
    if (CustomInputValidator.checkError(mEtDeviceDesc)) return;
    if (CustomInputValidator.checkError(mEtAndroidVersion)) return;

    Devices device = new Devices();
    device.setAndroidId(mAndroidVersionId);
    device.setDeviceDesc(mEtDeviceDesc.getText().toString().trim());
    device.setDeviceName(mEtDeviceName.getText().toString().trim());
    device.setImageURL("");

    if (RestClient.isNetworkAvailable()) {
      mDbHelper.insertNewDevice(device);

      Call call = new RestClient().getApiService().addDevice(device);
      call.enqueue(
          new Callback() {
            @Override
            public void onResponse(Response response, Retrofit retrofit) {
              if (response.errorBody() == null) {
                Toast.makeText(
                        ShowCaseApp.getAppContext(),
                        "Device added successfully!",
                        Toast.LENGTH_LONG)
                    .show();
                onBackPressed();
              }
            }

            @Override
            public void onFailure(Throwable t) {}
          });
    } else {
      Toast.makeText(
              ShowCaseApp.getAppContext(),
              ShowCaseApp.getAppContext().getResources().getString(R.string.no_internet),
              Toast.LENGTH_LONG)
          .show();
    }
  }
예제 #12
0
  private void initView() {
    context = (BaseActivity) getActivity();
    imgLeftCorner = (ImageView) ret.findViewById(R.id.img_left_corner);
    et_searchkey = (MaterialEditText) ret.findViewById(R.id.et_searchkey);
    mListView = (XListView) ret.findViewById(R.id.list_search_fans);
    mListView.setPullRefreshEnable(false);
    mListView.setPullLoadEnable(false);
    mNoContentHint = (TextView) ret.findViewById(R.id.no_content_hint);

    imgLeftCorner.setOnClickListener(this);
    mListView.setOnItemClickListener(this);
    et_searchkey.addTextChangedListener(this);

    et_searchkey.setFocusable(true);
    et_searchkey.setFocusableInTouchMode(true);
    et_searchkey.requestFocus();

    adapter = new SearchAdapter(context, R.layout.item_group_member2, cursor);
    mListView.setAdapter(adapter);
  }
  /** @Description: 瓷砖特效 */
  private void initMaterialRipple() {
    alimonyET.setPaddings(DensityUtils.sp2px(this, 32), 0, 0, 0);
    // 设置验证信息
    alimonyET.addValidator(
        new METValidator("请输入整数~") {

          @Override
          public boolean isValid(@NonNull CharSequence text, boolean isEmpty) {
            String number = text.toString();
            if ("".equals(number) || VerifyUtils.isDigit(number)) {
              return true;
            }
            return false;
          }
        });
    // 动态特效
    MaterialRippleLayout.on(commitBtn)
        .rippleColor(Color.parseColor(CommonConstant.RIPPLE_COLOR_DARK))
        .rippleAlpha(CommonConstant.RIPPLE_ALPHA)
        .rippleHover(true)
        .create();
  }
예제 #14
0
 @Override
 protected void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   setContentView(R.layout.activity_uncargo_order);
   initUserInfo();
   unRemoveEt = (MaterialEditText) findViewById(R.id.load_et);
   unRemoveEt.setOnKeyListener(onKey);
   unRemoveBtn = (ButtonRectangle) findViewById(R.id.remove_btn);
   mListView = (MaterialListView) findViewById(R.id.material_listview);
   ((TextView) findViewById(R.id.tv_common_title)).setText(R.string.uncargo);
   Intent intent = getIntent();
   customerId = intent.getStringExtra("customerId");
   presenter = new UnCargoOrderPresenter(this);
   unRemoveBtn.setOnClickListener(new LoadButtonClick());
   presenter.initCargoOrder(customerId);
 }
 private void loadDataFromSQLite() {
   // CHECK IF THERE'S DATA IN SQLITE
   Cursor cursor =
       getActivity()
           .getContentResolver()
           .query(MyContentProvider.CONTENT_URI_VIEW_USER_APPLICATION, null, null, null, null);
   if (cursor != null) {
     if (cursor.moveToFirst()) {
       appSpinner.setSelection(
           getIndex(
               appSpinner,
               cursor.getString(cursor.getColumnIndex(MyContentProvider.APPLICATION_TYPE_NAME))));
       etDescr.setText(
           cursor.getString(cursor.getColumnIndex(MyContentProvider.APPLICATION_DESCRIPTION)));
     }
     cursor.close();
   }
 }
  private void initView() {
    mEtDeviceName = (MaterialEditText) findViewById(R.id.etDeviceName);
    mEtDeviceDesc = (MaterialEditText) findViewById(R.id.etDeviceDescription);
    mEtAndroidVersion = (MaterialEditText) findViewById(R.id.etAndroidVersion);
    mLinDeviceName = (LinearLayout) findViewById(R.id.linDeviceName);
    mLinDeviceDesc = (LinearLayout) findViewById(R.id.linDeviceDescription);
    mLinAndroidVersion = (LinearLayout) findViewById(R.id.linAndroidVersion);

    mEtAndroidVersion.setOnClickListener(this);

    mEtDeviceName.addTextChangedListener(new CustomInputValidator(mEtDeviceName));
    mEtDeviceName.setOnFocusChangeListener(AddDeviceActivity.this);

    mEtDeviceDesc.setFilters(new InputFilter[] {new InputFilter.LengthFilter(256)});
    mEtDeviceDesc.addTextChangedListener(new CustomInputValidator(mEtDeviceDesc));
    mEtDeviceDesc.setOnFocusChangeListener(AddDeviceActivity.this);

    mDbHelper = DBHelper.getInstance(ShowCaseApp.getAppContext());
  }
  /** @Description: 瓷砖特效 */
  private void initMaterialRipple() {
    // 设置Spinner的Adapter
    String[] types = getResources().getStringArray(R.array.second_hand_type);
    List<String> typeList = Arrays.asList(types);
    MyArrayAdapter typeAdapter = new MyArrayAdapter(this, typeList);
    typeSp.setAdapter(typeAdapter);
    String[] bargains = getResources().getStringArray(R.array.second_hand_bargain);
    List<String> bargainList = Arrays.asList(bargains);
    MyArrayAdapter bargainAdapter = new MyArrayAdapter(this, bargainList);
    bargainSp.setAdapter(bargainAdapter);
    // 设置Padding
    titleET.setPaddings(DensityUtils.sp2px(this, 32), 0, 0, 0);
    typeSp.setPaddings(DensityUtils.sp2px(this, 32), 0, 0, 0);
    priceET.setPaddings(DensityUtils.sp2px(this, 32), 0, 0, 0);
    describeET.setPaddings(DensityUtils.sp2px(this, 32), 0, 0, 0);
    bargainSp.setPaddings(DensityUtils.sp2px(this, 32), 0, 0, 0);
    qqET.setPaddings(DensityUtils.sp2px(this, 32), 0, 0, 0);
    phoneET.setPaddings(DensityUtils.sp2px(this, 32), 0, 0, 0);
    // 设置验证信息
    priceET.addValidator(
        new METValidator("只能输入整数~") {

          @Override
          public boolean isValid(@NonNull CharSequence text, boolean isEmpty) {
            String number = text.toString();
            if ("".equals(number) || VerifyUtils.isDigit(number)) {
              return true;
            }
            return false;
          }
        });
    qqET.addValidator(
        new METValidator("请输入正确的QQ格式~") {

          @Override
          public boolean isValid(@NonNull CharSequence text, boolean isEmpty) {
            String number = text.toString();
            if ("".equals(number) || VerifyUtils.isDigit(number)) {
              return true;
            }
            return false;
          }
        });
    phoneET.addValidator(
        new METValidator("请输入正确的联系号码格式~") {

          @Override
          public boolean isValid(@NonNull CharSequence text, boolean isEmpty) {
            String number = text.toString();
            if ("".equals(number) || VerifyUtils.checkPhone(number)) {
              return true;
            }
            return false;
          }
        });

    // 动态特效
    MaterialRippleLayout.on(itemTitleRL)
        .rippleColor(Color.parseColor(CommonConstant.RIPPLE_COLOR_LITHT))
        .rippleAlpha(CommonConstant.RIPPLE_ALPHA)
        .rippleHover(true)
        .create();
    MaterialRippleLayout.on(contactTitleRL)
        .rippleColor(Color.parseColor(CommonConstant.RIPPLE_COLOR_LITHT))
        .rippleAlpha(CommonConstant.RIPPLE_ALPHA)
        .rippleHover(true)
        .create();
  }
예제 #18
0
 private void setData() {
   tempclientName = spCType.getSelectedItem().toString();
   tempagentName = spAgent.getSelectedItem().toString();
   tempcmpName = spCmp.getSelectedItem().toString();
   temppolNo = edPolicyNumber.getText().toString().trim();
   temppolType = spPType.getSelectedItem().toString();
   temppolDetails = edProductD.getText().toString().trim();
   tempefftDate = edDate.getText().toString().trim();
   tempexpDate = expDate.getText().toString().trim();
   tempinsSummary = edInsSumm.getText().toString().trim();
   temppremium = edPrem.getText().toString().trim();
   tempdownPayment = edDownP.getText().toString().trim();
   tempsalesCommision = edSales.getText().toString().trim();
   temppayMethod = spPayM.getSelectedItem().toString();
   temppayFreq = spPayFrq.getSelectedItem().toString();
   temptermLength = edTerm.getText().toString().trim();
   tempdeductible = edDeduct.getText().toString().trim();
   if (spStatus.getSelectedItem().toString().equals("Status")) {
     tempstatus = "";
   } else {
     tempstatus = spStatus.getSelectedItem().toString();
   }
   tempcharge = edCharge.getText().toString().trim();
   tempcredit = edCredit.getText().toString().trim();
   tempbalance = edBal.getText().toString().trim();
 }
예제 #19
0
 private void checkValidation() {
   if (spCType.getSelectedItem().toString().trim().length() == 0
       || spCType.getSelectedItem().toString().trim().equals("Client")) {
     showToast("Select Client");
   } else if (spAgent.getSelectedItem().toString().trim().length() == 0
       || spAgent.getSelectedItem().toString().trim().equals("Agent")) {
     showToast("Select Agent");
   } else if (spCmp.getSelectedItem().toString().trim().length() == 0
       || spCmp.getSelectedItem().toString().trim().equals("Company")) {
     showToast("Select Company");
   } else if (edPolicyNumber.getText().toString().trim().length() == 0) {
     showToast("Enter Policy Number");
   } else if (spPType.getSelectedItem().toString().trim().length() == 0
       || spCmp.getSelectedItem().toString().trim().equals("Product (Type of Policy)")) {
     showToast("Select Policy Type");
   } else if (edProductD.getText().toString().trim().length() == 0) {
     showToast("Enter Product Details");
   } else if (edDate.getText().toString().trim().length() == 0) {
     showToast("Select Effective Date");
   } else if (expDate.getText().toString().trim().length() == 0) {
     showToast("Select Expiry Date");
   } else if (edInsSumm.getText().toString().trim().length() == 0
       || edInsSumm.getText().toString().trim().equals("0.0")) {
     showToast("Enter Insured Summary");
   } else if (edPrem.getText().toString().trim().length() == 0
       || edPrem.getText().toString().trim().equals("0.0")) {
     showToast("Enter Premium");
   } else if (edDownP.getText().toString().trim().length() == 0
       || edDownP.getText().toString().trim().equals("0.0")) {
     showToast("Enter Down Payment");
   } else if (edSales.getText().toString().trim().length() == 0
       || edSales.getText().toString().trim().equals("0.0")) {
     showToast("Enter Sales Commission");
   } else if (spPayM.getSelectedItem().toString().trim().length() == 0
       || spPayM.getSelectedItem().toString().trim().equals("Payment Method")) {
     showToast("Select Payment Methods");
   } else if (spPayFrq.getSelectedItem().toString().trim().length() == 0
       || spPayFrq.getSelectedItem().toString().trim().equals("Payment Frequenct")) {
     showToast("Select Payment Frequency");
   } else {
     if (temppolNo == null || temppolNo.toString().length() == 0) {
       processSave();
       showToast("Save Data");
     } else {
       processUpdate();
     }
   }
 }
예제 #20
0
        // when dialog box is closed, below method will be called.
        @Override
        public void onDateSet(
            DatePicker view, int selectedYear, int selectedMonth, int selectedDay) {

          year = selectedYear;
          month = selectedMonth;
          day = selectedDay;

          // Show selected date
          expDate.setText(
              new StringBuilder()
                  .append(day)
                  .append("-")
                  .append(month + 1)
                  .append("-")
                  .append(year));

          StringBuilder sDate;
          StringBuilder eDate;

          eDate =
              new StringBuilder()
                  .append(year)
                  .append("-")
                  .append(month + 1)
                  .append("-")
                  .append(day);

          if (edDate.getText().toString().trim().length() == 0) {
            edDate.setText(
                new StringBuilder()
                    .append(day)
                    .append("-")
                    .append(month + 1)
                    .append("-")
                    .append(year));
            sDate =
                new StringBuilder()
                    .append(year)
                    .append("-")
                    .append(month + 1)
                    .append("-")
                    .append(day);
          } else {
            String tempDate = edDate.getText().toString();

            int tempdays =
                Integer.valueOf(tempDate.substring(0, edDate.getText().toString().indexOf("-")));
            int tempmonth =
                Integer.valueOf(
                    tempDate.substring(
                        edDate.getText().toString().indexOf("-") + 1,
                        edDate.getText().toString().lastIndexOf("-")));
            int tempyear =
                Integer.valueOf(
                    tempDate.substring(
                        edDate.getText().toString().lastIndexOf("-") + 1, edDate.length()));

            sDate =
                new StringBuilder()
                    .append(tempyear)
                    .append("-")
                    .append(tempmonth)
                    .append("-")
                    .append(tempdays);
          }

          LocalDate startDate = new LocalDate(sDate.toString().trim());
          LocalDate endDate = new LocalDate(eDate.toString().trim());

          Period period = new Period(startDate, endDate, PeriodType.months());
          Log.e("############## dif", "" + period.getMonths());

          if (period.getMonths() <= 0) {
            edTerm.setText("0");
          } else {
            edTerm.setText("" + period.getMonths());
          }
        }
예제 #21
0
  private void initview() {

    RadioGroup radioGroup = (RadioGroup) findViewById(R.id.radgrup_type);
    int id = radioGroup.getCheckedRadioButtonId();
    if (id == R.id.radio_stuent) {
      type = 1;
    } else {
      type = 0;
    }
    final MaterialEditText usernameEdt = (MaterialEditText) findViewById(R.id.edt_username);
    usernameEdt.addValidator(
        new METValidator("请输入正确的用户名") {
          @Override
          public boolean isValid(@NonNull CharSequence text, boolean isEmpty) {
            if (RegexUtil.isIDCode(text.toString()) && !isEmpty) {
              username = text.toString();
              return true;
            } else {
              return false;
            }
          }
        });

    final MaterialEditText pwEdt = (MaterialEditText) findViewById(R.id.edt_password);
    pwEdt.addValidator(
        new METValidator("密码要大于六位") {
          @Override
          public boolean isValid(@NonNull CharSequence text, boolean isEmpty) {
            if ((text != null) && (text.length() >= 6)) {
              password = text.toString();
              Log.d("pw", password);
              return true;
            } else {
              return false;
            }
          }
        });

    final MaterialEditText nameEdt = (MaterialEditText) findViewById(R.id.edt_name);
    nameEdt.addValidator(
        new METValidator("要真实姓名哦") {
          @Override
          public boolean isValid(@NonNull CharSequence text, boolean isEmpty) {
            Pattern pattern = Pattern.compile("^[\u4e00-\u9fa5]+$");
            if (pattern.matcher(text).matches()) {
              name = text.toString();
              Log.d("name", name);
              return true;
            } else {
              return false;
            }
          }
        });

    final MaterialEditText emailEdt = (MaterialEditText) findViewById(R.id.edt_email);
    emailEdt.addValidator(
        new METValidator("邮箱地址不正确") {
          @Override
          public boolean isValid(@NonNull CharSequence text, boolean isEmpty) {

            if (RegexUtil.isEmail(text.toString())) {
              email = text.toString();
              Log.d("email", email);
              return true;
            } else {
              return false;
            }
          }
        });

    Button registerBtn = (Button) findViewById(btn_register);
    registerBtn.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            if (usernameEdt.validate()
                && pwEdt.validate()
                && nameEdt.validate()
                && emailEdt.validate()) {
              User user = new User();
              user.setName(name);
              user.setUsername(username);
              user.setPassword(password);
              user.setType(type);
              user.setEmail(email);
              UserManager.getInstance(getApplicationContext()).registerUser(user);
            } else {
              toast("请核对注册信息");
            }
          }
        });
  }
  public void init(String[][] result) {

    MaterialEditText Shopname = (MaterialEditText) findViewById(R.id.billMerch);
    MaterialEditText Dates = (MaterialEditText) findViewById(R.id.billDate);
    MaterialEditText Times = (MaterialEditText) findViewById(R.id.billTime);
    MaterialEditText Total = (MaterialEditText) findViewById(R.id.billTotal);

    if (result[0][0].equalsIgnoreCase("No Error")) {
      if (result[1][0] != null) {
        Shopname.setText(result[1][0]);
      }
      if (result[2][0] != null) {
        Dates.setText(result[2][0]);
      }
      if (result[3][0] != null) {
        Times.setText(result[3][0]);
        Log.v(LOGTAG, "Time" + result[3][0]);
      }
      if (result[4][0] != null) {
        Total.setText(result[4][0]);
      }

      TableLayout ll = (TableLayout) findViewById(R.id.allitems);

      TextView column1 = new TextView(this);
      column1.setTextColor(getResources().getColor(R.color.text_colors));
      column1.setTextSize(20);
      TextView column2 = new TextView(this);
      column2.setTextColor(getResources().getColor(R.color.text_colors));
      column2.setTextSize(20);
      TextView column3 = new TextView(this);
      column3.setTextColor(getResources().getColor(R.color.text_colors));
      column3.setTextSize(20);
      //            column3.setGravity(Gravity);

      TableRow row = new TableRow(this);
      TableRow.LayoutParams lp = new TableRow.LayoutParams(TableRow.LayoutParams.WRAP_CONTENT);
      column1.setText("Item Name");
      column2.setText("Quantity");
      column3.setText("Subtotal");
      row.addView(column1);
      row.addView(column2);
      row.addView(column3);

      ll.addView(row);
      for (int i = 0; i < result[5].length; i++) {
        EditText item = new EditText(this);
        item.setTextColor(getResources().getColor(R.color.text_colors));
        item.setTextSize(20);
        EditText quantity = new EditText(this);
        quantity.setTextColor(getResources().getColor(R.color.text_colors));
        quantity.setTextSize(20);
        EditText subtotal = new EditText(this);
        subtotal.setTextColor(getResources().getColor(R.color.text_colors));
        subtotal.setTextSize(20);

        row = new TableRow(this);
        lp = new TableRow.LayoutParams(TableRow.LayoutParams.WRAP_CONTENT);
        Log.v(LOGTAG, "Length :" + Integer.toString(result[5].length));
        item.setText(result[5][i]);
        quantity.setText(result[6][i]);
        subtotal.setText(result[7][i]);
        row.addView(item);
        row.addView(quantity);
        row.addView(subtotal);

        ll.addView(row);
      }

      String title = "Filtration Has Succeeded...";

      String msg =
          "Make sure every field has correct information\n" + "You can either save or cancel";

      new SweetAlertDialog(this, SweetAlertDialog.SUCCESS_TYPE)
          .setTitleText(title)
          .setContentText(msg)
          .show();

    } else {

      String title = "Filtration Could Not Complete...";
      String msg =
          "Process has Failed\n"
              + "The process could not capture all the details,\n"
              + "You could either retry or enter the details manually and save.";

      new SweetAlertDialog(this, SweetAlertDialog.WARNING_TYPE)
          .setTitleText(title)
          .setContentText(msg)
          .setConfirmText("Ok")
          .show();
    }
  }
예제 #23
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.addpolicy);
    db = new DBAdapter(NewPolicies.this);
    final Calendar c = Calendar.getInstance();
    year = c.get(Calendar.YEAR);
    month = c.get(Calendar.MONTH);
    day = c.get(Calendar.DAY_OF_MONTH);

    temppolID = getIntent().getIntExtra("polID", 1);
    tempclientName = getIntent().getStringExtra("clientName");
    tempagentName = getIntent().getStringExtra("agentName");
    tempcmpName = getIntent().getStringExtra("cmpName");
    temppolNo = getIntent().getStringExtra("polNo");

    temppolType = getIntent().getStringExtra("polType");
    temppolDetails = getIntent().getStringExtra("polDetails");
    tempefftDate = getIntent().getStringExtra("efftDate");
    tempexpDate = getIntent().getStringExtra("expDate");
    temptermLength = getIntent().getStringExtra("termLength");

    tempinsSummary = getIntent().getStringExtra("insSummary");
    temppremium = getIntent().getStringExtra("premium");
    tempdownPayment = getIntent().getStringExtra("downPayment");
    tempsalesCommision = getIntent().getStringExtra("salesCommision");
    tempdeductible = getIntent().getStringExtra("deductible");
    temppayMethod = getIntent().getStringExtra("payMethod");

    temppayFreq = getIntent().getStringExtra("payFreq");
    tempstatus = getIntent().getStringExtra("status");
    tempcharge = getIntent().getStringExtra("charge");
    tempcredit = getIntent().getStringExtra("credit");
    tempbalance = getIntent().getStringExtra("balance");

    init();

    policyType = new ArrayList<>();
    policyType.add("Vehicle (auto)");
    policyType.add("Property");
    policyType.add("Home");
    policyType.add("Health");
    policyType.add("Dental");
    policyType.add("Life");
    policyType.add("International (Travel)");
    policyType.add("Other");
    ArrayAdapter<String> clientAdapter =
        new ArrayAdapter<String>(
            this, android.R.layout.simple_list_item_1, android.R.id.text1, policyType);
    spPType.setAdapter(clientAdapter);
    spPType.setSelection(getSimpleIndex(spPType, temppolType));

    paymentMethod = new ArrayList<>();
    paymentMethod.add("Cash/Check");
    paymentMethod.add("Debit Card/Credit Card");
    paymentMethod.add("Direct Debit/Standing Order");
    paymentMethod.add("In-House Payroll");
    paymentMethod.add("Other");
    ArrayAdapter<String> payMethodAdapter =
        new ArrayAdapter<String>(
            this, android.R.layout.simple_list_item_1, android.R.id.text1, paymentMethod);
    spPayM.setAdapter(payMethodAdapter);
    spPayM.setSelection(getSimpleIndex(spPayM, temppayMethod));

    paymentFreq = new ArrayList<>();
    paymentFreq.add("01-Unique/Yearly");
    paymentFreq.add("12-Monthly");
    paymentFreq.add("06-Three-Monthly/Quarterly");
    paymentFreq.add("02-Semi-Annually/Bi-Annually");
    paymentFreq.add("24-Semi-Monthly");
    ArrayAdapter<String> payFreqAdapter =
        new ArrayAdapter<String>(
            this, android.R.layout.simple_list_item_1, android.R.id.text1, paymentFreq);
    spPayFrq.setAdapter(payFreqAdapter);
    spPayFrq.setSelection(getSimpleIndex(spPayFrq, temppayFreq));

    status = new ArrayList<>();
    status.add("Active");
    status.add("Inactive");
    status.add("Canceled");
    ArrayAdapter<String> statusAdapter =
        new ArrayAdapter<String>(
            this, android.R.layout.simple_list_item_1, android.R.id.text1, status);
    spStatus.setAdapter(statusAdapter);
    spStatus.setSelection(getSimpleIndex(spStatus, tempstatus));

    if (temppolNo == null || temppolNo.toString().trim().length() == 0) {
      spPType.setSelection(0);
    } else {
      edPolicyNumber.setText(temppolNo + " :: Edit");
      edProductD.setText(temppolDetails);
      edDate.setText(tempefftDate);
      expDate.setText(tempexpDate);
      edInsSumm.setText(tempinsSummary);
      edPrem.setText(temppremium);
      edDownP.setText(tempdownPayment);
      edSales.setText(tempsalesCommision);
      edTerm.setText(temptermLength);
      edDeduct.setText(tempdeductible);
      edCharge.setText(tempcharge);
      edCredit.setText(tempcredit);
      edBal.setText(tempbalance);
    }

    spPType.setOnItemSelectedListener(
        new AdapterView.OnItemSelectedListener() {
          @Override
          public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) {
            switch (i) {
              case 0:
                edProductD.setText(
                    "Vehicle Type:\nMake/Model:\nMarket Price:\nPrimary use:\nYear:\nMileage:\nTransmission:\nColor:");
                break;
              case 1:
                edProductD.setText(
                    "Construction Type:\nMarket Price:\nYear Built:\nLocation:\nConstruction Materials:\n# of Units:\n# of Stories:\nOccupancy:");
                break;
              case 2:
                edProductD.setText(
                    "Construction Type:\nMarket Price:\nYear Built:\nLocation:\nConstruction Materials:\n# of Units:\n# of Stories:\nOccupancy:");
                break;
              case 3:
                edProductD.setText(
                    "SSN:\nCoverage Desired:Single / Family\nMember coverage:\nBeneficiaries:\nPersonal Info:\nMedical Info:");
                break;
              case 4:
                edProductD.setText(
                    "SSN:\nCoverage Desired:Single / Family\nMember coverage:\nBeneficiaries:\nPersonal Info:\nMedical Info:");
                break;
              case 5:
                edProductD.setText(
                    "SSN:\nCoverage Desired:Single / Family\nMember coverage:\nBeneficiaries:\nPersonal Info:\nMedical Info:");
                break;
              case 6:
                edProductD.setText("");
                break;
              case 7:
                edProductD.setText("");
                break;
            }
          }

          @Override
          public void onNothingSelected(AdapterView<?> adapterView) {}
        });

    edDate.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            showDialog(DATE_PICKER_ID1);
          }
        });

    expDate.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            showDialog(DATE_PICKER_ID2);
          }
        });
    /* edDate.setOnTouchListener(new View.OnTouchListener() {
        @Override
        public boolean onTouch(View v, MotionEvent event) {
            final int DRAWABLE_LEFT = 0;
            final int DRAWABLE_TOP = 1;
            final int DRAWABLE_RIGHT = 2;
            final int DRAWABLE_BOTTOM = 3;

            if (event.getAction() == MotionEvent.ACTION_UP) {
                if (event.getRawX() >= (edDate.getRight() - edDate.getCompoundDrawables()[DRAWABLE_RIGHT].getBounds().width())) {
                    showDialog(DATE_PICKER_ID1);
                    return true;
                }
            }
            return false;
        }
    });*/

    /*expDate.setOnTouchListener(new View.OnTouchListener() {
        @Override
        public boolean onTouch(View v, MotionEvent event) {
            final int DRAWABLE_LEFT = 0;
            final int DRAWABLE_TOP = 1;
            final int DRAWABLE_RIGHT = 2;
            final int DRAWABLE_BOTTOM = 3;

            if (event.getAction() == MotionEvent.ACTION_UP) {
                if (event.getRawX() >= (expDate.getRight() - expDate.getCompoundDrawables()[DRAWABLE_RIGHT].getBounds().width())) {
                    showDialog(DATE_PICKER_ID2);
                    return true;
                }
            }
            return false;
        }
    });*/

    imgSave.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            checkValidation();
          }
        });
  }
예제 #24
0
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.lmzhenduanxinxi, container, false);
    init();
    shouShuRiQi = (EditText) rootView.findViewById(R.id.shoushuriqi);
    shouShuBianHao = (MaterialEditText) rootView.findViewById(R.id.shoushubianhao);
    shuZhe = (MaterialEditText) rootView.findViewById(R.id.shuzhe);
    shiSuLeiXing = (EditText) rootView.findViewById(R.id.shisuleixing);
    shiSuBingCheng = (EditText) rootView.findViewById(R.id.shisubingcheng);
    linChuangXinLvShiChangZhenDuan =
        (MaterialEditText) rootView.findViewById(R.id.linchuangxinlvshichangzhenduan);
    dianShengLiJianChaZhenDuan =
        (MaterialEditText) rootView.findViewById(R.id.dianshenglijianchazhenduan);
    shuHouZhenDuan = (MaterialEditText) rootView.findViewById(R.id.shuhouzhenduan);

    confirm = (CircularProgressButton) rootView.findViewById(R.id.confirm);

    DateFormat dateFormat = DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.MEDIUM);
    if (case3.getOperationData() != 0) {
      shouShuRiQi.setText(dateFormat.format(new Date(case3.getOperationData())));
    }
    if (case3.getOperationNumber() != null) {
      shouShuBianHao.setText(case3.getOperationNumber());
    }
    if (case3.getOperatorName() != null) {
      shuZhe.setText(case3.getOperatorName());
    }
    if (case3.getAfType() != null && !case3.getAfType().equals("")) {
      shiSuLeiXing.setText(
          "类型:"
              + case3.getAfType()
              + "\n\n"
              + "频度:"
              + case3.getAfFrequency()
              + "\n\n"
              + "每次发作持续时间:"
              + case3.getAfEveryAttackTime()
              + "\n\n"
              + "最近发作持续时间:"
              + case3.getAfLastAttackTime()
              + "\n\n"
              + "曾用转复方法:"
              + case3.getCardioversionMethod()
              + "\n\n"
              + "转律用药:"
              + case3.getCardioversionMedication());
    }
    if (case3.getAfCourseDisease() != null) {
      shiSuBingCheng.setText(case3.getAfCourseDisease());
    }
    if (case3.getArrhythmiaDiagnose() != null) {
      linChuangXinLvShiChangZhenDuan.setText(case3.getArrhythmiaDiagnose());
    }
    if (case3.getElectrophysiologyDiagnose() != null) {
      dianShengLiJianChaZhenDuan.setText(case3.getElectrophysiologyDiagnose());
    }
    if (case3.getPostoperationDiagnose() != null) {
      shuHouZhenDuan.setText(case3.getPostoperationDiagnose());
    }

    confirm.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View view) {
            nextStepListner.OnNextStepClicked(1);
          }
        });
    return rootView;
  }
 @Override
 public void onStart() {
   super.onStart();
   Utils.Log("MessageFragment onStart called");
   messageText.setText("");
 }
 private void setType(EventType type) {
   MaterialEditText typeEditText = ((MaterialEditText) rootView.findViewById(R.id.event_type));
   if (type != null) typeEditText.setText(type.getTypeName());
   else typeEditText.setText(null);
   selectedEventType = type;
 }
 private void setOnEventTypeClickListener() {
   MaterialEditText typeEditText = ((MaterialEditText) rootView.findViewById(R.id.event_type));
   typeEditText.setOnClickListener(showEventTypeDialog());
 }
 /** @Description: 发布闲置物品 */
 private void sendSecondHand() {
   title = titleET.getText().toString();
   type = typeSp.getText().toString();
   price = priceET.getText().toString();
   describe = describeET.getText().toString();
   bargain = bargainSp.getText().toString();
   qq = qqET.getText().toString();
   phone = phoneET.getText().toString();
   if (null == title || "".equals(title)) {
     ToastUtils.showToast("请输入标题~");
     openLinearLayoutByNull(false);
     titleET.requestFocus();
     return;
   }
   if (null == type || "".equals(type)) {
     openLinearLayoutByNull(false);
     ToastUtils.showToast("请选择类型~");
     return;
   }
   if (null == price || "".equals(price)) {
     openLinearLayoutByNull(false);
     ToastUtils.showToast("请输入价格~");
     priceET.requestFocus();
     return;
   }
   if (null == describe || "".equals(describe)) {
     openLinearLayoutByNull(false);
     ToastUtils.showToast("请输入详细描述~");
     describeET.requestFocus();
     return;
   }
   if (null == bargain || "".equals(bargain)) {
     openLinearLayoutByNull(true);
     ToastUtils.showToast("请选择可否议价~");
     return;
   }
   if ((null == qq || "".equals(qq)) && (null == phone || "".equals(phone))) {
     ToastUtils.showToast("请输入联系qq或号码其中一种~");
     openLinearLayoutByNull(true);
     if ((null == qq || "".equals(qq))) {
       qqET.requestFocus();
     } else {
       phoneET.requestFocus();
     }
     return;
   }
   if (!"".equals(phone) && !VerifyUtils.checkPhone(phone)) {
     ToastUtils.showToast("请输入正确的联系号码格式~");
     openLinearLayoutByNull(true);
     phoneET.requestFocus();
     return;
   }
   send();
 }
        @Override
        public void onClick(View view) {

          Utils.Log("Send clicked");

          // If the message field is not empty
          if (!messageText.getText().toString().isEmpty()) {

            final Message message = new Message();
            message.setSender(username);
            message.setRecipient(conversation.getUsername());

            // If DHKE was completed and a key exists
            if (!dbManager.getAESKey(conversation.getUsername()).isEmpty()) {
              String signature = "";
              String key = dbManager.getAESKey(conversation.getUsername());
              byte[] iv = Crypto.GenerateRandomIV();
              final String plainText = messageText.getText().toString();
              final String cipherText = Crypto.AESencrypt(key, plainText, iv);
              final String base64IV = Base64.encodeToString(iv, Base64.NO_WRAP);

              try {
                PrivateKey RSAKeySign =
                    Crypto.RSAStringToPrivateKey(dbManager.getRSAKeySignaturePrivate());

                signature =
                    Base64.encodeToString(
                        Crypto.RSASign(Base64.decode(cipherText, Base64.NO_WRAP), RSAKeySign),
                        Base64.NO_WRAP);

              } catch (NoSuchAlgorithmException e) {
                e.printStackTrace();
              } catch (InvalidKeySpecException e) {
                e.printStackTrace();
              } catch (NoSuchProviderException e) {
                e.printStackTrace();
              } catch (InvalidKeyException e) {
                e.printStackTrace();
              } catch (SignatureException e) {
                e.printStackTrace();
              }

              message.setMessage(cipherText);
              message.setIv(base64IV);
              message.setSignature(signature);

              new HttpHandler() {
                @Override
                public HttpUriRequest getHttpRequestMethod() {
                  HttpPost httpPost = new HttpPost(Utils.SERVER_SEND_MESSAGE);

                  List<NameValuePair> nameValuePairs = new ArrayList<>();
                  nameValuePairs.add(new BasicNameValuePair("sender", message.getSender()));
                  nameValuePairs.add(new BasicNameValuePair("recipient", message.getRecipient()));
                  nameValuePairs.add(new BasicNameValuePair("message", message.getMessage()));
                  nameValuePairs.add(new BasicNameValuePair("iv", message.getIv()));
                  nameValuePairs.add(new BasicNameValuePair("signature", message.getSignature()));

                  try {
                    httpPost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
                  } catch (UnsupportedEncodingException e) {
                    e.printStackTrace();
                  }

                  return httpPost;
                }

                @Override
                public void onResponse(String result) {
                  Utils.Log("HttpResult: " + result);

                  if (conversation.isEncrypted().equals("true")) {
                    message.setMessage(
                        Crypto.AESencrypt(
                            conversationPass,
                            plainText,
                            Base64.decode(message.getIv(), Base64.NO_WRAP)));
                    message.setEncrypted(true);

                    dbManager.addMessage(message);

                    message.setEncrypted(false);
                    message.setMessage(plainText);

                    messages.add(message);
                    adapter.notifyDataSetChanged();

                  } else {
                    message.setMessage(plainText);
                    message.setEncrypted(false);

                    dbManager.addMessage(message);

                    messages.add(message);
                    adapter.notifyDataSetChanged();
                  }

                  messageList.setSelection(messages.size() + 1);
                }
              }.execute();

              messageText.setText("");

            }

            // DHKE was not complete yet, store messages unencrypted temporarily
            // and then encrypt and send them once the exchange is complete
            else {
              message.setEncrypted(false);
              message.setMessage(messageText.getText().toString());
              message.setIv(Base64.encodeToString(Crypto.GenerateRandomIV(), Base64.NO_WRAP));

              dbManager.addMessage(message);

              messages.add(message);
              adapter.notifyDataSetChanged();

              messageList.setSelection(adapter.getCount() - 1);
              messageText.setText("");
            }
          }
        }
  /** @Description: 按键监听 */
  @Override
  public void onClick(View v) {
    switch (v.getId()) {
      case R.id.top_back_btn:
        { // 返回
          finish();
          break;
        }
      case R.id.set_alimony_commit_btn:
        { // 提交
          String content = alimonyET.getText().toString().replace(" ", "");
          if (VerifyUtils.isDigit(content)) {
            dialog.show();
            Integer alimony = Integer.parseInt(content);
            GlobalParams.userInfo.setAlimony(alimony);
            GlobalParams.userInfo.update(
                this,
                new UpdateListener() {

                  @Override
                  public void onSuccess() { // 成功
                    LogcatUtils.i("设置生活费指标成功");
                    dialog.dismiss();
                    setResult(CommonConstant.RESULTCODE_SET_ALIMONY_SUCCESS);
                    finish();
                  }

                  @Override
                  public void onFailure(int code, String message) { // 失败
                    LogcatUtils.e("设置生活费指标失败:" + code + " " + message);
                    dialog.dismiss();
                    GlobalParams.userInfo.setAlimony(alimonyLast);
                    switch (code) {
                      case 9010:
                        { // 网络超时
                          ToastUtils.showToast("网络超时,请检查您的手机网络~");
                          break;
                        }
                      case 9016:
                        { // 无网络连接,请检查您的手机网络
                          ToastUtils.showToast("无网络连接,请检查您的手机网络~");
                          break;
                        }
                      default:
                        {
                          ToastUtils.showToast("提交失败,请重试~");
                          break;
                        }
                    }
                  }
                });
          } else {
            ToastUtils.showToast("请输入整数~");
            alimonyET.requestFocus();
          }
          break;
        }
      default:
        break;
    }
  }