From 732153f8bb1036f786d7f2fefa77b349fad84b7c Mon Sep 17 00:00:00 2001 From: Ammar Githam Date: Thu, 15 Apr 2021 23:40:55 +0900 Subject: [PATCH] Fix some codefactor warnings --- .../search/SearchCategoryFragment.java | 2 + .../fragments/search/SearchFragment.java | 3 + .../responses/search/SearchItem.java | 84 +++++++++---------- 3 files changed, 47 insertions(+), 42 deletions(-) diff --git a/app/src/main/java/awais/instagrabber/fragments/search/SearchCategoryFragment.java b/app/src/main/java/awais/instagrabber/fragments/search/SearchCategoryFragment.java index 89a2c7e9..4eb1ed8d 100644 --- a/app/src/main/java/awais/instagrabber/fragments/search/SearchCategoryFragment.java +++ b/app/src/main/java/awais/instagrabber/fragments/search/SearchCategoryFragment.java @@ -169,6 +169,8 @@ public class SearchCategoryFragment extends Fragment { swipeRefreshLayout.setRefreshing(true); } break; + default: + break; } } diff --git a/app/src/main/java/awais/instagrabber/fragments/search/SearchFragment.java b/app/src/main/java/awais/instagrabber/fragments/search/SearchFragment.java index 91ca1519..4373e95c 100644 --- a/app/src/main/java/awais/instagrabber/fragments/search/SearchFragment.java +++ b/app/src/main/java/awais/instagrabber/fragments/search/SearchFragment.java @@ -213,6 +213,8 @@ public class SearchFragment extends Fragment implements SearchCategoryFragment.O bundle.putLong("locationId", searchItem.getPlace().getLocation().getPk()); navController.navigate(R.id.action_global_locationFragment, bundle); break; + default: + break; } } catch (Exception e) { Log.e(TAG, "onSearchItemClick: ", e); @@ -237,6 +239,7 @@ public class SearchFragment extends Fragment implements SearchCategoryFragment.O liveData.removeObserver(this); break; case LOADING: + default: break; } } diff --git a/app/src/main/java/awais/instagrabber/repositories/responses/search/SearchItem.java b/app/src/main/java/awais/instagrabber/repositories/responses/search/SearchItem.java index 296e9c84..f99c7dfd 100644 --- a/app/src/main/java/awais/instagrabber/repositories/responses/search/SearchItem.java +++ b/app/src/main/java/awais/instagrabber/repositories/responses/search/SearchItem.java @@ -148,48 +148,6 @@ public class SearchItem { return null; } - @NonNull - private static User getUser(@NonNull final RecentSearch recentSearch) { - return new User( - Long.parseLong(recentSearch.getIgId()), - recentSearch.getUsername(), - recentSearch.getName(), - false, - recentSearch.getPicUrl(), - null, null, false, false, false, false, false, - null, null, 0, 0, 0, 0, null, null, - 0, null, null, null, null, null, null - ); - } - - @NonNull - private static Hashtag getHashtag(@NonNull final RecentSearch recentSearch) { - return new Hashtag( - recentSearch.getIgId(), - recentSearch.getName(), - 0, - null, - null - ); - } - - @NonNull - private static Place getPlace(@NonNull final RecentSearch recentSearch) { - final Location location = new Location( - Long.parseLong(recentSearch.getIgId()), - recentSearch.getName(), - recentSearch.getName(), - null, null, 0, 0 - ); - return new Place( - location, - recentSearch.getName(), - null, - null, - null - ); - } - public static List fromFavorite(final List favorites) { if (favorites == null) { return Collections.emptyList(); @@ -225,6 +183,20 @@ public class SearchItem { return searchItem; } + @NonNull + private static User getUser(@NonNull final RecentSearch recentSearch) { + return new User( + Long.parseLong(recentSearch.getIgId()), + recentSearch.getUsername(), + recentSearch.getName(), + false, + recentSearch.getPicUrl(), + null, null, false, false, false, false, false, + null, null, 0, 0, 0, 0, null, null, + 0, null, null, null, null, null, null + ); + } + @NonNull private static User getUser(@NonNull final Favorite favorite) { return new User( @@ -239,6 +211,17 @@ public class SearchItem { ); } + @NonNull + private static Hashtag getHashtag(@NonNull final RecentSearch recentSearch) { + return new Hashtag( + recentSearch.getIgId(), + recentSearch.getName(), + 0, + null, + null + ); + } + @NonNull private static Hashtag getHashtag(@NonNull final Favorite favorite) { return new Hashtag( @@ -250,6 +233,23 @@ public class SearchItem { ); } + @NonNull + private static Place getPlace(@NonNull final RecentSearch recentSearch) { + final Location location = new Location( + Long.parseLong(recentSearch.getIgId()), + recentSearch.getName(), + recentSearch.getName(), + null, null, 0, 0 + ); + return new Place( + location, + recentSearch.getName(), + null, + null, + null + ); + } + @Nullable private static Place getPlace(@NonNull final Favorite favorite) { try {