diff options
author | Alex Ning <chineseperson5@gmail.com> | 2019-10-14 03:03:54 +0000 |
---|---|---|
committer | Alex Ning <chineseperson5@gmail.com> | 2019-10-14 03:03:54 +0000 |
commit | 68f113a66ef9b21484ae24b9cb937397aee739fb (patch) | |
tree | debd9a06436aa1e53d9a7caf59cd5696c6fbb5a2 | |
parent | fdca23fa14c5f42b028a0598e9fb2c4ae6a696f2 (diff) | |
download | infinity-for-reddit-68f113a66ef9b21484ae24b9cb937397aee739fb.tar infinity-for-reddit-68f113a66ef9b21484ae24b9cb937397aee739fb.tar.gz infinity-for-reddit-68f113a66ef9b21484ae24b9cb937397aee739fb.tar.bz2 infinity-for-reddit-68f113a66ef9b21484ae24b9cb937397aee739fb.tar.lz infinity-for-reddit-68f113a66ef9b21484ae24b9cb937397aee739fb.tar.xz infinity-for-reddit-68f113a66ef9b21484ae24b9cb937397aee739fb.tar.zst infinity-for-reddit-68f113a66ef9b21484ae24b9cb937397aee739fb.zip |
Show an error message when favorite or unfavorite something failed. Minor bugs fixed. Version 1.3.0.
5 files changed, 15 insertions, 3 deletions
diff --git a/app/build.gradle b/app/build.gradle index e34daa12..4035fff1 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -6,8 +6,8 @@ android { applicationId "ml.docilealligator.infinityforreddit" minSdkVersion 21 targetSdkVersion 29 - versionCode 16 - versionName "1.2.2" + versionCode 17 + versionName "1.3.0" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } buildTypes { diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/FollowedUsersRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/FollowedUsersRecyclerViewAdapter.java index 43adb6cb..7978f89b 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/FollowedUsersRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/FollowedUsersRecyclerViewAdapter.java @@ -7,6 +7,7 @@ import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.TextView; +import android.widget.Toast; import androidx.annotation.NonNull; import androidx.recyclerview.widget.RecyclerView; @@ -136,6 +137,7 @@ public class FollowedUsersRecyclerViewAdapter extends RecyclerView.Adapter<Recyc @Override public void failed() { + Toast.makeText(mContext, R.string.thing_unfavorite_failed, Toast.LENGTH_SHORT).show(); int position = viewHolder.getAdapterPosition() - offset; if(position >= 0 && mFavoriteSubscribedUserData.size() > position) { mFavoriteSubscribedUserData.get(position).setFavorite(true); @@ -160,6 +162,7 @@ public class FollowedUsersRecyclerViewAdapter extends RecyclerView.Adapter<Recyc @Override public void failed() { + Toast.makeText(mContext, R.string.thing_favorite_failed, Toast.LENGTH_SHORT).show(); int position = viewHolder.getAdapterPosition() - offset; if(position >= 0 && mFavoriteSubscribedUserData.size() > position) { mFavoriteSubscribedUserData.get(position).setFavorite(false); @@ -212,6 +215,7 @@ public class FollowedUsersRecyclerViewAdapter extends RecyclerView.Adapter<Recyc @Override public void failed() { + Toast.makeText(mContext, R.string.thing_unfavorite_failed, Toast.LENGTH_SHORT).show(); int position = viewHolder.getAdapterPosition() - 1; if(position >= 0 && mFavoriteSubscribedUserData.size() > position) { mFavoriteSubscribedUserData.get(position).setFavorite(true); @@ -236,6 +240,7 @@ public class FollowedUsersRecyclerViewAdapter extends RecyclerView.Adapter<Recyc @Override public void failed() { + Toast.makeText(mContext, R.string.thing_favorite_failed, Toast.LENGTH_SHORT).show(); int position = viewHolder.getAdapterPosition() - 1; if(position >= 0 && mFavoriteSubscribedUserData.size() > position) { mFavoriteSubscribedUserData.get(position).setFavorite(false); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/SubscribedSubredditsRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/SubscribedSubredditsRecyclerViewAdapter.java index 1ccad0e9..510fe28e 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/SubscribedSubredditsRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/SubscribedSubredditsRecyclerViewAdapter.java @@ -7,6 +7,7 @@ import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.TextView; +import android.widget.Toast; import androidx.annotation.NonNull; import androidx.recyclerview.widget.RecyclerView; @@ -167,6 +168,7 @@ public class SubscribedSubredditsRecyclerViewAdapter extends RecyclerView.Adapte @Override public void failed() { + Toast.makeText(mContext, R.string.thing_unfavorite_failed, Toast.LENGTH_SHORT).show(); int position = viewHolder.getAdapterPosition() - offset; if(position >= 0 && mSubscribedSubredditData.size() > position) { mSubscribedSubredditData.get(position).setFavorite(true); @@ -191,6 +193,7 @@ public class SubscribedSubredditsRecyclerViewAdapter extends RecyclerView.Adapte @Override public void failed() { + Toast.makeText(mContext, R.string.thing_favorite_failed, Toast.LENGTH_SHORT).show(); int position = viewHolder.getAdapterPosition() - offset; if(position >= 0 && mSubscribedSubredditData.size() > position) { mSubscribedSubredditData.get(position).setFavorite(false); @@ -246,6 +249,7 @@ public class SubscribedSubredditsRecyclerViewAdapter extends RecyclerView.Adapte @Override public void failed() { + Toast.makeText(mContext, R.string.thing_unfavorite_failed, Toast.LENGTH_SHORT).show(); int position = viewHolder.getAdapterPosition() - 1; if(position >= 0 && mFavoriteSubscribedSubredditData.size() > position) { mFavoriteSubscribedSubredditData.get(position).setFavorite(true); @@ -270,6 +274,7 @@ public class SubscribedSubredditsRecyclerViewAdapter extends RecyclerView.Adapte @Override public void failed() { + Toast.makeText(mContext, R.string.thing_favorite_failed, Toast.LENGTH_SHORT).show(); int position = viewHolder.getAdapterPosition() - 1; if(position >= 0 && mFavoriteSubscribedSubredditData.size() > position) { mFavoriteSubscribedSubredditData.get(position).setFavorite(false); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/PostDataSource.java b/app/src/main/java/ml/docilealligator/infinityforreddit/PostDataSource.java index 3ee4c20f..f49d167b 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/PostDataSource.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/PostDataSource.java @@ -388,7 +388,7 @@ public class PostDataSource extends PageKeyedDataSource<String, Post> { RedditAPI api = retrofit.create(RedditAPI.class); Call<String> getPost; - if (accessToken != null) { + if (accessToken == null) { if (sortType.getTime() != null) { getPost = api.getSubredditBestPosts(subredditOrUserName, sortType.getType().value, sortType.getTime().value, after); diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index f37430d3..d332d5e0 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -231,6 +231,8 @@ <string name="post_hide_success">Post hidden</string> <string name="post_hide_failed">Unable to hide post</string> <string name="post_unhide_success">Post unhidden</string> + <string name="thing_favorite_failed">Failed to favorite it</string> + <string name="thing_unfavorite_failed">Failed to unfavorite it</string> <string name="post_unhide_failed">Unable to unhide post</string> <string name="delete_this_post">Delete This Post</string> <string name="delete_this_comment">Delete This Comment</string> |