Created
May 17, 2018 07:46
-
-
Save feinstein/8d2e0b87090d17a4135c365001a55106 to your computer and use it in GitHub Desktop.
Attempt to implement Nested Scrollable PdfViewer
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package br.com.feinstein.sidur.views; | |
import android.content.Context; | |
import android.support.annotation.Nullable; | |
import android.support.v4.view.NestedScrollingChild2; | |
import android.support.v4.view.NestedScrollingChildHelper; | |
import android.util.AttributeSet; | |
import com.github.barteksc.pdfviewer.PDFView; | |
public class NestedScrollablePdfViewer extends PDFView implements NestedScrollingChild2 { | |
private final NestedScrollingChildHelper nestedScrollingChildHelper; | |
/** | |
* Construct the initial view | |
* | |
* @param context | |
* @param set | |
*/ | |
public NestedScrollablePdfViewer(Context context, AttributeSet set) { | |
super(context, set); | |
nestedScrollingChildHelper = new NestedScrollingChildHelper(this); | |
} | |
@Override | |
public boolean startNestedScroll(int axes, int type) { | |
return nestedScrollingChildHelper.startNestedScroll(axes, type); | |
} | |
@Override | |
public void stopNestedScroll(int type) { | |
nestedScrollingChildHelper.stopNestedScroll(type); | |
} | |
@Override | |
public boolean hasNestedScrollingParent(int type) { | |
return nestedScrollingChildHelper.hasNestedScrollingParent(type); | |
} | |
@Override | |
public boolean dispatchNestedScroll(int dxConsumed, int dyConsumed, int dxUnconsumed, int dyUnconsumed, @Nullable int[] offsetInWindow, int type) { | |
return nestedScrollingChildHelper.dispatchNestedScroll(dxConsumed, dyConsumed, dxUnconsumed, dyUnconsumed, offsetInWindow, type); | |
} | |
@Override | |
public boolean dispatchNestedPreScroll(int dx, int dy, @Nullable int[] consumed, @Nullable int[] offsetInWindow, int type) { | |
return nestedScrollingChildHelper.dispatchNestedPreScroll(dx, dy, consumed, offsetInWindow, type); | |
} | |
@Override | |
public void setNestedScrollingEnabled(boolean enabled) { | |
nestedScrollingChildHelper.setNestedScrollingEnabled(enabled); | |
} | |
@Override | |
public boolean isNestedScrollingEnabled() { | |
return nestedScrollingChildHelper.isNestedScrollingEnabled(); | |
} | |
@Override | |
public boolean startNestedScroll(int axes) { | |
return nestedScrollingChildHelper.startNestedScroll(axes); | |
} | |
@Override | |
public void stopNestedScroll() { | |
nestedScrollingChildHelper.stopNestedScroll(); | |
} | |
@Override | |
public boolean hasNestedScrollingParent() { | |
return nestedScrollingChildHelper.hasNestedScrollingParent(); | |
} | |
@Override | |
public boolean dispatchNestedScroll(int dxConsumed, int dyConsumed, int dxUnconsumed, int dyUnconsumed, @Nullable int[] offsetInWindow) { | |
return nestedScrollingChildHelper.dispatchNestedScroll(dxConsumed, dyConsumed, dxUnconsumed, dyUnconsumed, offsetInWindow); | |
} | |
@Override | |
public boolean dispatchNestedPreScroll(int dx, int dy, @Nullable int[] consumed, @Nullable int[] offsetInWindow) { | |
return nestedScrollingChildHelper.dispatchNestedPreScroll(dx, dy, consumed, offsetInWindow); | |
} | |
@Override | |
public boolean dispatchNestedFling(float velocityX, float velocityY, boolean consumed) { | |
return nestedScrollingChildHelper.dispatchNestedFling(velocityX, velocityY, consumed); | |
} | |
@Override | |
public boolean dispatchNestedPreFling(float velocityX, float velocityY) { | |
return nestedScrollingChildHelper.dispatchNestedPreFling(velocityX, velocityY); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment