nextcloud / android

📱 Nextcloud Android app
https://play.google.com/store/apps/details?id=com.nextcloud.client
GNU General Public License v2.0
4.21k stars 1.75k forks source link

Refactor: Replace all anonymous classes with lambdas #2290

Open harshika-kashyap opened 6 years ago

harshika-kashyap commented 6 years ago

Actual behaviour

Right now, we have a lot of anonymous classes in the project.

Expected behaviour

They can and should be converted to lambdas.

Steps to reproduce

Eg. In method getFileList of SyncedFolderActivity we have two such cases.

Environment data

Android version: NA

Device model: NA

Stock or customized system: NA

Nextcloud app version: NA

Nextcloud server version: NA

Logs

Web server error log

NA

Nextcloud log (data/nextcloud.log)

NA

@AndyScherzinger Please review.

AndyScherzinger commented 6 years ago

@harshika-arya sound good to me :+1:

@tobiasKaminsky @mario what do you think?

@harshika-arya beware that @tobiasKaminsky is rewriting ListViews to RecyclerViews at the moment so code that is related to ListViews can be ignored since that'll change anyways :)

tobiasKaminsky commented 6 years ago

I would say that this can be done when we touch the code, I do not see a reason for doing this in a separate PR. What can & should be done instead is to extract inner private classes: ../../../src/main/java/com/owncloud/android/ui/activity/ActivitiesListActivity.java:395: This AsyncTask class should be static or leaks might occur (anonymous android.os.AsyncTask)

This happens 16x and is shown in lint report.