-
Notifications
You must be signed in to change notification settings - Fork 1.3k
ListStore integration for Post list #8473
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
Merged
kwonye
merged 24 commits into
feature/list-store-integration-for-post-list-master
from
issue/list-store-integration-for-post-list
Oct 25, 2018
Merged
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
352cc3a
A very rough first pass at integrating ListManager to post list
oguzkocer e0bcee4
Update FluxC hash, add lots of todos to post list and minor fixes
oguzkocer 766fe4d
Featured images are properly handled in post list
oguzkocer 45f8c74
Fix local changes not reflecting in post list
oguzkocer d94b356
Correctly handle upload events in post list
oguzkocer e4ac3aa
Add loading layout for post list
oguzkocer c1fb27f
Refresh the post list after an upload
oguzkocer 14c8eaf
Adds a workaround to local drafts briefly disappearing when it's push…
oguzkocer 3edc2dc
Skeleton view for loading posts in post list
oguzkocer b014196
Remove unused property and enum and replace if with when in PostListA…
oguzkocer 36fc606
Empty view in post list should be correctly updated now
oguzkocer 48f6e89
Fix an issue with comparing local items in post list
oguzkocer ae83827
Basic hide post support added for post list
oguzkocer 1fe0f13
Update FluxC hash and implement necessary changes in post list
oguzkocer 29a71b7
Update FluxC hash and resolve several todos in PostListFragment
oguzkocer 60e5209
Save trashed and uploaded post ids in the instance state
oguzkocer be31015
Merge branch 'feature/list-store-integration-for-post-list-master' in…
oguzkocer 5714744
Merge branch 'feature/list-store-integration-for-post-list-master' in…
oguzkocer 9adc90d
Add a style for post list skeleton buttons
oguzkocer d399213
Major cleanup/reorder of PostListFragment and PostListAdapter
oguzkocer 2d1814f
Second take at improving PostListFragment
oguzkocer f333500
Fix an issue for when a uploaded local draft doesn't show up in post …
oguzkocer 8719cdf
Throw illegal exception if a view type is not handled in PostListAdapter
oguzkocer ee5e054
Improve empty view handling for list manager changes
oguzkocer File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Update FluxC hash, add lots of todos to post list and minor fixes
- Loading branch information
commit e0bcee4bff3b9168b9f000728ff9e81c43cbed3a
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -238,6 +238,7 @@ class PostListAdapter( | |
onPostSelectedListener?.onPostSelected(post) | ||
} | ||
} | ||
// TODO: Handle the null case with a loading bar or something | ||
} | ||
|
||
private fun showFeaturedImage(postId: Int, imgFeatured: ImageView) { | ||
|
@@ -498,15 +499,16 @@ class PostListAdapter( | |
animOut.start() | ||
} | ||
|
||
fun getPositionForPost(post: PostModel): Int? { | ||
return listManager?.getPositionOfItem(post.remotePostId) | ||
} | ||
|
||
fun loadPosts(mode: LoadMode) { | ||
if (isLoadingPosts) { | ||
AppLog.d(AppLog.T.POSTS, "post adapter > already loading posts") | ||
fun getPositionForPost(post: PostModel): Int? = | ||
if (post.isLocalDraft) { | ||
listManager?.positionOfLocalItem { it.id == post.id } | ||
} else { | ||
LoadPostsTask(mode).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR) | ||
listManager?.positionOfRemoteItem(post.remotePostId) | ||
} | ||
|
||
fun updateRowForPost(post: PostModel) { | ||
getPositionForPost(post)?.let { position -> | ||
notifyItemChanged(position) | ||
} | ||
} | ||
|
||
|
@@ -545,7 +547,7 @@ class PostListAdapter( | |
|
||
fun unhidePost(post: PostModel) { | ||
if (hiddenPosts.remove(post)) { | ||
loadPosts(LoadMode.IF_CHANGED) | ||
// TODO: Handle this when the hide post is implemented | ||
} | ||
} | ||
|
||
|
@@ -599,6 +601,7 @@ class PostListAdapter( | |
// } | ||
} | ||
|
||
// TODO: Completely remove this! | ||
@SuppressLint("StaticFieldLeak") | ||
private inner class LoadPostsTask internal constructor(private val mLoadMode: LoadMode) | ||
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. We no longer need this task as |
||
: AsyncTask<Void, Void, Boolean>() { | ||
|
@@ -691,7 +694,3 @@ class PostListAdapter( | |
} | ||
} | ||
} | ||
|
||
fun <T> ListManager<T>.getPositionOfItem(remoteItemId: Long): Int? { | ||
return null | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
As mentioned here this is not actually removed, but just moved.