This commit is contained in:
Austin Huang 2021-01-23 11:32:34 -05:00
parent 89441a3562
commit eba37705e2
No known key found for this signature in database
GPG Key ID: 84C23AA04587A91F
5 changed files with 37 additions and 15 deletions

View File

@ -99,9 +99,12 @@ public final class CommentsViewerFragment extends BottomSheetDialogFragment impl
@Override
public void onFailure(Throwable t) {
Toast.makeText(getContext(), t.getMessage(), Toast.LENGTH_SHORT).show();
binding.swipeRefreshLayout.setRefreshing(false);
stopCurrentExecutor();
try {
Toast.makeText(getContext(), t.getMessage(), Toast.LENGTH_SHORT).show();
binding.swipeRefreshLayout.setRefreshing(false);
stopCurrentExecutor();
}
catch(Throwable e) {}
}
};

View File

@ -83,8 +83,11 @@ public final class FollowViewerFragment extends Fragment implements SwipeRefresh
@Override
public void onFailure(final Throwable t) {
binding.swipeRefreshLayout.setRefreshing(false);
Toast.makeText(getContext(), t.getMessage(), Toast.LENGTH_SHORT).show();
try {
binding.swipeRefreshLayout.setRefreshing(false);
Toast.makeText(getContext(), t.getMessage(), Toast.LENGTH_SHORT).show();
}
catch(Throwable e) {}
Log.e(TAG, "Error fetching list (double, following)", t);
}
};
@ -109,8 +112,11 @@ public final class FollowViewerFragment extends Fragment implements SwipeRefresh
@Override
public void onFailure(final Throwable t) {
binding.swipeRefreshLayout.setRefreshing(false);
Toast.makeText(getContext(), t.getMessage(), Toast.LENGTH_SHORT).show();
try {
binding.swipeRefreshLayout.setRefreshing(false);
Toast.makeText(getContext(), t.getMessage(), Toast.LENGTH_SHORT).show();
}
catch(Throwable e) {}
Log.e(TAG, "Error fetching list (double, follower)", t);
}
};
@ -221,8 +227,11 @@ public final class FollowViewerFragment extends Fragment implements SwipeRefresh
@Override
public void onFailure(final Throwable t) {
binding.swipeRefreshLayout.setRefreshing(false);
Toast.makeText(getContext(), t.getMessage(), Toast.LENGTH_SHORT).show();
try {
binding.swipeRefreshLayout.setRefreshing(false);
Toast.makeText(getContext(), t.getMessage(), Toast.LENGTH_SHORT).show();
}
catch(Throwable e) {}
Log.e(TAG, "Error fetching list (single)", t);
}
};

View File

@ -271,8 +271,11 @@ public final class NotificationsViewerFragment extends Fragment implements Swipe
@Override
public void onFailure(Throwable t) {
binding.swipeRefreshLayout.setRefreshing(false);
Toast.makeText(getContext(), t.getMessage(), Toast.LENGTH_SHORT).show();
try {
binding.swipeRefreshLayout.setRefreshing(false);
Toast.makeText(getContext(), t.getMessage(), Toast.LENGTH_SHORT).show();
}
catch(Throwable e) {}
}
}).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
break;
@ -287,8 +290,11 @@ public final class NotificationsViewerFragment extends Fragment implements Swipe
@Override
public void onFailure(final Throwable t) {
binding.swipeRefreshLayout.setRefreshing(false);
Toast.makeText(getContext(), t.getMessage(), Toast.LENGTH_SHORT).show();
try {
binding.swipeRefreshLayout.setRefreshing(false);
Toast.makeText(getContext(), t.getMessage(), Toast.LENGTH_SHORT).show();
}
catch(Throwable e) {}
}
});
break;

View File

@ -236,8 +236,11 @@ public class StoryViewerFragment extends Fragment {
@Override
public void onFailure(@NonNull final Call<DirectThreadBroadcastResponse> call, @NonNull final Throwable t) {
Toast.makeText(context, R.string.downloader_unknown_error, Toast.LENGTH_SHORT).show();
Log.e(TAG, "onFailure: ", t);
try {
Toast.makeText(context, R.string.downloader_unknown_error, Toast.LENGTH_SHORT).show();
Log.e(TAG, "onFailure: ", t);
}
catch(Throwable e) {}
}
});
} catch (UnsupportedEncodingException e) {

View File

@ -35,6 +35,7 @@ public abstract class BaseService {
final Gson gson = new GsonBuilder()
.setFieldNamingPolicy(FieldNamingPolicy.LOWER_CASE_WITH_UNDERSCORES)
.registerTypeAdapter(Caption.class, new Caption.CaptionDeserializer())
.setLenient()
.create();
builder = new Retrofit.Builder()
.addConverterFactory(ScalarsConverterFactory.create())