mirror of
https://github.com/nextcloud/android.git
synced 2024-11-24 14:15:44 +03:00
Use getter and setter
Signed-off-by: alperozturk <alper_ozturk@proton.me>
This commit is contained in:
parent
e4f231d1ce
commit
b2696e087e
2 changed files with 12 additions and 4 deletions
|
@ -103,7 +103,7 @@ class FileTransferService : Service() {
|
|||
return START_NOT_STICKY
|
||||
}
|
||||
|
||||
if (!isRunning && MainApp.lifecycle == AppLifecycle.Foreground) {
|
||||
if (!isRunning && MainApp.getAppLifeCycle() == AppLifecycle.Foreground) {
|
||||
ForegroundServiceHelper.startService(
|
||||
this,
|
||||
AppNotificationManager.TRANSFER_NOTIFICATION_ID,
|
||||
|
|
|
@ -376,14 +376,22 @@ public class MainApp extends MultiDexApplication implements HasAndroidInjector {
|
|||
registerGlobalPassCodeProtection();
|
||||
}
|
||||
|
||||
public static AppLifecycle lifecycle = AppLifecycle.Foreground;
|
||||
private static AppLifecycle lifecycle = AppLifecycle.Foreground;
|
||||
|
||||
public static AppLifecycle getAppLifeCycle() {
|
||||
return lifecycle;
|
||||
}
|
||||
|
||||
private void setAppLifeCycle(AppLifecycle appLifecycle) {
|
||||
lifecycle = appLifecycle;
|
||||
}
|
||||
|
||||
private final LifecycleEventObserver lifecycleEventObserver = ((lifecycleOwner, event) -> {
|
||||
if (event == Lifecycle.Event.ON_START) {
|
||||
lifecycle = AppLifecycle.Foreground;
|
||||
setAppLifeCycle(AppLifecycle.Foreground);
|
||||
Log_OC.d(TAG, "APP IN FOREGROUND");
|
||||
} else if (event == Lifecycle.Event.ON_STOP) {
|
||||
lifecycle = AppLifecycle.Background;
|
||||
setAppLifeCycle(AppLifecycle.Background);
|
||||
passCodeManager.setCanAskPin(true);
|
||||
Log_OC.d(TAG, "APP IN BACKGROUND");
|
||||
} else if (event == Lifecycle.Event.ON_RESUME) {
|
||||
|
|
Loading…
Reference in a new issue