mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-26 20:33:53 +01:00
Do not hardcode service name in HandlerService
This commit is contained in:
parent
ac5e94bf25
commit
67e3b645cb
2 changed files with 10 additions and 1 deletions
|
|
@ -7,6 +7,7 @@ import android.os.*;
|
|||
public abstract class HandlerService<T> extends Service {
|
||||
private volatile Looper threadLooper;
|
||||
private volatile ServiceHandler threadHandler;
|
||||
private String serviceName;
|
||||
|
||||
private final class ServiceHandler extends Handler {
|
||||
public ServiceHandler(Looper looper) {
|
||||
|
|
@ -39,10 +40,14 @@ public abstract class HandlerService<T> extends Service {
|
|||
return localBinder;
|
||||
}
|
||||
|
||||
protected HandlerService(String serviceName) {
|
||||
this.serviceName = serviceName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate() {
|
||||
super.onCreate();
|
||||
HandlerThread thread = new HandlerThread("UploadService");
|
||||
HandlerThread thread = new HandlerThread(serviceName);
|
||||
thread.start();
|
||||
|
||||
threadLooper = thread.getLooper();
|
||||
|
|
|
|||
|
|
@ -39,6 +39,10 @@ public class UploadService extends HandlerService<Contribution> {
|
|||
public static final int NOTIFICATION_UPLOAD_COMPLETE = 2;
|
||||
public static final int NOTIFICATION_UPLOAD_FAILED = 3;
|
||||
|
||||
protected UploadService(String serviceName) {
|
||||
super("UploadService");
|
||||
}
|
||||
|
||||
private class NotificationUpdateProgressListener implements ProgressListener {
|
||||
|
||||
String notificationTag;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue