Ejemplo n.º 1
0
 private void submitSolve() {
   try {
     List<ManyBook> books = mHelper.getManyBookDao().queryForAll();
     for (int i = 0; i < books.size(); i++) {
       if (positions[i] != 0) {
         ManyBook book = books.get(i);
         book.setSolve(true);
         mHelper.getManyBookDao().update(book);
       }
     }
     finish();
   } catch (Exception e) {
     e.printStackTrace();
   }
 }
Ejemplo n.º 2
0
 private void judgeSolve() {
   if (StringUtil.isEmpty(et_people.getText().toString().trim())) {
     ToastUtil.showToast(this, "请输入钱数");
     return;
   }
   if (Integer.valueOf(et_people.getText().toString().trim()) == 0) {
     ToastUtil.showToast(this, "请输入正确的钱数");
     return;
   }
   ManyBook book = null;
   for (int i = 0; i < books.size(); i++) {
     if (positions[i] != 0) {
       book = books.get(i);
       if (book.isSolve()) {
         solvedList.add(i);
       }
     }
   }
   if (solvedList.size() == 0) {
     startSolve();
   } else {
     createDialog();
   }
 }
Ejemplo n.º 3
0
 private void startSolve() {
   int people = 1;
   try {
     people = Integer.valueOf(et_people.getText().toString().trim());
     int money = 0;
     ManyBook book = null;
     for (int i = 0; i < books.size(); i++) {
       if (positions[i] != 0) {
         book = books.get(i);
         money += book.getMoney();
       }
     }
     DecimalFormat decimalFormat = new DecimalFormat(".00");
     tv_resulte.setText(
         "总计:"
             + money
             + "\n人数:"
             + people
             + "\n人均:"
             + decimalFormat.format(((float) money / (float) people)));
     bt_solve.setText("已均摊");
   } catch (Exception e) {
   }
 }