android.support.v4.view.ViewCompat#setNestedScrollingEnabled ( )源码实例Demo

下面列出了android.support.v4.view.ViewCompat#setNestedScrollingEnabled ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: EasyAbout   文件: AboutListItemView.java
private void init(Context context, String title, int titleColor) {
    inflate(getContext(), R.layout.ea_card_list, this);
    aboutItemList = new ArrayList<>();
    easyAboutAdapter = new EasyAboutAdapter(context, aboutItemList);
    RecyclerView recyclerView = findViewById(R.id.recycler_view);
    recyclerView.setNestedScrollingEnabled(false);
    ViewCompat.setNestedScrollingEnabled(recyclerView, false);
    recyclerView.setLayoutManager(new LinearLayoutManager(context));
    recyclerView.setItemAnimator(new DefaultItemAnimator());
    recyclerView.setAdapter(easyAboutAdapter);
    TextView titleTv = findViewById(R.id.card_title);
    if (titleColor==0)
        titleColor = ColorUtils.getThemeAccentColor(context);
    titleTv.setTextColor(titleColor);
    if (title==null)
        titleTv.setVisibility(GONE);
    else titleTv.setText(title);

    int cardColor = ColorUtils.getThemeAttrColor(context, "aboutCardBackground");
    if (cardColor!= 0)
        ((CardView) findViewById(R.id.card_view)).setCardBackgroundColor(cardColor);
}
 
源代码2 项目: FireFiles   文件: DocumentsActivity.java
public void upadateActionItems(AbsListView currentView) {

        mActionMenu.attachToListView(currentView);

        int defaultColor = SettingsActivity.getPrimaryColor(this);
        ViewCompat.setNestedScrollingEnabled(currentView, true);
        mActionMenu.show();
        mActionMenu.setVisibility(!isTelevision() && showActionMenu() ? View.VISIBLE : View.GONE);
        mActionMenu.setBackgroundTintList(SettingsActivity.getAccentColor());
        mActionMenu.setSecondaryBackgroundTintList(Utils.getActionButtonColor(defaultColor));
    }
 
源代码3 项目: FireFiles   文件: DocumentsActivity.java
public void upadateActionItems(AbsListView currentView) {

        mActionMenu.attachToListView(currentView);

        int defaultColor = SettingsActivity.getPrimaryColor(this);
        ViewCompat.setNestedScrollingEnabled(currentView, true);
        mActionMenu.show();
        mActionMenu.setVisibility(!isTelevision() && showActionMenu() ? View.VISIBLE : View.GONE);
        mActionMenu.setBackgroundTintList(SettingsActivity.getAccentColor());
        mActionMenu.setSecondaryBackgroundTintList(Utils.getActionButtonColor(defaultColor));
    }
 
源代码4 项目: FireFiles   文件: DocumentsActivity.java
public void upadateActionItems(AbsListView currentView) {

        mActionMenu.attachToListView(currentView);

        int defaultColor = SettingsActivity.getPrimaryColor(this);
        ViewCompat.setNestedScrollingEnabled(currentView, true);
        mActionMenu.show();
        mActionMenu.setVisibility(!isTelevision() && showActionMenu() ? View.VISIBLE : View.GONE);
        mActionMenu.setBackgroundTintList(SettingsActivity.getAccentColor());
        mActionMenu.setSecondaryBackgroundTintList(Utils.getActionButtonColor(defaultColor));
    }
 
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.setTheme(Preferences.get(this).isDarkTheme() ?
            R.style.MuzeiThemeDark : R.style.MuzeiTheme);
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_muzei);
    ButterKnife.bind(this);
    mMuzeiService = onInit();

    ViewCompat.setNestedScrollingEnabled(mScrollView, false);
    WindowHelper.disableTranslucentNavigationBar(this);

    ColorHelper.setNavigationBarColor(this, ColorHelper.getDarkerColor(
            ColorHelper.getAttributeColor(this, R.attr.colorAccent), 0.8f));
    ColorHelper.setStatusBarColor(this, ColorHelper.getAttributeColor(
            this, R.attr.colorPrimaryDark));
    ColorHelper.setupStatusBarIconColor(this);

    int color = ColorHelper.getAttributeColor(this, R.attr.toolbar_icon);
    Toolbar toolbar = findViewById(R.id.toolbar);
    toolbar.setTitle("");
    toolbar.setNavigationIcon(DrawableHelper.getTintedDrawable(
            this, R.drawable.ic_toolbar_muzei, color));
    setSupportActionBar(toolbar);

    mIsMinute = Preferences.get(this).isRotateMinute();
    mRotateTime = TimeHelper.milliToMinute(
            Preferences.get(this).getRotateTime());
    if (!mIsMinute) mRotateTime = mRotateTime / 60;

    initRefreshDuration();
    initSettings();

    mWifiOnly.setOnClickListener(this);
    mSelectCategories.setOnClickListener(this);
    mRefreshDuration.setOnClickListener(this);
    mSave.setOnClickListener(this);

    mWifiOnlyCheck.setChecked(Preferences.get(this).isWifiOnly());
}
 
源代码6 项目: candybar-library   文件: WallpapersFragment.java
@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    ViewCompat.setNestedScrollingEnabled(mRecyclerView, false);

    initPopupBubble();
    mProgress.getIndeterminateDrawable().setColorFilter(
            ColorHelper.getAttributeColor(getActivity(), R.attr.colorAccent),
            PorterDuff.Mode.SRC_IN);
    mSwipe.setColorSchemeColors(
            ContextCompat.getColor(getActivity(), R.color.swipeRefresh));

    mRecyclerView.setItemAnimator(new DefaultItemAnimator());
    mRecyclerView.setHasFixedSize(false);
    mRecyclerView.setLayoutManager(new GridLayoutManager(getActivity(),
            getActivity().getResources().getInteger(R.integer.wallpapers_column_count)));

    if (CandyBarApplication.getConfiguration().getWallpapersGrid() == CandyBarApplication.GridStyle.FLAT) {
        int padding = getActivity().getResources().getDimensionPixelSize(R.dimen.card_margin);
        mRecyclerView.setPadding(padding, padding, 0, 0);
    }

    setFastScrollColor(mFastScroll);
    mFastScroll.attachRecyclerView(mRecyclerView);

    mSwipe.setOnRefreshListener(() -> {
        if (mProgress.getVisibility() == View.GONE)
            mAsyncTask = new WallpapersLoader(true).execute();
        else mSwipe.setRefreshing(false);
    });

    mAsyncTask = new WallpapersLoader(false).execute();
}
 
源代码7 项目: octoandroid   文件: ConsoleFragment.java
private List<String> restoreInstance(Bundle savedInstanceState, View rootView) {
    mIsAutoScrollEnabled = savedInstanceState.getBoolean(AUTO_SCROLL_KEY);
    boolean lock = savedInstanceState.getBoolean(LOCK_KEY);
    ViewCompat.setNestedScrollingEnabled(rootView, lock);
    List<String> logList = savedInstanceState.getStringArrayList(LOG_LIST_KEY);
    if (logList == null) return new ArrayList<>();
    else return logList;
}
 
源代码8 项目: CollapsingRefresh   文件: SmartRefreshLayout.java
private void initView(Context context, AttributeSet attrs) {
	setClipToPadding(false);

	mScreenHeightPixels = context.getResources().getDisplayMetrics().heightPixels;
	mReboundInterpolator = new ViscousFluidInterpolator();
	mTouchSlop = ViewConfiguration.get(getContext()).getScaledTouchSlop();

	mNestedScrollingParentHelper = new NestedScrollingParentHelper(this);
	mNestedScrollingChildHelper = new NestedScrollingChildHelper(this);

	DensityUtil density = new DensityUtil();
	TypedArray ta = context.obtainStyledAttributes(attrs, R.styleable.SmartRefreshLayout);

	ViewCompat.setNestedScrollingEnabled(this, ta.getBoolean(R.styleable.SmartRefreshLayout_srlEnableNestedScrolling, false));
	mDragRate = ta.getFloat(R.styleable.SmartRefreshLayout_srlDragRate, mDragRate);
	mHeaderMaxDragRate = ta.getFloat(R.styleable.SmartRefreshLayout_srlHeaderMaxDragRate, mHeaderMaxDragRate);
	mFooterMaxDragRate = ta.getFloat(R.styleable.SmartRefreshLayout_srlFooterMaxDragRate, mFooterMaxDragRate);
	mEnableRefresh = ta.getBoolean(R.styleable.SmartRefreshLayout_srlEnableRefresh, mEnableRefresh);
	mReboundDuration = ta.getInt(R.styleable.SmartRefreshLayout_srlReboundDuration, mReboundDuration);
	mEnableLoadmore = ta.getBoolean(R.styleable.SmartRefreshLayout_srlEnableLoadmore, mEnableLoadmore);
	mHeaderHeight = ta.getDimensionPixelOffset(R.styleable.SmartRefreshLayout_srlHeaderHeight, density.dip2px(100));
	mFooterHeight = ta.getDimensionPixelOffset(R.styleable.SmartRefreshLayout_srlFooterHeight, density.dip2px(60));
	mDisableContentWhenRefresh = ta.getBoolean(R.styleable.SmartRefreshLayout_srlDisableContentWhenRefresh, mDisableContentWhenRefresh);
	mDisableContentWhenLoading = ta.getBoolean(R.styleable.SmartRefreshLayout_srlDisableContentWhenLoading, mDisableContentWhenLoading);
	mEnableHeaderTranslationContent = ta.getBoolean(R.styleable.SmartRefreshLayout_srlEnableHeaderTranslationContent, mEnableHeaderTranslationContent);
	mEnableFooterTranslationContent = ta.getBoolean(R.styleable.SmartRefreshLayout_srlEnableFooterTranslationContent, mEnableFooterTranslationContent);
	mEnablePreviewInEditMode = ta.getBoolean(R.styleable.SmartRefreshLayout_srlEnablePreviewInEditMode, mEnablePreviewInEditMode);
	mEnableAutoLoadmore = ta.getBoolean(R.styleable.SmartRefreshLayout_srlEnableAutoLoadmore, mEnableAutoLoadmore);
	mEnableOverScrollBounce = ta.getBoolean(R.styleable.SmartRefreshLayout_srlEnableAutoLoadmore, mEnableOverScrollBounce);
	mEnablePureScrollMode = ta.getBoolean(R.styleable.SmartRefreshLayout_srlEnablePureScrollMode, mEnablePureScrollMode);
	mEnableScrollContentWhenLoaded = ta.getBoolean(R.styleable.SmartRefreshLayout_srlEnableScrollContentWhenLoaded, mEnableScrollContentWhenLoaded);
	mFixedHeaderViewId = ta.getResourceId(R.styleable.SmartRefreshLayout_srlFixedHeaderViewId, View.NO_ID);
	mFixedFooterViewId = ta.getResourceId(R.styleable.SmartRefreshLayout_srlFixedFooterViewId, View.NO_ID);

	mManualLoadmore = ta.hasValue(R.styleable.SmartRefreshLayout_srlEnableLoadmore);
	mManualNestedScrolling = ta.hasValue(R.styleable.SmartRefreshLayout_srlEnableNestedScrolling);
	mHeaderHeightStatus = ta.hasValue(R.styleable.SmartRefreshLayout_srlHeaderHeight) ? DimensionStatus.XmlLayoutUnNotify : mHeaderHeightStatus;
	mFooterHeightStatus = ta.hasValue(R.styleable.SmartRefreshLayout_srlFooterHeight) ? DimensionStatus.XmlLayoutUnNotify : mFooterHeightStatus;

	mFooterExtendHeight = (int) Math.max((mFooterHeight * (mHeaderMaxDragRate - 1)), 0);
	mHeaderExtendHeight = (int) Math.max((mHeaderHeight * (mHeaderMaxDragRate - 1)), 0);

	int accentColor = ta.getColor(R.styleable.SmartRefreshLayout_srlAccentColor, 0);
	int primaryColor = ta.getColor(R.styleable.SmartRefreshLayout_srlPrimaryColor, 0);
	if (primaryColor != 0) {
		if (accentColor != 0) {
			mPrimaryColors = new int[]{primaryColor, accentColor};
		} else {
			mPrimaryColors = new int[]{primaryColor};
		}
	}

	ta.recycle();

}
 
@ReactProp(name = "nestedScrollEnabled")
public void setNestedScrollEnabled(ReactHorizontalScrollView view, boolean value) {
  ViewCompat.setNestedScrollingEnabled(view, value);
}
 
源代码10 项目: react-native-GPay   文件: ReactScrollViewManager.java
@ReactProp(name = "nestedScrollEnabled")
public void setNestedScrollEnabled(ReactScrollView view, boolean value) {
  ViewCompat.setNestedScrollingEnabled(view, value);
}
 
源代码11 项目: octoandroid   文件: TempGraphFragment.java
private void toggleLock() {
    mListener.setSwipeEnabled(!mListener.isSwipeEnabled());
    if (getView() == null) return;
    boolean isNestedScrollingEnabled = ViewCompat.isNestedScrollingEnabled(getView());
    ViewCompat.setNestedScrollingEnabled(getView(), !isNestedScrollingEnabled);
}
 
源代码12 项目: octoandroid   文件: ConsoleFragment.java
private void toggleLock() {
    if (getView() == null) return;
    boolean isEnabled = ViewCompat.isNestedScrollingEnabled(getView());
    ViewCompat.setNestedScrollingEnabled(getView(), !isEnabled);
}
 
源代码13 项目: googlecalendar   文件: MainActivity.java
private void setExpandAndCollapseEnabled(boolean enabled) {

        if (mNestedView.isNestedScrollingEnabled() != enabled) {
            ViewCompat.setNestedScrollingEnabled(mNestedView,enabled);

        }
    }
 
 同类方法