androidannotation的OnViewChangedNotifier
阿神
阿神 2017-04-18 09:15:16
0
1
491

androidannotation中的OnViewChangedNotifier有什么作用?

阿神
阿神

闭关修行中......

reply all(1)
刘奇

Look directly at the code OnViewChangedNotifier

public class OnViewChangedNotifier {

    private static OnViewChangedNotifier currentNotifier;

    public static OnViewChangedNotifier replaceNotifier(OnViewChangedNotifier notifier) {
        OnViewChangedNotifier previousNotifier = currentNotifier;
        currentNotifier = notifier;
        return previousNotifier;
    }

    public static void registerOnViewChangedListener(OnViewChangedListener listener) {
        if (currentNotifier != null) {
            currentNotifier.listeners.add(listener);
        }
    }

    private final Set<OnViewChangedListener> listeners = new LinkedHashSet<>();

    public void notifyViewChanged(HasViews hasViews) {
        for (OnViewChangedListener listener : listeners) {
            listener.onViewChanged(hasViews);
        }
    }

}

You can clearly see that it is a helper class used to call onViewChanged to notify OnViewChangedListener that a View state has changed.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template