當前位置: 首頁>>代碼示例>>Java>>正文


Java RxTextView類代碼示例

本文整理匯總了Java中com.jakewharton.rxbinding.widget.RxTextView的典型用法代碼示例。如果您正苦於以下問題:Java RxTextView類的具體用法?Java RxTextView怎麽用?Java RxTextView使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


RxTextView類屬於com.jakewharton.rxbinding.widget包,在下文中一共展示了RxTextView類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: editTextValueOnOk

import com.jakewharton.rxbinding.widget.RxTextView; //導入依賴的package包/類
@CheckResult
@NonNull
public static Observable<String> editTextValueOnOk(@NonNull RxAlertDialog rxAlertDialog,
                                                   @NonNull String initialText,
                                                   @IdRes int customEditTextViewId) {
    final EditText text = checkNotNull(rxAlertDialog.getCustomView())
            .findViewById(customEditTextViewId);
    text.setText(initialText);
    text.setOnKeyListener((v, keyCode, event) -> {
        if (isEnterClicked(event)) {
            finishDialog(rxAlertDialog);
        }
        return false;
    });
    text.setSelection(text.length());
    showSoftInputUntilItsShown(text);
    RxTextView.editorActions(text)
            .filter(actionId -> actionId == EditorInfo.IME_ACTION_DONE)
            .subscribe(actionId1 -> finishDialog(rxAlertDialog));
    return rxAlertDialog.observePositiveClick()
            .map(aVoid -> text.getText().toString());
}
 
開發者ID:st1hy,項目名稱:Red-Calorie,代碼行數:23,代碼來源:CustomDialogViewEditTextController.java

示例2: bind

import com.jakewharton.rxbinding.widget.RxTextView; //導入依賴的package包/類
private void bind(int position) {
    Item holder = mItems.get(position);
    DisplayableCalculation calculation = mCalculations.get(position);

    holder.tviName.setText(calculation.getName());
    holder.tviWeight.setText(calculation.getWeight());
    holder.eteGrade.setText(calculation.getGrade());
    holder.eteGrade.setEnabled(calculation.isEditingEnabled());

    int editTextColor = calculation.hasError() ? R.color.red : R.color.secondary_text;
    holder.eteGrade.setTextColor(ContextCompat.getColor(mContext,editTextColor));
    holder.eteGrade.setSelection(holder.eteGrade.getText().length());

    if(mListener!=null){
        RxTextView.afterTextChangeEvents(holder.eteGrade)
                .map(input -> input.editable().toString())
                .debounce(100, TimeUnit.MILLISECONDS)
                .subscribe(text -> {
                    boolean hasChanged = !text.equals(calculation.getGrade());
                    calculation.setGrade(text);
                    if(hasChanged)
                        mListener.onCalculationModified(calculation,position);
                });
    }
}
 
開發者ID:Bruno125,項目名稱:Unofficial-Ups,代碼行數:26,代碼來源:CalculationsView.java

示例3: setData

import com.jakewharton.rxbinding.widget.RxTextView; //導入依賴的package包/類
@Override
public void setData(PackageItem data) {
    String strTtime = "";
    if(data.getActionDate() != null && !data.getActionDate().isEmpty()){
        long timeStamp = DateUtils.strToTimeStamp(data.getActionDate());
        strTtime = DateUtils.convertTimeToFormat(timeStamp);
    }
    if(data.getNickname() != null && !data.getNickname().isEmpty()){
        Observable.just("包裹昵稱:" + data.getNickname()).subscribe(RxTextView.text(mName));
    }else{
        Observable.just("運單號:"+data.getCarrierNo()).subscribe(RxTextView.text(mName));
    }
    if(data.getInventoryStatus() != null){
        Observable.just(data.getWarehouseName()).subscribe(RxTextView.text(mWarehouse));
        Observable.just("已入庫"+" "+strTtime).subscribe(RxTextView.text(mStatus));
    }else{
        Observable.just(strTtime).subscribe(RxTextView.text(mWarehouse));
        Observable.just(data.getInventoryStatus().getStatus()).subscribe(RxTextView.text(mStatus));
    }
   mSelect.setChecked(data.isChecked());
}
 
開發者ID:Zyj163,項目名稱:yyox,代碼行數:22,代碼來源:PackageBoxItemHolder.java

示例4: setData

import com.jakewharton.rxbinding.widget.RxTextView; //導入依賴的package包/類
@Override
public void setData(Order data) {
    String strTtime = "";
    if(!data.getOrStatusDate().isEmpty()){
        long timeStamp = DateUtils.strToTimeStamp(data.getOrStatusDate());
        strTtime = DateUtils.convertTimeToFormat(timeStamp);
    }
    if(data.getType() == 3){
        Observable.just("合箱發貨").subscribe(RxTextView.text(mName));
    }else {
        Observable.just(data.getInventorybasic().get(0).getNickname()).subscribe(RxTextView.text(mName));
    }
    Observable.just("郵客單號:"+data.getOrderNo()).subscribe(RxTextView.text(mNumber));
    Observable.just(strTtime).subscribe(RxTextView.text(mTime));
    Observable.just(data.getOrderStatus()).subscribe(RxTextView.text(mStatus));
}
 
開發者ID:Zyj163,項目名稱:yyox,代碼行數:17,代碼來源:OrderCompletedItemHolder.java

示例5: setData

import com.jakewharton.rxbinding.widget.RxTextView; //導入依賴的package包/類
@Override
public void setData(WarehouseList data) {
    mButton.setOnClickListener(this);
    if (!data.getName().isEmpty() && data.getType() == 1){
        mImge.setImageResource(R.mipmap.meiguo);
    }else if (!data.getName().isEmpty() && data.getType() == 2){
        mImge.setImageResource(R.mipmap.deguo);
    }else if (!data.getName().isEmpty() && data.getType() == 3){
        mImge.setImageResource(R.mipmap.riben);
    }else if (!data.getName().isEmpty() && data.getType() == 4){
        mImge.setImageResource(R.mipmap.aodaliya);
    }
    Observable.just(data.getName()).subscribe(RxTextView.text(mName));
    Observable.just(data.getValue()).subscribe(RxTextView.text(mVaslue));

}
 
開發者ID:Zyj163,項目名稱:yyox,代碼行數:17,代碼來源:WarehouseListHolder.java

示例6: setData

import com.jakewharton.rxbinding.widget.RxTextView; //導入依賴的package包/類
@Override
public void setData(OrderPending data) {
    String strTtime = "";
    if(!data.getDate().isEmpty()){
        long timeStamp = DateUtils.strToTimeStamp(data.getDate());
        strTtime = DateUtils.convertTimeToFormat(timeStamp);
    }
    if(!data.getNickname().isEmpty()){
        Observable.just("包裹昵稱:" + data.getNickname()).subscribe(RxTextView.text(mName));
    }else{
        Observable.just("運單號:"+data.getNo()).subscribe(RxTextView.text(mName));
    }
    Observable.just("").subscribe(RxTextView.text(mGoods));
    Observable.just(data.getWarehouseName()).subscribe(RxTextView.text(mTime));
    Observable.just(data.getOrderStatus()+" "+strTtime).subscribe(RxTextView.text(mStatus));
}
 
開發者ID:Zyj163,項目名稱:yyox,代碼行數:17,代碼來源:OrderPendingPackageItemHolder.java

示例7: onCreateDialog

import com.jakewharton.rxbinding.widget.RxTextView; //導入依賴的package包/類
@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    final Context context = getActivity();
    View view = LayoutInflater.from(context).inflate(R.layout.new_item, null);

    EditText name = findById(view, android.R.id.input);
    Observable.combineLatest(createClicked, RxTextView.textChanges(name),
            (ignored, text) -> text.toString())
            .observeOn(Schedulers.io())
            .subscribe(description -> {
                insertTodoItem.bind(getListId(), description);
                db.executeInsert(insertTodoItem.table, insertTodoItem.program);
            });

    return new AlertDialog.Builder(context) //
            .setTitle(R.string.new_item)
            .setView(view)
            .setPositiveButton(R.string.create, (dialog, which) -> createClicked.onNext("clicked"))
            .setNegativeButton(R.string.cancel, (dialog, which) -> {})
            .create();
}
 
開發者ID:geralt-encore,項目名稱:Delightful-SQLBrite,代碼行數:23,代碼來源:NewItemFragment.java

示例8: onCreateDialog

import com.jakewharton.rxbinding.widget.RxTextView; //導入依賴的package包/類
@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    final Context context = getActivity();
    View view = LayoutInflater.from(context).inflate(R.layout.new_list, null);

    EditText name = findById(view, android.R.id.input);
    Observable.combineLatest(createClicked, RxTextView.textChanges(name),
            (ignored, text) -> text.toString())
            .observeOn(Schedulers.io())
            .subscribe(name1 -> {
                insertTodoList.bind(name1);
                db.executeInsert(insertTodoList.table, insertTodoList.program);
            });

    return new AlertDialog.Builder(context) //
            .setTitle(R.string.new_list)
            .setView(view)
            .setPositiveButton(R.string.create, (dialog, which) -> createClicked.onNext("clicked"))
            .setNegativeButton(R.string.cancel, (dialog, which) -> {})
            .create();
}
 
開發者ID:geralt-encore,項目名稱:Delightful-SQLBrite,代碼行數:23,代碼來源:NewListFragment.java

示例9: onCreate

import com.jakewharton.rxbinding.widget.RxTextView; //導入依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);


    Intent intent = getIntent();
    String title = intent.getStringExtra("title");
    String id = intent.getStringExtra("order_id");
    CommentForm commentForm = new CommentForm();
    ActionBar actionBar = getSupportActionBar();
    if (!TextUtils.isEmpty(title) && actionBar != null) {
        getSupportActionBar().setTitle(title);
    }
    if (!TextUtils.isEmpty(id))
        commentForm.setOrder_id(id);
    bind.setComment(commentForm);

    RxTextView.textChanges(bind.etComment)
            .map(charSequence -> 140 - charSequence.length())
            .compose(bindToLifecycle())
            .subscribe(integer -> bind.tvAbleCount
                    .setText(String.format(getString(R.string.commentFormat), integer)));
}
 
開發者ID:RunziiMo,項目名稱:grooo,代碼行數:24,代碼來源:CommentActivity.java

示例10: onCreate

import com.jakewharton.rxbinding.widget.RxTextView; //導入依賴的package包/類
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    if (AppPreferences.get().getProfile() != null) {
        startActivity(new Intent(
                GroooLoginActivity.this,
                MainActivity.class));
        finish();
        return;
    }

    bind.setLoginForm(new AuthUser());

    Observable.combineLatest(RxTextView.textChanges(bind.etUsername).skip(1)
            , RxTextView.textChanges(bind.etPassword).skip(1)
            , (charSequence, charSequence2) -> !TextUtils.isEmpty(charSequence) && !TextUtils.isEmpty(charSequence2))
            .compose(bindToLifecycle())
            .subscribe(aBoolean -> bind.btnLogin.setEnabled(aBoolean));
}
 
開發者ID:RunziiMo,項目名稱:grooo,代碼行數:21,代碼來源:GroooLoginActivity.java

示例11: onCreate

import com.jakewharton.rxbinding.widget.RxTextView; //導入依賴的package包/類
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    SearchDebounceBinding binding = DataBindingUtil.setContentView(this,
            R.layout.activity_search_debounce);

    adapter = new SearchAdapter(this);
    RecyclerViewUtils.setLinearManagerAndAdapter(binding.recyclerView, adapter);
    binding.recyclerView.addItemDecoration(DividerItemDecoration.newVertical(this,
            R.dimen.list_divider_height, R.color.divider_color));

    //[email protected]
    //1,避免EditText沒改變一次就請求一次.
    //2,避免頻繁的請求,多個導致結果順序錯亂,最終的結果也就有問題.

    // 但是對於第二個問題,也不能徹底的解決. 比如停止輸入400毫秒後,
    // 那麽肯定會開始請求Search接口, 但是用戶又會輸入新的關鍵字,
    // 這個時候上個請求還沒有返回, 新的請求又去請求Search接口.
    // 這個時候有可能最後的一個請求返回, 第一個請求最後返回,導致搜索結果不是想要的.
    //[email protected]

    subscription = RxTextView.textChangeEvents(binding.inputSearch)
            .debounce(400, TimeUnit.MILLISECONDS)
            .observeOn(AndroidSchedulers.mainThread())
            .subscribe(getSearchObserver());
}
 
開發者ID:chiclaim,項目名稱:awesome-android-mvvm,代碼行數:27,代碼來源:SearchDebounceActivity.java

示例12: onCreate

import com.jakewharton.rxbinding.widget.RxTextView; //導入依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_splash);

    ButterKnife.bind(this);

    presenter = new SplashActivityPresenter(this,new Validator());

    textChangeSubscription = RxTextView.textChangeEvents(etUsername).subscribe(new Action1<TextViewTextChangeEvent>() {
        @Override
        public void call(TextViewTextChangeEvent textViewTextChangeEvent) {
            presenter.username = textViewTextChangeEvent.text().toString();
            etUsername.setError(null);
        }
    });
}
 
開發者ID:xsingHu,項目名稱:xs-android-architecture,代碼行數:18,代碼來源:SplashActivity.java

示例13: validateLoginForms

import com.jakewharton.rxbinding.widget.RxTextView; //導入依賴的package包/類
@Override
public void validateLoginForms(EditText emailEdit, EditText passEdit, OnFormEmitted listener) {
    Observable<Boolean> emailObservable = RxTextView.textChanges(emailEdit)
            .map(inputText -> inputText.toString().matches("^[_A-Za-z0-9-\\+]+(\\.[_A-Za-z0-9-]+)*@"
                    + "[A-Za-z0-9-]+(\\.[A-Za-z0-9]+)*(\\.[A-Za-z]{2,})$"))
            .skip(1)
            .distinctUntilChanged();

    Observable<Boolean> passwordObservable = RxTextView.textChanges(passEdit)
            .map(inputText -> inputText.toString().length() < 6)
            .skip(1)
            .distinctUntilChanged();

    emailObservable.subscribe(listener::emailOnNext);

    passwordObservable.subscribe(listener::passwordOnNext);

    Observable.combineLatest(
            emailObservable,
            passwordObservable,
            (emailValid, passValid) -> emailValid && !passValid)
            .distinctUntilChanged()
            .subscribe(listener::buttonChanged);
}
 
開發者ID:matbrandao,項目名稱:Saude-no-Mapa,代碼行數:25,代碼來源:LoginInteractorImpl.java

示例14: validateReactivateForms

import com.jakewharton.rxbinding.widget.RxTextView; //導入依賴的package包/類
@Override
public void validateReactivateForms(EditText emailEdit, EditText passEdit, OnFormEmitted listener) {
    Observable<Boolean> emailObservable = RxTextView.textChanges(emailEdit)
            .map(inputText -> inputText.toString().matches("^[_A-Za-z0-9-\\+]+(\\.[_A-Za-z0-9-]+)*@"
                    + "[A-Za-z0-9-]+(\\.[A-Za-z0-9]+)*(\\.[A-Za-z]{2,})$"))
            .skip(1)
            .distinctUntilChanged();

    Observable<Boolean> passwordObservable = RxTextView.textChanges(passEdit)
            .map(inputText -> inputText.toString().length() < 6)
            .skip(1)
            .distinctUntilChanged();

    emailObservable.subscribe(listener::emailOnNext);

    passwordObservable.subscribe(listener::passwordOnNext);

    Observable.combineLatest(
            emailObservable,
            passwordObservable,
            (emailValid, passValid) -> emailValid && !passValid)
            .distinctUntilChanged()
            .subscribe(listener::buttonChanged);
}
 
開發者ID:matbrandao,項目名稱:Saude-no-Mapa,代碼行數:25,代碼來源:LoginInteractorImpl.java

示例15: onCreateView

import com.jakewharton.rxbinding.widget.RxTextView; //導入依賴的package包/類
@Override
public View onCreateView(LayoutInflater inflater,
                         @Nullable ViewGroup container,
                         @Nullable Bundle savedInstanceState) {
    View layout = inflater.inflate(R.layout.fragment_form_validation_comb_latest,
          container,
          false);
    ButterKnife.bind(this, layout);

    emailChangeObservable = RxTextView.textChanges(email).skip(1);
    passwordChangeObservable = RxTextView.textChanges(password).skip(1);
    numberChangeObservable = RxTextView.textChanges(number).skip(1);

    combineLatestEvents();

    return layout;
}
 
開發者ID:gdg-novi-sad,項目名稱:oct-04-16-rxjava,代碼行數:18,代碼來源:FormValidationCombineLatestFragment.java


注:本文中的com.jakewharton.rxbinding.widget.RxTextView類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。