androidx.fragment.app.Fragment.onStop()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(5.8k)|赞(0)|评价(0)|浏览(171)

本文整理了Java中androidx.fragment.app.Fragment.onStop()方法的一些代码示例,展示了Fragment.onStop()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Fragment.onStop()方法的具体详情如下:
包路径:androidx.fragment.app.Fragment
类名称:Fragment
方法名:onStop

Fragment.onStop介绍

暂无

代码示例

代码示例来源:origin: trello/RxLifecycle

@Override
public void onStop() {
  lifecycleSubject.onNext(FragmentEvent.STOP);
  super.onStop();
}

代码示例来源:origin: ybq/Android-SpinKit

@Override
  public void onStop() {
    super.onStop();
    mWaveDrawable.stop();
    mCircleDrawable.stop();
    mChasingDotsDrawable.stop();
  }
}

代码示例来源:origin: westnordost/StreetComplete

@Override public void onStop()
{
  super.onStop();
  stopPositionTracking();
}

代码示例来源:origin: westnordost/StreetComplete

@Override public void onStop()
{
  super.onStop();
  unregisterForLocationProviderChanges();
}

代码示例来源:origin: trello/RxLifecycle

private void testBindUntilEvent(LifecycleProvider<FragmentEvent> provider) {
  Fragment fragment = (Fragment) provider;
  startFragment(fragment);
  TestObserver<Object> testObserver = observable.compose(provider.bindUntilEvent(STOP)).test();
  fragment.onAttach(null);
  testObserver.assertNotComplete();
  fragment.onCreate(null);
  testObserver.assertNotComplete();
  fragment.onViewCreated(null, null);
  testObserver.assertNotComplete();
  fragment.onStart();
  testObserver.assertNotComplete();
  fragment.onResume();
  testObserver.assertNotComplete();
  fragment.onPause();
  testObserver.assertNotComplete();
  fragment.onStop();
  testObserver.assertComplete();
}

代码示例来源:origin: trello/RxLifecycle

private void testLifecycle(LifecycleProvider<FragmentEvent> provider) {
  Fragment fragment = (Fragment) provider;
  startFragment(fragment);
  TestObserver<FragmentEvent> testObserver = provider.lifecycle().skip(1).test();
  fragment.onAttach(null);
  fragment.onCreate(null);
  fragment.onViewCreated(null, null);
  fragment.onStart();
  fragment.onResume();
  fragment.onPause();
  fragment.onStop();
  fragment.onDestroyView();
  fragment.onDestroy();
  fragment.onDetach();
  testObserver.assertValues(
    FragmentEvent.ATTACH,
    FragmentEvent.CREATE,
    FragmentEvent.CREATE_VIEW,
    FragmentEvent.START,
    FragmentEvent.RESUME,
    FragmentEvent.PAUSE,
    FragmentEvent.STOP,
    FragmentEvent.DESTROY_VIEW,
    FragmentEvent.DESTROY,
    FragmentEvent.DETACH
  );
}

代码示例来源:origin: trello/RxLifecycle

private void testLifecycle(LifecycleProvider<FragmentEvent> provider) {
  Fragment fragment = (Fragment) provider;
  startFragment(fragment);
  TestObserver<FragmentEvent> testObserver = provider.lifecycle().skip(1).test();
  fragment.onAttach(null);
  fragment.onCreate(null);
  fragment.onViewCreated(null, null);
  fragment.onStart();
  fragment.onResume();
  fragment.onPause();
  fragment.onStop();
  fragment.onDestroyView();
  fragment.onDestroy();
  fragment.onDetach();
  testObserver.assertValues(
    FragmentEvent.ATTACH,
    FragmentEvent.CREATE,
    FragmentEvent.CREATE_VIEW,
    FragmentEvent.START,
    FragmentEvent.RESUME,
    FragmentEvent.PAUSE,
    FragmentEvent.STOP,
    FragmentEvent.DESTROY_VIEW,
    FragmentEvent.DESTROY,
    FragmentEvent.DETACH
  );
}

代码示例来源:origin: trello/RxLifecycle

private void testBindUntilEvent(LifecycleProvider<FragmentEvent> provider) {
  Fragment fragment = (Fragment) provider;
  startFragment(fragment);
  TestObserver<Object> testObserver = observable.compose(provider.bindUntilEvent(STOP)).test();
  fragment.onAttach(null);
  testObserver.assertNotComplete();
  fragment.onCreate(null);
  testObserver.assertNotComplete();
  fragment.onViewCreated(null, null);
  testObserver.assertNotComplete();
  fragment.onStart();
  testObserver.assertNotComplete();
  fragment.onResume();
  testObserver.assertNotComplete();
  fragment.onPause();
  testObserver.assertNotComplete();
  fragment.onStop();
  testObserver.assertComplete();
}

代码示例来源:origin: westnordost/StreetComplete

@Override public void onStop()
{
  super.onStop();
  getContext().unregisterReceiver(locationAvailabilityReceiver);
  LocalBroadcastManager.getInstance(getContext()).unregisterReceiver(locationRequestFinishedReceiver);
}

代码示例来源:origin: andriydruk/BonjourBrowser

@Override
public void onStop() {
  super.onStop();
  if (mResolveIPDisposable != null) {
    mResolveIPDisposable.dispose();
  }
  if (mResolveTXTDisposable != null) {
    mResolveTXTDisposable.dispose();
  }
}

代码示例来源:origin: cemrich/zapp

@Override
public void onStop() {
  super.onStop();
  // don't use onPause to support multiwindow feature
  rootView.setVisibility(View.VISIBLE);
  errorText.setVisibility(View.GONE);
}

代码示例来源:origin: trello/RxLifecycle

TestObserver<Object> pauseObserver = observable.compose(provider.bindToLifecycle()).test();
fragment.onStop();
attachObserver.assertNotComplete();
createObserver.assertNotComplete();

代码示例来源:origin: trello/RxLifecycle

TestObserver<Object> pauseObserver = observable.compose(provider.bindToLifecycle()).test();
fragment.onStop();
attachObserver.assertNotComplete();
createObserver.assertNotComplete();

代码示例来源:origin: andriydruk/BonjourBrowser

@Override
public void onStop() {
  super.onStop();
  if (mDisposable != null && !mDisposable.isDisposed()) {
    mDisposable.dispose();
  }
}

代码示例来源:origin: proninyaroslav/libretorrent

@Override
public void onStop()
{
  super.onStop();
  LocalBroadcastManager.getInstance(activity).unregisterReceiver(feedManagerReceiver);
}

代码示例来源:origin: proninyaroslav/libretorrent

@Override
public void onStop()
{
  super.onStop();
  TorrentTaskServiceReceiver.getInstance().unregister(serviceReceiver);
}

代码示例来源:origin: proninyaroslav/libretorrent

@Override
public void onStop()
{
  super.onStop();
  LocalBroadcastManager.getInstance(activity).unregisterReceiver(feedManagerReceiver);
}

代码示例来源:origin: AlexMofer/ProjectX

@Override
public void onStop() {
  super.onStop();
  final AMPresenter presenter = getPresenter();
  if (presenter != null) {
    presenter.onStopped();
  }
}

代码示例来源:origin: KDE/kdeconnect-android

@Override
public void onStop() {
  super.onStop();
  mSwipeRefreshLayout.setEnabled(false);
  BackgroundService.RunCommand(mActivity, service -> service.removeDeviceListChangedCallback("PairingFragment"));
}

代码示例来源:origin: proninyaroslav/libretorrent

@Override
public void onStop()
{
  super.onStop();
  TorrentTaskServiceReceiver.getInstance().unregister(serviceReceiver);
  stopUpdateTorrentState();
}

相关文章