mirror of
https://github.com/M66B/FairEmail.git
synced 2026-03-27 03:15:39 +01:00
Refactoring
This commit is contained in:
@@ -1067,7 +1067,6 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
ServiceSynchronize.state(this, true);
|
||||
|
||||
LocalBroadcastManager lbm = LocalBroadcastManager.getInstance(this);
|
||||
IntentFilter iff = new IntentFilter();
|
||||
@@ -1094,7 +1093,6 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
|
||||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
ServiceSynchronize.state(this, false);
|
||||
super.onPause();
|
||||
|
||||
LocalBroadcastManager lbm = LocalBroadcastManager.getInstance(this);
|
||||
|
||||
@@ -764,11 +764,15 @@ public class ApplicationEx extends Application
|
||||
@Override
|
||||
public void onActivityPostResumed(@NonNull Activity activity) {
|
||||
log(activity, "onActivityPostResumed");
|
||||
if (activity instanceof ActivityView)
|
||||
ServiceSynchronize.state(activity, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivityPrePaused(@NonNull Activity activity) {
|
||||
log(activity, "onActivityPrePaused");
|
||||
if (activity instanceof ActivityView)
|
||||
ServiceSynchronize.state(activity, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -3427,14 +3427,14 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences
|
||||
}
|
||||
|
||||
private static void start(Context context, Intent intent) {
|
||||
if (isBackgroundService(context))
|
||||
context.startService(intent);
|
||||
else
|
||||
try {
|
||||
try {
|
||||
if (isBackgroundService(context))
|
||||
context.startService(intent);
|
||||
else
|
||||
ContextCompat.startForegroundService(context, intent);
|
||||
} catch (Throwable ex) {
|
||||
Log.e(ex);
|
||||
}
|
||||
} catch (Throwable ex) {
|
||||
Log.e(ex);
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean isBackgroundService(Context context) {
|
||||
|
||||
Reference in New Issue
Block a user