mirror of
https://github.com/KokaKiwi/BarInsta
synced 2024-11-22 14:47:29 +00:00
Null check context object. Should fix https://github.com/austinhuang0131/barinsta/issues/427
This commit is contained in:
parent
ae79a35d01
commit
160d556ac5
@ -416,6 +416,8 @@ public class LocationFragment extends Fragment implements SwipeRefreshLayout.OnR
|
|||||||
// binding.locationBiography.setCaptionIsExpandable(true);
|
// binding.locationBiography.setCaptionIsExpandable(true);
|
||||||
// binding.locationBiography.setCaptionIsExpanded(true);
|
// binding.locationBiography.setCaptionIsExpanded(true);
|
||||||
|
|
||||||
|
final Context context = getContext();
|
||||||
|
if (context == null) return;
|
||||||
if (TextUtils.isEmpty(biography)) {
|
if (TextUtils.isEmpty(biography)) {
|
||||||
locationDetailsBinding.locationBiography.setVisibility(View.GONE);
|
locationDetailsBinding.locationBiography.setVisibility(View.GONE);
|
||||||
} else {
|
} else {
|
||||||
@ -432,13 +434,13 @@ public class LocationFragment extends Fragment implements SwipeRefreshLayout.OnR
|
|||||||
final String originalText = autoLinkItem.getOriginalText().trim();
|
final String originalText = autoLinkItem.getOriginalText().trim();
|
||||||
navigateToProfile(originalText);
|
navigateToProfile(originalText);
|
||||||
});
|
});
|
||||||
locationDetailsBinding.locationBiography.addOnEmailClickListener(autoLinkItem -> Utils.openEmailAddress(getContext(),
|
locationDetailsBinding.locationBiography.addOnEmailClickListener(autoLinkItem -> Utils.openEmailAddress(context,
|
||||||
autoLinkItem.getOriginalText()
|
autoLinkItem.getOriginalText()
|
||||||
.trim()));
|
.trim()));
|
||||||
locationDetailsBinding.locationBiography
|
locationDetailsBinding.locationBiography
|
||||||
.addOnURLClickListener(autoLinkItem -> Utils.openURL(getContext(), autoLinkItem.getOriginalText().trim()));
|
.addOnURLClickListener(autoLinkItem -> Utils.openURL(context, autoLinkItem.getOriginalText().trim()));
|
||||||
locationDetailsBinding.locationBiography.setOnLongClickListener(v -> {
|
locationDetailsBinding.locationBiography.setOnLongClickListener(v -> {
|
||||||
Utils.copyText(getContext(), biography);
|
Utils.copyText(context, biography);
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -465,7 +467,7 @@ public class LocationFragment extends Fragment implements SwipeRefreshLayout.OnR
|
|||||||
locationDetailsBinding.locationUrl.setVisibility(View.VISIBLE);
|
locationDetailsBinding.locationUrl.setVisibility(View.VISIBLE);
|
||||||
locationDetailsBinding.locationUrl.setText(TextUtils.getSpannableUrl(url));
|
locationDetailsBinding.locationUrl.setText(TextUtils.getSpannableUrl(url));
|
||||||
}
|
}
|
||||||
final FavoriteDataSource dataSource = FavoriteDataSource.getInstance(getContext());
|
final FavoriteDataSource dataSource = FavoriteDataSource.getInstance(context);
|
||||||
final FavoriteRepository favoriteRepository = FavoriteRepository.getInstance(dataSource);
|
final FavoriteRepository favoriteRepository = FavoriteRepository.getInstance(dataSource);
|
||||||
locationDetailsBinding.favChip.setVisibility(View.VISIBLE);
|
locationDetailsBinding.favChip.setVisibility(View.VISIBLE);
|
||||||
favoriteRepository.getFavorite(String.valueOf(locationId), FavoriteType.LOCATION, new RepositoryCallback<Favorite>() {
|
favoriteRepository.getFavorite(String.valueOf(locationId), FavoriteType.LOCATION, new RepositoryCallback<Favorite>() {
|
||||||
|
Loading…
Reference in New Issue
Block a user