mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-29 05:43:55 +01:00
Get coordinate template when parsing image page
Currently the image detail view does not display the coordinates. This commit adds the coordinate template to the parser and displays the results rounded to 4 digits.
This commit is contained in:
parent
81d23a3b94
commit
c6a2f2c7ea
4 changed files with 91 additions and 0 deletions
|
|
@ -70,6 +70,7 @@ public class MediaDetailFragment extends Fragment {
|
|||
private TextView title;
|
||||
private TextView desc;
|
||||
private TextView license;
|
||||
private TextView coordinates;
|
||||
private LinearLayout categoryContainer;
|
||||
private ScrollView scrollView;
|
||||
private ArrayList<String> categoryNames;
|
||||
|
|
@ -123,6 +124,7 @@ public class MediaDetailFragment extends Fragment {
|
|||
title = (TextView) view.findViewById(R.id.mediaDetailTitle);
|
||||
desc = (TextView) view.findViewById(R.id.mediaDetailDesc);
|
||||
license = (TextView) view.findViewById(R.id.mediaDetailLicense);
|
||||
coordinates = (TextView) view.findViewById(R.id.mediaDetailCoordinates);
|
||||
categoryContainer = (LinearLayout) view.findViewById(R.id.mediaDetailCategoryContainer);
|
||||
|
||||
licenseList = new LicenseList(getActivity());
|
||||
|
|
@ -226,6 +228,7 @@ public class MediaDetailFragment extends Fragment {
|
|||
// Set text of desc, license, and categories
|
||||
desc.setText(prettyDescription(media));
|
||||
license.setText(prettyLicense(media));
|
||||
coordinates.setText(prettyCoordinates(media));
|
||||
|
||||
categoryNames.removeAll(categoryNames);
|
||||
categoryNames.addAll(media.getCategories());
|
||||
|
|
@ -388,4 +391,15 @@ public class MediaDetailFragment extends Fragment {
|
|||
return licenseObj.getName();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the coordinates nicely formatted.
|
||||
*
|
||||
* @return Coordinates as text.
|
||||
*/
|
||||
private String prettyCoordinates(Media media) {
|
||||
String coordinates = media.getCoordinates();
|
||||
|
||||
return coordinates;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue