Tidy up and create framework for autofilling EditText

This commit is contained in:
misaochan 2018-01-02 21:22:09 +10:00 committed by maskara
parent fba7628f3c
commit 73327192f9
3 changed files with 9 additions and 11 deletions

View file

@ -39,15 +39,6 @@ class DirectUpload {
editor.putString("Title", title); editor.putString("Title", title);
editor.putString("Desc", desc); editor.putString("Desc", desc);
editor.apply(); 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() { void initiateGalleryUpload() {

View file

@ -239,12 +239,13 @@ public class ShareActivity
} }
if (intent.hasExtra("isDirectUpload")) { if (intent.hasExtra("isDirectUpload")) {
Timber.d("This was initiated by a direct upload from Nearby"); 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); SharedPreferences sharedPref = this.getSharedPreferences("Direct Upload", Context.MODE_PRIVATE);
String imageTitle = sharedPref.getString("Title", ""); String imageTitle = sharedPref.getString("Title", "");
String imageDesc = sharedPref.getString("Desc", ""); String imageDesc = sharedPref.getString("Desc", "");
Timber.d("In ShareActivity, image title: " + imageTitle + " and image desc: " + imageDesc); Timber.d("In ShareActivity, image title: " + imageTitle + " and image desc: " + imageDesc);
} }
mimeType = intent.getType(); mimeType = intent.getType();
} }

View file

@ -106,6 +106,12 @@ public class SingleUploadFragment extends CommonsDaggerSupportFragment {
license = prefs.getString(Prefs.DEFAULT_LICENSE, Prefs.Licenses.CC_BY_SA_3); 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 // check if this is the first time we have uploaded
if (prefs.getString("Title", "").trim().length() == 0 if (prefs.getString("Title", "").trim().length() == 0
&& prefs.getString("Desc", "").trim().length() == 0) { && prefs.getString("Desc", "").trim().length() == 0) {