Fix Multi-Upload Wizard only asks Metadata for one picture (#5478)

* Fix Multi-Upload Wizard only asks Metadata for one picture

* javadoc

* typo

---------

Co-authored-by: shashankkumar <shashankkumar45556@gmail.com>
Co-authored-by: Nicolas Raoul <nicolas.raoul@gmail.com>
This commit is contained in:
Shashank Kumar 2024-01-26 19:13:07 +05:30 committed by GitHub
parent 5225f3e7f2
commit 8789879f10
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -167,6 +167,11 @@ public class UploadActivity extends BaseActivity implements UploadContract.View,
*/
private boolean showPermissionsDialog = true;
/**
* Whether fragments have been saved.
*/
private boolean isFragmentsSaved = false;
@SuppressLint("CheckResult")
@Override
protected void onCreate(Bundle savedInstanceState) {
@ -179,6 +184,7 @@ public class UploadActivity extends BaseActivity implements UploadContract.View,
created by the system and populate the fragments ArrayList
*/
if (savedInstanceState != null) {
isFragmentsSaved = true;
List<Fragment> fragmentList = getSupportFragmentManager().getFragments();
fragments = new ArrayList<>();
for (Fragment fragment : fragmentList) {
@ -597,18 +603,18 @@ public class UploadActivity extends BaseActivity implements UploadContract.View,
}
};
if(fragments.size()==0){
if(isFragmentsSaved){
UploadMediaDetailFragment fragment = (UploadMediaDetailFragment) fragments.get(0);
fragment.setCallback(uploadMediaDetailFragmentCallback);
}else{
uploadMediaDetailFragment.setCallback(uploadMediaDetailFragmentCallback);
fragments.add(uploadMediaDetailFragment);
}else{
UploadMediaDetailFragment fragment = (UploadMediaDetailFragment) fragments.get(0);
fragment.setCallback(uploadMediaDetailFragmentCallback);
}
}
//If fragments are not created, create them and add them to the fragments ArrayList
if(!(fragments.size()>1)){
if(!isFragmentsSaved){
uploadCategoriesFragment = new UploadCategoriesFragment();
if (place != null) {
Bundle categoryBundle = new Bundle();