Tidy up and create framework for autofilling EditText

This commit is contained in:
misaochan 2018-01-02 21:22:09 +10:00
parent ccb0c87b5f
commit 565e61c0d1
3 changed files with 9 additions and 11 deletions

View file

@ -39,15 +39,6 @@ class DirectUpload {
editor.putString("Title", title);
editor.putString("Desc", desc);
editor.apply();
/**
//TODO remove this
sharedPref = fragment.getActivity().getSharedPreferences(Context.MODE_PRIVATE);
String imageTitle = sharedPref.getString("Title", "");
String imageDesc = sharedPref.getString("Desc", "");
Timber.d("In DirectUpload, image title: " + imageTitle + " and image desc: " + imageDesc);
*/
}
void initiateGalleryUpload() {

View file

@ -227,12 +227,13 @@ public class ShareActivity
}
if (intent.hasExtra("isDirectUpload")) {
Timber.d("This was initiated by a direct upload from Nearby");
//TODO: Shift this into title/desc screen after upload initiated
SharedPreferences sharedPref = this.getSharedPreferences("Direct Upload", Context.MODE_PRIVATE);
String imageTitle = sharedPref.getString("Title", "");
String imageDesc = sharedPref.getString("Desc", "");
Timber.d("In ShareActivity, image title: " + imageTitle + " and image desc: " + imageDesc);
}
mimeType = intent.getType();
}

View file

@ -104,6 +104,12 @@ public class SingleUploadFragment extends DaggerFragment {
license = prefs.getString(Prefs.DEFAULT_LICENSE, Prefs.Licenses.CC_BY_SA_3);
//TODO: Get this to display title and desc
if (true) {
titleEdit.setText("");
descEdit.setText("");
}
// check if this is the first time we have uploaded
if (prefs.getString("Title", "").trim().length() == 0
&& prefs.getString("Desc", "").trim().length() == 0) {