Java Code Examples for android.support.design.widget.AppBarLayout#OnOffsetChangedListener

The following examples show how to use android.support.design.widget.AppBarLayout#OnOffsetChangedListener . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BaseBehavior.java    From CollapsingRefresh with Apache License 2.0 5 votes vote down vote up
protected void dispatchOffsetChanged(AppBarLayout layout, int translationOffset) {
	if (layout instanceof SmoothAppBarLayout) {
		List listeners = ((SmoothAppBarLayout) layout).mOffsetChangedListeners;
		int i = 0;
		for (int z = listeners.size(); i < z; ++i) {
			WeakReference ref = (WeakReference) listeners.get(i);
			AppBarLayout.OnOffsetChangedListener listener = ref != null ? (AppBarLayout.OnOffsetChangedListener) ref.get() : null;
			if (listener != null) {
				listener.onOffsetChanged(layout, translationOffset);
			}
		}
	}
}
 
Example 2
Source File: BaseBehavior.java    From Expert-Android-Programming with MIT License 5 votes vote down vote up
protected void dispatchOffsetUpdates(AppBarLayout layout, int translationOffset) {
  if (layout instanceof SmoothAppBarLayout) {
    List listeners = ((SmoothAppBarLayout) layout).mOffsetChangedListeners;
    int i = 0;
    for (int z = listeners.size(); i < z; ++i) {
      WeakReference ref = (WeakReference) listeners.get(i);
      AppBarLayout.OnOffsetChangedListener listener = ref != null ? (AppBarLayout.OnOffsetChangedListener) ref.get() : null;
      if (listener != null) {
        listener.onOffsetChanged(layout, translationOffset);
      }
    }
  }
}
 
Example 3
Source File: SmoothCollapsingToolbarLayout.java    From Expert-Android-Programming with MIT License 5 votes vote down vote up
@Override
protected void onAttachedToWindow() {
  super.onAttachedToWindow();
  initViews();
  if (!isInEditMode()) {
    mOnAppBarLayoutOffsetChangedListener = new AppBarLayout.OnOffsetChangedListener() {

      @Override
      public void onOffsetChanged(AppBarLayout appBarLayout, int i) {
        SmoothCollapsingToolbarLayout.this.onOffsetChanged(appBarLayout, i);
      }
    };
    getAppBarLayout().addOnOffsetChangedListener(mOnAppBarLayoutOffsetChangedListener);
  }
}
 
Example 4
Source File: BaseBehavior.java    From smooth-app-bar-layout with Apache License 2.0 5 votes vote down vote up
protected void dispatchOffsetUpdates(AppBarLayout layout, int translationOffset) {
  if (layout instanceof SmoothAppBarLayout) {
    List listeners = ((SmoothAppBarLayout) layout).mOffsetChangedListeners;
    int i = 0;
    for (int z = listeners.size(); i < z; ++i) {
      WeakReference ref = (WeakReference) listeners.get(i);
      AppBarLayout.OnOffsetChangedListener listener = ref != null ? (AppBarLayout.OnOffsetChangedListener) ref.get() : null;
      if (listener != null) {
        listener.onOffsetChanged(layout, translationOffset);
      }
    }
  }
}
 
Example 5
Source File: SmoothCollapsingToolbarLayout.java    From smooth-app-bar-layout with Apache License 2.0 5 votes vote down vote up
@Override
protected void onAttachedToWindow() {
  super.onAttachedToWindow();
  initViews();
  if (!isInEditMode()) {
    mOnAppBarLayoutOffsetChangedListener = new AppBarLayout.OnOffsetChangedListener() {

      @Override
      public void onOffsetChanged(AppBarLayout appBarLayout, int i) {
        SmoothCollapsingToolbarLayout.this.onOffsetChanged(appBarLayout, i);
      }
    };
    getAppBarLayout().addOnOffsetChangedListener(mOnAppBarLayoutOffsetChangedListener);
  }
}
 
Example 6
Source File: LibraryFragment.java    From Orin with GNU General Public License v3.0 4 votes vote down vote up
public void addOnAppBarOffsetChangedListener(AppBarLayout.OnOffsetChangedListener onOffsetChangedListener) {
    appbar.addOnOffsetChangedListener(onOffsetChangedListener);
}
 
Example 7
Source File: LibraryFragment.java    From Orin with GNU General Public License v3.0 4 votes vote down vote up
public void removeOnAppBarOffsetChangedListener(AppBarLayout.OnOffsetChangedListener onOffsetChangedListener) {
    appbar.removeOnOffsetChangedListener(onOffsetChangedListener);
}
 
Example 8
Source File: LibraryFragment.java    From RetroMusicPlayer with GNU General Public License v3.0 4 votes vote down vote up
public void addOnAppBarOffsetChangedListener(AppBarLayout.OnOffsetChangedListener onOffsetChangedListener) {
    mAppbar.addOnOffsetChangedListener(onOffsetChangedListener);
}
 
Example 9
Source File: LibraryFragment.java    From RetroMusicPlayer with GNU General Public License v3.0 4 votes vote down vote up
public void removeOnAppBarOffsetChangedListener(AppBarLayout.OnOffsetChangedListener onOffsetChangedListener) {
    mAppbar.removeOnOffsetChangedListener(onOffsetChangedListener);
}
 
Example 10
Source File: OnSmoothScrollListener.java    From CollapsingRefresh with Apache License 2.0 votes vote down vote up
void addOnOffsetChangedListener(AppBarLayout.OnOffsetChangedListener listener); 
Example 11
Source File: OnSmoothScrollListener.java    From CollapsingRefresh with Apache License 2.0 votes vote down vote up
void removeOnOffsetChangedListener(AppBarLayout.OnOffsetChangedListener listener);