mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-11-02 15:53:55 +01:00
Merge ba7ffc8051 into cdc4f89da5
This commit is contained in:
commit
c0a74ccb06
2 changed files with 284 additions and 268 deletions
|
|
@ -12,6 +12,7 @@ import fr.free.nrw.commons.R
|
|||
import fr.free.nrw.commons.contributions.Contribution
|
||||
import fr.free.nrw.commons.databinding.FragmentPendingUploadsBinding
|
||||
import fr.free.nrw.commons.di.CommonsDaggerSupportFragment
|
||||
import fr.free.nrw.commons.upload.worker.WorkRequestHelper
|
||||
import fr.free.nrw.commons.utils.DialogUtil.showAlertDialog
|
||||
import fr.free.nrw.commons.utils.ViewUtil
|
||||
import java.util.Locale
|
||||
|
|
@ -105,14 +106,22 @@ class PendingUploadsFragment :
|
|||
binding.pendingUplaodsLl.visibility = View.VISIBLE
|
||||
adapter.submitList(list)
|
||||
binding.progressTextView.setText(contributionsSize.toString() + " uploads left")
|
||||
|
||||
if ((pausedOrQueuedUploads == contributionsSize) || CommonsApplication.isPaused) {
|
||||
//As this function would be triggered multiple times by one tap
|
||||
//Add new checking to enable/ disable the pause button for better UI
|
||||
if (!WorkRequestHelper.Companion.getisUploadWorkerRunning()) {
|
||||
uploadProgressActivity.setPausedIcon(true)
|
||||
}
|
||||
|
||||
} else {
|
||||
if (WorkRequestHelper.Companion.getisUploadWorkerRunning()) {
|
||||
uploadProgressActivity.setPausedIcon(false)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Cancels a specific upload after getting a confirmation from the user using Dialog.
|
||||
|
|
|
|||
|
|
@ -70,5 +70,12 @@ class WorkRequestHelper {
|
|||
isUploadWorkerRunning = false
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Provide a function for other class to get the flag isUploadWorkerRunning
|
||||
*/
|
||||
fun getisUploadWorkerRunning(): Boolean {
|
||||
return isUploadWorkerRunning;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue