mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-27 12:53:55 +01:00
Move direct uploading code to DirectUpload class
This commit is contained in:
parent
8200d808d7
commit
009df16f3e
2 changed files with 39 additions and 14 deletions
|
|
@ -0,0 +1,36 @@
|
||||||
|
package fr.free.nrw.commons.nearby;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.SharedPreferences;
|
||||||
|
|
||||||
|
import timber.log.Timber;
|
||||||
|
|
||||||
|
class DirectUpload {
|
||||||
|
|
||||||
|
private String title;
|
||||||
|
private String desc;
|
||||||
|
|
||||||
|
DirectUpload(String title, String desc) {
|
||||||
|
this.title = title;
|
||||||
|
this.desc = desc;
|
||||||
|
}
|
||||||
|
|
||||||
|
void storeSharedPrefs(Context context) {
|
||||||
|
|
||||||
|
Activity activity = (Activity) context;
|
||||||
|
SharedPreferences sharedPref = activity.getPreferences(Context.MODE_PRIVATE);
|
||||||
|
SharedPreferences.Editor editor = sharedPref.edit();
|
||||||
|
|
||||||
|
editor.putString("Title", title);
|
||||||
|
editor.putString("Desc", desc);
|
||||||
|
editor.apply();
|
||||||
|
|
||||||
|
//TODO: Shift this into title/desc screen after upload initiated
|
||||||
|
sharedPref = activity.getPreferences(Context.MODE_PRIVATE);
|
||||||
|
String imageTitle = sharedPref.getString("Title", "");
|
||||||
|
String imageDesc = sharedPref.getString("Desc", "");
|
||||||
|
|
||||||
|
Timber.d("After shared prefs, image title: " + imageTitle + " Image desc: " + imageDesc);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -386,20 +386,9 @@ public class NearbyMapFragment extends android.support.v4.app.Fragment {
|
||||||
//TODO: Change this to activate camera upload (see ContributionsListFragment). Insert shared preference.
|
//TODO: Change this to activate camera upload (see ContributionsListFragment). Insert shared preference.
|
||||||
Timber.d("Image title: " + place.getName() + "Image desc: " + place.getLongDescription());
|
Timber.d("Image title: " + place.getName() + "Image desc: " + place.getLongDescription());
|
||||||
|
|
||||||
SharedPreferences sharedPref = getActivity().getPreferences(Context.MODE_PRIVATE);
|
DirectUpload directUpload = new DirectUpload(place.getName(), place.getLongDescription());
|
||||||
SharedPreferences.Editor editor = sharedPref.edit();
|
directUpload.storeSharedPrefs(getActivity());
|
||||||
editor.putString("Title", place.getName());
|
|
||||||
editor.putString("Desc", place.getLongDescription());
|
|
||||||
editor.apply();
|
|
||||||
|
|
||||||
//TODO: Shift this into title/desc screen after upload initiated
|
|
||||||
sharedPref = getActivity().getPreferences(Context.MODE_PRIVATE);
|
|
||||||
String imageTitle = sharedPref.getString("Title", "");
|
|
||||||
String imageDesc = sharedPref.getString("Desc", "");
|
|
||||||
|
|
||||||
Timber.d("After shared prefs, image title: " + imageTitle + " Image desc: " + imageDesc);
|
|
||||||
|
|
||||||
openWebView(place.siteLinks.getWikidataLink());
|
|
||||||
});
|
});
|
||||||
|
|
||||||
fabGallery.setOnClickListener(view -> {
|
fabGallery.setOnClickListener(view -> {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue