mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-26 20:33:53 +01:00
commit
0e71e817b6
27 changed files with 72 additions and 44 deletions
|
|
@ -1,7 +1,5 @@
|
|||
package fr.free.nrw.commons;
|
||||
|
||||
import fr.free.nrw.commons.location.LatLng;
|
||||
|
||||
import org.mediawiki.api.ApiResult;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
|
|
@ -22,6 +20,7 @@ import javax.xml.parsers.DocumentBuilder;
|
|||
import javax.xml.parsers.DocumentBuilderFactory;
|
||||
import javax.xml.parsers.ParserConfigurationException;
|
||||
|
||||
import fr.free.nrw.commons.location.LatLng;
|
||||
import timber.log.Timber;
|
||||
|
||||
/**
|
||||
|
|
@ -32,12 +31,10 @@ import timber.log.Timber;
|
|||
*/
|
||||
public class MediaDataExtractor {
|
||||
private boolean fetched;
|
||||
private boolean processed;
|
||||
|
||||
private String filename;
|
||||
private ArrayList<String> categories;
|
||||
private Map<String, String> descriptions;
|
||||
private String author;
|
||||
private Date date;
|
||||
private String license;
|
||||
private String coordinates;
|
||||
|
|
@ -51,7 +48,6 @@ public class MediaDataExtractor {
|
|||
categories = new ArrayList<>();
|
||||
descriptions = new HashMap<>();
|
||||
fetched = false;
|
||||
processed = false;
|
||||
this.licenseList = licenseList;
|
||||
}
|
||||
|
||||
|
|
@ -122,7 +118,6 @@ public class MediaDataExtractor {
|
|||
descriptions = getMultilingualText(descriptionNode);
|
||||
|
||||
Node authorNode = findTemplateParameter(templateNode, "author");
|
||||
author = getFlatText(authorNode);
|
||||
}
|
||||
|
||||
Node coordinateTemplateNode = findTemplate(doc.getDocumentElement(), "location");
|
||||
|
|
|
|||
|
|
@ -10,7 +10,6 @@ import butterknife.ButterKnife;
|
|||
import fr.free.nrw.commons.theme.BaseActivity;
|
||||
|
||||
public class WelcomeActivity extends BaseActivity {
|
||||
private WelcomePagerAdapter adapter;
|
||||
|
||||
@BindView(R.id.welcomePager) ViewPager pager;
|
||||
@BindView(R.id.welcomePagerIndicator) CirclePageIndicator indicator;
|
||||
|
|
@ -29,7 +28,7 @@ public class WelcomeActivity extends BaseActivity {
|
|||
}
|
||||
|
||||
private void setUpAdapter() {
|
||||
adapter = new WelcomePagerAdapter(this);
|
||||
WelcomePagerAdapter adapter = new WelcomePagerAdapter(this);
|
||||
pager.setAdapter(adapter);
|
||||
indicator.setViewPager(pager);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,7 +14,6 @@ public class CacheController {
|
|||
|
||||
private double x, y;
|
||||
private QuadTree<List<String>> quadTree;
|
||||
private Point<List<String>>[] pointsFound;
|
||||
private double xMinus, xPlus, yMinus, yPlus;
|
||||
|
||||
private static final int EARTH_RADIUS = 6378137;
|
||||
|
|
@ -42,6 +41,7 @@ public class CacheController {
|
|||
}
|
||||
|
||||
public List<String> findCategory() {
|
||||
Point<List<String>>[] pointsFound;
|
||||
//Convert decLatitude and decLongitude to a coordinate offset range
|
||||
convertCoordRange();
|
||||
pointsFound = quadTree.searchWithin(xMinus, yMinus, xPlus, yPlus);
|
||||
|
|
|
|||
|
|
@ -14,13 +14,11 @@ import fr.free.nrw.commons.R;
|
|||
|
||||
public class CategoriesAdapter extends BaseAdapter {
|
||||
|
||||
private Context context;
|
||||
private LayoutInflater mInflater;
|
||||
|
||||
private ArrayList<CategorizationFragment.CategoryItem> items;
|
||||
|
||||
public CategoriesAdapter(Context context, ArrayList<CategorizationFragment.CategoryItem> items) {
|
||||
this.context = context;
|
||||
this.items = items;
|
||||
mInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,16 +32,15 @@ import fr.free.nrw.commons.theme.NavigationBaseActivity;
|
|||
import fr.free.nrw.commons.utils.UriSerializer;
|
||||
import timber.log.Timber;
|
||||
|
||||
|
||||
public class NearbyActivity extends NavigationBaseActivity {
|
||||
|
||||
@BindView(R.id.progressBar)
|
||||
ProgressBar progressBar;
|
||||
private boolean isMapViewActive = false;
|
||||
|
||||
private LocationServiceManager locationManager;
|
||||
private LatLng curLatLang;
|
||||
private Gson gson;
|
||||
private String gsonPlaceList;
|
||||
private String gsonCurLatLng;
|
||||
private Bundle bundle;
|
||||
private NearbyAsyncTask nearbyAsyncTask;
|
||||
|
||||
|
|
@ -203,11 +202,11 @@ public class NearbyActivity extends NavigationBaseActivity {
|
|||
return;
|
||||
}
|
||||
|
||||
gson = new GsonBuilder()
|
||||
Gson gson = new GsonBuilder()
|
||||
.registerTypeAdapter(Uri.class, new UriSerializer())
|
||||
.create();
|
||||
gsonPlaceList = gson.toJson(placeList);
|
||||
gsonCurLatLng = gson.toJson(curLatLang);
|
||||
String gsonPlaceList = gson.toJson(placeList);
|
||||
String gsonCurLatLng = gson.toJson(curLatLang);
|
||||
|
||||
if (placeList.size() == 0) {
|
||||
int duration = Toast.LENGTH_SHORT;
|
||||
|
|
|
|||
|
|
@ -24,9 +24,7 @@ import fr.free.nrw.commons.utils.UriDeserializer;
|
|||
import timber.log.Timber;
|
||||
|
||||
public class NearbyListFragment extends ListFragment {
|
||||
private Gson gson;
|
||||
private List<Place> placeList;
|
||||
private LatLng curLatLng;
|
||||
|
||||
@BindView(R.id.listView) ListView listview;
|
||||
|
||||
|
|
@ -60,7 +58,7 @@ public class NearbyListFragment extends ListFragment {
|
|||
// Check that this is the first time view is created,
|
||||
// to avoid double list when screen orientation changed
|
||||
Bundle bundle = this.getArguments();
|
||||
gson = new GsonBuilder()
|
||||
Gson gson = new GsonBuilder()
|
||||
.registerTypeAdapter(Uri.class, new UriDeserializer())
|
||||
.create();
|
||||
if (bundle != null) {
|
||||
|
|
@ -69,7 +67,7 @@ public class NearbyListFragment extends ListFragment {
|
|||
Type listType = new TypeToken<List<Place>>() {}.getType();
|
||||
placeList = gson.fromJson(gsonPlaceList, listType);
|
||||
Type curLatLngType = new TypeToken<LatLng>() {}.getType();
|
||||
curLatLng = gson.fromJson(gsonLatLng, curLatLngType);
|
||||
LatLng curLatLng = gson.fromJson(gsonLatLng, curLatLngType);
|
||||
placeList = NearbyController.loadAttractionsFromLocationToPlaces(curLatLng, placeList);
|
||||
}
|
||||
if (savedInstanceState == null) {
|
||||
|
|
|
|||
|
|
@ -31,8 +31,6 @@ import fr.free.nrw.commons.utils.UriDeserializer;
|
|||
|
||||
public class NearbyMapFragment extends android.support.v4.app.Fragment {
|
||||
private MapView mapView;
|
||||
private Gson gson;
|
||||
private List<Place> placeList;
|
||||
private List<NearbyBaseMarker> baseMarkerOptionses;
|
||||
private fr.free.nrw.commons.location.LatLng curLatLng;
|
||||
|
||||
|
|
@ -44,14 +42,14 @@ public class NearbyMapFragment extends android.support.v4.app.Fragment {
|
|||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
Bundle bundle = this.getArguments();
|
||||
gson = new GsonBuilder()
|
||||
Gson gson = new GsonBuilder()
|
||||
.registerTypeAdapter(Uri.class, new UriDeserializer())
|
||||
.create();
|
||||
if (bundle != null) {
|
||||
String gsonPlaceList = bundle.getString("PlaceList");
|
||||
String gsonLatLng = bundle.getString("CurLatLng");
|
||||
Type listType = new TypeToken<List<Place>>() {}.getType();
|
||||
placeList = gson.fromJson(gsonPlaceList, listType);
|
||||
List<Place> placeList = gson.fromJson(gsonPlaceList, listType);
|
||||
Type curLatLngType = new TypeToken<fr.free.nrw.commons.location.LatLng>() {}.getType();
|
||||
curLatLng = gson.fromJson(gsonLatLng, curLatLngType);
|
||||
baseMarkerOptionses = NearbyController
|
||||
|
|
|
|||
|
|
@ -30,8 +30,7 @@ public class GPSExtractor {
|
|||
public boolean imageCoordsExists;
|
||||
private MyLocationListener myLocationListener;
|
||||
private LocationManager locationManager;
|
||||
private String provider;
|
||||
private Criteria criteria;
|
||||
|
||||
|
||||
public GPSExtractor(String filePath, Context context){
|
||||
this.filePath = filePath;
|
||||
|
|
@ -54,8 +53,8 @@ public class GPSExtractor {
|
|||
*/
|
||||
protected void registerLocationManager() {
|
||||
locationManager = (LocationManager) context.getSystemService(Context.LOCATION_SERVICE);
|
||||
criteria = new Criteria();
|
||||
provider = locationManager.getBestProvider(criteria, true);
|
||||
Criteria criteria = new Criteria();
|
||||
String provider = locationManager.getBestProvider(criteria, true);
|
||||
myLocationListener = new MyLocationListener();
|
||||
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -33,7 +33,6 @@ public class MwVolleyApi {
|
|||
private static RequestQueue REQUEST_QUEUE;
|
||||
private static final Gson GSON = new GsonBuilder().create();
|
||||
private Context context;
|
||||
private String coordsLog;
|
||||
|
||||
protected static Set<String> categorySet;
|
||||
private static List<String> categoryList;
|
||||
|
|
@ -56,7 +55,6 @@ public class MwVolleyApi {
|
|||
}
|
||||
|
||||
public void request(String coords) {
|
||||
coordsLog = coords;
|
||||
String apiUrl = buildUrl(coords);
|
||||
Timber.d("URL: %s", apiUrl);
|
||||
|
||||
|
|
|
|||
|
|
@ -47,7 +47,6 @@ public class ShareActivity
|
|||
implements SingleUploadFragment.OnUploadActionInitiated,
|
||||
CategorizationFragment.OnCategoriesSaveHandler {
|
||||
|
||||
private SingleUploadFragment shareView;
|
||||
private CategorizationFragment categorizationFragment;
|
||||
|
||||
private CommonsApplication app;
|
||||
|
|
@ -59,13 +58,13 @@ public class ShareActivity
|
|||
private Uri mediaUri;
|
||||
private Contribution contribution;
|
||||
private SimpleDraweeView backgroundImageView;
|
||||
|
||||
private UploadController uploadController;
|
||||
|
||||
private CommonsApplication cacheObj;
|
||||
private boolean cacheFound;
|
||||
|
||||
private GPSExtractor imageObj;
|
||||
private String filePath;
|
||||
private String decimalCoords;
|
||||
|
||||
private boolean useNewPermissions = false;
|
||||
|
|
@ -194,7 +193,7 @@ public class ShareActivity
|
|||
protected void onAuthCookieAcquired(String authCookie) {
|
||||
app.getMWApi().setAuthCookie(authCookie);
|
||||
|
||||
shareView = (SingleUploadFragment) getSupportFragmentManager().findFragmentByTag("shareView");
|
||||
SingleUploadFragment shareView = (SingleUploadFragment) getSupportFragmentManager().findFragmentByTag("shareView");
|
||||
categorizationFragment = (CategorizationFragment) getSupportFragmentManager().findFragmentByTag("categorization");
|
||||
if(shareView == null && categorizationFragment == null) {
|
||||
shareView = new SingleUploadFragment();
|
||||
|
|
@ -375,7 +374,7 @@ public class ShareActivity
|
|||
* @param gpsEnabled
|
||||
*/
|
||||
public void getFileMetadata(boolean gpsEnabled) {
|
||||
filePath = FileUtils.getPath(this, mediaUri);
|
||||
String filePath = FileUtils.getPath(this, mediaUri);
|
||||
Timber.d("Filepath: %s", filePath);
|
||||
Timber.d("Calling GPSExtractor");
|
||||
if(imageObj == null) {
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@
|
|||
android:layout_width="150dp"
|
||||
android:layout_height="118dp"
|
||||
android:scaleType="fitXY"
|
||||
android:contentDescription="@string/welcome_image_mount_zao"
|
||||
/>
|
||||
|
||||
<ImageView
|
||||
|
|
@ -32,6 +33,7 @@
|
|||
android:layout_width="150dp"
|
||||
android:layout_height="118dp"
|
||||
android:scaleType="fitXY"
|
||||
android:contentDescription="@string/welcome_image_llamas"
|
||||
/>
|
||||
|
||||
<ImageView
|
||||
|
|
@ -40,6 +42,7 @@
|
|||
android:layout_width="150dp"
|
||||
android:layout_height="118dp"
|
||||
android:scaleType="fitXY"
|
||||
android:contentDescription="@string/welcome_image_rainbow_bridge"
|
||||
/>
|
||||
|
||||
<ImageView
|
||||
|
|
@ -48,6 +51,7 @@
|
|||
android:layout_width="150dp"
|
||||
android:layout_height="118dp"
|
||||
android:scaleType="fitXY"
|
||||
android:contentDescription="@string/welcome_image_tulip"
|
||||
/>
|
||||
|
||||
</GridLayout>
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@
|
|||
android:id="@+id/selfie_x"
|
||||
android:layout_width="110dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:contentDescription="@string/welcome_image_no_selfies"
|
||||
/>
|
||||
|
||||
<ImageView
|
||||
|
|
@ -30,6 +31,7 @@
|
|||
android:layout_width="110dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toRightOf="@+id/selfie_x"
|
||||
android:contentDescription="@string/welcome_image_proprietary"
|
||||
/>
|
||||
|
||||
</RelativeLayout>
|
||||
|
|
|
|||
|
|
@ -17,13 +17,17 @@
|
|||
<ImageView
|
||||
android:layout_width="150dp"
|
||||
android:layout_height="180dp"
|
||||
android:src="@drawable/welcome_wikipedia"/>
|
||||
android:src="@drawable/welcome_wikipedia"
|
||||
android:contentDescription="@string/welcome_image_welcome_wikipedia"
|
||||
/>
|
||||
|
||||
<ImageView
|
||||
android:layout_width="160dp"
|
||||
android:layout_height="120dp"
|
||||
android:layout_gravity="center"
|
||||
android:src="@drawable/welcome_copyright"/>
|
||||
android:src="@drawable/welcome_copyright"
|
||||
android:contentDescription="@string/welcome_image_proprietary"
|
||||
/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@
|
|||
android:paddingBottom="24dp"
|
||||
android:adjustViewBounds="true"
|
||||
android:layout_gravity="center"
|
||||
android:contentDescription="@string/welcome_image_sydney_opera_house"
|
||||
/>
|
||||
|
||||
<LinearLayout android:orientation="vertical"
|
||||
|
|
|
|||
|
|
@ -13,7 +13,9 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:src="@drawable/welcome_wikipedia"
|
||||
android:adjustViewBounds="true"/>
|
||||
android:adjustViewBounds="true"
|
||||
android:contentDescription="@string/welcome_image_welcome_wikipedia"
|
||||
/>
|
||||
|
||||
<LinearLayout android:orientation="vertical"
|
||||
android:layout_width="wrap_content"
|
||||
|
|
|
|||
|
|
@ -26,7 +26,9 @@
|
|||
<ImageView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@drawable/ic_launcher" />
|
||||
android:src="@drawable/ic_launcher"
|
||||
android:contentDescription= "@string/commons_logo"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
style="?android:textAppearanceLarge"
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
|
||||
<include
|
||||
android:id="@+id/toolbar"
|
||||
layout="@layout/toolbar"
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@
|
|||
android:layout_gravity="center"
|
||||
android:src="@android:drawable/ic_menu_close_clear_cancel"
|
||||
android:visibility="gone"
|
||||
android:contentDescription="@string/mediaimage_failed"
|
||||
/>
|
||||
|
||||
<fr.free.nrw.commons.MediaWikiImageView
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@
|
|||
android:src="@drawable/empty_photo"
|
||||
android:background="#ffffff"
|
||||
android:scaleType="centerCrop"
|
||||
android:contentDescription="@string/no_image_found"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
|
|
|
|||
|
|
@ -15,7 +15,10 @@
|
|||
android:layout_height="192dp"
|
||||
app:actualImageScaleType="centerCrop"
|
||||
app:placeholderImage="@drawable/ic_image_black_24dp"
|
||||
app:failureImage="@drawable/ic_error_outline_black_24dp" />
|
||||
app:failureImage="@drawable/ic_error_outline_black_24dp"
|
||||
android:scaleType="centerCrop"
|
||||
android:contentDescription="@string/upload_image"
|
||||
/>
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/uploadOverlay"
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@
|
|||
android:layout_width="150dp"
|
||||
android:layout_height="118dp"
|
||||
android:scaleType="fitXY"
|
||||
android:contentDescription="@string/welcome_image_mount_zao"
|
||||
/>
|
||||
|
||||
<ImageView
|
||||
|
|
@ -31,6 +32,7 @@
|
|||
android:layout_width="150dp"
|
||||
android:layout_height="118dp"
|
||||
android:scaleType="fitXY"
|
||||
android:contentDescription="@string/welcome_image_llamas"
|
||||
/>
|
||||
|
||||
<ImageView
|
||||
|
|
@ -39,6 +41,7 @@
|
|||
android:layout_width="150dp"
|
||||
android:layout_height="118dp"
|
||||
android:scaleType="fitXY"
|
||||
android:contentDescription="@string/welcome_image_rainbow_bridge"
|
||||
/>
|
||||
|
||||
<ImageView
|
||||
|
|
@ -47,6 +50,7 @@
|
|||
android:layout_width="150dp"
|
||||
android:layout_height="118dp"
|
||||
android:scaleType="fitXY"
|
||||
android:contentDescription="@string/welcome_image_tulip"
|
||||
/>
|
||||
|
||||
</GridLayout>
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@
|
|||
android:id="@+id/selfie_x"
|
||||
android:layout_width="140dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:contentDescription="@string/welcome_image_no_selfies"
|
||||
/>
|
||||
|
||||
<ImageView
|
||||
|
|
@ -27,7 +28,9 @@
|
|||
android:id="@+id/proprietary_x"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_width="140dp"
|
||||
android:layout_height="wrap_content" />
|
||||
android:layout_height="wrap_content"
|
||||
android:contentDescription="@string/welcome_image_proprietary"
|
||||
/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@
|
|||
android:layout_width="150dp"
|
||||
android:layout_height="180dp"
|
||||
android:layout_marginLeft="30dp"
|
||||
android:contentDescription="@string/welcome_image_welcome_wikipedia"
|
||||
/>
|
||||
|
||||
<ImageView
|
||||
|
|
@ -29,6 +30,7 @@
|
|||
android:layout_height="120dp"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:contentDescription="@string/welcome_image_welcome_copyright"
|
||||
/>
|
||||
|
||||
</LinearLayout>
|
||||
|
|
|
|||
|
|
@ -15,7 +15,8 @@
|
|||
android:src="@drawable/sydney_opera_house"
|
||||
android:adjustViewBounds="true"
|
||||
android:layout_gravity="center"
|
||||
android:id="@+id/imageView" />
|
||||
android:id="@+id/imageView"
|
||||
android:contentDescription="@string/welcome_image_sydney_opera_house"/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="295dp"
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@
|
|||
android:layout_gravity="center"
|
||||
android:src="@drawable/welcome_wikipedia"
|
||||
android:adjustViewBounds="true"
|
||||
android:contentDescription="@string/welcome_image_welcome_wikipedia"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
|
|
|
|||
|
|
@ -168,7 +168,20 @@ Tap this message (or hit back) to skip this step.</string>
|
|||
<string name="set_limit">Set Recent Upload Limit</string>
|
||||
<string name="login_failed_2fa_not_supported">Two factor authentication is currently not supported.</string>
|
||||
<string name="logout_verification">Do you really want to logout?</string>
|
||||
|
||||
<string name="commons_logo">Commons Logo</string>
|
||||
<string name="background_image">Background Image</string>
|
||||
<string name="mediaimage_failed">Media Image Failed</string>
|
||||
<string name="no_image_found">No Image Found</string>
|
||||
<string name="upload_image">Upload Image</string>
|
||||
<string name="welcome_image_mount_zao">Mount Zao</string>
|
||||
<string name="welcome_image_llamas">Llamas</string>
|
||||
<string name="welcome_image_rainbow_bridge">Rainbow Bridge</string>
|
||||
<string name="welcome_image_tulip">Tulip</string>
|
||||
<string name="welcome_image_no_selfies">No Selfies</string>
|
||||
<string name="welcome_image_proprietary">Proprietary Image</string>
|
||||
<string name="welcome_image_welcome_wikipedia">Welcome Wikipedia</string>
|
||||
<string name="welcome_image_welcome_copyright">Welcome Copyright</string>
|
||||
<string name="welcome_image_sydney_opera_house">Sydney Opera House</string>
|
||||
<string name="cancel">Cancel</string>
|
||||
<string name="navigation_drawer_open">Open</string>
|
||||
<string name="navigation_drawer_close">Close</string>
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ buildscript {
|
|||
mavenCentral()
|
||||
}
|
||||
dependencies {
|
||||
classpath "com.android.tools.build:gradle:${project.gradleVersion}"
|
||||
classpath "com.android.tools.build:gradle:${project.gradleVersion}"
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue