久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

  • <i id='BWrtm'><tr id='BWrtm'><dt id='BWrtm'><q id='BWrtm'><span id='BWrtm'><b id='BWrtm'><form id='BWrtm'><ins id='BWrtm'></ins><ul id='BWrtm'></ul><sub id='BWrtm'></sub></form><legend id='BWrtm'></legend><bdo id='BWrtm'><pre id='BWrtm'><center id='BWrtm'></center></pre></bdo></b><th id='BWrtm'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='BWrtm'><tfoot id='BWrtm'></tfoot><dl id='BWrtm'><fieldset id='BWrtm'></fieldset></dl></div>

    <small id='BWrtm'></small><noframes id='BWrtm'>

    1. <tfoot id='BWrtm'></tfoot>

        <bdo id='BWrtm'></bdo><ul id='BWrtm'></ul>

        <legend id='BWrtm'><style id='BWrtm'><dir id='BWrtm'><q id='BWrtm'></q></dir></style></legend>

      1. RxTextView.textChanges 與 Edittext 上的 setText

        RxTextView.textChanges with setText on Edittext(RxTextView.textChanges 與 Edittext 上的 setText)
          • <bdo id='qyqgv'></bdo><ul id='qyqgv'></ul>

            <small id='qyqgv'></small><noframes id='qyqgv'>

          • <legend id='qyqgv'><style id='qyqgv'><dir id='qyqgv'><q id='qyqgv'></q></dir></style></legend>

                    <tbody id='qyqgv'></tbody>
                  <i id='qyqgv'><tr id='qyqgv'><dt id='qyqgv'><q id='qyqgv'><span id='qyqgv'><b id='qyqgv'><form id='qyqgv'><ins id='qyqgv'></ins><ul id='qyqgv'></ul><sub id='qyqgv'></sub></form><legend id='qyqgv'></legend><bdo id='qyqgv'><pre id='qyqgv'><center id='qyqgv'></center></pre></bdo></b><th id='qyqgv'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='qyqgv'><tfoot id='qyqgv'></tfoot><dl id='qyqgv'><fieldset id='qyqgv'></fieldset></dl></div>

                  <tfoot id='qyqgv'></tfoot>
                1. 本文介紹了RxTextView.textChanges 與 Edittext 上的 setText的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  RxTextView.textChanges(editText)
                                  .map(CharSequence::toString)
                                  .debounce(200, TimeUnit.MILLISECONDS)
                                  .observeOn(AndroidSchedulers.mainThread())
                                  .subscribe(input -> {
                                     output = //...do something with input
                                     editText.setText(ouput)
                                   }));
                  

                  當我 setText(output) 它進入循環.要設置文本,我首先需要刪除偵聽器,然后再次設置偵聽器.如何使用 RxJava 做到這一點?

                  When I setText(output) it goes in loop. To set the text I first need to remove listener and then set listener again. How can I do this using RxJava?

                  推薦答案

                  當我 setText(output) 它進入循環.要設置文本,我首先需要刪除偵聽器,然后再次設置偵聽器.如何使用 RxJava 做到這一點?

                  When I setText(output) it goes in loop. To set the text I first need to remove listener and then set listener again. How can I do this using RxJava?

                  為了滿足要求,我設法擴展了 RxBinding 源代碼,如下所示.

                  To meet the requirement I managed to extend the RxBinding source code as follows.

                  EditableTextViewTextObservable.java:

                  public class EditableTextViewTextObservable extends InitialValueObservable<CharSequence> {
                      private final TextView view;
                  
                      EditableTextViewTextObservable(TextView view) {
                          this.view = view;
                      }
                  
                      @Override
                      protected void subscribeListener(Observer<? super CharSequence> observer) {
                          EditableTextViewTextObservable.Listener listener = new EditableTextViewTextObservable.Listener(view, observer);
                          observer.onSubscribe(listener);
                          view.addTextChangedListener(listener);
                      }
                  
                      @Override protected CharSequence getInitialValue() {
                          return view.getText();
                      }
                  
                      final static class Listener extends MainThreadDisposable implements TextWatcher {
                          private final TextView view;
                          private final Observer<? super CharSequence> observer;
                  
                          Listener(TextView view, Observer<? super CharSequence> observer) {
                              this.view = view;
                              this.observer = observer;
                          }
                  
                          @Override
                          public void beforeTextChanged(CharSequence s, int start, int count, int after) {
                          }
                  
                          @Override
                          public void onTextChanged(CharSequence s, int start, int before, int count) {
                          }
                  
                          @Override
                          public void afterTextChanged(Editable s) {
                              if (!isDisposed()) {
                                  view.removeTextChangedListener(this);
                                  observer.onNext(s);
                                  view.addTextChangedListener(this);
                              }
                          }
                  
                          @Override
                          protected void onDispose() {
                              view.removeTextChangedListener(this);
                          }
                      }
                  }
                  

                  EditableRxTextView.java:

                  public final class EditableRxTextView {
                      @CheckResult
                      @NonNull
                      public static InitialValueObservable<CharSequence> textChanges(@NonNull TextView view) {
                          return new EditableTextViewTextObservable(view);
                      }
                  }
                  

                  用法:

                  EditableRxTextView.textChanges(editText)
                              .map(CharSequence::toString)
                              .debounce(200, TimeUnit.MILLISECONDS)
                              .observeOn(AndroidSchedulers.mainThread())
                              .subscribe(input -> {
                                 output = //...do something with input
                                 editText.setText(ouput)
                               }));
                  

                  這篇關于RxTextView.textChanges 與 Edittext 上的 setText的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                  【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                  相關文檔推薦

                  How can I detect integer overflow on 32 bits int?(如何檢測 32 位 int 上的整數溢出?)
                  Local variables before return statements, does it matter?(return 語句之前的局部變量,這有關系嗎?)
                  How to convert Integer to int?(如何將整數轉換為整數?)
                  How do I create an int array with randomly shuffled numbers in a given range(如何在給定范圍內創建一個隨機打亂數字的 int 數組)
                  Inconsistent behavior on java#39;s ==(java的行為不一致==)
                  Why is Java able to store 0xff000000 as an int?(為什么 Java 能夠將 0xff000000 存儲為 int?)
                    <tbody id='wtEz9'></tbody>
                      <bdo id='wtEz9'></bdo><ul id='wtEz9'></ul>

                        <small id='wtEz9'></small><noframes id='wtEz9'>

                        • <i id='wtEz9'><tr id='wtEz9'><dt id='wtEz9'><q id='wtEz9'><span id='wtEz9'><b id='wtEz9'><form id='wtEz9'><ins id='wtEz9'></ins><ul id='wtEz9'></ul><sub id='wtEz9'></sub></form><legend id='wtEz9'></legend><bdo id='wtEz9'><pre id='wtEz9'><center id='wtEz9'></center></pre></bdo></b><th id='wtEz9'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='wtEz9'><tfoot id='wtEz9'></tfoot><dl id='wtEz9'><fieldset id='wtEz9'></fieldset></dl></div>

                          <legend id='wtEz9'><style id='wtEz9'><dir id='wtEz9'><q id='wtEz9'></q></dir></style></legend>
                            <tfoot id='wtEz9'></tfoot>
                            主站蜘蛛池模板: 美女久久| 久久不卡区 | 五月激情综合网 | 欧美一区2区三区4区公司二百 | 亚洲精品福利在线 | 国产精品久久一区二区三区 | 亚洲精品小视频在线观看 | 久久99精品久久久久久 | 色黄爽| 国产成人免费观看 | 久久大陆| 密色视频 | 九九九国产 | 精品视频一区二区三区在线观看 | 欧美成人精品欧美一级 | 一级免费黄色 | 中文字幕不卡 | 在线播放国产一区二区三区 | 精品国产一区二区在线 | 黑人巨大精品欧美一区二区免费 | 日日摸夜夜添夜夜添精品视频 | 亚洲国产第一页 | caoporn国产精品免费公开 | 国产一二三区电影 | 亚洲天堂av在线 | 亚洲一区二区av | 国产亚洲精品精品国产亚洲综合 | 国产免费视频 | 一区二区三区四区在线 | 亚洲精久久久 | 国产综合久久久久久鬼色 | 欧美一级淫片免费视频黄 | 91在线视频观看 | 欧美a∨| 亚洲精品电影网在线观看 | 亚洲欧洲成人av每日更新 | 亚洲成av | 久久久久久成人 | 999re5这里只有精品 | 日本不卡高字幕在线2019 | 在线观看中文视频 |