1
0
Fork 0
mirror of https://github.com/syncthing/syncthing-android.git synced 2024-11-26 22:31:16 +00:00

Removed unneeded code.

This commit is contained in:
Felix Ableitner 2015-04-26 05:48:15 +02:00
parent e821d2e468
commit 02a043f76c

View file

@ -14,7 +14,6 @@ import android.content.SharedPreferences;
import android.os.AsyncTask; import android.os.AsyncTask;
import android.os.Build; import android.os.Build;
import android.os.Environment; import android.os.Environment;
import android.os.Handler;
import android.os.IBinder; import android.os.IBinder;
import android.preference.PreferenceManager; import android.preference.PreferenceManager;
import android.support.v4.app.NotificationCompat; import android.support.v4.app.NotificationCompat;
@ -92,8 +91,6 @@ public class SyncthingService extends Service {
private final SyncthingServiceBinder mBinder = new SyncthingServiceBinder(this); private final SyncthingServiceBinder mBinder = new SyncthingServiceBinder(this);
private Handler mMainHandler;
/** /**
* Callback for when the Syncthing web interface becomes first available after service start. * Callback for when the Syncthing web interface becomes first available after service start.
*/ */
@ -255,7 +252,6 @@ public class SyncthingService extends Service {
.putString("gui_password", sb.toString()).commit(); .putString("gui_password", sb.toString()).commit();
} }
mMainHandler = new Handler();
mDeviceStateHolder = new DeviceStateHolder(SyncthingService.this); mDeviceStateHolder = new DeviceStateHolder(SyncthingService.this);
registerReceiver(mDeviceStateHolder, new IntentFilter(Intent.ACTION_BATTERY_CHANGED)); registerReceiver(mDeviceStateHolder, new IntentFilter(Intent.ACTION_BATTERY_CHANGED));
new StartupTask().execute(); new StartupTask().execute();
@ -393,23 +389,18 @@ public class SyncthingService extends Service {
/** /**
* Called to notifiy listeners of an API change. * Called to notifiy listeners of an API change.
* *
* Must only be called from SyncthingService or {@link RestApi}. * Must only be called from SyncthingService or {@link RestApi} on the main thread.
*/ */
private void onApiChange() { private void onApiChange() {
mMainHandler.post(new Runnable() { for (Iterator<OnApiChangeListener> i = mOnApiChangeListeners.iterator();
@Override i.hasNext(); ) {
public void run() { OnApiChangeListener listener = i.next();
for (Iterator<OnApiChangeListener> i = mOnApiChangeListeners.iterator(); if (listener != null) {
i.hasNext(); ) { listener.onApiChange(mCurrentState);
OnApiChangeListener listener = i.next(); } else {
if (listener != null) { i.remove();
listener.onApiChange(mCurrentState);
} else {
i.remove();
}
}
} }
}); }
} }
/** /**