public void newComment(View view) { final String newCommentString = mEdtNewComment.getText().toString().trim(); if (!TextUtils.isEmpty(newCommentString)) { CommentsEntity entity = new CommentsEntity( null, mCurrentAction.getId(), TimeStampUtils.dateToTimeStamp(new Date()), newCommentString, mCurrentUser.getId()); new CommentsManager(this).refresh(entity); finish(); } }
@Override public Loader<Cursor> onCreateLoader(int id, Bundle args) { switch (id) { case COMMENTS_LOADER_ID: return new CursorLoader( this, Contract.Comments.CONTENT_URI, null, Contract.Comments.ACTION_ID_SELECTION, new String[] {mCurrentAction.getId().toString()}, Contract.Comments.TIME_STAMP_ASC); default: throw new IllegalArgumentException("Invalid loader id=" + id); } }
@Override protected void onSaveInstanceState(@SuppressWarnings("NullableProblems") Bundle outState) { super.onSaveInstanceState(outState); outState.putLong(ACTION_ID_KEY, mCurrentAction.getId()); }