-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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 Swipe feature in Posts Activity and bug fix #456 #9
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -45,7 +45,7 @@ | |
|
||
public class ViewPostsFragment extends ListFragment { | ||
/** Called when the activity is first created. */ | ||
private String[] mPostIDs, mTitles, mDateCreated, mDateCreatedFormatted, | ||
private static String[] mPostIDs, mTitles, mDateCreated, mDateCreatedFormatted, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Instead of making these static, you could create a listener that works similarly to the 'onCommentStatusChangeListener' in ViewPostFragment.java. When the user swipes, you can call the listener which will tell the CommentsActivity to move to the next post. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I have created methods getNextId/getPrevId which acts similiar to a listener There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, but you shouldn't need to have those variables be static. The PostsActivity is the container for the two fragments. If one fragment wants to communicate a change, it should tell PostsActivity and it will communicate with the other fragment. I suggest you read up on http://developer.android.com/guide/components/fragments.html. In this case you could change the getNextId to something like 'loadNextPost' which would tell the list fragment to load the next item in the list, which would select the next row and load the post in the ViewPostFragment. Thanks for working on this. Fragments are kind of weird :) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ok..will update that |
||
mDraftIDs, mDraftTitles, mDraftDateCreated, mStatuses, mDraftStatuses; | ||
private int[] mUploaded; | ||
private int mRowID = 0; | ||
|
@@ -64,6 +64,28 @@ public class ViewPostsFragment extends ListFragment { | |
public int numRecords = 20; | ||
public ViewSwitcher switcher; | ||
public getRecentPostsTask getPostsTask; | ||
public static int curr_position=0; | ||
|
||
public String getnextID(){ | ||
if(curr_position+1>=mPostIDs.length) | ||
return mPostIDs[curr_position]; | ||
|
||
else{ | ||
curr_position=curr_position+1; | ||
return mPostIDs[curr_position]; | ||
} | ||
} | ||
|
||
public String getprevID(){ | ||
if(curr_position-1<0) | ||
return mPostIDs[curr_position]; | ||
|
||
else{ | ||
curr_position=curr_position-1; | ||
return mPostIDs[curr_position]; | ||
} | ||
|
||
} | ||
|
||
@Override | ||
public void onCreate(Bundle icicle) { | ||
|
@@ -273,6 +295,7 @@ public void onItemClick(AdapterView<?> arg0, View v, | |
.getId(), mSelectedID, isPage); | ||
if (post.getId() >= 0) { | ||
WordPress.currentPost = post; | ||
curr_position=position; | ||
mOnPostSelectedListener.onPostSelected(post); | ||
mPostListAdapter.notifyDataSetChanged(); | ||
} else { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about "Are you sure you want to delete this comment?"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes will update that...