Java Code Examples for android.view.View.OnAttachStateChangeListener

The following are Jave code examples for showing how to use OnAttachStateChangeListener of the android.view.View class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: kolibri-android   File: Kolibri.java   Source Code and License Vote up 6 votes
@UiThread
public static void bind(View view, KolibriProvider provider) {
  final KolibriCoordinator coordinator = provider.provideCoordinator(view);
  if (coordinator == null) {
    return;
  }

  View.OnAttachStateChangeListener binding = new Binding(view, coordinator);
  view.addOnAttachStateChangeListener(binding);
  // Sometimes we missed the first attach because the child's already been added.
  // Sometimes we didn't. The binding keeps track to avoid double attachment of the Coordinator,
  // and to guard against attachment to two different views simultaneously.
  binding.onViewAttachedToWindow(view);
}
 
Example 2
Project: FrescoLoader   File: ViewCompat.java   Source Code and License Vote up 5 votes
CompatAttachStateChangeListener(View view, View.OnAttachStateChangeListener listener) {
    mView = view;
    mListener = listener;
    myAttached = isAttachedToWindow(mView);
    yourAttached = false;
    if (myAttached) mView.getViewTreeObserver().addOnPreDrawListener(this);
    mView.addOnAttachStateChangeListener(this);
    update();
}
 
Example 3
Project: FrescoLoader   File: ViewCompat.java   Source Code and License Vote up 4 votes
public static void addOnAttachStateChangeListener(View view, View.OnAttachStateChangeListener listener) {
    CompatAttachStateChangeListener.addOnAttachStateChangeListener(view, listener);
}
 
Example 4
Project: FrescoLoader   File: ViewCompat.java   Source Code and License Vote up 4 votes
private static void addOnAttachStateChangeListener(View view, View.OnAttachStateChangeListener listener) {
    new CompatAttachStateChangeListener(view, listener);
}
 
Example 5
Project: RxLifeCycle   File: TestUtil.java   Source Code and License Vote up 2 votes
/**
 * Manually retrieve the view's attach state change listeners of an event. Robolectric
 * doesn't currently support manually firing these, and it would seem the events are not called
 * in normal Robolectric usage either.
 *
 * @param view View with listeners to notify
 */
static CopyOnWriteArrayList<View.OnAttachStateChangeListener> getAttachStateChangeListeners(View view) {
    Object listenerInfo = ReflectionHelpers.callInstanceMethod(view, "getListenerInfo");
    return ReflectionHelpers.getField(listenerInfo, "mOnAttachStateChangeListeners");
}
 
Example 6
Project: leoapp-sources   File: InfoButton.java   Source Code and License Vote up 2 votes
/**
 * Delegiert von android.widget.Button
 *
 * @param listener siehe {@link Button}
 */
public void addOnAttachStateChangeListener(View.OnAttachStateChangeListener listener) {
    b.addOnAttachStateChangeListener(listener);
}
 
Example 7
Project: leoapp-sources   File: InfoButton.java   Source Code and License Vote up 2 votes
/**
 * Delegiert von android.widget.Button
 *
 * @param listener siehe {@link Button}
 */
public void removeOnAttachStateChangeListener(View.OnAttachStateChangeListener listener) {
    b.removeOnAttachStateChangeListener(listener);
}