com.jakewharton.rxbinding.view.RxView Java Examples
The following examples show how to use
com.jakewharton.rxbinding.view.RxView.
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: TopAppListWidget.java From aptoide-client-v8 with GNU General Public License v3.0 | 6 votes |
@Override public void bindView(TopAppListDisplayable displayable, int position) { App app = displayable.getPojo(); ImageLoader.with(itemView.getContext()) .loadWithRoundCorners(app.getIcon(), 8, appIcon, R.attr.placeholder_square); name.setText(app.getName()); topNumber.setText(String.valueOf(position + 1)); appInfoViewHolder.setInfo(app.getAppcoins() .hasBilling(), app.getStats() .getRating() .getAvg(), true, true); downloadNumber.setText(String.format("%s %s", AptoideUtils.StringU.withSuffix(app.getStats() .getDownloads()), itemView.getContext() .getResources() .getString(R.string.downloads))); compositeSubscription.add(RxView.clicks(itemView) .subscribe(v -> { getFragmentNavigator().navigateTo(AptoideApplication.getFragmentProvider() .newAppViewFragment(app.getId(), app.getPackageName(), app.getStore() .getAppearance() .getTheme(), app.getStore() .getName(), displayable.getTag(), String.valueOf(getAdapterPosition())), true); }, throwable -> CrashReport.getInstance() .log(throwable))); }
Example #2
Source File: StoreAddCommentWidget.java From aptoide-client-v8 with GNU General Public License v3.0 | 6 votes |
@Override public void bindView(StoreAddCommentDisplayable displayable, int position) { accountManager = ((AptoideApplication) getContext().getApplicationContext()).getAccountManager(); accountNavigator = ((ActivityResultNavigator) getContext()).getAccountNavigator(); commentStore.setBackgroundResource(displayable.getRaisedButtonDrawable()); compositeSubscription.add(RxView.clicks(commentStore) .flatMap(a -> showStoreCommentFragment(displayable.getStoreId(), displayable.getStoreName(), getContext().getSupportFragmentManager(), commentStore)) .subscribe(a -> { // all done when we get here. }, err -> { CrashReport.getInstance() .log(err); })); }
Example #3
Source File: GridAdWidget.java From aptoide-client-v8 with GNU General Public License v3.0 | 6 votes |
@Override public void bindView(GridAdDisplayable displayable, int position) { MinimalAd pojo = displayable.getPojo(); name.setText(pojo.getName()); final FragmentActivity context = getContext(); ImageLoader.with(context) .load(pojo.getIconPath(), icon); compositeSubscription.add(RxView.clicks(itemView) .subscribe(v -> { getFragmentNavigator().navigateTo(AptoideApplication.getFragmentProvider() .newAppViewFragment(new SearchAdResult(pojo), displayable.getTag()), true); }, throwable -> CrashReport.getInstance() .log(throwable))); try { DecimalFormat oneDecimalFormatter = new DecimalFormat("0.0"); rating.setText(oneDecimalFormatter.format(pojo.getStars())); } catch (Exception e) { rating.setText(R.string.appcardview_title_no_stars); } }
Example #4
Source File: CreateStoreWidget.java From aptoide-client-v8 with GNU General Public License v3.0 | 6 votes |
@Override public void bindView(CreateStoreDisplayable displayable, int position) { SpannableFactory spannableFactory = new SpannableFactory(); String followersText = String.format(getContext().getString(R.string.storetab_short_followers), String.valueOf(displayable.getFollowers())); ParcelableSpan[] textStyle = { new StyleSpan(android.graphics.Typeface.BOLD), new ForegroundColorSpan(displayable.getTextAccentColor()) }; followers.setText(spannableFactory.createMultiSpan(followersText, textStyle, String.valueOf(displayable.getFollowers()))); String followingText = String.format(getContext().getString(R.string.storetab_short_followings), String.valueOf(displayable.getFollowings())); following.setText(spannableFactory.createMultiSpan(followingText, textStyle, String.valueOf(displayable.getFollowings()))); compositeSubscription.add(RxView.clicks(button) .observeOn(AndroidSchedulers.mainThread()) .doOnNext(click -> getFragmentNavigator().navigateTo( ManageStoreFragment.newInstance(new ManageStoreViewModel(), false), true)) .doOnNext(__ -> displayable.getStoreAnalytics() .sendStoreTabInteractEvent("Login", false)) .subscribe(__ -> { }, err -> crashReport.log(err))); }
Example #5
Source File: GridAppWidget.java From aptoide-client-v8 with GNU General Public License v3.0 | 6 votes |
@Override public void bindView(T displayable, int position) { final App pojo = displayable.getPojo(); final long appId = pojo.getId(); final FragmentActivity context = getContext(); ImageLoader.with(context) .load(pojo.getIcon(), icon); name.setText(pojo.getName()); appInfoViewHolder.setInfo(pojo.hasBilling(), pojo.getStats() .getRating() .getAvg(), true, false); storeName = pojo.getStore() .getName(); compositeSubscription.add(RxView.clicks(itemView) .subscribe(newOnClickListener(displayable, pojo, appId), throwable -> CrashReport.getInstance() .log(throwable))); }
Example #6
Source File: AppBrickWidget.java From aptoide-client-v8 with GNU General Public License v3.0 | 6 votes |
@Override public void bindView(AppBrickDisplayable displayable, int position) { final FragmentActivity context = getContext(); ImageLoader.with(context) .load(displayable.getPojo() .getGraphic(), R.attr.placeholder_brick, graphic); compositeSubscription.add(RxView.clicks(itemView) .subscribe(v -> { getFragmentNavigator().navigateTo(AptoideApplication.getFragmentProvider() .newAppViewFragment(displayable.getPojo() .getId(), displayable.getPojo() .getPackageName(), displayable.getPojo() .getStore() .getAppearance() .getTheme(), displayable.getPojo() .getStore() .getName(), displayable.getTag(), String.valueOf(getAdapterPosition())), true); }, throwable -> CrashReport.getInstance() .log(throwable))); }
Example #7
Source File: SearchGankActivity.java From gank.io-unofficial-android-client with Apache License 2.0 | 6 votes |
private void search() { RxView.clicks(mSearch) .throttleFirst(2, TimeUnit.SECONDS) .map(aVoid -> mEditText.getText().toString()) .observeOn(AndroidSchedulers.mainThread()) .subscribe(s -> { if (!types.contains(s)) { SnackbarUtil.showMessage(mRecyclerView, "请输入正确的干货类型"); } type = s; mSwipeRefreshLayout.postDelayed(() -> { mSwipeRefreshLayout.setRefreshing(true); page = 1; ganks.clear(); mIsRefresh = true; searchGank(); }, 500); }); }
Example #8
Source File: RecommendedStoreWidget.java From aptoide-client-v8 with GNU General Public License v3.0 | 6 votes |
@Override public void bindView(RecommendedStoreDisplayable displayable, int position) { Store store = displayable.getPojo(); storeName.setText(store.getName()); followingUsers.setText(String.valueOf(store.getStats() .getSubscribers())); numberStoreApps.setText(String.valueOf(store.getStats() .getApps())); final FragmentActivity context = getContext(); ImageLoader.with(context) .loadUsingCircleTransform(store.getAvatar(), storeIcon); setFollowButtonListener(displayable); setButtonText(displayable); compositeSubscription.add(RxView.clicks(itemView) .subscribe(click -> { displayable.openStoreFragment(getFragmentNavigator()); if (!displayable.getOrigin() .isEmpty()) { storeAnalytics.sendStoreOpenEvent(displayable.getOrigin(), store.getName(), false); storeAnalytics.sendStoreTabInteractEvent("More Recommended Stores", false); } else { storeAnalytics.sendStoreOpenEvent("Recommended Stores", store.getName(), false); storeAnalytics.sendStoreTabInteractEvent("Open a Recommended Store", false); } }, throwable -> CrashReport.getInstance() .log(throwable))); }
Example #9
Source File: SendFeedbackFragment.java From aptoide-client-v8 with GNU General Public License v3.0 | 5 votes |
@Override public void setupViews() { super.setupViews(); RxView.clicks(sendFeedbackBtn) .subscribe(aVoid -> sendFeedback(), err -> { crashReport.log(err); }); }
Example #10
Source File: TopListActivity.java From ratebeer with GNU General Public License v3.0 | 5 votes |
private <T> void setupAutoComplete(List<T> items, Action1<T> onClick) { SimpleAutoCompleteAdapter<T> adapter = new SimpleAutoCompleteAdapter<>(new ContextThemeWrapper(this, R.style.AppTheme_Dark), items); filterEdit.setAdapter(adapter); RxView.focusChanges(filterEdit) .filter(hasFocus -> hasFocus) .subscribe(f -> filterEdit.showDropDown()); RxAutoCompleteTextView.itemClickEvents(filterEdit) .doOnNext(click -> ImeUtils.hideIme(filterEdit)) .map(click -> adapter.getItem(click.position())) .subscribe(onClick); RxTextView.textChanges(filterEdit) .map(text -> text.length() > 0) .subscribe(RxView.visibility(clearFilterButton)); }
Example #11
Source File: AddStoreDialog.java From aptoide-client-v8 with GNU General Public License v3.0 | 5 votes |
private void setupButtonHandlers() { subscriptions.add(RxView.clicks(addStoreButton) .subscribe(click -> { setDefaultState(); addStoreAction(); storeAnalytics.sendStoreTabInteractEvent("Add Store", true); })); subscriptions.add(RxView.clicks(topStoresButton) .subscribe(click -> topStoresAction())); }
Example #12
Source File: GridAppListWidget.java From aptoide-client-v8 with GNU General Public License v3.0 | 5 votes |
@Override public void bindView(GridAppListDisplayable displayable, int position) { App app = displayable.getPojo(); name.setText(app.getName()); Date modified = app.getUpdated(); if (modified != null) { tvTimeSinceModified.setText(AptoideUtils.DateTimeU.getInstance(itemView.getContext()) .getTimeDiffString(itemView.getContext(), modified.getTime(), getContext().getResources())); } name.setText(app.getName()); name.setTypeface(null, Typeface.BOLD); tvStoreName.setText(app.getStore() .getName()); tvStoreName.setTypeface(null, Typeface.BOLD); final FragmentActivity context = getContext(); compositeSubscription.add(RxView.clicks(itemView) .subscribe(v -> { // FIXME getFragmentNavigator().navigateTo(AptoideApplication.getFragmentProvider() .newAppViewFragment(app.getId(), app.getPackageName(), displayable.getTag()), true); }, throwable -> CrashReport.getInstance() .log(throwable))); ImageLoader.with(context) .load(app.getIcon(), icon); }
Example #13
Source File: KittensView.java From okuki with Apache License 2.0 | 5 votes |
@Override public void onBindViewHolder(KittenViewHolder holder, int position) { int size = getResources().getDisplayMetrics().widthPixels / 2; holder.kittenImg.setLayoutParams(new ViewGroup.LayoutParams(size, size)); Glide.with(getContext()).load(presenter.getItemImage(position)).asGif() .diskCacheStrategy(DiskCacheStrategy.SOURCE).centerCrop().into(holder.kittenImg); RxView.clicks(holder.kittenImg).subscribe( click -> presenter.handleItemSelected(position), Errors.log() ); }
Example #14
Source File: OffersRecyclerViewAdapter.java From fyber_mobile_offers with MIT License | 5 votes |
@Override public void onBindViewHolder(final OfferViewHolder holder, int position) { final Offer offer = offers.get(position); holder.offer = offer; holder.getBinding().setVariable(BR.offer, offer); holder.getBinding().executePendingBindings(); RxView.clicks(holder.view) .map(aVoid -> holder.offer) .subscribe(notify::onNext); }
Example #15
Source File: RxValidator.java From RxValidator with Apache License 2.0 | 5 votes |
public RxValidator onFocusChanged() { this.changeEmitter = RxView.focusChanges(et).skip(1).filter(new Func1<Boolean, Boolean>() { @Override public Boolean call(Boolean hasFocus) { return !hasFocus; } }).map(new Func1<Boolean, String>() { @Override public String call(Boolean aBoolean) { return et.getText().toString(); } }); return this; }
Example #16
Source File: ThemeSelectorViewAdapter.java From aptoide-client-v8 with GNU General Public License v3.0 | 5 votes |
private void bind(View view) { storeThemeImage = view.findViewById(R.id.theme_color); storeThemeCheckMark = view.findViewById(R.id.theme_checked); RxView.clicks(view) .doOnNext(__ -> storeThemePublishRelay.call(storeTheme)) .subscribe(); }
Example #17
Source File: RateActivity.java From ratebeer with GNU General Public License v3.0 | 5 votes |
private void bindPopup(final View button, final TextView text, int layout) { RxView.clicks(button).subscribe(clicked -> { ViewGroup content = (ViewGroup) getLayoutInflater().inflate(layout, null); PopupWindow popup = new PopupWindow(content, ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT, true); applyClickListeners(content, view -> { text.setText(((TextView) view).getText()); popup.dismiss(); }); //noinspection deprecation Hack to have the background transparent popup.setBackgroundDrawable(new BitmapDrawable()); popup.setOutsideTouchable(true); popup.showAsDropDown(button); }); }
Example #18
Source File: CommentListFragment.java From aptoide-client-v8 with GNU General Public License v3.0 | 5 votes |
@Override public void setupViews() { super.setupViews(); setupToolbar(); RxView.clicks(floatingActionButton) .flatMap(a -> createNewCommentFragment(elementIdAsLong, storeName).toObservable()) .compose(bindUntilEvent(LifecycleEvent.DESTROY)) .subscribe(a -> { // no-op }); }
Example #19
Source File: EditorialFragment.java From aptoide-client-v8 with GNU General Public License v3.0 | 5 votes |
@Override public Observable<EditorialDownloadEvent> pauseDownload(EditorialViewModel editorialViewModel) { return RxView.clicks(pauseDownload) .map(click -> new EditorialDownloadEvent(EditorialEvent.Type.PAUSE, editorialViewModel.getBottomCardPackageName(), editorialViewModel.getBottomCardMd5(), editorialViewModel.getBottomCardVersionCode(), editorialViewModel.getBottomCardAppId())) .mergeWith(downloadEventListener.filter(editorialEvent -> editorialEvent.getClickType() .equals(EditorialEvent.Type.PAUSE))); }
Example #20
Source File: ChuckNorrisView.java From okuki with Apache License 2.0 | 5 votes |
@Override protected void onAttachedToWindow() { super.onAttachedToWindow(); presenter.attachVu(this); RxView.clicks(this).subscribe( aVoid -> presenter.reload(), Errors.log() ); }
Example #21
Source File: RateAndReviewsFragment.java From aptoide-client-v8 with GNU General Public License v3.0 | 5 votes |
@Override public void bindViews(View view) { super.bindViews(view); final FloatingActionButton floatingActionButton = view.findViewById(R.id.fab); RxView.clicks(floatingActionButton) .flatMap(__ -> dialogUtils.showRateDialog(getActivity(), appName, packageName, storeName)) .compose(bindUntilEvent(FragmentEvent.DESTROY_VIEW)) .subscribe(__ -> { }, err -> CrashReport.getInstance() .log(err)); }
Example #22
Source File: CommentWidget.java From aptoide-client-v8 with GNU General Public License v3.0 | 5 votes |
@Override public void bindView(CommentDisplayable displayable, int position) { Comment comment = displayable.getComment(); final FragmentActivity context = getContext(); ImageLoader.with(context) .loadWithCircleTransformAndPlaceHolderAvatarSize(comment.getUser() .getAvatar(), userAvatar, R.drawable.layer_1); userName.setText(comment.getUser() .getName()); String date = AptoideUtils.DateTimeU.getInstance(getContext()) .getTimeDiffString(context, comment.getAdded() .getTime(), getContext().getResources()); datePos1.setText(date); datePos2.setText(date); this.comment.setText(comment.getBody()); if (ComplexComment.class.isAssignableFrom(comment.getClass())) { datePos2.setVisibility(View.VISIBLE); bindComplexComment((ComplexComment) comment); } else { datePos1.setVisibility(View.VISIBLE); } compositeSubscription.add(RxView.clicks(itemView) .doOnNext(click -> displayable.itemClicked(itemView)) .subscribe(__ -> { }, throwable -> CrashReport.getInstance() .log(throwable))); }
Example #23
Source File: SearchResultViewHolder.java From aptoide-client-v8 with GNU General Public License v3.0 | 5 votes |
private void bindViews(View itemView) { nameTextView = (TextView) itemView.findViewById(R.id.app_name); iconImageView = (ImageView) itemView.findViewById(R.id.app_icon); downloadsTextView = (TextView) itemView.findViewById(R.id.downloads); ratingBar = (TextView) itemView.findViewById(R.id.rating); storeTextView = (TextView) itemView.findViewById(R.id.store_name); subscriptions.add(RxView.clicks(itemView) .map(__ -> searchApp) .subscribe(data -> onItemViewClick.call( new SearchAppResultWrapper(query, data, getAdapterPosition())))); }
Example #24
Source File: StoreFragment.java From aptoide-client-v8 with GNU General Public License v3.0 | 5 votes |
@Override public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); if (bottomNavigationActivity != null) { bottomNavigationActivity.requestFocus(BOTTOM_NAVIGATION_ITEM); } final SuggestionCursorAdapter suggestionCursorAdapter = new SuggestionCursorAdapter(getContext()); if (hasSearchFromStoreFragment()) { final Toolbar toolbar = getToolbar(); final Observable<MenuItem> toolbarMenuItemClick = RxToolbar.itemClicks(toolbar) .publish() .autoConnect(); appSearchSuggestionsView = new AppSearchSuggestionsView(this, RxView.clicks(toolbar), crashReport, suggestionCursorAdapter, PublishSubject.create(), toolbarMenuItemClick, searchAnalytics); final AptoideApplication application = (AptoideApplication) getContext().getApplicationContext(); final SearchSuggestionsPresenter searchSuggestionsPresenter = new SearchSuggestionsPresenter(appSearchSuggestionsView, application.getSearchSuggestionManager(), AndroidSchedulers.mainThread(), suggestionCursorAdapter, crashReport, trendingManager, searchNavigator, false, searchAnalytics); attachPresenter(searchSuggestionsPresenter); handleOptionsItemSelected(toolbarMenuItemClick); } }
Example #25
Source File: AppBrickListWidget.java From aptoide-client-v8 with GNU General Public License v3.0 | 5 votes |
@Override public void bindView(AppBrickListDisplayable displayable, int position) { App app = displayable.getPojo(); ImageLoader.with(getContext()) .load(app.getIcon(), R.attr.placeholder_square, appIcon); ImageLoader.with(getContext()) .load(app.getGraphic(), R.attr.placeholder_brick, graphic); name.setText(app.getName()); float rating = app.getStats() .getRating() .getAvg(); if (rating == 0) { this.rating.setText(R.string.appcardview_title_no_stars); } else { this.rating.setText(oneDecimalFormatter.format(rating)); } compositeSubscription.add(RxView.clicks(itemView) .subscribe(v -> { getFragmentNavigator().navigateTo(AptoideApplication.getFragmentProvider() .newAppViewFragment(app.getId(), app.getPackageName(), app.getStore() .getAppearance() .getTheme(), app.getStore() .getName(), displayable.getTag(), String.valueOf(getAdapterPosition())), true); }, throwable -> CrashReport.getInstance() .log(throwable))); }
Example #26
Source File: ClaimPromotionDialogFragment.java From aptoide-client-v8 with GNU General Public License v3.0 | 5 votes |
@Override public Observable<ClaimDialogResultWrapper> dismissGenericMessage() { return RxView.clicks(genericMessageButton) .map(__ -> { if (genericMessageTitle.getText() .equals(getResources().getString(R.string.holidayspromotion_title_completed))) { return new ClaimDialogResultWrapper(getArguments().getString(PACKAGE_NAME), true); } else { return new ClaimDialogResultWrapper(getArguments().getString(PACKAGE_NAME), false); } }); }
Example #27
Source File: ThrottleFirstExampleActivity.java From Learning-Rxandroid with Apache License 2.0 | 5 votes |
private void throttleFirstExample() { //有点 : 防暴力点击的 RxView.clicks(click_me) .throttleFirst(3000, TimeUnit.MILLISECONDS) // 设置防抖间隔为 3000ms .subscribe(new Action1<Void>() { @Override public void call(Void aVoid) { Toast.makeText(getBaseContext(), "Clicking", Toast.LENGTH_LONG).show(); } }); }
Example #28
Source File: HomeContainerFragment.java From aptoide-client-v8 with GNU General Public License v3.0 | 5 votes |
@Override public Observable<Boolean> gamesChipClicked() { return RxView.clicks(gamesChip) .map(__ -> gamesChip.isChecked()) .doOnNext(__ -> { if (appsChip.isChecked()) appsChip.setChecked(false); }); }
Example #29
Source File: HomeContainerFragment.java From aptoide-client-v8 with GNU General Public License v3.0 | 5 votes |
@Override public Observable<Boolean> appsChipClicked() { return RxView.clicks(appsChip) .map(__ -> appsChip.isChecked()) .doOnNext(__ -> { if (gamesChip.isChecked()) gamesChip.setChecked(false); }); }
Example #30
Source File: EditorialFragment.java From aptoide-client-v8 with GNU General Public License v3.0 | 5 votes |
@Override public Observable<EditorialEvent> appCardClicked(EditorialViewModel model) { return RxView.clicks(appCardView) .map(click -> new EditorialEvent(EditorialEvent.Type.APPCARD, model.getBottomCardAppId(), model.getBottomCardPackageName())) .mergeWith(uiEventsListener.filter(editorialEvent -> editorialEvent.getClickType() .equals(EditorialEvent.Type.APPCARD))); }