Use Dagger injection to store title and desc

This commit is contained in:
misaochan 2018-01-24 21:54:11 +10:00
parent 9354c1c93e
commit a03ea07608

View file

@ -25,7 +25,7 @@ public class DirectUpload {
private Fragment fragment; private Fragment fragment;
private SharedPreferences prefs; private SharedPreferences prefs;
@Inject @Named("direct_nearby_upload_prefs") SharedPreferences directPrefs;
DirectUpload(String title, String desc, Fragment fragment, ContributionController controller, SharedPreferences prefs) { DirectUpload(String title, String desc, Fragment fragment, ContributionController controller, SharedPreferences prefs) {
this.title = title; this.title = title;
@ -36,8 +36,7 @@ public class DirectUpload {
} }
void storeSharedPrefs() { void storeSharedPrefs() {
SharedPreferences sharedPref = fragment.getActivity().getSharedPreferences("Direct Upload", Context.MODE_PRIVATE); SharedPreferences.Editor editor = directPrefs.edit();
SharedPreferences.Editor editor = sharedPref.edit();
editor.putString("Title", title); editor.putString("Title", title);
editor.putString("Desc", desc); editor.putString("Desc", desc);