mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-28 21:33:53 +01:00
Merge pull request #777 from akaita/media_detail
Fix issues in Media Detail screen
This commit is contained in:
commit
19a3fa3adc
6 changed files with 51 additions and 30 deletions
|
|
@ -2,8 +2,10 @@ package fr.free.nrw.commons.media;
|
|||
|
||||
import android.content.Intent;
|
||||
import android.database.DataSetObserver;
|
||||
import android.net.Uri;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.util.TypedValue;
|
||||
import android.view.LayoutInflater;
|
||||
|
|
@ -18,6 +20,7 @@ import java.io.IOException;
|
|||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.Locale;
|
||||
|
||||
import fr.free.nrw.commons.License;
|
||||
import fr.free.nrw.commons.LicenseList;
|
||||
|
|
@ -26,6 +29,7 @@ import fr.free.nrw.commons.MediaDataExtractor;
|
|||
import fr.free.nrw.commons.MediaWikiImageView;
|
||||
import fr.free.nrw.commons.PageTitle;
|
||||
import fr.free.nrw.commons.R;
|
||||
import fr.free.nrw.commons.location.LatLng;
|
||||
import timber.log.Timber;
|
||||
|
||||
public class MediaDetailFragment extends Fragment {
|
||||
|
|
@ -262,6 +266,7 @@ public class MediaDetailFragment extends Fragment {
|
|||
}
|
||||
|
||||
private void rebuildCatList() {
|
||||
categoryContainer.removeAllViews();
|
||||
// @fixme add the category items
|
||||
for (String cat : categoryNames) {
|
||||
View catLabel = buildCatLabel(cat);
|
||||
|
|
@ -327,7 +332,7 @@ public class MediaDetailFragment extends Fragment {
|
|||
|
||||
private String prettyUploadedDate(Media media) {
|
||||
Date date = media.getDateUploaded();
|
||||
if (date.toString() == null || date.toString().isEmpty()) {
|
||||
if (date == null || date.toString() == null || date.toString().isEmpty()) {
|
||||
return "Uploaded date not available";
|
||||
}
|
||||
SimpleDateFormat formatter = new SimpleDateFormat("dd MMM yyyy");
|
||||
|
|
@ -340,6 +345,9 @@ public class MediaDetailFragment extends Fragment {
|
|||
* @return Coordinates as text.
|
||||
*/
|
||||
private String prettyCoordinates(Media media) {
|
||||
return media.getCoordinates();
|
||||
if (media.getCoordinates() == null) {
|
||||
return getString(R.string.media_detail_coordinates_empty);
|
||||
}
|
||||
return media.getCoordinates().getPrettyCoordinateString();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue