1
0
mirror of https://github.com/KokaKiwi/BarInsta synced 2024-11-22 06:37:30 +00:00

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); swipeRefreshLayout.setRefreshing(true);
} }
break; break;
default:
break;
} }
} }

View File

@ -213,6 +213,8 @@ public class SearchFragment extends Fragment implements SearchCategoryFragment.O
bundle.putLong("locationId", searchItem.getPlace().getLocation().getPk()); bundle.putLong("locationId", searchItem.getPlace().getLocation().getPk());
navController.navigate(R.id.action_global_locationFragment, bundle); navController.navigate(R.id.action_global_locationFragment, bundle);
break; break;
default:
break;
} }
} catch (Exception e) { } catch (Exception e) {
Log.e(TAG, "onSearchItemClick: ", e); Log.e(TAG, "onSearchItemClick: ", e);
@ -237,6 +239,7 @@ public class SearchFragment extends Fragment implements SearchCategoryFragment.O
liveData.removeObserver(this); liveData.removeObserver(this);
break; break;
case LOADING: case LOADING:
default:
break; break;
} }
} }

View File

@ -148,48 +148,6 @@ public class SearchItem {
return null; 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) { public static List<SearchItem> fromFavorite(final List<Favorite> favorites) {
if (favorites == null) { if (favorites == null) {
return Collections.emptyList(); return Collections.emptyList();
@ -225,6 +183,20 @@ public class SearchItem {
return 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 @NonNull
private static User getUser(@NonNull final Favorite favorite) { private static User getUser(@NonNull final Favorite favorite) {
return new User( 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 @NonNull
private static Hashtag getHashtag(@NonNull final Favorite favorite) { private static Hashtag getHashtag(@NonNull final Favorite favorite) {
return new Hashtag( 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 @Nullable
private static Place getPlace(@NonNull final Favorite favorite) { private static Place getPlace(@NonNull final Favorite favorite) {
try { try {