Java Code Examples for android.support.v4.view.ViewCompat#setNestedScrollingEnabled()

The following examples show how to use android.support.v4.view.ViewCompat#setNestedScrollingEnabled() . 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: AboutListItemView.java    From EasyAbout with MIT License 6 votes vote down vote up
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);
}
 
Example 2
Source File: DocumentsActivity.java    From FireFiles with Apache License 2.0 5 votes vote down vote up
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));
    }
 
Example 3
Source File: DocumentsActivity.java    From FireFiles with Apache License 2.0 5 votes vote down vote up
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));
    }
 
Example 4
Source File: DocumentsActivity.java    From FireFiles with Apache License 2.0 5 votes vote down vote up
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));
    }
 
Example 5
Source File: WallpaperBoardMuzeiActivity.java    From wallpaperboard with Apache License 2.0 5 votes vote down vote up
@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());
}
 
Example 6
Source File: WallpapersFragment.java    From candybar-library with Apache License 2.0 5 votes vote down vote up
@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();
}
 
Example 7
Source File: ConsoleFragment.java    From octoandroid with GNU General Public License v3.0 5 votes vote down vote up
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;
}
 
Example 8
Source File: SmartRefreshLayout.java    From CollapsingRefresh with Apache License 2.0 4 votes vote down vote up
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();

}
 
Example 9
Source File: ReactHorizontalScrollViewManager.java    From react-native-GPay with MIT License 4 votes vote down vote up
@ReactProp(name = "nestedScrollEnabled")
public void setNestedScrollEnabled(ReactHorizontalScrollView view, boolean value) {
  ViewCompat.setNestedScrollingEnabled(view, value);
}
 
Example 10
Source File: ReactScrollViewManager.java    From react-native-GPay with MIT License 4 votes vote down vote up
@ReactProp(name = "nestedScrollEnabled")
public void setNestedScrollEnabled(ReactScrollView view, boolean value) {
  ViewCompat.setNestedScrollingEnabled(view, value);
}
 
Example 11
Source File: TempGraphFragment.java    From octoandroid with GNU General Public License v3.0 4 votes vote down vote up
private void toggleLock() {
    mListener.setSwipeEnabled(!mListener.isSwipeEnabled());
    if (getView() == null) return;
    boolean isNestedScrollingEnabled = ViewCompat.isNestedScrollingEnabled(getView());
    ViewCompat.setNestedScrollingEnabled(getView(), !isNestedScrollingEnabled);
}
 
Example 12
Source File: ConsoleFragment.java    From octoandroid with GNU General Public License v3.0 4 votes vote down vote up
private void toggleLock() {
    if (getView() == null) return;
    boolean isEnabled = ViewCompat.isNestedScrollingEnabled(getView());
    ViewCompat.setNestedScrollingEnabled(getView(), !isEnabled);
}
 
Example 13
Source File: MainActivity.java    From googlecalendar with Apache License 2.0 3 votes vote down vote up
private void setExpandAndCollapseEnabled(boolean enabled) {

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

        }
    }