本文整理匯總了Java中com.jakewharton.rxbinding.view.RxView類的典型用法代碼示例。如果您正苦於以下問題:Java RxView類的具體用法?Java RxView怎麽用?Java RxView使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
RxView類屬於com.jakewharton.rxbinding.view包,在下文中一共展示了RxView類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: search
import com.jakewharton.rxbinding.view.RxView; //導入依賴的package包/類
private void search() {
RxView.clicks(mSearchBtn)
.throttleFirst(2, TimeUnit.SECONDS)
.map(aVoid -> mSearchEdit.getText().toString().trim())
.filter(s -> !TextUtils.isEmpty(s))
.observeOn(AndroidSchedulers.mainThread())
.subscribe(s -> {
KeyBoardUtil.closeKeybord(mSearchEdit,
TotalStationSearchActivity.this);
showSearchAnim();
clearData();
content = s;
getSearchData();
});
}
示例2: setupVolume
import com.jakewharton.rxbinding.view.RxView; //導入依賴的package包/類
private void setupVolume(SeekBar bar, ImageView mute, ImageView unmute, int stream) {
int max = audioManager.getStreamMaxVolume(stream);
bar.setMax(max);
uiState.onNext(new State(stream, audioManager.getStreamVolume(stream), audioManager.isStreamMute(stream)));
// Skip the initial value to avoid setting the focused stream
RxSeekBar.userChanges(bar).skip(1).subscribe(v -> {
focusedStream = stream;
uiState.onNext(new State(stream, v, false));
volumeState.onNext(new State(stream, v, false));
});
RxView.clicks(mute).subscribe(v -> {
focusedStream = stream;
uiState.onNext(new State(stream, -1, true));
volumeState.onNext(new State(stream, -1, true));
});
RxView.clicks(unmute).subscribe(v -> {
focusedStream = stream;
uiState.onNext(new State(stream, -1, false));
volumeState.onNext(new State(stream, -1, false));
});
}
示例3: bindView
import com.jakewharton.rxbinding.view.RxView; //導入依賴的package包/類
@Override public void bindView(AppBrickDisplayable displayable) {
final FragmentActivity context = getContext();
ImageLoader.with(context)
.load(displayable.getPojo()
.getGraphic(), R.drawable.placeholder_brick, graphic);
compositeSubscription.add(RxView.clicks(itemView)
.subscribe(v -> {
Analytics.AppViewViewedFrom.addStepToList(displayable.getTag());
getFragmentNavigator().navigateTo(AptoideApplication.getFragmentProvider()
.newAppViewFragment(displayable.getPojo()
.getId(), displayable.getPojo()
.getPackageName(), displayable.getTag()), true);
Analytics.HomePageEditorsChoice.clickOnEditorsChoiceItem(getAdapterPosition(),
displayable.getPojo()
.getPackageName(), true);
}, throwable -> CrashReport.getInstance()
.log(throwable)));
}
示例4: onViewCreated
import com.jakewharton.rxbinding.view.RxView; //導入依賴的package包/類
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
RxView.clicks(mFab).throttleFirst(800, TimeUnit.MILLISECONDS)
.subscribe(new Action1<Void>() {
@Override
public void call(Void aVoid) {
reactionToFABClick();
}
}, new Action1<Throwable>() {
@Override
public void call(Throwable throwable) {
throwable.printStackTrace();
}
});
}
示例5: onStart
import com.jakewharton.rxbinding.view.RxView; //導入依賴的package包/類
@Override
protected void onStart() {
super.onStart();
compositeSubscription.add(RxView.clicks(binding.buttonDebounce)
.observeOn(Schedulers.computation())
.debounce(3, TimeUnit.SECONDS)
.observeOn(AndroidSchedulers.mainThread())
.subscribe(v -> binding.textDebounceResult.setText("Debounce Completed")));
compositeSubscription.add(RxView.clicks(binding.buttonSleep)
.observeOn(Schedulers.io())
.map(v -> {
SystemClock.sleep(3000L);
return v;
})
.observeOn(AndroidSchedulers.mainThread())
.subscribe(v -> binding.textSleepResult.setText("Sleep Completed")));
}
示例6: initBookmark
import com.jakewharton.rxbinding.view.RxView; //導入依賴的package包/類
private void initBookmark() {
mBookmark = (ImageView) findViewById(R.id.activity_main_bookmark);
mGoodJobBookmark = null;
RxView.clicks(findViewById(R.id.activity_main_container_bookmark))
.debounce(500, TimeUnit.MILLISECONDS)
.observeOn(AndroidSchedulers.mainThread())
.subscribeOn(AndroidSchedulers.mainThread())
.subscribe(aVoid -> {
if (mGoodJobBookmark == null) {
mGoodJobBookmark = new GoodJob(this)
.setAnimationStartListener(goodJob -> mBookmark.setImageResource(R.mipmap.bookmark))
.setAnimationEndListener(goodJob1 -> mBookmark.setImageResource(R.mipmap.bookmark_checked))
.setPathStraight(0, mBookmark.getHeight() * (-2))
.setEffectIsImage(R.mipmap.bookmark_checked);
}
mGoodJobBookmark.show(mBookmark);
});
}
示例7: onCreate
import com.jakewharton.rxbinding.view.RxView; //導入依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_user_crud);
ButterKnife.bind(this);
daoSession=iDB.getSession(this);
user=daoSession.getUserDao();
RxView.clicks(btnAdd)
.subscribe(btnAddClick);
RxView.clicks(btnSearch)
.subscribe(btnSearchClick);
RxView.clicks(btnUpdate)
.subscribe(btnUpdateClick);
RxView.clicks(btnRemove)
.subscribe(btnRemoveClick);
RxView.clicks(btnClearAll)
.subscribe(btnClearAllClick);
}
示例8: onViewCreated
import com.jakewharton.rxbinding.view.RxView; //導入依賴的package包/類
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
Timber.d("onViewCreated");
mDevices.setLayoutManager(new LinearLayoutManager(getContext()));
mDevices.setHasFixedSize(true);
mDevices.addItemDecoration(new DividerItemDecoration(getContext(), DividerItemDecoration.VERTICAL));
mDevices.addOnItemTouchListener(new RecyclerItemClickListener(getContext(), (view1, position) -> {
Timber.d("Device position: " + position + " id: " + mAdapter.getItemId(position));
PopupMenu popupMenu = new PopupMenu(getContext(), view1);
popupMenu.inflate(R.menu.fragment_devices_popupmenu);
popupMenu.setOnMenuItemClickListener(new OnExecDevicePopupMenu(mAdapter.getItemId(position)));
popupMenu.show();
}));
RxView.clicks(mCreateInput)
.subscribe(aVoid -> {
Bundle args = new Bundle();
args.putLong("deviceId", -1);
router.navigateTo(Screens.DEVICE_SCREEN, args);
});
mCacheDevicesPresenter.load();
}
示例9: onViewCreated
import com.jakewharton.rxbinding.view.RxView; //導入依賴的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());
}
示例10: bindView
import com.jakewharton.rxbinding.view.RxView; //導入依賴的package包/類
@UiThread @Override public void bindView(TimeLineStatsDisplayable displayable) {
followers.setText(displayable.getFollowersText(getContext()));
following.setText(displayable.getFollowingText(getContext()));
Observable<Void> followersClick = RxView.clicks(followers)
.doOnNext(__ -> displayable.followersClick(getFragmentNavigator()));
Observable<Void> followingClick = RxView.clicks(following)
.doOnNext(__ -> displayable.followingClick(getFragmentNavigator()));
Observable<Void> followFriendsClick = RxView.clicks(followFriends)
.doOnNext(__ -> displayable.followFriendsClick(getFragmentNavigator()));
compositeSubscription.add(Observable.merge(followersClick, followingClick, followFriendsClick)
.doOnError((throwable) -> CrashReport.getInstance()
.log(throwable))
.subscribe());
if (!displayable.isShouldShowAddFriends()) {
rightSeparator.setVisibility(View.GONE);
followFriends.setVisibility(View.GONE);
}
}
示例11: setupViews
import com.jakewharton.rxbinding.view.RxView; //導入依賴的package包/類
@Override public void setupViews() {
super.setupViews();
setupToolbar();
RxView.clicks(floatingActionButton)
.flatMap(a -> {
if (commentType == CommentType.TIMELINE) {
return createNewCommentFragment(elementIdAsString).toObservable();
}
return createNewCommentFragment(elementIdAsLong, storeName).toObservable();
})
.compose(bindUntilEvent(LifecycleEvent.DESTROY))
.subscribe(a -> {
// no-op
});
}
示例12: onCreate
import com.jakewharton.rxbinding.view.RxView; //導入依賴的package包/類
@Override
public void onCreate(final @Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.video_player_layout);
ButterKnife.bind(this);
this.viewModel.outputs.preparePlayerWithUrl()
.compose(Transformers.takeWhen(lifecycle().filter(ActivityEvent.RESUME::equals)))
.compose(bindToLifecycle())
.subscribe(this::preparePlayer);
this.mediaController = new MediaController(this);
this.mediaController.setAnchorView(this.rootView);
RxView.clicks(this.rootView)
.compose(bindToLifecycle())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(__ -> toggleControlsVisibility());
}
示例13: bindView
import com.jakewharton.rxbinding.view.RxView; //導入依賴的package包/類
@Override public void bindView(CreateStoreDisplayable displayable) {
followers.setText(String.format(itemView.getContext()
.getString(R.string.my_store_create_store_followers),
String.valueOf(displayable.getFollowers())));
followings.setText(String.format(itemView.getContext()
.getString(R.string.my_store_create_store_followings),
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"))
.subscribe(__ -> {
}, err -> crashReport.log(err)));
}
示例14: bindView
import com.jakewharton.rxbinding.view.RxView; //導入依賴的package包/類
@Override public void bindView(CommentsReadMoreDisplayable displayable) {
final BodyInterceptor<BaseBody> baseBodyInterceptor =
((AptoideApplication) getContext().getApplicationContext()).getAccountSettingsBodyInterceptorPoolV7();
final OkHttpClient httpClient =
((AptoideApplication) getContext().getApplicationContext()).getDefaultClient();
final Converter.Factory converterFactory = WebService.getDefaultConverter();
Observable<ListComments> listCommentsObservable =
ListCommentsRequest.of(displayable.getResourceId(), displayable.getNext(), 100,
displayable.isReview(), baseBodyInterceptor, httpClient, converterFactory,
((AptoideApplication) getContext().getApplicationContext()).getTokenInvalidator(),
((AptoideApplication) getContext().getApplicationContext()).getDefaultSharedPreferences())
.observe();
compositeSubscription.add(RxView.clicks(readMoreButton)
.flatMap(__ -> listCommentsObservable)
.subscribe(listComments -> displayable.getCommentAdder()
.addComment(listComments.getDataList()
.getList())));
}
示例15: bindView
import com.jakewharton.rxbinding.view.RxView; //導入依賴的package包/類
@Override public void bindView(GridAdDisplayable displayable) {
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 -> {
Analytics.AppViewViewedFrom.addStepToList(displayable.getTag());
getFragmentNavigator().navigateTo(AptoideApplication.getFragmentProvider()
.newAppViewFragment(new SearchAdResult(pojo), displayable.getTag()), true);
}, throwable -> CrashReport.getInstance()
.log(throwable)));
downloadsNumber.setText(
AptoideUtils.StringU.withSuffix(pojo.getDownloads()) + context.getString(
R.string._downloads));
rating.setRating(pojo.getStars());
}