mirror of
https://github.com/nextcloud/android.git
synced 2024-11-26 23:28:42 +03:00
Fix code analytics
Signed-off-by: alperozturk <alper_ozturk@proton.me>
This commit is contained in:
parent
c135e24c4b
commit
5c31d91149
6 changed files with 13 additions and 16 deletions
|
@ -45,10 +45,8 @@ class FileDownloadHelper {
|
|||
private var instance: FileDownloadHelper? = null
|
||||
|
||||
fun instance(): FileDownloadHelper {
|
||||
return if (instance == null) {
|
||||
FileDownloadHelper()
|
||||
} else {
|
||||
instance!!
|
||||
return instance ?: synchronized(this) {
|
||||
instance ?: FileDownloadHelper().also { instance = it }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -179,11 +179,11 @@ class FileDownloadWorker(
|
|||
}
|
||||
|
||||
private fun setWorkerState(user: User?, file: DownloadFileOperation?) {
|
||||
WorkerStateLiveData.instance?.setWorkState(WorkerState.Download(user, file))
|
||||
WorkerStateLiveData.instance().setWorkState(WorkerState.Download(user, file))
|
||||
}
|
||||
|
||||
private fun setIdleWorkerState() {
|
||||
WorkerStateLiveData.instance?.setWorkState(WorkerState.Idle)
|
||||
WorkerStateLiveData.instance().setWorkState(WorkerState.Idle)
|
||||
}
|
||||
|
||||
private fun addAccountUpdateListener() {
|
||||
|
|
|
@ -30,13 +30,12 @@ class WorkerStateLiveData private constructor() : LiveData<WorkerState>() {
|
|||
}
|
||||
|
||||
companion object {
|
||||
var instance: WorkerStateLiveData? = null
|
||||
get() {
|
||||
if (field == null) {
|
||||
field = WorkerStateLiveData()
|
||||
}
|
||||
return field
|
||||
private var instance: WorkerStateLiveData? = null
|
||||
|
||||
fun instance(): WorkerStateLiveData {
|
||||
return instance ?: synchronized(this) {
|
||||
instance ?: WorkerStateLiveData().also { instance = it }
|
||||
}
|
||||
private set
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1563,7 +1563,7 @@ public class FileDisplayActivity extends FileActivity
|
|||
}
|
||||
|
||||
private void observeWorkerState() {
|
||||
WorkerStateLiveData.Companion.getInstance().observe(this, state -> {
|
||||
WorkerStateLiveData.Companion.instance().observe(this, state -> {
|
||||
if (state instanceof WorkerState.Download) {
|
||||
Log_OC.d(TAG, "Download worker started");
|
||||
handleDownloadWorkerState();
|
||||
|
|
|
@ -518,7 +518,7 @@ public class ManageAccountsActivity extends FileActivity implements UserListAdap
|
|||
}
|
||||
|
||||
private void observeWorkerState() {
|
||||
WorkerStateLiveData.Companion.getInstance().observe(this, state -> {
|
||||
WorkerStateLiveData.Companion.instance().observe(this, state -> {
|
||||
if (state instanceof WorkerState.Download) {
|
||||
Log_OC.d(TAG, "Download worker started");
|
||||
workerAccountName = ((WorkerState.Download) state).getUser().getAccountName();
|
||||
|
|
|
@ -307,7 +307,7 @@ public class PreviewImageActivity extends FileActivity implements
|
|||
}
|
||||
|
||||
private void observeWorkerState() {
|
||||
WorkerStateLiveData.Companion.getInstance().observe(this, state -> {
|
||||
WorkerStateLiveData.Companion.instance().observe(this, state -> {
|
||||
if (state instanceof WorkerState.Download) {
|
||||
Log_OC.d(TAG, "Download worker started");
|
||||
isDownloadWorkStarted = true;
|
||||
|
|
Loading…
Reference in a new issue