• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java FragmentEvent类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.trello.rxlifecycle.android.FragmentEvent的典型用法代码示例。如果您正苦于以下问题:Java FragmentEvent类的具体用法?Java FragmentEvent怎么用?Java FragmentEvent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



FragmentEvent类属于com.trello.rxlifecycle.android包,在下文中一共展示了FragmentEvent类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: showSuggestedApps

import com.trello.rxlifecycle.android.FragmentEvent; //导入依赖的package包/类
public void showSuggestedApps() {
  appViewSimilarAppAnalytics.similarAppsIsShown();
  setSuggestedShowing(true);

  adsRepository.getAdsFromAppviewSuggested(getPackageName(), appViewModel.getKeywords())
      .onErrorReturn(throwable -> Collections.emptyList())
      .zipWith(requestFactoryCdnWeb.newGetRecommendedRequest(6, getPackageName())
          .observe(), (minimalAds, listApps) -> new AppViewSuggestedAppsDisplayable(minimalAds,
          removeCurrentAppFromSuggested(listApps.getDataList()
              // TODO: 04/10/2017 trinkes make some default thing for StoreContext.home
              .getList()), appViewSimilarAppAnalytics, navigationTracker, StoreContext.home))
      .observeOn(AndroidSchedulers.mainThread())
      .compose(bindUntilEvent(FragmentEvent.DESTROY_VIEW))
      .subscribe(appViewSuggestedAppsDisplayable -> {
        addDisplayableWithAnimation(1, appViewSuggestedAppsDisplayable);
      }, Throwable::printStackTrace);
}
 
开发者ID:Aptoide,项目名称:aptoide-client-v8,代码行数:18,代码来源:AppViewFragment.java


示例2: fetchRollbacks

import com.trello.rxlifecycle.android.FragmentEvent; //导入依赖的package包/类
@UiThread private void fetchRollbacks() {
  RollbackAccessor rollbackAccessor = AccessorFactory.getAccessorFor(
      ((AptoideApplication) getContext().getApplicationContext()
          .getApplicationContext()).getDatabase(), Rollback.class);
  rollbackAccessor.getConfirmedRollbacks()
      .observeOn(Schedulers.computation())
      .map(rollbacks -> createDisplayables(rollbacks))
      .observeOn(AndroidSchedulers.mainThread())
      .compose(bindUntilEvent(FragmentEvent.DESTROY_VIEW))
      .subscribe(rollbacks -> {
        if (rollbacks == null || rollbacks.isEmpty()) {
          emptyData.setText(AptoideUtils.StringU.getFormattedString(R.string.no_rollbacks_msg,
              getContext().getResources(), marketName));
          emptyData.setVisibility(View.VISIBLE);
        } else {
          emptyData.setVisibility(View.GONE);
          clearDisplayables().addDisplayables(rollbacks, true);
        }
        finishLoading();
      });
}
 
开发者ID:Aptoide,项目名称:aptoide-client-v8,代码行数:22,代码来源:RollbackFragment.java


示例3: onViewCreated

import com.trello.rxlifecycle.android.FragmentEvent; //导入依赖的package包/类
@Override public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
  super.onViewCreated(view, savedInstanceState);

  // show updates
  updateRepository.getAll(false)
      //.buffer(750, TimeUnit.MILLISECONDS)
      //.flatMap(listOfUpdateList -> Observable.from(listOfUpdateList).takeLast(1))
      .sample(750, TimeUnit.MILLISECONDS)
      .observeOn(AndroidSchedulers.mainThread())
      .flatMap(updateList -> {
        clearDisplayables();
        setUpdates(updateList);
        showUpdateMessage(updateList);
        return fetchInstalled().doOnNext(apps -> setInstalled(apps));
      })
      .compose(bindUntilEvent(FragmentEvent.DESTROY_VIEW))
      .subscribe(__ -> {
        finishLoading();
      }, err -> {
        Logger.e(TAG, "listing updates or installed threw an exception");
        CrashReport.getInstance()
            .log(err);
        finishLoading();
      });
}
 
开发者ID:Aptoide,项目名称:aptoide-client-v8,代码行数:26,代码来源:UpdatesFragment.java


示例4: convertToEvent

import com.trello.rxlifecycle.android.FragmentEvent; //导入依赖的package包/类
@NonNull private Observable<LifecycleEvent> convertToEvent(FragmentEvent event) {
  switch (event) {
    case ATTACH:
    case CREATE:
      return Observable.empty();
    case CREATE_VIEW:
      return Observable.just(LifecycleEvent.CREATE);
    case START:
      return Observable.just(LifecycleEvent.START);
    case RESUME:
      return Observable.just(LifecycleEvent.RESUME);
    case PAUSE:
      return Observable.just(LifecycleEvent.PAUSE);
    case STOP:
      return Observable.just(LifecycleEvent.STOP);
    case DESTROY_VIEW:
      return Observable.just(LifecycleEvent.DESTROY);
    case DETACH:
    case DESTROY:
      return Observable.empty();
    default:
      throw new IllegalStateException("Unrecognized event: " + event.name());
  }
}
 
开发者ID:Aptoide,项目名称:aptoide-client-v8,代码行数:25,代码来源:FragmentView.java


示例5: fetchScheduledDownloads

import com.trello.rxlifecycle.android.FragmentEvent; //导入依赖的package包/类
private void fetchScheduledDownloads() {
  scheduledDownloadRepository.getAllScheduledDownloads()
      .observeOn(AndroidSchedulers.mainThread())
      .compose(bindUntilEvent(FragmentEvent.DESTROY_VIEW))
      .subscribe(scheduledDownloads -> {
        updateUi(scheduledDownloads);
      }, t -> {
        CrashReport.getInstance()
            .log(t);
        emptyData.setText(R.string.no_sch_downloads);
        emptyData.setVisibility(View.VISIBLE);
        clearDisplayables();
        finishLoading();
      });

  // keep installing data when downloading were stoped
  //scheduledDownloadRepository.getAllScheduledDownloads().first().subscribe(scheduleds -> {
  //  ArrayList<Scheduled> installing = new ArrayList<>();
  //  for (Scheduled s : scheduleds) {
  //    if (s.isDownloading()) installing.add(s);
  //  }
  //  downloadAndInstallScheduledList(installing);
  //});

  //compositeSubscription.add(subscription);
}
 
开发者ID:Aptoide,项目名称:aptoide-client-v8,代码行数:27,代码来源:ScheduledDownloadsFragment.java


示例6: onCreateOptionsMenu

import com.trello.rxlifecycle.android.FragmentEvent; //导入依赖的package包/类
@Override public void onCreateOptionsMenu(final Menu menu, final MenuInflater inflater) {
  super.onCreateOptionsMenu(menu, inflater);
  inflater.inflate(R.menu.menu_install, menu);
  installMenuItem = menu.findItem(R.id.menu_install);

  installedRepository.getInstalled(packageName)
      .compose(bindUntilEvent(FragmentEvent.DESTROY_VIEW))
      .subscribe(installed -> {
        if (installed != null) {
          // app installed... update text
          installMenuItem.setTitle(R.string.reviewappview_button_open);
        }
      }, err -> {
        CrashReport.getInstance()
            .log(err);
      });
}
 
开发者ID:Aptoide,项目名称:aptoide-client-v8,代码行数:18,代码来源:RateAndReviewsFragment.java


示例7: setupThemeSelector

import com.trello.rxlifecycle.android.FragmentEvent; //导入依赖的package包/类
public void setupThemeSelector() {

    themeSelectorView.setLayoutManager(
        new LinearLayoutManager(getActivity(), LinearLayoutManager.HORIZONTAL, false));
    PublishRelay<StoreTheme> storeThemePublishRelay = PublishRelay.create();
    themeSelectorAdapter =
        new ThemeSelectorViewAdapter(storeThemePublishRelay, StoreTheme.getThemesFromVersion(8));
    themeSelectorView.setAdapter(themeSelectorAdapter);

    themeSelectorAdapter.storeThemeSelection()
        .doOnNext(storeTheme -> currentModel.setStoreTheme(storeTheme))
        .compose(bindUntilEvent(FragmentEvent.DESTROY_VIEW))
        .subscribe();

    themeSelectorView.addItemDecoration(new DividerItemDecoration(getContext(), 8,
        DividerItemDecoration.LEFT | DividerItemDecoration.RIGHT));

    themeSelectorAdapter.selectTheme(currentModel.getStoreTheme());
  }
 
开发者ID:Aptoide,项目名称:aptoide-client-v8,代码行数:20,代码来源:ManageStoreFragment.java


示例8: showStoreCommentFragment

import com.trello.rxlifecycle.android.FragmentEvent; //导入依赖的package包/类
private Observable<Void> showStoreCommentFragment(final long storeId,
    @NonNull final String storeName, @NonNull final FragmentManager fragmentManager,
    @NonNull final View view) {

  return Observable.just(accountManager.isLoggedIn())
      .flatMap(isLoggedIn -> {

        if (isLoggedIn) {
          // show fragment CommentDialog
          CommentDialogFragment commentDialogFragment =
              CommentDialogFragment.newInstanceStoreComment(storeId, storeName);

          return commentDialogFragment.lifecycle()
              .doOnSubscribe(
                  () -> commentDialogFragment.show(fragmentManager, "fragment_comment_dialog"))
              .filter(event -> event.equals(FragmentEvent.DESTROY_VIEW))
              .flatMap(event -> Observable.empty());
        }

        return showSignInMessage(view).toObservable();
      });
}
 
开发者ID:Aptoide,项目名称:aptoide-client-v8,代码行数:23,代码来源:StoreAddCommentWidget.java


示例9: showStoreCommentFragment

import com.trello.rxlifecycle.android.FragmentEvent; //导入依赖的package包/类
private Completable showStoreCommentFragment(final long storeId, @NonNull final Comment comment,
    @NonNull final String storeName, @NonNull final FragmentManager fragmentManager,
    @NonNull final View view, Observable<Void> reloadComments) {

  return accountManager.accountStatus()
      .first()
      .toSingle()
      .flatMapCompletable(account -> {
        if (account.isLoggedIn()) {
          // show fragment CommentDialog
          CommentDialogFragment commentDialogFragment =
              CommentDialogFragment.newInstanceStoreCommentReply(storeId, comment.getId(),
                  storeName);

          return commentDialogFragment.lifecycle()
              .doOnSubscribe(() -> commentDialogFragment.show(fragmentManager,
                  "fragment_comment_dialog_latest"))
              .filter(event -> event.equals(FragmentEvent.DESTROY_VIEW))
              .flatMap(event -> reloadComments)
              .toCompletable();
        }

        return showSignInMessage(view);
      });
}
 
开发者ID:Aptoide,项目名称:aptoide-client-v8,代码行数:26,代码来源:StoreLatestCommentsWidget.java


示例10: createNewCommentFragment

import com.trello.rxlifecycle.android.FragmentEvent; //导入依赖的package包/类
public Completable createNewCommentFragment(final String timelineArticleId,
    final long previousCommentId) {

  return accountManager.accountStatus()
      .first()
      .toSingle()
      .flatMapCompletable(account -> {
        if (account.isLoggedIn()) {
          // show fragment CommentDialog
          FragmentManager fm = CommentListFragment.this.getActivity()
              .getSupportFragmentManager();
          CommentDialogFragment commentDialogFragment =
              CommentDialogFragment.newInstanceTimelineArticleComment(timelineArticleId,
                  previousCommentId);
          commentDialogFragment.setCommentDialogCallbackContract(this);

          return commentDialogFragment.lifecycle()
              .doOnSubscribe(() -> commentDialogFragment.show(fm, "fragment_comment_dialog"))
              .filter(event -> event.equals(FragmentEvent.DESTROY_VIEW))
              .toCompletable();
        }

        return showSignInMessage();
      });
}
 
开发者ID:Aptoide,项目名称:aptoide-client-v8,代码行数:26,代码来源:CommentListFragment.java


示例11: onViewCreated

import com.trello.rxlifecycle.android.FragmentEvent; //导入依赖的package包/类
@Override public void onViewCreated(final View view, Bundle savedInstanceState) {
  super.onViewCreated(view, savedInstanceState);
  bindViews(view);
  setupSearchView();
  setupStoreSearch(searchView);
  RxView.clicks(addStoreButton)
      .compose(bindUntilEvent(FragmentEvent.DESTROY_VIEW))
      .subscribe(click -> {
        addStoreAction();
        storeAnalytics.sendStoreTabInteractEvent("Add Store");
      });
  RxView.clicks(topStoresButton)
      .compose(bindUntilEvent(FragmentEvent.DESTROY_VIEW))
      .subscribe(click -> topStoresAction());

  RxView.clicks(topStoreText1)
      .compose(bindUntilEvent(FragmentEvent.DESTROY_VIEW))
      .subscribe(click -> topStoresAction());

  RxView.clicks(topStoreText2)
      .compose(bindUntilEvent(FragmentEvent.DESTROY_VIEW))
      .subscribe(click -> topStoresAction());
}
 
开发者ID:Aptoide,项目名称:aptoide-client-v8,代码行数:24,代码来源:AddStoreDialog.java


示例12: registerForViewChanges

import com.trello.rxlifecycle.android.FragmentEvent; //导入依赖的package包/类
private void registerForViewChanges() {
  AptoideAccountManager accountManager =
      ((AptoideApplication) getContext().getApplicationContext()).getAccountManager();

  Observable<Account> loginObservable = accountManager.accountStatus()
      .doOnNext(__ -> reloadData());

  Observable<List<Store>> storesObservable = storeRepository.getAll()
      .skip(1)
      .doOnNext(__ -> {
        Logger.d(TAG, "Store database changed, reloading...");
        reloadData();
      });

  //
  // until this fragment is destroyed we listen for DB changes and login state changes
  // to reload the stores that we are showing
  //
  Observable.merge(loginObservable, storesObservable)
      .observeOn(AndroidSchedulers.mainThread())
      .compose(bindUntilEvent(FragmentEvent.DESTROY_VIEW))
      .subscribe(__ -> {
      }, err -> CrashReport.getInstance()
          .log(err));
}
 
开发者ID:Aptoide,项目名称:aptoide-client-v8,代码行数:26,代码来源:MyStoresFragment.java


示例13: setupViews

import com.trello.rxlifecycle.android.FragmentEvent; //导入依赖的package包/类
@Override public void setupViews() {
  loginBottomSheet.state()
      .observeOn(AndroidSchedulers.mainThread())
      .compose(bindUntilEvent(FragmentEvent.DESTROY_VIEW))
      .subscribe(state -> {
        if (isInPortraitMode && LoginBottomSheet.State.EXPANDED.equals(state)) {
          skipOrNextLayout.setVisibility(View.GONE);
        } else if (LoginBottomSheet.State.COLLAPSED.equals(state)) {
          skipOrNextLayout.setVisibility(View.VISIBLE);
        }
      });

  final AptoideAccountManager accountManager =
      ((AptoideApplication) getContext().getApplicationContext()).getAccountManager();
  WizardPresenter presenter =
      new WizardPresenter(this, accountManager, CrashReport.getInstance());
  attachPresenter(presenter);
  viewPager.addOnPageChangeListener(presenter);
}
 
开发者ID:Aptoide,项目名称:aptoide-client-v8,代码行数:20,代码来源:WizardFragment.java


示例14: showSuggestedApps

import com.trello.rxlifecycle.android.FragmentEvent; //导入依赖的package包/类
public void showSuggestedApps() {
  appViewSimilarAppAnalytics.similarAppsIsShown();
  suggestedShowing = true;

  adsRepository.getAdsFromAppviewSuggested(packageName, keywords)
      .onErrorReturn(throwable -> Collections.emptyList())
      .zipWith(requestFactoryCdnWeb.newGetRecommendedRequest(6, packageName)
          .observe(), (minimalAds, listApps) -> new AppViewSuggestedAppsDisplayable(minimalAds,
          removeCurrentAppFromSuggested(listApps.getDataList()
              // TODO: 04/10/2017 trinkes make some default thing for StoreContext.home
              .getList()), appViewSimilarAppAnalytics, navigationTracker, StoreContext.home))
      .observeOn(AndroidSchedulers.mainThread())
      .compose(bindUntilEvent(FragmentEvent.DESTROY_VIEW))
      .subscribe(appViewSuggestedAppsDisplayable -> {
        addDisplayableWithAnimation(1, appViewSuggestedAppsDisplayable);
      }, Throwable::printStackTrace);
}
 
开发者ID:Aptoide,项目名称:aptoide-client-v8,代码行数:18,代码来源:AppViewFragment.java


示例15: openSocialLink

import com.trello.rxlifecycle.android.FragmentEvent; //导入依赖的package包/类
private void openSocialLink(String packageName, String socialUrl, String pageTitle,
    Uri uriToOpenApp) {

  installedRepository.getInstalled(packageName)
      .first()
      .observeOn(AndroidSchedulers.mainThread())
      .compose(bindUntilEvent(FragmentEvent.DESTROY_VIEW))
      .subscribe(installedFacebook -> {
        if (installedFacebook == null) {
          getFragmentNavigator().navigateTo(AptoideApplication.getFragmentProvider()
              .newSocialFragment(socialUrl, pageTitle), true);
        } else {
          Intent sharingIntent = new Intent(Intent.ACTION_VIEW, uriToOpenApp);
          getContext().startActivity(sharingIntent);
        }
      }, err -> {
        CrashReport.getInstance()
            .log(err);
      });
}
 
开发者ID:Aptoide,项目名称:aptoide-client-v8,代码行数:21,代码来源:HomeFragment.java


示例16: bindUntilEvent

import com.trello.rxlifecycle.android.FragmentEvent; //导入依赖的package包/类
/**
 * Executes an observable subscription based on {@link RxLifecycle}
 * {@link LifecycleProvider}
 *
 * @param observable {@link rx.Observable} given observable for subscribe
 * @param event {@link FragmentEvent} a fragment on {@link RxLifecycle}
 * @param subscribers [OPTIONAL] {@link rx.Subscriber} custom subscriber
 * @param <T> any object for {@link rx.Observable}
 * @return {@link Subscription}
 */
@SafeVarargs protected final <T> Subscription bindUntilEvent(@NonNull Observable<T> observable,
    @NonNull FragmentEvent event, Subscriber<T>... subscribers) {
  if (subscribers.length > 1) {
    throw new IllegalArgumentException("You can pass only one Subscriber<T>");
  }
  if (subscribers.length == 0) {
    return composeUntilEvent(observable, event).subscribe(new DefaultSubscriber<T>());
  }
  return composeUntilEvent(observable, event).subscribe(subscribers[0]);
}
 
开发者ID:ezhome,项目名称:Android-RxPresenter,代码行数:21,代码来源:RxPresenter.java


示例17: composeLifecycle

import com.trello.rxlifecycle.android.FragmentEvent; //导入依赖的package包/类
/**
 * Helper methods, Composes a new {@link rx.Observable} based on a specific event
 *
 * @param observable {@link rx.Observable} given observable for subscribe
 * @param <T> any object for {@link rx.Observable}
 * @return {@link rx.Observable}
 */
@SuppressWarnings("unchecked")
private <T> Observable<T> composeLifecycle(@NonNull Observable<T> observable, Scheduler scheduler) {
  if (naviComponent instanceof Fragment) {
    return observable.doOnUnsubscribe(loggingUnsub)
        .compose(applySchedulers(scheduler))
        .compose(lifecycleProvider.<T>bindUntilEvent(FragmentEvent.DESTROY_VIEW));
  } else {
    return observable.doOnUnsubscribe(loggingUnsub)
        .compose(applySchedulers(scheduler))
        .compose(lifecycleProvider.<T>bindUntilEvent(ActivityEvent.DESTROY));
  }
}
 
开发者ID:ezhome,项目名称:Android-RxPresenter,代码行数:20,代码来源:RxPresenter.java


示例18: testActivityObservableBindUntilEvent

import com.trello.rxlifecycle.android.FragmentEvent; //导入依赖的package包/类
@Test public void testActivityObservableBindUntilEvent() throws Exception {
  final Observable<Object> observable = PublishSubject.create().asObservable();

  TestSubscriber<Object> testSubscriber = TestSubscriber.create();
  NaviFragment fragment = new TestFragment();
  this.presenter.bind(fragment);

  startFragment(fragment);
  this.presenter.bindUntilEvent(observable, FragmentEvent.STOP, testSubscriber);

  fragment.onAttach(null);
  assertFalse(testSubscriber.isUnsubscribed());
  fragment.onCreate(null);
  assertFalse(testSubscriber.isUnsubscribed());
  fragment.onViewCreated(null, null);
  assertFalse(testSubscriber.isUnsubscribed());
  fragment.onStart();
  assertFalse(testSubscriber.isUnsubscribed());
  fragment.onResume();
  assertFalse(testSubscriber.isUnsubscribed());
  fragment.onPause();
  assertFalse(testSubscriber.isUnsubscribed());
  fragment.onStop();
  testSubscriber.assertCompleted();
  testSubscriber.assertUnsubscribed();
  fragment.onDestroyView();
  testSubscriber.assertCompleted();
  testSubscriber.assertUnsubscribed();
}
 
开发者ID:ezhome,项目名称:Android-RxPresenter,代码行数:30,代码来源:RxPresenterTest.java


示例19: onDialogViewCreated

import com.trello.rxlifecycle.android.FragmentEvent; //导入依赖的package包/类
@Override
protected void onDialogViewCreated() {
    textView.setText(text);
    progressBar.setIndeterminate(true);
    progressBar.setMax(1000);
    progress.compose(bindUntilEvent(FragmentEvent.DESTROY_VIEW))
            .onErrorResumeNext(Observable.empty())
            .doAfterTerminate(this::dismiss)
            .subscribe(this::updateStatus);
}
 
开发者ID:M4lik,项目名称:burning-series,代码行数:11,代码来源:ShowSyncDialog.java


示例20: onDialogViewCreated

import com.trello.rxlifecycle.android.FragmentEvent; //导入依赖的package包/类
@Override
protected void onDialogViewCreated() {
    progressBar.setIndeterminate(true);
    progressBar.setMax(1000);
    progress.compose(bindUntilEvent(FragmentEvent.DESTROY_VIEW))
            .onErrorResumeNext(Observable.empty())
            .doAfterTerminate(this::dismiss)
            .subscribe(this::updateStatus);
}
 
开发者ID:M4lik,项目名称:burning-series,代码行数:10,代码来源:DownloadUpdateDialog.java



注:本文中的com.trello.rxlifecycle.android.FragmentEvent类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java EnglishReasonPhraseCatalog类代码示例发布时间:2022-05-22
下一篇:
Java MillisDurationField类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap