本文整理汇总了Java中android.support.v4.view.NestedScrollingParentHelper类的典型用法代码示例。如果您正苦于以下问题:Java NestedScrollingParentHelper类的具体用法?Java NestedScrollingParentHelper怎么用?Java NestedScrollingParentHelper使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
NestedScrollingParentHelper类属于android.support.v4.view包,在下文中一共展示了NestedScrollingParentHelper类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initAttrs
import android.support.v4.view.NestedScrollingParentHelper; //导入依赖的package包/类
private void initAttrs(Context context, AttributeSet attrs) {
if (getChildCount() > 1) {
throw new RuntimeException("WXSwipeLayout should not have more than one child");
}
parentHelper = new NestedScrollingParentHelper(this);
if (isInEditMode() && attrs == null) {
return;
}
mRefreshViewBgColor = Color.TRANSPARENT;
mProgressBgColor = Color.TRANSPARENT;
mProgressColor = Color.RED;
}
示例2: NestedScrollView
import android.support.v4.view.NestedScrollingParentHelper; //导入依赖的package包/类
public NestedScrollView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
this.mTempRect = new Rect();
this.mIsLayoutDirty = true;
this.mIsLaidOut = false;
this.mChildToScrollTo = null;
this.mIsBeingDragged = false;
this.mSmoothScrollingEnabled = true;
this.mActivePointerId = -1;
this.mScrollOffset = new int[2];
this.mScrollConsumed = new int[2];
initScrollView();
TypedArray a = context.obtainStyledAttributes(attrs, SCROLLVIEW_STYLEABLE, defStyleAttr, 0);
setFillViewport(a.getBoolean(0, false));
a.recycle();
this.mParentHelper = new NestedScrollingParentHelper(this);
this.mChildHelper = new NestedScrollingChildHelper(this);
setNestedScrollingEnabled(true);
ViewCompat.setAccessibilityDelegate(this, ACCESSIBILITY_DELEGATE);
}
示例3: PullToRefreshView
import android.support.v4.view.NestedScrollingParentHelper; //导入依赖的package包/类
public PullToRefreshView(Context context, AttributeSet attrs) {
super(context, attrs);
TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.RefreshView);
final int type = a.getInteger(R.styleable.RefreshView_type, STYLE_SUN);
a.recycle();
mDecelerateInterpolator = new DecelerateInterpolator(DECELERATE_INTERPOLATION_FACTOR);
mTouchSlop = ViewConfiguration.get(context).getScaledTouchSlop();
mTotalDragDistance = Utils.convertDpToPixel(context, DRAG_MAX_DISTANCE);
mRefreshView = new ImageView(context);
setRefreshStyle(type);
addView(mRefreshView);
setWillNotDraw(false);
ViewCompat.setChildrenDrawingOrderEnabled(this, true);
mNestedScrollingParentHelper = new NestedScrollingParentHelper(this);
mNestedScrollingChildHelper = new NestedScrollingChildHelper(this);
setNestedScrollingEnabled(true);
}
示例4: init
import android.support.v4.view.NestedScrollingParentHelper; //导入依赖的package包/类
private void init() {
mPullHandler = new ProxyPullHeader(HEADER_FACTORY.made(getContext()));
mIsPinContent = HEADER_FACTORY.isPinContent();
if (mIsPinContent) {
scrollerHelper = new PinContentScroller();
} else {
scrollerHelper = new AllScroller();
}
setWillNotDraw(false);
addHeadView();
final ViewConfiguration configuration = ViewConfiguration.get(getContext());
mTouchSlop = configuration.getScaledTouchSlop();
mNestedScrollingParentHelper = new NestedScrollingParentHelper(this);
mNestedScrollingChildHelper = new NestedScrollingChildHelper(this);
setNestedScrollingEnabled(true);
}
示例5: StickyNavigationLayout
import android.support.v4.view.NestedScrollingParentHelper; //导入依赖的package包/类
public StickyNavigationLayout(Context context, AttributeSet attrs) {
super(context, attrs);
//setOrientation(LinearLayout.VERTICAL);
mGroupStickyDelegate = new GroupStickyDelegate();
mNestedScrollingParentHelper = new NestedScrollingParentHelper(this);
mNestedScrollingChildHelper = new NestedScrollingChildHelper(this);
mScroller = new OverScroller(context);
mTouchSlop = ViewConfiguration.get(context).getScaledTouchSlop();//触摸阙值
mMaximumVelocity = ViewConfiguration.get(context).getScaledMaximumFlingVelocity();
mMinimumVelocity = ViewConfiguration.get(context).getScaledMinimumFlingVelocity();
final TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.StickyNavigationLayout);
// mCodeSet will set stick view from onFinishInflate.
mTopViewId = a.getResourceId(R.styleable.StickyNavigationLayout_stickyLayout_top_id, 0);
mIndicatorId = a.getResourceId(R.styleable.StickyNavigationLayout_stickyLayout_indicator_id, 0);
mContentId = a.getResourceId(R.styleable.StickyNavigationLayout_stickyLayout_content_id, 0);
mAutoFitScroll = a.getBoolean(R.styleable.StickyNavigationLayout_stickyLayout_auto_fit_scroll, false);
a.recycle();
//getWindowVisibleDisplayFrame(mExpectTopRect);
}
开发者ID:LightSun,项目名称:Android-sticky-navigation-layout,代码行数:25,代码来源:StickyNavigationLayout_medlinker.java
示例6: StickyNavigationLayout_backup
import android.support.v4.view.NestedScrollingParentHelper; //导入依赖的package包/类
public StickyNavigationLayout_backup(Context context, AttributeSet attrs) {
super(context, attrs);
//setOrientation(LinearLayout.VERTICAL);
mGroupStickyDelegate = new GroupStickyDelegate();
mNestedScrollingParentHelper = new NestedScrollingParentHelper(this);
mNestedScrollingChildHelper = new NestedScrollingChildHelper(this);
mScroller = new OverScroller(context);
mTouchSlop = ViewConfiguration.get(context).getScaledTouchSlop();//触摸阙值
mMaximumVelocity = ViewConfiguration.get(context).getScaledMaximumFlingVelocity();
mMinimumVelocity = ViewConfiguration.get(context).getScaledMinimumFlingVelocity();
final TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.StickyNavigationLayout);
// mCodeSet will set stick view from onFinishInflate.
if(!mCodeSet) {
mTopViewId = a.getResourceId(R.styleable.StickyNavigationLayout_stickyLayout_top_id, 0);
mIndicatorId = a.getResourceId(R.styleable.StickyNavigationLayout_stickyLayout_indicator_id, 0);
mContentId = a.getResourceId(R.styleable.StickyNavigationLayout_stickyLayout_content_id, 0);
}
mAutoFitScroll = a.getBoolean(R.styleable.StickyNavigationLayout_stickyLayout_auto_fit_scroll, false);
mAutoFitPercent = a.getFloat(R.styleable.StickyNavigationLayout_stickyLayout_threshold_percent, 0.5f);
a.recycle();
//getWindowVisibleDisplayFrame(mExpectTopRect);
}
开发者ID:LightSun,项目名称:Android-sticky-navigation-layout,代码行数:27,代码来源:StickyNavigationLayout_backup.java
示例7: initAttrs
import android.support.v4.view.NestedScrollingParentHelper; //导入依赖的package包/类
private void initAttrs(Context context, AttributeSet attrs) {
if (getChildCount() > 1) {
throw new RuntimeException("WXSwipeLayout should not have more than one child");
}
parentHelper = new NestedScrollingParentHelper(this);
loadingViewHeight = dipToPx(context, REFRESH_VIEW_HEIGHT);
refreshViewFlowHeight = loadingViewHeight * (float)1.5;
if (isInEditMode() && attrs == null) {
return;
}
mRefreshViewBgColor = Color.TRANSPARENT;
mProgressBgColor = Color.TRANSPARENT;
mProgressColor = Color.RED;
}
示例8: NestedScrollView
import android.support.v4.view.NestedScrollingParentHelper; //导入依赖的package包/类
public NestedScrollView(Context paramContext, AttributeSet paramAttributeSet, int paramInt)
{
super(paramContext, paramAttributeSet, paramInt);
setFocusable(true);
setDescendantFocusability(262144);
setWillNotDraw(false);
ViewConfiguration localViewConfiguration = ViewConfiguration.get(getContext());
this.mTouchSlop = localViewConfiguration.getScaledTouchSlop();
this.mMinimumVelocity = localViewConfiguration.getScaledMinimumFlingVelocity();
this.mMaximumVelocity = localViewConfiguration.getScaledMaximumFlingVelocity();
TypedArray localTypedArray = paramContext.obtainStyledAttributes(paramAttributeSet, SCROLLVIEW_STYLEABLE, paramInt, 0);
setFillViewport(localTypedArray.getBoolean(0, false));
localTypedArray.recycle();
this.mParentHelper = new NestedScrollingParentHelper(this);
this.mChildHelper = new NestedScrollingChildHelper(this);
setNestedScrollingEnabled(true);
ViewCompat.setAccessibilityDelegate(this, ACCESSIBILITY_DELEGATE);
}
示例9: SwipeRefreshLayout
import android.support.v4.view.NestedScrollingParentHelper; //导入依赖的package包/类
public SwipeRefreshLayout(Context paramContext, AttributeSet paramAttributeSet)
{
super(paramContext, paramAttributeSet);
this.mTouchSlop = ViewConfiguration.get(paramContext).getScaledTouchSlop();
this.mMediumAnimationDuration = getResources().getInteger(17694721);
setWillNotDraw(false);
this.mDecelerateInterpolator = new DecelerateInterpolator(2.0F);
TypedArray localTypedArray = paramContext.obtainStyledAttributes(paramAttributeSet, LAYOUT_ATTRS);
setEnabled(localTypedArray.getBoolean(0, true));
localTypedArray.recycle();
DisplayMetrics localDisplayMetrics = getResources().getDisplayMetrics();
this.mCircleWidth = ((int)(40.0F * localDisplayMetrics.density));
this.mCircleHeight = ((int)(40.0F * localDisplayMetrics.density));
this.mCircleView = new CircleImageView(getContext());
this.mProgress = new MaterialProgressDrawable(getContext(), this);
this.mProgress.setBackgroundColor(-328966);
this.mCircleView.setImageDrawable(this.mProgress);
this.mCircleView.setVisibility(8);
addView(this.mCircleView);
ViewCompat.setChildrenDrawingOrderEnabled$4d3af60(this);
this.mSpinnerFinalOffset = (64.0F * localDisplayMetrics.density);
this.mTotalDragDistance = this.mSpinnerFinalOffset;
this.mNestedScrollingParentHelper = new NestedScrollingParentHelper(this);
this.mNestedScrollingChildHelper = new NestedScrollingChildHelper(this);
setNestedScrollingEnabled(true);
}
示例10: AbsRefreshLayout
import android.support.v4.view.NestedScrollingParentHelper; //导入依赖的package包/类
/**
*/
@SuppressWarnings("deprecation")
public AbsRefreshLayout(View listView) {
this(listView.getContext());
mNestedScrollingParentHelper = new NestedScrollingParentHelper(this);
mNestedScrollingChildHelper = new NestedScrollingChildHelper(this);
setNestedScrollingEnabled(true);
mTargetView = listView;
ViewGroup group = (ViewGroup) mTargetView.getParent();
if (group != null) {
LayoutParams params = mTargetView.getLayoutParams();
int index = group.indexOfChild(listView);
group.removeView(listView);
group.addView(this, index, params);
}
mTargetView.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT,
LayoutParams.MATCH_PARENT));
super.addView(mTargetView);
}
示例11: init
import android.support.v4.view.NestedScrollingParentHelper; //导入依赖的package包/类
/**
* @param context
* @param attrs
* @param defStyleAttr
*/
private void init(Context context, AttributeSet attrs, int defStyleAttr) {
mNestedScrollingParentHelper = new NestedScrollingParentHelper(this);
mNestedScrollingChildHelper = new NestedScrollingChildHelper(this);
setNestedScrollingEnabled(true);
mScroller = new Scroller(context, new DecelerateInterpolator());
TypedArray a = context.obtainStyledAttributes(attrs,
R.styleable.AbsRefreshLayout, defStyleAttr, 0);
final int N = a.getIndexCount();
int resFooter = R.layout.layout_loadmore;
for (int i = 0; i < N; i++) {
int attr = a.getIndex(i);
if (attr == R.styleable.AbsRefreshLayout_footerNestLayout) {
resFooter = a.getResourceId(attr, resFooter);
break;
}
}
a.recycle();
/**
* Convert values in dp to values in px;
*/
setFooterView(inflate(context, resFooter, null));
}
示例12: ResolverDrawerLayout
import android.support.v4.view.NestedScrollingParentHelper; //导入依赖的package包/类
public ResolverDrawerLayout(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
final TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.ResolverDrawerLayout,
defStyleAttr, 0);
mMaxWidth = a.getDimensionPixelSize(R.styleable.ResolverDrawerLayout_resolverMaxWidth, -1);
mMaxCollapsedHeight = a.getDimensionPixelSize(
R.styleable.ResolverDrawerLayout_maxCollapsedHeight, 0);
mMaxCollapsedHeightSmall = a.getDimensionPixelSize(
R.styleable.ResolverDrawerLayout_maxCollapsedHeightSmall,
mMaxCollapsedHeight);
a.recycle();
mParentHelper = new NestedScrollingParentHelper(this);
mScroller = new OverScroller(context, AnimationUtils.loadInterpolator(context,
android.R.interpolator.decelerate_quint));
mVelocityTracker = VelocityTracker.obtain();
final ViewConfiguration vc = ViewConfiguration.get(context);
mTouchSlop = vc.getScaledTouchSlop();
mMinFlingVelocity = vc.getScaledMinimumFlingVelocity();
}
示例13: NestedScrollView
import android.support.v4.view.NestedScrollingParentHelper; //导入依赖的package包/类
public NestedScrollView(Context context, AttributeSet attributeset, int i)
{
super(context, attributeset, i);
mTempRect = new Rect();
mIsLayoutDirty = true;
mIsLaidOut = false;
mChildToScrollTo = null;
mIsBeingDragged = false;
mSmoothScrollingEnabled = true;
mActivePointerId = -1;
mScrollOffset = new int[2];
mScrollConsumed = new int[2];
initScrollView();
context = context.obtainStyledAttributes(attributeset, SCROLLVIEW_STYLEABLE, i, 0);
setFillViewport(context.getBoolean(0, false));
context.recycle();
mParentHelper = new NestedScrollingParentHelper(this);
mChildHelper = new NestedScrollingChildHelper(this);
setNestedScrollingEnabled(true);
ViewCompat.setAccessibilityDelegate(this, ACCESSIBILITY_DELEGATE);
}
示例14: ISwipeRefreshLayout
import android.support.v4.view.NestedScrollingParentHelper; //导入依赖的package包/类
/**
* Constructor that is called when inflating ISwipeRefreshLayout from XML.
*
* @param context
* @param attrs
*/
public ISwipeRefreshLayout(Context context, AttributeSet attrs) {
super(context, attrs);
mTouchSlop = ViewConfiguration.get(context).getScaledTouchSlop();
mMediumAnimationDuration = getResources().getInteger(
android.R.integer.config_mediumAnimTime);
setWillNotDraw(false);
mDecelerateInterpolator = new DecelerateInterpolator(DECELERATE_INTERPOLATION_FACTOR);
final DisplayMetrics metrics = getResources().getDisplayMetrics();
mRefreshViewHeight = (int) (DEFAULT_HEADER_HEIGHT * metrics.density);
HEADER_VIEW_MIN_HEIGHT = mRefreshViewHeight;
ViewCompat.setChildrenDrawingOrderEnabled(this, true);
mTotalDragDistance = (int) (DEFAULT_HEADER_TARGET * metrics.density);
mNestedScrollingParentHelper = new NestedScrollingParentHelper(this);
mNestedScrollingChildHelper = new NestedScrollingChildHelper(this);
setNestedScrollingEnabled(true);
final TypedArray a = context.obtainStyledAttributes(attrs, LAYOUT_ATTRS);
setEnabled(a.getBoolean(0, true));
a.recycle();
//add default refreshview
setRefreshHeaderView(new ClassicIRefreshHeaderView(getContext()));
}
示例15: CoordinatorLayout
import android.support.v4.view.NestedScrollingParentHelper; //导入依赖的package包/类
public CoordinatorLayout(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
this.mLayoutDependencyComparator = new Comparator<View>() {
public int compare(View lhs, View rhs) {
if (lhs == rhs) {
return 0;
}
if (((LayoutParams) lhs.getLayoutParams()).dependsOn(CoordinatorLayout.this, lhs, rhs)) {
return 1;
}
return ((LayoutParams) rhs.getLayoutParams()).dependsOn(CoordinatorLayout.this, rhs, lhs) ? -1 : 0;
}
};
this.mDependencySortedChildren = new ArrayList();
this.mTempList1 = new ArrayList();
this.mTempDependenciesList = new ArrayList();
this.mTempRect1 = new Rect();
this.mTempRect2 = new Rect();
this.mTempRect3 = new Rect();
this.mTempIntPair = new int[2];
this.mNestedScrollingParentHelper = new NestedScrollingParentHelper(this);
ThemeUtils.checkAppCompatTheme(context);
TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.CoordinatorLayout, defStyleAttr, R.style.Widget_Design_CoordinatorLayout);
int keylineArrayRes = a.getResourceId(R.styleable.CoordinatorLayout_keylines, 0);
if (keylineArrayRes != 0) {
Resources res = context.getResources();
this.mKeylines = res.getIntArray(keylineArrayRes);
float density = res.getDisplayMetrics().density;
int count = this.mKeylines.length;
for (int i = 0; i < count; i++) {
int[] iArr = this.mKeylines;
iArr[i] = (int) (((float) iArr[i]) * density);
}
}
this.mStatusBarBackground = a.getDrawable(R.styleable.CoordinatorLayout_statusBarBackground);
a.recycle();
if (INSETS_HELPER != null) {
INSETS_HELPER.setupForWindowInsets(this, new ApplyInsetsListener());
}
super.setOnHierarchyChangeListener(new HierarchyChangeListener());
}