コード例 #1
0
ファイル: AndroidCallUtil.java プロジェクト: gaixiaochuan/BIM
  /**
   * Checks if there is a call in progress. If true then shows a warning toast and finishes the
   * activity.
   *
   * @param activity activity doing a check.
   * @return <tt>true</tt> if there is call in progress and <tt>Activity</tt> was finished.
   */
  public static boolean checkCallInProgress(Activity activity) {
    if (CallManager.getActiveCallsCount() > 0) {
      logger.warn("Call is in progress");

      Toast t =
          Toast.makeText(activity, R.string.service_gui_WARN_CALL_IN_PROGRESS, Toast.LENGTH_SHORT);
      t.show();

      activity.finish();
      return true;
    } else {
      return false;
    }
  }
コード例 #2
0
 private void saveOrder(Order orderToSave) {
   valueList.put("_id", currentOrder.getOrderId());
   for (EditText fieldToSave : editFields) {
     if (fieldToSave.getText() != null) {
       valueList.put(fieldToSave.getTag().toString(), fieldToSave.getText().toString());
     }
   }
   orderToSave.setOrderValues(valueList);
   if (orderToSave.save()) {
     Toast toast =
         Toast.makeText(
             MainActivity.appContext,
             "Order " + orderToSave.getOrderId() + " saved",
             Toast.LENGTH_LONG);
     toast.show();
   }
 }