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:
parent
a1e0b10e7b
commit
6579e2ea94
2 changed files with 12 additions and 10 deletions
|
@ -73,7 +73,6 @@ public class RunConditionMonitor {
|
|||
Log.v(TAG, "Created new instance");
|
||||
((SyncthingApp) context.getApplicationContext()).component().inject(this);
|
||||
mContext = context;
|
||||
// ToDo mPreferences.registerOnSharedPreferenceChangeListener(this);
|
||||
mOnRunConditionChangedListener = listener;
|
||||
|
||||
/**
|
||||
|
@ -109,15 +108,6 @@ public class RunConditionMonitor {
|
|||
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 {
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
|
|
|
@ -519,6 +519,18 @@ public class SyncthingService extends Service {
|
|||
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.
|
||||
*
|
||||
|
|
Loading…
Reference in a new issue