Rename DownloadController's newInstance() to getInstance()

Also, make both the instance getters synchronized.
This commit is contained in:
Gabriele M
2017-07-03 16:08:32 +02:00
parent bda4d2b9b4
commit 789dc7d737
2 changed files with 3 additions and 3 deletions

View File

@@ -51,11 +51,11 @@ public class DownloadController implements DownloadControllerInt {
private final File mDownloadRoot;
public static DownloadController getInstance() {
public static synchronized DownloadController getInstance() {
return sDownloadController;
}
public static synchronized DownloadController newInstance(Context context) {
public static synchronized DownloadController getInstance(Context context) {
if (sDownloadController == null) {
sDownloadController = new DownloadController(context);
}

View File

@@ -52,7 +52,7 @@ public class DownloadService extends Service {
public void onCreate() {
super.onCreate();
mDownloadController = DownloadController.newInstance(this);
mDownloadController = DownloadController.getInstance(this);
mNotificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
mNotificationBuilder = new NotificationCompat.Builder(this);