Skip to content

Commit 8789879

Browse files
shashankiitbhushashank666nicolas-raoul
authored
Fix Multi-Upload Wizard only asks Metadata for one picture (commons-app#5478)
* Fix Multi-Upload Wizard only asks Metadata for one picture * javadoc * typo --------- Co-authored-by: shashankkumar <[email protected]> Co-authored-by: Nicolas Raoul <[email protected]>
1 parent 5225f3e commit 8789879

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

app/src/main/java/fr/free/nrw/commons/upload/UploadActivity.java

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,11 @@ public class UploadActivity extends BaseActivity implements UploadContract.View,
167167
*/
168168
private boolean showPermissionsDialog = true;
169169

170+
/**
171+
* Whether fragments have been saved.
172+
*/
173+
private boolean isFragmentsSaved = false;
174+
170175
@SuppressLint("CheckResult")
171176
@Override
172177
protected void onCreate(Bundle savedInstanceState) {
@@ -179,6 +184,7 @@ protected void onCreate(Bundle savedInstanceState) {
179184
created by the system and populate the fragments ArrayList
180185
*/
181186
if (savedInstanceState != null) {
187+
isFragmentsSaved = true;
182188
List<Fragment> fragmentList = getSupportFragmentManager().getFragments();
183189
fragments = new ArrayList<>();
184190
for (Fragment fragment : fragmentList) {
@@ -597,18 +603,18 @@ public boolean isWLMUpload() {
597603
}
598604
};
599605

600-
if(fragments.size()==0){
606+
if(isFragmentsSaved){
607+
UploadMediaDetailFragment fragment = (UploadMediaDetailFragment) fragments.get(0);
608+
fragment.setCallback(uploadMediaDetailFragmentCallback);
609+
}else{
601610
uploadMediaDetailFragment.setCallback(uploadMediaDetailFragmentCallback);
602611
fragments.add(uploadMediaDetailFragment);
603-
}else{
604-
UploadMediaDetailFragment fragment = (UploadMediaDetailFragment) fragments.get(0);
605-
fragment.setCallback(uploadMediaDetailFragmentCallback);
606612
}
607613

608614
}
609615

610616
//If fragments are not created, create them and add them to the fragments ArrayList
611-
if(!(fragments.size()>1)){
617+
if(!isFragmentsSaved){
612618
uploadCategoriesFragment = new UploadCategoriesFragment();
613619
if (place != null) {
614620
Bundle categoryBundle = new Bundle();

0 commit comments

Comments
 (0)