Commit Graph

56 Commits

Author SHA1 Message Date
Alex Ning
807ddf5a6e Move several classes to other packages. 2018-12-27 13:54:19 +08:00
Alex Ning
5603df7546 Loading best posts in specific subreddits is now working. 2018-12-27 13:28:23 +08:00
Alex Ning
45f67457fa Use Android Paging Library to load and display best posts. Loading best posts in a specific subreddit is broken. Fixed a bug which is PostViewModel's data becoming null after the app restart. Add notch support for Android Pie. 2018-12-27 11:29:02 +08:00
Alex Ning
60b659e651 Use GifImageView to display all the images in order to prevent slow playing of the gifs. Extend GifImageView as AspectRatioGifImageView to retain the features of AspectRatioImageView. 2018-12-22 10:42:24 +08:00
Alex Ning
33db4809e4 Use notifyItemRangeInserted when appropriate in order to avoid reloading the whole dataset. Change bur transformation parameter for NSFW preview. 2018-12-12 19:23:38 +08:00
Alex Ning
cdcb38db51 Use MVVM design pattern to load and display the posts. Minor bugs fixed. 2018-11-09 12:30:31 +08:00
Alex Ning
4373d3aa55 Minor layout tweaks. 2018-11-08 14:13:17 +08:00
Alex Ning
6e5a0e7ef3 Use AspectRatiotImageView instead of ImageView to fully display the preview images of posts and prevent scrolling jump in PostFragment and ViewPostDetailActivity. 2018-10-28 23:18:01 +08:00
Alex Ning
66402e661b Close the navigation drawer after clicking the item in it. Fix some logic related to post parsing. 2018-10-27 16:46:30 +08:00
Alex Ning
86ea4c8982 Bind views using ButterKnife. Let volume controls adjust music stream in ViewVideoActivity. 2018-10-27 00:06:35 +08:00
Alex Ning
ae81b23737 Move refreshAccessToken method from RefreshAccessToken class to AccessTokenAuthenticator class. Bind views using Butterknife in PostRecyclerViewAdapter and CommentMultiLevelRecyclerViewAdapter. 2018-10-19 15:29:07 +08:00
Alex Ning
4d0a0725c9 Use OkHttp3 Authenticator instead of OkHttp Interceptor to handle the case when the request fails with code 401. Refresh the access token in a synchronized block to avoid getting more than one access tokens and getting duplicate posts when performing multiple unauthorized requests. Minor bugs fixed. 2018-10-14 11:24:38 +08:00
Alex Ning
8b52810d7c Use Dagger 2 to inject the Retrofit singleton to classes. Minor bugs fixed. 2018-10-12 23:52:23 +08:00
Alex Ning
11ac14a3f1 Display a crosspost icon if the post is a crosspost. Hide the thumbtack icon if the post is not viewed in its subreddit. Tweak the post layout. Minor bugs fixed. 2018-10-05 14:28:14 +08:00
Alex Ning
b4a3e8b822 Minor layout tweaks. 2018-10-01 14:07:32 +08:00
Alex Ning
17ccccfa0e Add an error view when loading the image fails in ViewImageActivity. 2018-10-01 13:45:02 +08:00
Alex Ning
1bd9ba61c6 Change the layout of post. Add an error view when loading the preview image fails. 2018-09-28 14:49:49 +08:00
Alex Ning
cdcd5923fa Fixed a bug which causes the LastItemSynchronizer object in PaginationSynchronizer becomes null when the app is reopened after it was killed. Prepare to use Dagger 2 to manage Retrofit singleton. 2018-09-28 09:18:28 +08:00
Alex Ning
bfb311d75f Add a feature which is refreshing the posts by clicking the refresh button. Minor bugs fixed. Rewrite some code. 2018-09-24 17:03:57 +08:00
Alex Ning
a7d4485fc1 Click the subreddit icon or the subreddit name to view the subreddit's details in ViewPostDetailActivity. 2018-09-22 11:09:57 +08:00
Alex Ning
fc356c6505 Disable the animation for finishing activity in ViewImageActivity and ViewVideoActivity. Fixed a bug that occurred when parsing posts finishes but the PostFragment is not added in any Activity (e.g. Activity finishes). 2018-09-22 10:45:38 +08:00
Alex Ning
88e4cf810f Click the subreddit icon or the subreddit name to view the subreddit's details in PostFragment. Make the status bar in ViewSubredditDetailActivity translucent. Prepare to view the user's details in ViewUserDetailActivity. Minor bugs fixed. 2018-09-21 23:35:57 +08:00
Alex Ning
5c51450a8e Fixed a bug that the expand less button and the expand more button is not shown at the right time. 2018-09-03 16:17:51 +08:00
Alex Ning
06a692130c Replace the RecyclerView for comments to MultiLevelRecyclerView in order to display the comment trees easily. Click the expand more button to expand the comment tree. Click the expand less button to hide the comment tree. Rewrite some code. 2018-09-03 00:05:42 +08:00
Alex Ning
6637cefc05 Blur the preview image if the post is NSFW. Tweak some layouts. Optimize some methods. 2018-08-30 21:18:21 +08:00
Alex Ning
4364e20e36 Display a custom error view when there is something wrong when loading best posts. Probably fix a bug that holder.getAdapterPosition() returns -1 when loading subreddit icons in the RecyclerView of PostFragment. Subreddit banners are parsed correctly in ParseSubscribedThing. Check if the api call is successful in onResponse. Rewrite some methods. 2018-08-30 14:08:02 +08:00
Alex Ning
3fa6257428 Use Retrofit to fetch posts. Delete PaginationRequestQueueSynchronizer because there is no need to pass request queue between PostFragment and PostPaginationScrollListener. Delete and rewrite some code. 2018-08-29 12:54:05 +08:00
Alex Ning
2a57e4d5b4 Use Retrofit to send API requests. Rename some methods. Changing the type of some methods related to fetching data to static. 2018-08-28 23:59:03 +08:00
Alex Ning
a6a951732d Change some methods related to parsing data to static methods. Preparing to use Retrofit to send API requests. Already made a change to use Retrofit to fetch comments. 2018-08-27 23:05:56 +08:00
Alex Ning
41b243be7d Display the number of gold given to the post. 2018-08-26 14:51:13 +08:00
Alex Ning
d83ded0193 Display a thumbtack icon if the post is stickied on top. Display a gold icon and the number of gold if the post is gilded. Load subreddit icons in LoadSubredditIconAsyncTaskListener instead of loading the icons in onPostExecute() of LoadSubredditIconAsyncTask in order to avoid loading icons on a destroyed activity when start the Activity and then press back or up button immediately. 2018-08-24 10:38:37 +08:00
Alex Ning
f90bd4d1cc Change the logic of parsing the subreddit icon. Click the icon and the banner of the subreddit to view the image in ViewImageActivity. 2018-08-23 17:27:16 +08:00
Alex Ning
97079663ff Correctly handle the case that the value of SELFTEXT_HTML or BODY_HTML_KEY is null. Delete the constraint that only when all the subscribed subreddits and users data have been inserted can the two RecyclerViews update their data in order to avoid the newly fetched data cannot be observed by observers and make the RecyclerView getting the new data impossible. 2018-08-22 19:49:50 +08:00
Alex Ning
80058ff6ab Load comment and post content text in HTML form instead of String. Fixed a bug that the icon of subreddits was not parsed properly in ParseSubredditData class. 2018-08-21 00:08:48 +08:00
Alex Ning
0fa03cba21 Rename some classes and layout resources. Feature added: view posts in ViewSubredditDetailActivity. 2018-08-20 22:33:00 +08:00
Alex Ning
07b32b3900 Rename some classes. Change the logic of getting the subreddit icon. Prepare to display posts in ViewSubredditDetailActivity. 2018-08-20 00:04:49 +08:00
Alex Ning
23bf92d9cf Added feature: Vote in ViewPostDetailActivity. Fix some behavior after the vote fails. 2018-08-19 00:03:56 +08:00
Alex Ning
38344e305c Save vote state in CommentData 2018-08-18 09:35:45 +08:00
Alex Ning
cca0313990 Load user info after the new access token is retrieved if the old access token expired. Feature added: vote comment 2018-08-18 09:22:31 +08:00
Alex Ning
3c1423a127 Disable image rotation in ViewImageActivity. Disable dispatching touch event in ViewImageActivity when the image is zooming in or out in order to view the image. 2018-08-11 23:13:26 +08:00
Alex Ning
eb973138f7 Fixed a bug which causes the app to crash when there is no comment in a post. Add a no comment placeholder which is displayed when there is no comment in a post. 2018-08-11 17:49:30 +08:00
Alex Ning
c0eaf2d3bb Fixed a bug which causes the app crash when starting ViewImageActivity from ViewPostDetailActivity. 2018-08-11 00:05:20 +08:00
Alex Ning
362634d1c7 Display the subreddit icon in ViewPostDetailActivity. Fixed a bug when the subreddit had no icon, the default icon was not shown. Save the subreddit icon url to BestPostData. Having done saving the subreddit icon url to the instance of BestPostData, skip loading the icon from the database using AsyncTask and load the icon from the instance of BestPostData instead. 2018-08-10 10:24:36 +08:00
Alex Ning
e44a172db0 Display subreddit icons in best posts, eventually. Rename some methods. 2018-08-10 08:22:56 +08:00
Alex Ning
b0e2e273a7 Cancel loading the user's info when there is nobody logging in. Delete a line which access a deleted string resource in manifest. 2018-08-05 15:07:37 +08:00
Alex Ning
f2eb18749c Fetch a new access token in onCreate method of MainActivity when the old access token is about to expire, specifically, to expire within the next 5 minutes or is already expired to avoid refreshing the access token many times by other queries later. 2018-08-05 14:26:01 +08:00
Alex Ning
c6026e5659 Fetch the subreddit info and save it to the database. Solve a bug that cannot create a instance of SubredditViewModel. 2018-08-05 12:26:50 +08:00
Alex Ning
9334d3860e Preparing to fetch the subreddit info and save it to the database. 2018-08-01 00:15:58 +08:00
Alex Ning
7f8ca49190 Add the ViewSubredditActivity. Add a OnClickListener in the subscribed subreddits RecyclerView to lauch the ViewSubredditActivity. 2018-07-30 23:27:52 +08:00
Alex Ning
c752b66953 Add a scroll bar in the navigation drawer 2018-07-30 00:11:05 +08:00