mirror of
https://codeberg.org/Bazsalanszky/Infinity-For-Lemmy.git
synced 2025-01-23 08:24:44 +01:00
Show an error message when favorite or unfavorite something failed. Minor bugs fixed. Version 1.3.0.
This commit is contained in:
parent
fdca23fa14
commit
68f113a66e
@ -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 {
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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>
|
||||
|
Loading…
x
Reference in New Issue
Block a user