Fix some codefactor warnings

This commit is contained in:
Ammar Githam 2021-04-15 23:40:55 +09:00
parent 81a55151c1
commit 732153f8bb
3 changed files with 47 additions and 42 deletions

View File

@ -169,6 +169,8 @@ public class SearchCategoryFragment extends Fragment {
swipeRefreshLayout.setRefreshing(true);
}
break;
default:
break;
}
}

View File

@ -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;
}
}

View File

@ -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<SearchItem> fromFavorite(final List<Favorite> 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 {