version:
fix: update:优化唤醒
This commit is contained in:
@@ -20,8 +20,8 @@ import com.trello.rxlifecycle4.android.ActivityEvent;
|
||||
import com.uiuios.aios.R;
|
||||
import com.uiuios.aios.alarm.AlarmAdapter;
|
||||
import com.uiuios.aios.alarm.AlarmUtils;
|
||||
import com.uiuios.aios.base.BaseLightLifecycleActivity;
|
||||
import com.uiuios.aios.alarm.AlarmClockData;
|
||||
import com.uiuios.aios.base.BaseLifecycleActivity;
|
||||
import com.uiuios.aios.bean.BaseResponse;
|
||||
import com.uiuios.aios.dialog.DeleteDialog;
|
||||
import com.uiuios.aios.network.NetInterfaceManager;
|
||||
@@ -37,7 +37,7 @@ import cn.jzvd.Jzvd;
|
||||
import io.reactivex.rxjava3.core.Observer;
|
||||
import io.reactivex.rxjava3.disposables.Disposable;
|
||||
|
||||
public class AlarmClockActivity extends BaseLightLifecycleActivity implements AlarmClockContact.ClockView {
|
||||
public class AlarmClockActivity extends BaseLifecycleActivity implements AlarmClockContact.ClockView {
|
||||
private static final String TAG = AlarmClockActivity.class.getSimpleName();
|
||||
|
||||
@BindView(R.id.recyclerView)
|
||||
|
||||
@@ -1,115 +0,0 @@
|
||||
package com.uiuios.aios.base;
|
||||
|
||||
import android.os.Bundle;
|
||||
|
||||
import androidx.annotation.CallSuper;
|
||||
import androidx.annotation.CheckResult;
|
||||
import androidx.annotation.ContentView;
|
||||
import androidx.annotation.LayoutRes;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import com.trello.rxlifecycle4.LifecycleProvider;
|
||||
import com.trello.rxlifecycle4.LifecycleTransformer;
|
||||
import com.trello.rxlifecycle4.RxLifecycle;
|
||||
import com.trello.rxlifecycle4.android.ActivityEvent;
|
||||
import com.trello.rxlifecycle4.android.RxLifecycleAndroid;
|
||||
|
||||
import io.reactivex.rxjava3.core.Observable;
|
||||
import io.reactivex.rxjava3.subjects.BehaviorSubject;
|
||||
|
||||
public abstract class BaseLightLifecycleActivity extends AppCompatActivity implements LifecycleProvider<ActivityEvent> {
|
||||
public final BehaviorSubject<ActivityEvent> lifecycleSubject = BehaviorSubject.create();
|
||||
|
||||
public BaseLightLifecycleActivity() {
|
||||
super();
|
||||
}
|
||||
|
||||
@ContentView
|
||||
public BaseLightLifecycleActivity(@LayoutRes int contentLayoutId) {
|
||||
super(contentLayoutId);
|
||||
}
|
||||
|
||||
@Override
|
||||
@NonNull
|
||||
@CheckResult
|
||||
public final Observable<ActivityEvent> lifecycle() {
|
||||
return lifecycleSubject.hide();
|
||||
}
|
||||
|
||||
@Override
|
||||
@NonNull
|
||||
@CheckResult
|
||||
public final <T> LifecycleTransformer<T> bindUntilEvent(@NonNull ActivityEvent event) {
|
||||
return RxLifecycle.bindUntilEvent(lifecycleSubject, event);
|
||||
}
|
||||
|
||||
@Override
|
||||
@NonNull
|
||||
@CheckResult
|
||||
public final <T> LifecycleTransformer<T> bindToLifecycle() {
|
||||
return RxLifecycleAndroid.bindActivity(lifecycleSubject);
|
||||
}
|
||||
|
||||
@Override
|
||||
@CallSuper
|
||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
lifecycleSubject.onNext(ActivityEvent.CREATE);
|
||||
setContentView(this.getLayoutId());
|
||||
initView();
|
||||
initData();
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置布局
|
||||
*/
|
||||
public abstract int getLayoutId();
|
||||
|
||||
/**
|
||||
* 初始化视图
|
||||
*/
|
||||
public abstract void initView();
|
||||
|
||||
|
||||
/**
|
||||
* 初始化数据
|
||||
*/
|
||||
public abstract void initData();
|
||||
|
||||
@Override
|
||||
@CallSuper
|
||||
protected void onStart() {
|
||||
super.onStart();
|
||||
lifecycleSubject.onNext(ActivityEvent.START);
|
||||
}
|
||||
|
||||
@Override
|
||||
@CallSuper
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
lifecycleSubject.onNext(ActivityEvent.RESUME);
|
||||
}
|
||||
|
||||
@Override
|
||||
@CallSuper
|
||||
protected void onPause() {
|
||||
lifecycleSubject.onNext(ActivityEvent.PAUSE);
|
||||
super.onPause();
|
||||
}
|
||||
|
||||
@Override
|
||||
@CallSuper
|
||||
protected void onStop() {
|
||||
lifecycleSubject.onNext(ActivityEvent.STOP);
|
||||
super.onStop();
|
||||
}
|
||||
|
||||
@Override
|
||||
@CallSuper
|
||||
protected void onDestroy() {
|
||||
lifecycleSubject.onNext(ActivityEvent.DESTROY);
|
||||
super.onDestroy();
|
||||
}
|
||||
}
|
||||
@@ -72,17 +72,17 @@ public class BootReceiver extends BroadcastReceiver {
|
||||
case Intent.ACTION_BOOT_COMPLETED:
|
||||
|
||||
break;
|
||||
case Intent.ACTION_BATTERY_CHANGED:
|
||||
case Intent.ACTION_BATTERY_LOW:
|
||||
case Intent.ACTION_BATTERY_OKAY:
|
||||
case Intent.ACTION_POWER_CONNECTED:
|
||||
case Intent.ACTION_POWER_DISCONNECTED:
|
||||
case Intent.ACTION_DATE_CHANGED:
|
||||
case Intent.ACTION_TIME_TICK:
|
||||
case Intent.ACTION_USER_PRESENT:
|
||||
case Intent.ACTION_SCREEN_OFF:
|
||||
case Intent.ACTION_SCREEN_ON:
|
||||
break;
|
||||
// case Intent.ACTION_BATTERY_CHANGED:
|
||||
// case Intent.ACTION_BATTERY_LOW:
|
||||
// case Intent.ACTION_BATTERY_OKAY:
|
||||
// case Intent.ACTION_POWER_CONNECTED:
|
||||
// case Intent.ACTION_POWER_DISCONNECTED:
|
||||
// case Intent.ACTION_DATE_CHANGED:
|
||||
// case Intent.ACTION_TIME_TICK:
|
||||
// case Intent.ACTION_USER_PRESENT:
|
||||
// case Intent.ACTION_SCREEN_OFF:
|
||||
// case Intent.ACTION_SCREEN_ON:
|
||||
// break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user