mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-27 12:53:55 +01:00
Add dagger injections and storeSharedPrefs()
This commit is contained in:
parent
3d0f697f70
commit
8b533ef98d
2 changed files with 18 additions and 0 deletions
|
|
@ -6,6 +6,9 @@ import android.support.v4.app.Fragment;
|
|||
import android.support.v4.content.ContextCompat;
|
||||
import android.support.v7.app.AlertDialog;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Named;
|
||||
|
||||
import fr.free.nrw.commons.R;
|
||||
import fr.free.nrw.commons.contributions.ContributionController;
|
||||
|
||||
|
|
@ -19,6 +22,7 @@ public class DirectUpload {
|
|||
private Fragment fragment;
|
||||
private SharedPreferences prefs;
|
||||
|
||||
|
||||
DirectUpload(Fragment fragment, ContributionController controller, SharedPreferences prefs) {
|
||||
this.fragment = fragment;
|
||||
this.controller = controller;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package fr.free.nrw.commons.nearby;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.net.Uri;
|
||||
import android.support.transition.TransitionManager;
|
||||
import android.support.v4.app.Fragment;
|
||||
|
|
@ -18,6 +19,9 @@ import com.pedrogomez.renderers.Renderer;
|
|||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Named;
|
||||
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
import fr.free.nrw.commons.R;
|
||||
|
|
@ -47,6 +51,9 @@ class PlaceRenderer extends Renderer<Place> {
|
|||
private ContributionController controller;
|
||||
|
||||
|
||||
@Inject @Named("prefs") SharedPreferences prefs;
|
||||
@Inject @Named("direct_nearby_upload_prefs") SharedPreferences directPrefs;
|
||||
|
||||
PlaceRenderer(){
|
||||
openedItems = new ArrayList<>();
|
||||
}
|
||||
|
|
@ -109,6 +116,13 @@ class PlaceRenderer extends Renderer<Place> {
|
|||
});
|
||||
}
|
||||
|
||||
void storeSharedPrefs() {
|
||||
SharedPreferences.Editor editor = directPrefs.edit();
|
||||
editor.putString("Title", place.getName());
|
||||
editor.putString("Desc", place.getLongDescription());
|
||||
editor.apply();
|
||||
}
|
||||
|
||||
private void closeLayout(LinearLayout buttonLayout){
|
||||
buttonLayout.setVisibility(View.GONE);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue