mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-26 20:33:53 +01:00
Merge remote-tracking branch 'refs/remotes/commons-app/master'
This commit is contained in:
commit
7947087280
4 changed files with 71 additions and 2 deletions
|
|
@ -23,7 +23,9 @@ import com.nostra13.universalimageloader.core.assist.FailReason;
|
|||
import com.nostra13.universalimageloader.core.assist.ImageLoadingListener;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
|
||||
import fr.free.nrw.commons.CommonsApplication;
|
||||
import fr.free.nrw.commons.License;
|
||||
|
|
@ -71,6 +73,7 @@ public class MediaDetailFragment extends Fragment {
|
|||
private TextView desc;
|
||||
private TextView license;
|
||||
private TextView coordinates;
|
||||
private TextView uploadedDate;
|
||||
private LinearLayout categoryContainer;
|
||||
private ScrollView scrollView;
|
||||
private ArrayList<String> categoryNames;
|
||||
|
|
@ -125,6 +128,7 @@ public class MediaDetailFragment extends Fragment {
|
|||
desc = (TextView) view.findViewById(R.id.mediaDetailDesc);
|
||||
license = (TextView) view.findViewById(R.id.mediaDetailLicense);
|
||||
coordinates = (TextView) view.findViewById(R.id.mediaDetailCoordinates);
|
||||
uploadedDate = (TextView) view.findViewById(R.id.mediaDetailuploadeddate);
|
||||
categoryContainer = (LinearLayout) view.findViewById(R.id.mediaDetailCategoryContainer);
|
||||
|
||||
licenseList = new LicenseList(getActivity());
|
||||
|
|
@ -229,6 +233,7 @@ public class MediaDetailFragment extends Fragment {
|
|||
desc.setText(prettyDescription(media));
|
||||
license.setText(prettyLicense(media));
|
||||
coordinates.setText(prettyCoordinates(media));
|
||||
uploadedDate.setText(prettyUploadedDate(media));
|
||||
|
||||
categoryNames.removeAll(categoryNames);
|
||||
categoryNames.addAll(media.getCategories());
|
||||
|
|
@ -392,6 +397,16 @@ public class MediaDetailFragment extends Fragment {
|
|||
}
|
||||
}
|
||||
|
||||
private String prettyUploadedDate(Media media) {
|
||||
Date date = media.getDateUploaded();
|
||||
if (date.toString() == null || date.toString().isEmpty()) {
|
||||
return "Uploaded date not available";
|
||||
}
|
||||
SimpleDateFormat formatter = new SimpleDateFormat("dd MMM yyyy");
|
||||
String formattedDate = formatter.format(date);
|
||||
return formattedDate;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the coordinates nicely formatted.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -1,8 +1,12 @@
|
|||
package fr.free.nrw.commons.nearby;
|
||||
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.location.LocationManager;
|
||||
|
||||
import android.net.Uri;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Bundle;
|
||||
|
|
@ -14,6 +18,7 @@ import android.view.MenuInflater;
|
|||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.Toast;
|
||||
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
|
|
@ -57,7 +62,7 @@ public class NearbyActivity extends BaseActivity {
|
|||
locationManager = new LocationServiceManager(this);
|
||||
locationManager.registerLocationManager();
|
||||
curLatLang = locationManager.getLatestLocation();
|
||||
nearbyAsyncTask = new NearbyAsyncTask();
|
||||
nearbyAsyncTask = new NearbyAsyncTask(this);
|
||||
nearbyAsyncTask.execute();
|
||||
|
||||
}
|
||||
|
|
@ -148,7 +153,7 @@ public class NearbyActivity extends BaseActivity {
|
|||
}
|
||||
|
||||
protected void refreshView() {
|
||||
nearbyAsyncTask = new NearbyAsyncTask();
|
||||
nearbyAsyncTask = new NearbyAsyncTask(this);
|
||||
nearbyAsyncTask.execute();
|
||||
}
|
||||
|
||||
|
|
@ -164,6 +169,12 @@ public class NearbyActivity extends BaseActivity {
|
|||
|
||||
private class NearbyAsyncTask extends AsyncTask<Void, Integer, List<Place>> {
|
||||
|
||||
private Context mContext;
|
||||
|
||||
private NearbyAsyncTask (Context context) {
|
||||
mContext = context;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPreExecute() {
|
||||
super.onPreExecute();
|
||||
|
|
@ -195,6 +206,12 @@ public class NearbyActivity extends BaseActivity {
|
|||
gsonPlaceList = gson.toJson(placeList);
|
||||
gsonCurLatLng = gson.toJson(curLatLang);
|
||||
|
||||
if (placeList.size() == 0) {
|
||||
int duration = Toast.LENGTH_SHORT;
|
||||
Toast toast = Toast.makeText(mContext, R.string.no_nearby, duration);
|
||||
toast.show();
|
||||
}
|
||||
|
||||
bundle.clear();
|
||||
bundle.putString("PlaceList", gsonPlaceList);
|
||||
bundle.putString("CurLatLng", gsonCurLatLng);
|
||||
|
|
|
|||
|
|
@ -217,6 +217,41 @@
|
|||
android:id="@+id/mediaDetailCategoryContainer"
|
||||
/>
|
||||
</LinearLayout>
|
||||
|
||||
<fr.free.nrw.commons.media.MediaDetailSpacer
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="8dp"
|
||||
/>
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/subBackground"
|
||||
android:padding="16dp"
|
||||
>
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/media_detail_uploaded_date"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="16sp"
|
||||
android:textStyle="bold"
|
||||
android:paddingBottom="6dp"
|
||||
/>
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/media_detail_uploaded_date"
|
||||
android:background="?attr/subBackground"
|
||||
android:id="@+id/mediaDetailuploadeddate"
|
||||
android:textColor="@android:color/white"
|
||||
android:layout_gravity="left|start"
|
||||
android:textSize="14sp"
|
||||
android:padding="12dp"
|
||||
/>
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
|
|
|
|||
|
|
@ -159,6 +159,7 @@ Tap this message (or hit back) to skip this step.</string>
|
|||
<string name="location_permission_rationale">Optional permission: Get current location for category suggestions</string>
|
||||
<string name="ok">OK</string>
|
||||
<string name="title_activity_nearby">Nearby Places</string>
|
||||
<string name="no_nearby">No nearby places found</string>
|
||||
<string name="warning">Warning</string>
|
||||
<string name="file_exists">This file already exists on Commons. Are you sure you want to proceed?</string>
|
||||
<string name="yes">Yes</string>
|
||||
|
|
@ -167,6 +168,7 @@ Tap this message (or hit back) to skip this step.</string>
|
|||
<string name="media_detail_media_title">Title of the media</string>
|
||||
<string name="media_detail_description">Description</string>
|
||||
<string name="media_detail_description_explanation">Description of the media goes here. This can potentially be fairly long, and will need to wrap across multiple lines. We hope it looks nice though.</string>
|
||||
<string name="media_detail_uploaded_date">Uploaded date</string>>
|
||||
<string name="become_a_tester_title">Become a Beta Tester</string>
|
||||
<string name="become_a_tester_description">Opt-in to our beta channel on Google Play and get early access to new features and bug fixes</string>
|
||||
<string name="beta_opt_in_link">https://play.google.com/apps/testing/fr.free.nrw.commons</string>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue