1
0
Fork 0
mirror of https://github.com/syncthing/syncthing-android.git synced 2025-01-11 04:25:53 +00:00

Added SyncthingService#reEvaluateRunConditions

This commit is contained in:
Catfriend1 2018-07-26 12:35:03 +02:00
parent a1e0b10e7b
commit 6579e2ea94
2 changed files with 12 additions and 10 deletions

View file

@ -73,7 +73,6 @@ public class RunConditionMonitor {
Log.v(TAG, "Created new instance"); Log.v(TAG, "Created new instance");
((SyncthingApp) context.getApplicationContext()).component().inject(this); ((SyncthingApp) context.getApplicationContext()).component().inject(this);
mContext = context; mContext = context;
// ToDo mPreferences.registerOnSharedPreferenceChangeListener(this);
mOnRunConditionChangedListener = listener; mOnRunConditionChangedListener = listener;
/** /**
@ -109,15 +108,6 @@ public class RunConditionMonitor {
mReceiverManager.unregisterAllReceivers(mContext); mReceiverManager.unregisterAllReceivers(mContext);
} }
/*
// ToDo
@Override
public void onRunConditionPreferencesChanged() {
// Force a re-evaluation of which run conditions apply according to the changed prefs.
updateShouldRunDecision();
}
*/
private class BatteryReceiver extends BroadcastReceiver { private class BatteryReceiver extends BroadcastReceiver {
@Override @Override
public void onReceive(Context context, Intent intent) { public void onReceive(Context context, Intent intent) {

View file

@ -519,6 +519,18 @@ public class SyncthingService extends Service {
return mApi; return mApi;
} }
/**
* Force re-evaluating run conditions immediately e.g. after
* preferences were modified by {@link SettingsActivity}.
*/
public void reEvaluateRunConditions() {
if (mRunConditionMonitor == null) {
return;
}
Log.v(TAG, "Forced re-evaluating run conditions ...");
mRunConditionMonitor.updateShouldRunDecision();
}
/** /**
* Register a listener for the syncthing API state changing. * Register a listener for the syncthing API state changing.
* *