当前位置: 首页>>代码示例>>Java>>正文


Java FragmentEvent类代码示例

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


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


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