mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-29 22:03:55 +01:00
* Api call * added captions * final commit * some minor changes * sigular * test for captions * mock fetchCaptionbyFileName * corrected method name * * used ? instead of !! (unsafe call on nullable) * updated unit test for fetchCaptionByFilename()
This commit is contained in:
parent
047059c490
commit
3c9b7ba7a8
9 changed files with 137 additions and 6 deletions
|
|
@ -101,6 +101,8 @@ public class MediaDetailFragment extends CommonsDaggerSupportFragment {
|
|||
SimpleDraweeView image;
|
||||
@BindView(R.id.mediaDetailSpacer)
|
||||
MediaDetailSpacer spacer;
|
||||
@BindView(R.id.mediaDetailCaption)
|
||||
TextView mediaCaption;
|
||||
@BindView(R.id.mediaDetailTitle)
|
||||
TextView title;
|
||||
@BindView(R.id.mediaDetailDesc)
|
||||
|
|
@ -315,6 +317,7 @@ public class MediaDetailFragment extends CommonsDaggerSupportFragment {
|
|||
coordinates.setText(prettyCoordinates(media));
|
||||
uploadedDate.setText(prettyUploadedDate(media));
|
||||
mediaDiscussion.setText(prettyDiscussion(media));
|
||||
mediaCaption.setText(prettyCaption(media));
|
||||
|
||||
categoryNames.clear();
|
||||
categoryNames.addAll(media.getCategories());
|
||||
|
|
@ -516,6 +519,16 @@ public class MediaDetailFragment extends CommonsDaggerSupportFragment {
|
|||
return desc;
|
||||
}
|
||||
}
|
||||
|
||||
private String prettyCaption(Media media) {
|
||||
String caption = media.getCaption().trim();
|
||||
if (caption.equals("")) {
|
||||
return getString(R.string.detail_caption_empty);
|
||||
} else {
|
||||
return caption;
|
||||
}
|
||||
}
|
||||
|
||||
private String prettyDiscussion(Media media) {
|
||||
String disc = media.getDiscussion().trim();
|
||||
if (disc.equals("")) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue