@Test public void onViewDetached() throws Exception { autoComplete.onViewAttached(editText); autoComplete.onViewDetached(); assertThat(autoComplete.getAdapter(), nullValue()); assertThat(autoComplete.getEditText(), nullValue()); }
@Override public void onViewDetached() { for (TypeAdapterDelegate adapter : typeAdapters) { adapter.unregisterDataSetObserver(delegateDataSetObserver); } if (adapter != null) { adapter.unregisterDataSetObserver(dataSetObserver); adapter.notifyDataSetInvalidated(); adapter = null; } if (editText != null) { editText.setAdapter(null); editText = null; } }
MultiAutoCompleteImpl implements MultiAutoComplete, TextWatcher, MultiAutoCompleteEditText.OnSelectionChangedListener { @Override public void onViewDetached() { for (TypeAdapterDelegate adapter : typeAdapters) { adapter.unregisterDataSetObserver(delegateDataSetObserver); } if (adapter != null) { adapter.unregisterDataSetObserver(dataSetObserver); adapter.notifyDataSetInvalidated(); adapter = null; } if (editText != null) { editText.setAdapter(null); editText = null; } } }
MultiAutoCompleteImpl implements MultiAutoComplete, TextWatcher, MultiAutoCompleteEditText.OnSelectionChangedListener { @Override public void onViewDetached() { for (TypeAdapterDelegate adapter : typeAdapters) { adapter.unregisterDataSetObserver(delegateDataSetObserver); } if (adapter != null) { adapter.unregisterDataSetObserver(dataSetObserver); adapter.notifyDataSetInvalidated(); adapter = null; } if (editText != null) { editText.setAdapter(null); editText = null; } } MultiAutoCompleteImpl(@NonNull Tokenizer tokenizer,
                          @NonNull List<TypeAdapterDelegate> typeAdapters,
                          @Nullable Delayer delayer); }
MultiAutoCompleteImpl implements MultiAutoComplete, TextWatcher, MultiAutoCompleteEditText.OnSelectionChangedListener { @Override public void onViewDetached() { for (TypeAdapterDelegate adapter : typeAdapters) { adapter.unregisterDataSetObserver(delegateDataSetObserver); } if (adapter != null) { adapter.unregisterDataSetObserver(dataSetObserver); adapter.notifyDataSetInvalidated(); adapter = null; } if (editText != null) { editText.setAdapter(null); editText = null; } } MultiAutoCompleteImpl(@NonNull Tokenizer tokenizer,
                          @NonNull List<TypeAdapterDelegate> typeAdapters,
                          @Nullable Delayer delayer); @Override void onViewAttached(@NonNull MultiAutoCompleteEditText view); @Override void onViewDetached(); @Override void beforeTextChanged(CharSequence s, int start, int count, int after); @Override void onTextChanged(CharSequence s, int start, int before, int count); @Override @CallSuper void afterTextChanged(Editable s); @Override boolean onSelectionChanged(int selStart, int selEnd); }
MultiAutoCompleteImpl implements MultiAutoComplete, TextWatcher, MultiAutoCompleteEditText.OnSelectionChangedListener { @Override public void onViewDetached() { for (TypeAdapterDelegate adapter : typeAdapters) { adapter.unregisterDataSetObserver(delegateDataSetObserver); } if (adapter != null) { adapter.unregisterDataSetObserver(dataSetObserver); adapter.notifyDataSetInvalidated(); adapter = null; } if (editText != null) { editText.setAdapter(null); editText = null; } } MultiAutoCompleteImpl(@NonNull Tokenizer tokenizer,
                          @NonNull List<TypeAdapterDelegate> typeAdapters,
                          @Nullable Delayer delayer); @Override void onViewAttached(@NonNull MultiAutoCompleteEditText view); @Override void onViewDetached(); @Override void beforeTextChanged(CharSequence s, int start, int count, int after); @Override void onTextChanged(CharSequence s, int start, int before, int count); @Override @CallSuper void afterTextChanged(Editable s); @Override boolean onSelectionChanged(int selStart, int selEnd);  }