Advertisement
Guest User

Untitled

a guest
Sep 22nd, 2017
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.59 KB | None | 0 0
  1.         mAutoComp.addTextChangedListener(new TextWatcher() {
  2.             public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {}
  3.             public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {}
  4.             public void afterTextChanged(Editable editable) {
  5.                 mProgressCircle.setVisibility(View.VISIBLE);
  6.                 new Thread(new Runnable() {
  7.                     public void run() {
  8.                         mAddressAdapter.update(mAutoComp.getText().toString(), new AddressAdapter.Refreshable(){
  9.                             public void refresh(int type) {
  10.                                 switch(type){
  11.                                     case PROGRESS_AWAY:
  12.                                         runOnUiThread(new Runnable() {
  13.                                             public void run() {
  14.                                                 mProgressCircle.setVisibility(View.INVISIBLE);
  15.                                             }
  16.                                         });
  17.                                         break;
  18.                                     case UPDATE_DATA:
  19.                                         runOnUiThread(new Runnable() {
  20.                                             public void run() {
  21.                                                 mAddressAdapter.refreshData();
  22.                                             }
  23.                                         });
  24.                                 }
  25.                             }
  26.                         });
  27.                 }}).start();
  28.             }
  29.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement