Java Code Examples for com.jakewharton.rxrelay.PublishRelay#create()

The following examples show how to use com.jakewharton.rxrelay.PublishRelay#create() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MainActivity.java    From aptoide-client-v8 with GNU General Public License v3.0 6 votes vote down vote up
@Override protected void onCreate(@Nullable Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  getActivityComponent().inject(this);
  final AptoideApplication application = (AptoideApplication) getApplicationContext();
  MoPub.onCreate(this);
  installManager = application.getInstallManager();
  snackBarLayout = findViewById(R.id.snackbar_layout);
  installErrorsDismissEvent = PublishRelay.create();
  authenticationSubject = PublishSubject.create();
  themeAnalytics.setDarkThemeUserProperty(themeManager.getDarkThemeMode());
  progressDialog = GenericDialogs.createGenericPleaseWaitDialog(this,
      themeManager.getAttributeForTheme(R.attr.dialogsTheme).resourceId);

  setupUpdatesNotification();

  attachPresenter(presenter);
  handleAuthenticationIntent(getIntent());
}
 
Example 2
Source File: ActivityModule.java    From aptoide-client-v8 with GNU General Public License v3.0 6 votes vote down vote up
@ActivityScope @Provides Presenter provideMainPresenter(
    RootInstallationRetryHandler rootInstallationRetryHandler, ApkFy apkFy,
    InstallManager installManager, @Named("default") SharedPreferences sharedPreferences,
    @Named("secureShared") SharedPreferences secureSharedPreferences,
    @Named("main-fragment-navigator") FragmentNavigator fragmentNavigator,
    DeepLinkManager deepLinkManager, BottomNavigationNavigator bottomNavigationNavigator,
    UpdatesManager updatesManager, AutoUpdateManager autoUpdateManager,
    RootAvailabilityManager rootAvailabilityManager, AppsNameExperiment appsNameExperiment,
    BottomNavigationMapper bottomNavigationMapper, AptoideAccountManager accountManager,
    AccountNavigator accountNavigator, AgentPersistence agentPersistence) {
  return new MainPresenter((MainView) view, installManager, rootInstallationRetryHandler,
      CrashReport.getInstance(), apkFy, new ContentPuller(activity), notificationSyncScheduler,
      new InstallCompletedNotifier(PublishRelay.create(), installManager,
          CrashReport.getInstance()), sharedPreferences, secureSharedPreferences,
      fragmentNavigator, deepLinkManager, firstCreated, (AptoideBottomNavigator) activity,
      AndroidSchedulers.mainThread(), Schedulers.io(), bottomNavigationNavigator, updatesManager,
      autoUpdateManager, (PermissionService) activity, rootAvailabilityManager,
      appsNameExperiment, bottomNavigationMapper, accountManager, accountNavigator,
      agentPersistence);
}
 
Example 3
Source File: ManageStoreFragment.java    From aptoide-client-v8 with GNU General Public License v3.0 6 votes vote down vote up
public void setupThemeSelector() {

    themeSelectorView.setLayoutManager(
        new LinearLayoutManager(getActivity(), RecyclerView.HORIZONTAL, false));
    PublishRelay<StoreTheme> storeThemePublishRelay = PublishRelay.create();
    themeSelectorAdapter =
        new ThemeSelectorViewAdapter(storeThemePublishRelay, StoreTheme.getThemesFromVersion(8),
            themeManager);
    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());
  }
 
Example 4
Source File: ApplicationModule.java    From aptoide-client-v8 with GNU General Public License v3.0 6 votes vote down vote up
@Singleton @Provides RootInstallationRetryHandler provideRootInstallationRetryHandler(
    InstallManager installManager) {

  Intent retryActionIntent = new Intent(application, RootInstallNotificationEventReceiver.class);
  retryActionIntent.setAction(RootInstallNotificationEventReceiver.ROOT_INSTALL_RETRY_ACTION);

  PendingIntent retryPendingIntent = PendingIntent.getBroadcast(application, 2, retryActionIntent,
      PendingIntent.FLAG_UPDATE_CURRENT);

  NotificationCompat.Action action =
      new NotificationCompat.Action(R.drawable.ic_refresh_action_black,
          application.getString(R.string.generalscreen_short_root_install_timeout_error_action),
          retryPendingIntent);

  PendingIntent deleteAction = PendingIntent.getBroadcast(application, 3,
      retryActionIntent.setAction(
          RootInstallNotificationEventReceiver.ROOT_INSTALL_DISMISS_ACTION),
      PendingIntent.FLAG_UPDATE_CURRENT);

  int notificationId = 230498;
  return new RootInstallationRetryHandler(notificationId,
      application.getSystemNotificationShower(), installManager, PublishRelay.create(), 0,
      application, new RootInstallErrorNotificationFactory(notificationId,
      BitmapFactory.decodeResource(application.getResources(), R.mipmap.ic_launcher), action,
      deleteAction));
}
 
Example 5
Source File: AptoideAccountManager.java    From aptoide-client-v8 with GNU General Public License v3.0 5 votes vote down vote up
public AptoideAccountManager build() {

      if (accountPersistence == null) {
        throw new IllegalArgumentException("AccountDataPersist is mandatory.");
      }

      if (accountService == null) {
        throw new IllegalArgumentException("AccountManagerService is mandatory.");
      }

      if (storeManager == null) {
        throw new IllegalArgumentException("StoreManager is mandatory.");
      }

      if (credentialsValidator == null) {
        credentialsValidator = new CredentialsValidator();
      }

      if (accountRelay == null) {
        accountRelay = PublishRelay.create();
      }

      final SignUpAdapterRegistry adapterRegistry =
          new SignUpAdapterRegistry(adapters, accountService);

      adapterRegistry.register(APTOIDE_SIGN_UP_TYPE,
          new AptoideSignUpAdapter(credentialsValidator));

      return new AptoideAccountManager(credentialsValidator, accountPersistence, accountService,
          accountRelay, adapterRegistry, storeManager, adultContent);
    }
 
Example 6
Source File: ActivityModule.java    From aptoide-client-v8 with GNU General Public License v3.0 5 votes vote down vote up
@ActivityScope @Provides AccountNavigator provideAccountNavigator(
    @Named("main-fragment-navigator") FragmentNavigator fragmentNavigator,
    AptoideAccountManager accountManager, CallbackManager callbackManager,
    GoogleApiClient googleApiClient, AccountAnalytics accountAnalytics,
    BottomNavigationNavigator bottomNavigationNavigator, ThemeManager themeManager) {
  return new AccountNavigator(bottomNavigationNavigator, fragmentNavigator, accountManager,
      ((ActivityNavigator) activity), LoginManager.getInstance(), callbackManager,
      googleApiClient, PublishRelay.create(), "http://m.aptoide.com/account/password-recovery",
      accountAnalytics, themeManager);
}
 
Example 7
Source File: RxAlertDialog.java    From aptoide-client-v8 with GNU General Public License v3.0 5 votes vote down vote up
public RxAlertDialog build() {
  final AlertDialog dialog = builder.create();
  final CancelEvent cancelEvent = new CancelEvent(PublishRelay.create());
  final DismissEvent dismissEvent = new DismissEvent(PublishRelay.create());
  dialog.setOnCancelListener(cancelEvent);
  dialog.setOnDismissListener(dismissEvent);
  return new RxAlertDialog(dialog, view, positiveClick, negativeClick, cancelEvent,
      dismissEvent);
}
 
Example 8
Source File: ActivityResultNavigator.java    From aptoide-client-v8 with GNU General Public License v3.0 5 votes vote down vote up
@Override protected void onCreate(@Nullable Bundle savedInstanceState) {
  fragmentResultRelay = ((AptoideApplication) getApplicationContext()).getFragmentResultRelay();
  fragmentResultMap = ((AptoideApplication) getApplicationContext()).getFragmentResultMap();
  fragmentNavigator =
      new FragmentResultNavigator(getSupportFragmentManager(), R.id.fragment_placeholder,
          android.R.anim.fade_in, android.R.anim.fade_out, fragmentResultMap,
          fragmentResultRelay);
  // super.onCreate handles fragment creation using FragmentManager.
  // Make sure navigator instances are already created when fragments are created,
  // else getFragmentNavigator and getActivityNavigator will return null.
  super.onCreate(savedInstanceState);
  resultRelay = PublishRelay.create();
  getActivityComponent().inject(this);
}
 
Example 9
Source File: RxBus.java    From FriendBook with GNU General Public License v3.0 4 votes vote down vote up
public RxBus(RemoteRxBus remoteRxBus) {
    mRemoteRxBus = remoteRxBus;
    mBus =  PublishRelay.create();
    mStickyEventMap = new ConcurrentHashMap<>();
}
 
Example 10
Source File: RxJava1Proxies.java    From RHub with Apache License 2.0 4 votes vote down vote up
public static RxJava1RelayProxy publishRelayProxy() {
    return new RxJava1RelayProxy(PublishRelay.create());
}
 
Example 11
Source File: PermissionProviderActivity.java    From aptoide-client-v8 with GNU General Public License v3.0 4 votes vote down vote up
@Override protected void onCreate(@Nullable Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  this.permissionRelay = PublishRelay.create();
  this.requestedCodeGrantedPermissions = new SparseArray<>();
}
 
Example 12
Source File: RxAlertDialog.java    From aptoide-client-v8 with GNU General Public License v3.0 4 votes vote down vote up
public Builder setPositiveButton(@StringRes int textId) {
  positiveClick = new DialogClick(DialogInterface.BUTTON_POSITIVE, PublishRelay.create());
  builder.setPositiveButton(textId, positiveClick);
  return this;
}
 
Example 13
Source File: RxAlertDialog.java    From aptoide-client-v8 with GNU General Public License v3.0 4 votes vote down vote up
public Builder setNegativeButton(@StringRes int textId) {
  negativeClick = new DialogClick(DialogInterface.BUTTON_NEGATIVE, PublishRelay.create());
  builder.setNegativeButton(textId, negativeClick);
  return this;
}
 
Example 14
Source File: AptoideApplication.java    From aptoide-client-v8 with GNU General Public License v3.0 4 votes vote down vote up
public PublishRelay<NotificationInfo> getNotificationsPublishRelay() {
  if (notificationsPublishRelay == null) {
    notificationsPublishRelay = PublishRelay.create();
  }
  return notificationsPublishRelay;
}
 
Example 15
Source File: SearchResultFragment.java    From aptoide-client-v8 with GNU General Public License v3.0 4 votes vote down vote up
@Override public void onCreate(@Nullable Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  getFragmentComponent(savedInstanceState).inject(this);
  CrashReport crashReport = CrashReport.getInstance();

  if (viewModel == null && savedInstanceState != null && savedInstanceState.containsKey(
      VIEW_MODEL)) {
    viewModel = Parcels.unwrap(savedInstanceState.getParcelable(VIEW_MODEL));
  } else if (viewModel == null && getArguments().containsKey(VIEW_MODEL)) {
    viewModel = Parcels.unwrap(getArguments().getParcelable(VIEW_MODEL));
  }

  if (savedInstanceState != null && savedInstanceState.containsKey(FOCUS_IN_SEARCH)) {
    focusInSearchBar = savedInstanceState.getBoolean(FOCUS_IN_SEARCH);
  } else if (getArguments().containsKey(FOCUS_IN_SEARCH) && savedInstanceState == null) {
    focusInSearchBar = getArguments().getBoolean(FOCUS_IN_SEARCH);
  }

  if (viewModel != null) {
    currentQuery = viewModel.getSearchQueryModel()
        .getFinalQuery();
  }

  final AptoideApplication application = (AptoideApplication) getActivity().getApplication();

  noResults = false;
  networkError = false;

  onItemViewClickRelay = PublishRelay.create();
  onAdClickRelay = PublishRelay.create();
  suggestionClickedPublishSubject = PublishSubject.create();
  searchSetupPublishSubject = PublishSubject.create();
  queryTextChangedPublisher = PublishSubject.create();

  showingSearchResultsView = PublishSubject.create();
  noResultsAdultContentSubject = PublishSubject.create();
  noResultsPublishSubject = PublishSubject.create();

  final List<SearchAppResult> searchResultFollowedStores = new ArrayList<>();
  final List<SearchAdResult> searchResultAdsFollowedStores = new ArrayList<>();

  followedStoresResultAdapter =
      new SearchResultAdapter(onAdClickRelay, onItemViewClickRelay, searchResultFollowedStores,
          searchResultAdsFollowedStores, crashReport, oneDecimalFormatter);

  listItemPadding = getResources().getDimension(R.dimen.padding_tiny);

  final List<SearchAppResult> searchResultAllStores = new ArrayList<>();
  final List<SearchAdResult> searchResultAdsAllStores = new ArrayList<>();

  allStoresResultAdapter =
      new SearchResultAdapter(onAdClickRelay, onItemViewClickRelay, searchResultAllStores,
          searchResultAdsAllStores, crashReport, oneDecimalFormatter);

  searchSuggestionsAdapter =
      new SearchSuggestionsAdapter(new ArrayList<>(), suggestionClickedPublishSubject);
  searchTrendingAdapter =
      new SearchSuggestionsAdapter(new ArrayList<>(), suggestionClickedPublishSubject);

  setHasOptionsMenu(true);
}