[go: nahoru, domu]

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added add/edit Post excerpt #22

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
added Post excerpt
  • Loading branch information
aagam-shah committed Jul 31, 2013
commit 1842822ec89f3f4fce1db2b722d2756e535e2c54
4 changes: 2 additions & 2 deletions src/org/wordpress/android/models/Post.java
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ public void setLocalDraft(boolean localDraft) {
this.localDraft = localDraft;
}

public JSONArray getCategories() {
public JSONArray getJSONCategories() {
JSONArray jArray = null;
if (categories == null)
categories = "";
Expand All @@ -197,7 +197,7 @@ public JSONArray getCategories() {
return jArray;
}

public void setCategories(JSONArray categories) {
public void setJSONCategories(JSONArray categories) {
this.categories = categories.toString();
}

Expand Down
11 changes: 9 additions & 2 deletions src/org/wordpress/android/ui/posts/EditPostActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public class EditPostActivity extends SherlockActivity implements OnClickListene
private WPEditText mContentEditText;
private ImageButton mAddPictureButton;
private Spinner mStatusSpinner;
private EditText mTitleEditText, mPasswordEditText, mTagsEditText;
private EditText mTitleEditText, mPasswordEditText, mTagsEditText, mExcerptEditText;
private TextView mLocationText, mPubDateText;
private ToggleButton mBoldToggleButton, mEmToggleButton, mBquoteToggleButton;
private ToggleButton mUnderlineToggleButton, mStrikeToggleButton;
Expand Down Expand Up @@ -224,6 +224,7 @@ public void onCreate(Bundle savedInstanceState) {
setContentView(R.layout.edit);
mContentEditText = (WPEditText) findViewById(R.id.postContent);
mTitleEditText = (EditText) findViewById(R.id.title);
mExcerptEditText= (EditText) findViewById(R.id.postExcerpt);
mPasswordEditText = (EditText) findViewById(R.id.post_password);
mLocationText = (TextView) findViewById(R.id.locationText);
mBoldToggleButton = (ToggleButton) findViewById(R.id.bold);
Expand Down Expand Up @@ -327,6 +328,7 @@ else if (mQuickMediaType == Constants.QUICK_POST_VIDEO_LIBRARY)
}
} else {
mTitleEditText.setText(mPost.getTitle());
mExcerptEditText.setText(mPost.getMt_excerpt());

if (mPost.isUploaded()) {
items = new String[] {
Expand Down Expand Up @@ -1394,7 +1396,12 @@ private boolean savePost(boolean isAutoSave, boolean isDraftSave) {
String title = mTitleEditText.getText().toString();
String password = mPasswordEditText.getText().toString();
String pubDate = mPubDateText.getText().toString();
String excerpt = mExcerptEditText.getText().toString();
String content = "";

if(excerpt.matches("")){
excerpt="";
}

if (mLocalDraft || mIsNew && !isAutoSave) {
Editable e = mContentEditText.getText();
Expand Down Expand Up @@ -1521,7 +1528,7 @@ public void onClick(DialogInterface dialog, int whichButton) {
}

if (mIsNew) {
mPost = new Post(mBlogID, title, content, images, pubDateTimestamp, mCategories.toString(), tags, status, password,
mPost = new Post(mBlogID, title, content, excerpt, images, pubDateTimestamp, mCategories.toString(), tags, status, password,
latitude, longitude, mIsPage, postFormat, true, false);
mPost.setLocalDraft(true);

Expand Down