Java Code Examples for androidx.core.view.ViewCompat#setNestedScrollingEnabled()

The following examples show how to use androidx.core.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: DynamicInfoView.java    From dynamic-support with Apache License 2.0 6 votes vote down vote up
@Override
protected void onInflate() {
    inflate(getContext(), getLayoutRes(), this);

    mIconView = findViewById(R.id.ads_info_view_icon);
    mTitleView = findViewById(R.id.ads_info_view_title);
    mSubtitleView = findViewById(R.id.ads_info_view_subtitle);
    mDescriptionView = findViewById(R.id.ads_info_view_description);
    mStatusView = findViewById(R.id.ads_info_view_status);
    mIconBigView = findViewById(R.id.ads_info_view_icon_big);
    mLinksView = findViewById(R.id.ads_recycler_view);

    mVisibilityIconView = mIconView.getVisibility();
    mDynamicItems = new ArrayList<>();

    ViewCompat.setNestedScrollingEnabled(mLinksView, false);
    onUpdate();
}
 
Example 2
Source File: WallpapersFragment.java    From candybar 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 3
Source File: DetailsActivity.java    From PopularMovies with MIT License 5 votes vote down vote up
private void setupTrailersAdapter() {
    RecyclerView listTrailers = mBinding.movieDetailsInfo.listTrailers;
    listTrailers.setLayoutManager(
            new LinearLayoutManager(this, RecyclerView.HORIZONTAL, false));
    listTrailers.setHasFixedSize(true);
    listTrailers.setAdapter(new TrailersAdapter());
    ViewCompat.setNestedScrollingEnabled(listTrailers, false);
}
 
Example 4
Source File: DetailsActivity.java    From PopularMovies with MIT License 5 votes vote down vote up
private void setupCastAdapter() {
    RecyclerView listCast = mBinding.movieDetailsInfo.listCast;
    listCast.setLayoutManager(
            new LinearLayoutManager(this, RecyclerView.HORIZONTAL, false));
    listCast.setAdapter(new CastAdapter());
    ViewCompat.setNestedScrollingEnabled(listCast, false);
}
 
Example 5
Source File: DetailsActivity.java    From PopularMovies with MIT License 5 votes vote down vote up
private void setupReviewsAdapter() {
    RecyclerView listReviews = mBinding.movieDetailsInfo.listReviews;
    listReviews.setLayoutManager(
            new LinearLayoutManager(this, RecyclerView.VERTICAL, false));
    listReviews.setAdapter(new ReviewsAdapter());
    ViewCompat.setNestedScrollingEnabled(listReviews, false);
}
 
Example 6
Source File: DynamicAlertController.java    From dynamic-support with Apache License 2.0 5 votes vote down vote up
private void setupContent(ViewGroup contentPanel) {
    mScrollView = mWindow.findViewById(R.id.scrollView);
    mScrollView.setFocusable(false);
    ViewCompat.setNestedScrollingEnabled(mScrollView, false);

    // Special case for users that only want to display a String
    mMessageView = contentPanel.findViewById(android.R.id.message);
    if (mMessageView == null) {
        return;
    }

    if (mMessage != null) {
        mMessageView.setText(mMessage);
    } else {
        mMessageView.setVisibility(View.GONE);
        mScrollView.removeView(mMessageView);

        if (mListView != null) {
            final ViewGroup scrollParent = (ViewGroup) mScrollView.getParent();
            final int childIndex = scrollParent.indexOfChild(mScrollView);
            scrollParent.removeViewAt(childIndex);
            scrollParent.addView(mListView, childIndex,
                    new ViewGroup.LayoutParams(MATCH_PARENT, MATCH_PARENT));
        } else {
            // contentPanel.setVisibility(View.GONE);
        }
    }
}
 
Example 7
Source File: DynamicRecyclerViewNested.java    From dynamic-support with Apache License 2.0 5 votes vote down vote up
@CallSuper
@Override
protected void onCreateRecyclerView(@NonNull RecyclerView recyclerView) {
    super.onCreateRecyclerView(recyclerView);

    ViewCompat.setNestedScrollingEnabled(recyclerView, false);
}
 
Example 8
Source File: MainActivity.java    From PreferenceRoom with Apache License 2.0 5 votes vote down vote up
private void initializeUI() {
  ListViewAdapter adapter = new ListViewAdapter(this, R.layout.item_profile);

  if (component.UserProfile().getLogin()) {
    ListView listView = findViewById(R.id.content_listView);
    ViewCompat.setNestedScrollingEnabled(listView, true);
    listView.setAdapter(adapter);

    adapter.addItem(new ItemProfile("message", component.UserProfile().getNickname()));
    adapter.addItem(
        new ItemProfile("nick value", component.UserProfile().getUserinfo().getName()));
    adapter.addItem(new ItemProfile("age", component.UserProfile().getUserinfo().getAge() + ""));
    adapter.addItem(new ItemProfile("visits", component.UserProfile().getVisits() + ""));

    /**
     * increment visits count. show {@link com.skydoves.preferenceroomdemo.entities.Profile}
     * putVisitCountFunction()
     */
    component.UserProfile().putVisits(component.UserProfile().getVisits());
  }

  if (component.UserDevice().getUuid() == null) {
    putDumpDeviceInfo();
  } else {
    adapter.addItem(new ItemProfile("version", component.UserDevice().getVersion()));
    adapter.addItem(new ItemProfile("uuid", component.UserDevice().getUuid()));
  }
}
 
Example 9
Source File: ChannelListFragment.java    From zapp with MIT License 5 votes vote down vote up
@Override
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
	FragmentChannelListBinding binding = FragmentChannelListBinding.inflate(inflater, container, false);

	RecyclerView channelGridView = binding.gridviewChannels;
	ViewCompat.setNestedScrollingEnabled(channelGridView, true);
	channelGridView.setLayoutManager(new GridAutofitLayoutManager(getContext(), 320));
	channelGridView.setAdapter(gridAdapter);

	return binding.getRoot();
}