mirror of
https://github.com/M66B/FairEmail.git
synced 2026-04-01 22:56:33 +02:00
Refactoring
This commit is contained in:
@@ -1308,8 +1308,7 @@ public class ServiceSynchronize extends ServiceBase {
|
||||
|
||||
@Override
|
||||
public void onAvailable(Network network) {
|
||||
networkState.update(ConnectionHelper.getNetworkState(ServiceSynchronize.this));
|
||||
updateNotification();
|
||||
updateState();
|
||||
|
||||
synchronized (ServiceSynchronize.this) {
|
||||
try {
|
||||
@@ -1364,8 +1363,7 @@ public class ServiceSynchronize extends ServiceBase {
|
||||
|
||||
@Override
|
||||
public void onCapabilitiesChanged(Network network, NetworkCapabilities capabilities) {
|
||||
networkState.update(ConnectionHelper.getNetworkState(ServiceSynchronize.this));
|
||||
updateNotification();
|
||||
updateState();
|
||||
|
||||
synchronized (ServiceSynchronize.this) {
|
||||
try {
|
||||
@@ -1382,8 +1380,7 @@ public class ServiceSynchronize extends ServiceBase {
|
||||
|
||||
@Override
|
||||
public void onLost(Network network) {
|
||||
networkState.update(ConnectionHelper.getNetworkState(ServiceSynchronize.this));
|
||||
updateNotification();
|
||||
updateState();
|
||||
|
||||
synchronized (ServiceSynchronize.this) {
|
||||
try {
|
||||
@@ -1399,7 +1396,9 @@ public class ServiceSynchronize extends ServiceBase {
|
||||
}
|
||||
}
|
||||
|
||||
private void updateNotification() {
|
||||
private void updateState() {
|
||||
networkState.update(ConnectionHelper.getNetworkState(ServiceSynchronize.this));
|
||||
|
||||
if (lastSuitable == null || lastSuitable != networkState.isSuitable()) {
|
||||
lastSuitable = networkState.isSuitable();
|
||||
NotificationManager nm = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
|
||||
|
||||
Reference in New Issue
Block a user