@Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    View view = inflater.inflate(R.layout.fragment_editnote, null);
    Bundle bundle = getArguments();
    date = bundle.getString("date");
    notetitleedit = (EditText) view.findViewById(R.id.notetitleedit);
    notetitleshowText = (TextView) view.findViewById(R.id.notetitleshowText);
    notecontenteditText = (EditText) view.findViewById(R.id.notecontenteditText);
    notecontentshowText = (TextView) view.findViewById(R.id.notecontentshowText);
    notestarttimeedit = (EditText) view.findViewById(R.id.notestarttimeedit);
    noteendtimeedit = (EditText) view.findViewById(R.id.noteendtimeedit);
    notenotificationenable = (SwitchButton) view.findViewById(R.id.notenotificationenable);
    notevoiceenable = (CheckBox) view.findViewById(R.id.notevoiceenable);
    noteshockenable = (CheckBox) view.findViewById(R.id.noteshockenable);
    notestarttimeselect = (Button) view.findViewById(R.id.notestarttimeselect);
    noteendtimeselect = (Button) view.findViewById(R.id.noteendtimeselect);
    notestarttimeselect.setOnClickListener(this);
    noteendtimeselect.setOnClickListener(this);
    boolean isShow = bundle.getBoolean("show", false);
    // 传递参数包括id则为查看或修改,否则为新建
    isNew = !bundle.containsKey("id");
    if (!isNew) {
      id = bundle.getLong("id");
      Note note = UserDataDbUtil.shareUserDataDb(getActivity()).getNote(id);
      if (isShow) {
        notetitleshowText.setText(note.getTitle());
        notecontentshowText.setText(note.getContent());

      } else {
        notetitleedit.setText(note.getTitle());
        notecontenteditText.setText(note.getContent());
      }
      noteendtimeedit.setText(TimeRender.getDate(note.getDotimeEnd(), "HH:mm"));
      notestarttimeedit.setText(TimeRender.getDate(note.getDotimeStart(), "HH:mm"));
      notenotificationenable.setChecked(note.isNotification());
      notevoiceenable.setChecked(note.isVoice());
      noteshockenable.setChecked(note.isShock());
    }
    if (isShow) {
      show();
    } else {
      edit();
    }
    return view;
  }
 public void sureValue() {
   String title = notetitleedit.getText().toString();
   if (title.equals("")) {
     Toast.makeText(getActivity(), "代办事项不能为空!", Toast.LENGTH_SHORT).show();
     return;
   }
   String content = notecontenteditText.getText().toString();
   String startTime = notestarttimeedit.getText().toString();
   String endTime = noteendtimeedit.getText().toString();
   if (startTime.equals("")) {
     Toast.makeText(getActivity(), "开始时间不能为空!", Toast.LENGTH_SHORT).show();
     return;
   }
   if (endTime.equals("")) {
     Toast.makeText(getActivity(), "结束时间不能为空!", Toast.LENGTH_SHORT).show();
     return;
   }
   Log.e("time", date + " " + startTime);
   long start = TimeRender.string2Date(date + " " + startTime, "yyyy-MM-dd HH:mm").getTime();
   long end = TimeRender.string2Date(date + " " + endTime, "yyyy-MM-dd HH:mm").getTime();
   if (end <= start) {
     Toast.makeText(getActivity(), "结束时间必须大于开始时间!", Toast.LENGTH_SHORT).show();
     return;
   }
   if (isNew) {
     long newId =
         UserDataDbUtil.shareUserDataDb(getActivity())
             .insertNewNote(
                 XmppTool.loginUser.getUserId(),
                 title,
                 content,
                 start,
                 end,
                 notenotificationenable.isChecked(),
                 notevoiceenable.isChecked(),
                 noteshockenable.isChecked());
     if (newId > 0) {
       Toast.makeText(getActivity(), "创建成功!", Toast.LENGTH_SHORT).show();
       getActivity().finish();
       MyAnimationUtils.outActivity(getActivity());
     } else {
       Toast.makeText(getActivity(), "创建失败,请重试!", Toast.LENGTH_SHORT).show();
     }
   } else {
     boolean isS =
         UserDataDbUtil.shareUserDataDb(getActivity())
             .modifyNote(
                 id,
                 title,
                 content,
                 start,
                 end,
                 notenotificationenable.isChecked(),
                 notevoiceenable.isChecked(),
                 noteshockenable.isChecked());
     if (isS) {
       Toast.makeText(getActivity(), "修改成功!", Toast.LENGTH_SHORT).show();
       getActivity().finish();
       MyAnimationUtils.outActivity(getActivity());
     } else {
       Toast.makeText(getActivity(), "修改失败,请重试!", Toast.LENGTH_SHORT).show();
     }
   }
 }