示例#1
0
 private void saveNote() {
   view.hideKeyBoard();
   if (TextUtils.isEmpty(view.getLabelText())) {
     note.setLabel(mContext.getString(R.string.default_label));
   } else {
     note.setLabel(view.getLabelText());
   }
   note.setContent(view.getContentText());
   note.setLastOprTime(TimeUtils.getCurrentTimeInLong());
   note.setStatus(SNote.Status.NEED_PUSH.getValue());
   event = new MainPresenter.NotifyEvent<>();
   switch (operateMode) {
     case CREATE_NOTE_MODE:
       note.setCreateTime(TimeUtils.getCurrentTimeInLong());
       event.setType(MainPresenter.NotifyEvent.CREATE_NOTE);
       mFinalDb.saveBindId(note);
       break;
     default:
       event.setType(MainPresenter.NotifyEvent.UPDATE_NOTE);
       mFinalDb.update(note);
       break;
   }
   event.setData(note);
   view.finishView();
 }
 /**
  * 失败返回-1
  *
  * @param context Context
  * @param entity ErrorHelpLog
  * @return int
  */
 public static int Insert(Context context, ErrorHelpLog entity) {
   FinalDb db = FinalDb.create(context, ApplicationConfig.DATABASE_NAME, DEBUG);
   if (db.saveBindId(entity)) {
     return entity.getId();
   }
   return -1;
 }