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

Java RxToolbar类代码示例

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

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



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

示例1: setupDefaultUpButton

import com.jakewharton.rxbinding.support.v7.widget.RxToolbar; //导入依赖的package包/类
@SuppressLint("PrivateResource")
protected final Toolbar setupDefaultUpButton() {
	Toolbar mainToolbar = (Toolbar) findViewById(R.id.main_toolbar);
	mainToolbar.setNavigationIcon(R.drawable.ic_action_back);
	RxToolbar.navigationClicks(mainToolbar).subscribe(ignore -> navigateUp());
	return mainToolbar;
}
 
开发者ID:erickok,项目名称:ratebeer,代码行数:8,代码来源:RateBeerActivity.java


示例2: onCreate

import com.jakewharton.rxbinding.support.v7.widget.RxToolbar; //导入依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	setContentView(R.layout.activity_photo);

	// Set up toolbar
	Toolbar mainToolbar = setupDefaultUpButton();
	mainToolbar.inflateMenu(R.menu.menu_refresh);
	RxToolbar.itemClicks(mainToolbar)
			.filter(item -> item.getItemId() == R.id.menu_refresh)
			.subscribe(item -> showPhoto(true));

	showPhoto(false);

}
 
开发者ID:erickok,项目名称:ratebeer,代码行数:16,代码来源:PhotoActivity.java


示例3: onMenuSelection

import com.jakewharton.rxbinding.support.v7.widget.RxToolbar; //导入依赖的package包/类
@Override
public Observable<Integer> onMenuSelection() {
    return RxToolbar.itemClicks(toolbar).map(menuItem -> menuItem.getItemId());
}
 
开发者ID:wongcain,项目名称:okuki,代码行数:5,代码来源:MainActivity.java


示例4: onNavHomeClick

import com.jakewharton.rxbinding.support.v7.widget.RxToolbar; //导入依赖的package包/类
@Override
public Observable<Void> onNavHomeClick() {
    return RxToolbar.navigationClicks(toolbar);
}
 
开发者ID:wongcain,项目名称:okuki,代码行数:5,代码来源:MainActivity.java


示例5: onCreate

import com.jakewharton.rxbinding.support.v7.widget.RxToolbar; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    shopInfo = new ShopInfo();
    applyShopInfo(AppManager.getShopInfo());
    shopInfoObservable = NetworkWrapper.get()
            .getShopInfo(AppManager.getShopInfo().getId())
            .compose(bindToLifecycle());
    setInfoObservable = NetworkWrapper.get()
            .setShopInfo(AppManager.getShopInfo().getId(), shopInfo)
            .compose(bindToLifecycle());
    Glide.with(this).load("").placeholder(new IconicsDrawable(this, GoogleMaterial.Icon.gmd_store)
            .sizeDp(36).colorRes(R.color.colorAccent).paddingRes(R.dimen.padding_icon)).into(binding.ivUserNameLogo);
    Glide.with(this).load("").placeholder(new IconicsDrawable(this, GoogleMaterial.Icon.gmd_local_phone)
            .sizeDp(36).colorRes(R.color.colorAccent).paddingRes(R.dimen.padding_icon)).into(binding.ivUserPhoneLogo);
    Glide.with(this).load("").placeholder(new IconicsDrawable(this, GoogleMaterial.Icon.gmd_attach_money)
            .sizeDp(36).colorRes(R.color.colorAccent).paddingRes(R.dimen.padding_icon)).into(binding.ivUserBasepriceLogo);
    Glide.with(this).load("").placeholder(new IconicsDrawable(this, GoogleMaterial.Icon.gmd_description)
            .sizeDp(36).colorRes(R.color.colorAccent).paddingRes(R.dimen.padding_icon)).into(binding.ivUserDescriptionLogo);
    Glide.with(this).load("").placeholder(new IconicsDrawable(this, GoogleMaterial.Icon.gmd_local_activity)
            .sizeDp(36).colorRes(R.color.colorAccent).paddingRes(R.dimen.padding_icon)).into(binding.ivUserActivityLogo);
    RxToolbar.itemClicks(getToolbar())
            .debounce(500, TimeUnit.MILLISECONDS)
            .map(menuItem -> menuItem.getItemId())
            .compose(bindToLifecycle())
            .observeOn(AndroidSchedulers.mainThread())
            .subscribe(this::onToolbarItemClicked);
    Observable.combineLatest(RxTextView.textChanges(binding.tvUserName).skip(1)
            , RxTextView.textChanges(binding.tvUserPhone).skip(1)
            , RxTextView.textChanges(binding.tvUserBaseprice).skip(1)
            , RxTextView.textChanges(binding.tvUserDescription).skip(1)
            , RxTextView.textChanges(binding.tvUserActivity).skip(1)
            , (name, phone, baseprice, description, activity) -> {
                shopInfo.setName(name.toString());
                shopInfo.setPhone(phone.toString());
                shopInfo.setBasePrice(baseprice.toString());
                shopInfo.setDescription(description.toString());
                shopInfo.setActivity(activity.toString());
                return !TextUtils.isEmpty(name) && !TextUtils.isEmpty(phone)
                        && !TextUtils.isEmpty(baseprice)
                        && !TextUtils.isEmpty(description);
            })
            .subscribe(aBoolean -> {
                isCheckable = aBoolean;
            });
}
 
开发者ID:RunziiMo,项目名称:grooo,代码行数:47,代码来源:ManageActivity.java


示例6: observableUpClicks

import com.jakewharton.rxbinding.support.v7.widget.RxToolbar; //导入依赖的package包/类
@Override
public Observable<Void> observableUpClicks() {
    return RxToolbar.navigationClicks(toolbar);
}
 
开发者ID:patrick-doyle,项目名称:android-rxmvp,代码行数:5,代码来源:DefaultLoginView.java


示例7: onCreate

import com.jakewharton.rxbinding.support.v7.widget.RxToolbar; //导入依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	setContentView(R.layout.activity_customlist);

	// Set up toolbar
	Toolbar mainToolbar = setupDefaultUpButton();
	mainToolbar.inflateMenu(R.menu.menu_delete);

	EditText listNameEdit = (EditText) findViewById(R.id.list_name_edit);
	beersList = (RecyclerView) findViewById(R.id.beers_list);
	emptyText = (TextView) findViewById(R.id.empty_text);

	customListBeersAdapter = new CustomListBeersAdapter();
	beersList.setLayoutManager(new LinearLayoutManager(this));
	beersList.setAdapter(customListBeersAdapter);

	long listId = getIntent().getLongExtra("listId", 0);
	if (listId > 0) {
		list = database(this).get(CustomList.class, listId);
		listNameEdit.setText(list.name);
	} else {
		// Create and directly save, such that we have an id to bind beers to
		list = new CustomList();
		rxdb(this).put(list);
	}

	// Allow deleting the entire list
	RxToolbar.itemClicks(mainToolbar).compose(onUi())
			.filter(item -> item.getItemId() == R.id.menu_delete).compose(toIo())
			.flatMap(event -> Db.deleteCustomList(this, list)).compose(toUi())
			.doOnEach(RBLog::rx)
			.first().toCompletable()
			.subscribe(this::finish, e -> Snackbar.show(this, R.string.error_unexpectederror));

	// Directly persist name changes
	RxTextView.textChanges(listNameEdit)
			.map(name -> {
				list.name = name.toString();
				return list;
			})
			.compose(bindToLifecycle())
			.subscribe(rxdb(this).put(), e -> RBLog.e("Error persisting the list name", e));

	// Directly visualize item changes
	Db.getCustomListBeerChanges(this, list._id)
			.compose(bindToLifecycle())
			.subscribe(
					change -> customListBeersAdapter.change(change),
					e -> RBLog.e("Error handling a beer list change", e));

	// Load current beers list and always have it update the empty view visibility when adding/removing beers
	Db.getCustomListBeers(this, list._id)
			.toList()
			.compose(onIoToUi())
			.compose(bindToLifecycle())
			.subscribe(
					beers -> customListBeersAdapter.init(beers),
					e -> Snackbar.show(this, R.string.error_unexpectederror));
	RxRecyclerViewAdapter.dataEvents(customListBeersAdapter)
			.filter(event -> event.getKind() != RecyclerAdapterDataEvent.Kind.RANGE_CHANGE)
			.subscribe(event -> {
				emptyText.setVisibility(customListBeersAdapter.getItemCount() == 0 ? View.VISIBLE : View.GONE);
				beersList.setVisibility(customListBeersAdapter.getItemCount() == 0 ? View.GONE : View.VISIBLE);
			}, e -> RBLog.e("Unexpected error when handling list addition/removal", e));
}
 
开发者ID:erickok,项目名称:ratebeer,代码行数:67,代码来源:CustomListActivity.java


示例8: onCreate

import com.jakewharton.rxbinding.support.v7.widget.RxToolbar; //导入依赖的package包/类
@SuppressLint("PrivateResource")
@Override
public void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	setContentView(R.layout.activity_beer);

	// Set up toolbar
	Toolbar mainToolbar = setupDefaultUpButton();
	mainToolbar.inflateMenu(R.menu.menu_link);
	mainToolbar.inflateMenu(R.menu.menu_refresh);
	RxToolbar.itemClicks(mainToolbar).subscribe(item -> {
		if (item.getItemId() == R.id.menu_link) {
			new ShareHelper(this).shareBeer(beerId, beerName);
		} else if (item.getItemId() == R.id.menu_link) {
			Animations.fadeFlip(loadingProgress, detailsLayout);
			refresh(true);
		}
	});

	ratingsList = (RecyclerView) findViewById(R.id.ratings_list);
	loadingProgress = (ProgressBar) findViewById(R.id.loading_progress);
	detailsLayout = findViewById(R.id.details_layout);
	numbersLayout = findViewById(R.id.numbers_layout);
	listAddButton = (CheckableImageButton) findViewById(R.id.list_add_button);
	moreLayout = findViewById(R.id.more_layout);
	brewerNameText = (TextView) findViewById(R.id.brewer_name_text);
	rateButton = (FloatingActionButton) findViewById(R.id.rate_button);
	rateButton.setVisibility(View.GONE);

	beerId = getIntent().getLongExtra("beerId", 0);
	if (getIntent().getAction() != null && getIntent().getAction().equals(Intent.ACTION_VIEW) && getIntent().getData() != null) {
		List<String> segments = getIntent().getData().getPathSegments();
		if (segments != null && segments.size() > 1) {
			try {
				beerId = Integer.parseInt(segments.get(1));
			} catch (NumberFormatException e) {
				// Not a supported URL; start the url in a browser instead (via missing beerId)
			}
		}
	}
	if (beerId == 0) {
		startActivity(new Intent(Intent.ACTION_VIEW, getIntent().getData()));
		finish();
	}
}
 
开发者ID:erickok,项目名称:ratebeer,代码行数:46,代码来源:BeerActivity.java


示例9: onCreateView

import com.jakewharton.rxbinding.support.v7.widget.RxToolbar; //导入依赖的package包/类
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle
        savedInstanceState) {
    super.onCreateView(inflater, container, savedInstanceState);

    View view = inflater.inflate(
            R.layout.activity_car_selection_newcar_fragment, container, false);
    ButterKnife.inject(this, view);

    // Get the display size in pixels
    Display display = getActivity().getWindowManager().getDefaultDisplay();
    Point size = new Point();
    display.getSize(size);
    int width = size.x;

    // Set the dropdown width of the spinner to half of the display pixel width.
    manufacturerSpinner.setDropDownWidth(width / 2);
    modelSpinner.setDropDownWidth(width / 2);
    yearSpinner.setDropDownWidth(width / 2);
    engineSpinner.setDropDownWidth(width / 2);

    toolbar.setNavigationIcon(R.drawable.ic_close_white_24dp);
    toolbar.inflateMenu(R.menu.menu_logbook_add_fueling);
    toolbar.setNavigationOnClickListener(v -> closeThisFragment());


    // initially we set the toolbar exp to gone
    toolbar.setVisibility(View.GONE);
    toolbarExp.setVisibility(View.GONE);
    contentView.setVisibility(View.GONE);
    downloadView.setVisibility(View.INVISIBLE);

    createCarSubscription = RxToolbar.itemClicks(toolbar)
            .filter(continueWhenFormIsCorrect())
            .map(createCarFromForm())
            .filter(continueWhenCarHasCorrectValues())
            .map(checkCarAlreadyExist())
            .subscribe(new Subscriber<Car>() {
                @Override
                public void onCompleted() {
                    LOG.info("onCompleted car");
                }

                @Override
                public void onError(Throwable e) {
                    LOG.warn(e.getMessage(), e);
                }

                @Override
                public void onNext(Car car) {
                    LOG.info("car added");
                    ((CarSelectionUiListener) getActivity()).onCarAdded(car);
                    closeThisFragment();
                }
            });


    dispatchRemoteSensors();

    initFocusChangedListener();
    initTextWatcher();
    return view;
}
 
开发者ID:enviroCar,项目名称:enviroCar-app,代码行数:65,代码来源:CarSelectionAddCarFragment.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Java AttributeStatement类代码示例发布时间:2022-05-22
下一篇:
Java ComponentFeature类代码示例发布时间: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