Java 类android.arch.lifecycle.LifecycleRegistry 实例源码

项目:OCiney    文件:AdsManager.java   
public AdsManager(Context context, LifecycleRegistry lifecycleRegistry) {
    this.context = context;
    this.lifecycleRegistry = lifecycleRegistry;

    RxLifecycle.with(lifecycleRegistry)
            .onResume()
            .doOnSubscribe(compositeDisposable::add)
            .subscribe(resume -> this.onResume());

    RxLifecycle.with(lifecycleRegistry)
            .onPause()
            .doOnSubscribe(compositeDisposable::add)
            .subscribe(resume -> this.onPause());

    RxLifecycle.with(lifecycleRegistry)
            .onDestroy()
            .doOnSubscribe(compositeDisposable::add)
            .subscribe(resume -> this.onDestroy());
}
项目:igrow-android    文件:TestUtils.java   
private LifecycleRegistry init() {
    LifecycleRegistry registry = new LifecycleRegistry(this);
    registry.handleLifecycleEvent(Lifecycle.Event.ON_CREATE);
    registry.handleLifecycleEvent(Lifecycle.Event.ON_START);
    registry.handleLifecycleEvent(Lifecycle.Event.ON_RESUME);
    return registry;
}
项目:Open-Mam    文件:AbstractPresenter.java   
public void bind(LifecycleRegistry lifecycle, V view) {
    unbind();
    this.viewReference = new WeakReference<V>(view);
    RxLifecycle.with(lifecycle)
            .onDestroy()
            .doOnSubscribe(this::call)
            .subscribe(x -> unbind());
}
项目:RxRedux    文件:BaseActivity.java   
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mLifecycleRegistry = new LifecycleRegistry(this);
    mLifecycleRegistry.markState(Lifecycle.State.CREATED);
    navigator = NavigatorFactory.getInstance();
    AppCompatDelegate.setCompatVectorFromResourcesEnabled(true);
    restoreViewStateFromBundle(savedInstanceState);
    initialize();
    setupUI(savedInstanceState == null);
}
项目:RxRedux    文件:BaseFragment.java   
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mLifecycleRegistry = new LifecycleRegistry(this);
    mLifecycleRegistry.markState(Lifecycle.State.CREATED);
    setRetainInstance(true);
    navigator = NavigatorFactory.getInstance();
    if (savedInstanceState != null && savedInstanceState.containsKey(UI_MODEL)) {
        viewState = savedInstanceState.getParcelable(UI_MODEL);
    }
    initialize();
}
项目:mobile-buy-sdk-android    文件:LifeCycleBoundCallback.java   
private LifecycleRegistry init() {
  LifecycleRegistry registry = new LifecycleRegistry(this);
  registry.handleLifecycleEvent(Lifecycle.Event.ON_CREATE);
  registry.handleLifecycleEvent(Lifecycle.Event.ON_START);
  registry.handleLifecycleEvent(Lifecycle.Event.ON_RESUME);
  return registry;
}
项目:muzei    文件:MuzeiWallpaperService.java   
@Override
public void onCreate() {
    super.onCreate();
    mLifecycle = new LifecycleRegistry(this);
    mLifecycle.addObserver(new WallpaperAnalytics(this));
    mLifecycle.addObserver(new SourceManager(this));
    mLifecycle.addObserver(new NotificationUpdater(this));
    mLifecycle.addObserver(new WearableController(this));
    mLifecycle.addObserver(new WidgetUpdater(this));
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N_MR1) {
        mLifecycle.addObserver(new ArtworkInfoShortcutController(this, this));
    }
    if (UserManagerCompat.isUserUnlocked(this)) {
        mLifecycle.handleLifecycleEvent(Lifecycle.Event.ON_START);
    } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
        mUnlockReceiver = new BroadcastReceiver() {
            @Override
            public void onReceive(Context context, Intent intent) {
                mLifecycle.handleLifecycleEvent(Lifecycle.Event.ON_START);
                unregisterReceiver(this);
                mUnlockReceiver = null;
            }
        };
        IntentFilter filter = new IntentFilter(Intent.ACTION_USER_UNLOCKED);
        registerReceiver(mUnlockReceiver, filter);
    }
}
项目:muzei    文件:SourceManager.java   
public SourceManager(Context context) {
    mContext = context;
    mLifecycle = new LifecycleRegistry(this);
    mLifecycle.addObserver(new NetworkChangeObserver(mContext));
    new SubscriberLiveData().observe(this, source -> {
        if (source != null) {
            sendSelectedSourceAnalytics(source.componentName);
            // Ensure the artwork from the newly selected source is downloaded
            context.startService(TaskQueueService.getDownloadCurrentArtworkIntent(context));
        }
    });
}
项目:Make-A-Pede-Android-App    文件:ControllerActivity.java   
@Override
public LifecycleRegistry getLifecycle() {
    return lifecycleRegistry;
}
项目:Android-ArchComponents    文件:AppCompatLifecycleActivity.java   
@Override
public LifecycleRegistry getLifecycle() {
    return registry;
}
项目:TubiPlayer    文件:LifeCycleActivity.java   
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mLifecycleRegistry = new LifecycleRegistry(this);
    mLifecycleRegistry.markState(Lifecycle.State.CREATED);
}
项目:MVP-Architecture-Components    文件:BaseActivity.java   
@Override
public LifecycleRegistry getLifecycle() {
    return lifecycleRegistry;
}
项目:MVP-Architecture-Components    文件:BaseFragment.java   
@Override
public LifecycleRegistry getLifecycle() {
    return lifecycleRegistry;
}
项目:LifecycleAwareRx    文件:LifecycleTest.java   
TestLifecycleOwner() {
    this.lifecycle = new LifecycleRegistry(this);
}
项目:firebase-chat-android-architecture-components    文件:InboxActivity.java   
@Override
public LifecycleRegistry getLifecycle() {
    return lifecycleRegistry;
}
项目:android-architecture-components    文件:RepoFragment.java   
@Override
public LifecycleRegistry getLifecycle() {
    return lifecycleRegistry;
}
项目:foco    文件:MainActivity.java   
@Override
public LifecycleRegistry getLifecycle() {
    return mRegistry;
}
项目:RxComponentLifecycle    文件:RxLifecycle.java   
public RxLifecycle(LifecycleRegistry lifecycleRegistry) {
    this.observer = new RxLifecycleObserver(subject);
    this.lifecycleRegistry = lifecycleRegistry;
    lifecycleRegistry.addObserver(observer);
}
项目:RxComponentLifecycle    文件:RxLifecycle.java   
public static RxLifecycle with(LifecycleRegistry lifecycleRegistry) {
    return new RxLifecycle(lifecycleRegistry);
}
项目:RxComponentLifecycle    文件:AbstractActivity.java   
public LifecycleRegistry getLifecycle() {
    return this.mRegistry;
}
项目:NewAndroidArchitecture    文件:BaseLifecycleActivity.java   
@MainThread
@NonNull
@Override
public LifecycleRegistry getLifecycle() {
    return lifecycleRegistry;
}
项目:Inshorts    文件:ArticleListActivity.java   
@Override
public LifecycleRegistry getLifecycle() {
    return mRegistry;
}
项目:Expert-Android-Programming    文件:ClearBaseActivity.java   
@Override
public LifecycleRegistry getLifecycle() {
    return mRegistry;
}
项目:ArchitectureComponents    文件:MainActivity.java   
@Override
public LifecycleRegistry getLifecycle() {
    return lifecycleRegistry;
}
项目:OfflineSampleApp    文件:CommentsActivity.java   
@Override
public LifecycleRegistry getLifecycle() {
    return registry;
}
项目:mvp-android-arch-component    文件:BaseActivity.java   
@Override
public LifecycleRegistry getLifecycle() {
  return lifecycleRegistry;
}
项目:Open-Mam    文件:BaseActivity.java   
@Override
public LifecycleRegistry getLifecycle() {
    return mRegistry;
}
项目:Open-Mam    文件:BaseFragment.java   
@Override
public LifecycleRegistry getLifecycle() {
    return mRegistry;
}
项目:android-instant-apps-demo    文件:InstantAppsLifecycleFragment.java   
@Override
public LifecycleRegistry getLifecycle() {
    return mRegistry;
}
项目:android-instant-apps-demo    文件:InstantAppsLifecycleActivity.java   
@Override
public LifecycleRegistry getLifecycle() {
    return mRegistry;
}
项目:ActivityFragmentManager    文件:ActivityToolbar.java   
@Override
public LifecycleRegistry getLifecycle() {
    return mRegistry;
}
项目:redux    文件:MainActivity.java   
@Override
public LifecycleRegistry getLifecycle() {
    return registry;
}
项目:AutoDispose    文件:TestLifecycleOwner.java   
private TestLifecycleOwner(@Nullable LifecycleRegistry registry) {
  this.registry = registry == null ? new LifecycleRegistry(this) : registry;
}
项目:AutoDispose    文件:TestLifecycleOwner.java   
@Override public LifecycleRegistry getLifecycle() {
  return registry;
}
项目:RecipeFinderJavaVersion    文件:MainActivity.java   
@Override
public LifecycleRegistry getLifecycle() {
    return lifecycleRegistry;
}
项目:RecipeFinderJavaVersion    文件:RecipeAnalysisDetailsActivity.java   
@Override
public LifecycleRegistry getLifecycle() {
    return lifecycleRegistry;
}
项目:transistor    文件:MainActivity.java   
@Override
public LifecycleRegistry getLifecycle() {
    return mRegistry;
}
项目:mobile-buy-sdk-android    文件:ProductDetailsActivity.java   
@Override public LifecycleRegistry getLifecycle() {
  return lifecycleRegistry;
}
项目:mobile-buy-sdk-android    文件:CartHeaderView.java   
@Override public LifecycleRegistry getLifecycle() {
  return lifecycleRegistry;
}
项目:mobile-buy-sdk-android    文件:CartActivity.java   
@Override public LifecycleRegistry getLifecycle() {
  return lifecycleRegistry;
}