Java Code Examples for android.support.v7.widget.RecyclerView#setNestedScrollingEnabled()

The following examples show how to use android.support.v7.widget.RecyclerView#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: MyPieChartView.java    From kAndroid with Apache License 2.0 6 votes vote down vote up
private void addVertical() {
    mRecyclerView = new RecyclerView(mContext);
    mRecyclerView.setLayoutManager(new GridLayoutManager(mContext, 3));
    mRecyclerView.setNestedScrollingEnabled(false);
    if (adapter == null) {
        adapter = new PicChartAdapter(mContext, mData);
        mRecyclerView.setAdapter(adapter);
    } else {
        adapter.notifyDataSetChanged();
    }

    RelativeLayout relativeLayout = new RelativeLayout(mContext);
    LayoutParams params = new LayoutParams(
            ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.WRAP_CONTENT);
    params.gravity = Gravity.BOTTOM | Gravity.CENTER_HORIZONTAL;
    relativeLayout.setLayoutParams(params);
    RelativeLayout.LayoutParams p2 = new RelativeLayout.LayoutParams(
            ViewGroup.LayoutParams.MATCH_PARENT,
            (int) (mBaseHeight - 2 * raduis - 20));
    relativeLayout.addView(mRecyclerView, p2);
    addView(relativeLayout);
}
 
Example 2
Source File: DiscoverDappsFragment.java    From alpha-wallet-android with MIT License 6 votes vote down vote up
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container,
                         @Nullable Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.layout_discover_dapps, container, false);
    adapter = new DiscoverDappsListAdapter(
            getData(),
            onDappClickListener,
            this::onDappAdded,
            this::onDappRemoved);
    RecyclerView list = view.findViewById(R.id.discover_dapps_list);
    list.setNestedScrollingEnabled(false);
    list.setLayoutManager(new LinearLayoutManager(getActivity()));
    list.setAdapter(adapter);
    return view;
}
 
Example 3
Source File: BangumiDetailsActivity.java    From HeroVideo-master with Apache License 2.0 6 votes vote down vote up
/**
 * 初始化评论recyclerView
 */
private void initCommentRecycler()
{

    mBangumiCommentRecycler.setHasFixedSize(false);
    mBangumiCommentRecycler.setNestedScrollingEnabled(false);
    LinearLayoutManager mLinearLayoutManager = new LinearLayoutManager(this);
    mBangumiCommentRecycler.setLayoutManager(mLinearLayoutManager);
    BangumiDetailsCommentAdapter mCommentAdapter = new BangumiDetailsCommentAdapter(mBangumiCommentRecycler, replies);
    HeaderViewRecyclerAdapter mHeaderViewRecyclerAdapter = new HeaderViewRecyclerAdapter(mCommentAdapter);

    View headView = LayoutInflater.from(this).inflate(R.layout.layout_video_hot_comment_head, mBangumiCommentRecycler, false);
    RecyclerView mHotCommentRecycler = (RecyclerView) headView.findViewById(R.id.hot_comment_recycler);
    mHotCommentRecycler.setHasFixedSize(false);
    mHotCommentRecycler.setNestedScrollingEnabled(false);
    mHotCommentRecycler.setLayoutManager(new LinearLayoutManager(this));
    BangumiDetailsHotCommentAdapter mVideoHotCommentAdapter = new BangumiDetailsHotCommentAdapter(mHotCommentRecycler, hotComments);
    mHotCommentRecycler.setAdapter(mVideoHotCommentAdapter);
    mHeaderViewRecyclerAdapter.addHeaderView(headView);

    mBangumiCommentRecycler.setAdapter(mHeaderViewRecyclerAdapter);
}
 
Example 4
Source File: BeenThereActivity.java    From Expert-Android-Programming with MIT License 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_been_there);

    toolbar = (Toolbar) findViewById(R.id.toolbar1);
    setSupportActionBar(toolbar);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    getSupportActionBar().setTitle("Been There");
    toolbar.setTitleTextColor(ContextCompat.getColor(context, R.color.white));

    user_id = getIntent().getStringExtra(Constant.USER_ID);

    recyclerView = (RecyclerView) findViewById(R.id.recyclerView);
    allList = new ArrayList<>();
    allAdapter = new PlacesRateAdapter(context, allList);
    allAdapter.setClickListener(new PlacesRateAdapter.ClickListener() {
        @Override
        public void onItemClickListener(View v, int pos) {

            RestaurantItem item = allList.get(pos);
            startActivity(PlaceDetailActivity.getCallIntent(context, item));
        }
    });

    recyclerView.setLayoutManager(new LinearLayoutManager(context));
    recyclerView.setNestedScrollingEnabled(false);
    recyclerView.setAdapter(allAdapter);

}
 
Example 5
Source File: FriendFacebookActivity.java    From Expert-Android-Programming with MIT License 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_friends_search);

    toolbar = (Toolbar) findViewById(R.id.toolbar1);
    setSupportActionBar(toolbar);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    getSupportActionBar().setTitle("Find friends on Facebook");
    toolbar.setTitleTextColor(ContextCompat.getColor(context, R.color.white));

    recyclerView = (RecyclerView) findViewById(R.id.recyclerView);


    allList = new ArrayList<>();
    allAdapter = new FriendAdapter(context, allList);
    /*
    allAdapter.setClickListener(new FriendAdapter.ClickListener() {
        @Override
        public void onItemClickListener(View v, int pos) {

        }

        @Override
        public void onFriendListener(int pos, boolean isFollowing) {

        }
    });*/

    recyclerView.setLayoutManager(new LinearLayoutManager(context));
    recyclerView.setNestedScrollingEnabled(false);
    recyclerView.setAdapter(allAdapter);

    setList();
}
 
Example 6
Source File: FluentAppBar.java    From fluentAppBar with Apache License 2.0 5 votes vote down vote up
public void setSecondaryMenu(@MenuRes int menuRes, OnClickListener onClickListener) {
    RecyclerView recyclerView = (RecyclerView) findViewById(R.id.secondary_menu_items_recyler);
    recyclerView.setNestedScrollingEnabled(false);
    recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
    menuSecondaryItemsAdapter = new MenuSecondaryItemsAdapter(getContext(), menuRes, onClickListener,
            foregroundColour);
    recyclerView.setAdapter(menuSecondaryItemsAdapter);
}
 
Example 7
Source File: SampleActivity.java    From SlidingRootNav with Apache License 2.0 5 votes vote down vote up
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    Toolbar toolbar = findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);

    slidingRootNav = new SlidingRootNavBuilder(this)
            .withToolbarMenuToggle(toolbar)
            .withMenuOpened(false)
            .withContentClickableWhenMenuOpened(false)
            .withSavedState(savedInstanceState)
            .withMenuLayout(R.layout.menu_left_drawer)
            .inject();

    screenIcons = loadScreenIcons();
    screenTitles = loadScreenTitles();

    DrawerAdapter adapter = new DrawerAdapter(Arrays.asList(
            createItemFor(POS_DASHBOARD).setChecked(true),
            createItemFor(POS_ACCOUNT),
            createItemFor(POS_MESSAGES),
            createItemFor(POS_CART),
            new SpaceItem(48),
            createItemFor(POS_LOGOUT)));
    adapter.setListener(this);

    RecyclerView list = findViewById(R.id.list);
    list.setNestedScrollingEnabled(false);
    list.setLayoutManager(new LinearLayoutManager(this));
    list.setAdapter(adapter);

    adapter.setSelected(POS_DASHBOARD);
}
 
Example 8
Source File: CharacterActivity.java    From Villains-and-Heroes with Apache License 2.0 5 votes vote down vote up
private void setupSectionView(RecyclerView recyclerView, @SectionVO.Type int type) {
    recyclerView.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.HORIZONTAL, false));
    recyclerView.setNestedScrollingEnabled(false);
    recyclerView.setHasFixedSize(true);
    SectionAdapter adapter = new SectionAdapter(this, type, this);
    recyclerView.setAdapter(adapter);
    SnapHelper snapHelper = new LinearSnapHelper();
    snapHelper.attachToRecyclerView(recyclerView);
}
 
Example 9
Source File: HistoryActivity.java    From UberClone with MIT License 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_history);

    mBalance = findViewById(R.id.balance);
    mPayout = findViewById(R.id.payout);
    mPayoutEmail = findViewById(R.id.payoutEmail);

    mHistoryRecyclerView = (RecyclerView) findViewById(R.id.historyRecyclerView);
    mHistoryRecyclerView.setNestedScrollingEnabled(false);
    mHistoryRecyclerView.setHasFixedSize(true);
    mHistoryLayoutManager = new LinearLayoutManager(HistoryActivity.this);
    mHistoryRecyclerView.setLayoutManager(mHistoryLayoutManager);
    mHistoryAdapter = new HistoryAdapter(getDataSetHistory(), HistoryActivity.this);
    mHistoryRecyclerView.setAdapter(mHistoryAdapter);


    customerOrDriver = getIntent().getExtras().getString("customerOrDriver");
    userId = FirebaseAuth.getInstance().getCurrentUser().getUid();
    getUserHistoryIds();

    if(customerOrDriver.equals("Drivers")){
        mBalance.setVisibility(View.VISIBLE);
        mPayout.setVisibility(View.VISIBLE);
        mPayoutEmail.setVisibility(View.VISIBLE);
    }

    mPayout.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            payoutRequest();
        }
    });
}
 
Example 10
Source File: TransitionAnimationActivity.java    From Study_Android_Demo with Apache License 2.0 5 votes vote down vote up
private void initRecyclerView() {
    RecyclerView recyclerView = (RecyclerView) findViewById(R.id.rv_share_elements);
    recyclerView.setFocusable(false);
    recyclerView.setLayoutManager(new GridLayoutManager(this, 2));
    recyclerView.setNestedScrollingEnabled(false);
    recyclerView.addItemDecoration(new GridSpacingItemDecoration(2, 5, false));
    recyclerView.setAdapter(new MyRecyclerViewAdapter(this));
}
 
Example 11
Source File: AddressBookActivity.java    From Expert-Android-Programming with MIT License 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_address_book);

    toolbar = (Toolbar) findViewById(R.id.toolbar1);
    setSupportActionBar(toolbar);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    getSupportActionBar().setTitle("Address Book");
    toolbar.setTitleTextColor(ContextCompat.getColor(context, R.color.white));

    recyclerView = (RecyclerView) findViewById(R.id.recyclerView);


    userAddresses = new ArrayList<>();
    addressAdapter = new AddressAdapter(context, userAddresses);
    addressAdapter.setClickListener(new AddressAdapter.ClickListener() {
        @Override
        public void onItemClickListener(View v, int pos) {
            gotoDetailsActivity(pos);
        }
    });

    recyclerView.setLayoutManager(new LinearLayoutManager(context));
    recyclerView.setNestedScrollingEnabled(false);
    recyclerView.setAdapter(addressAdapter);

    no_address_view = (LinearLayout) findViewById(R.id.no_address_view);
    no_address_view.setVisibility(View.INVISIBLE);


}
 
Example 12
Source File: RecyclerViewInsideScrollViewActivity.java    From AndroidPlayground with MIT License 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_recycler_view_inside_scroll_view);

    LinearLayout header = (LinearLayout) findViewById(R.id.mLlHeader);
    final TextView title = (TextView) findViewById(R.id.mTitle);

    final RecyclerView recyclerView = (RecyclerView) findViewById(R.id.mRecyclerView);
    final Adapter adapter = new Adapter(this);
    recyclerView.setNestedScrollingEnabled(false);
    recyclerView.setLayoutManager(new FixedHeightGridLayoutManager(this, 3));
    recyclerView.setAdapter(adapter);
    adapter.setContentCount(100);
    adapter.notifyDataSetChanged();

    NestedScrollView nestedScrollView = (NestedScrollView) findViewById(R.id.mNestedScrollView);
    nestedScrollView.getViewTreeObserver()
            .addOnScrollChangedListener(new NSVHeaderScrollOutPercentListener(
                    new NSVHeaderScrollOutPercentListener.HeaderScrollOutPercentageListener() {
                        @Override
                        public void onHeaderScrollOffPercent(float percent) {
                            int alpha = (int) (percent * 255);
                            title.setTextColor(alpha << 24 | 0xFFFFFF);
                        }
                    }, header, 0.618F, 1.0F));
}
 
Example 13
Source File: RecyclerViewUtil.java    From diycode with Apache License 2.0 5 votes vote down vote up
public static <T extends SingleTypeAdapter> void init(Context context, RecyclerView recyclerView, T adapter) {
    LinearLayoutManager layoutManager = new LinearLayoutManager(context);
    layoutManager.setSmoothScrollbarEnabled(true);
    layoutManager.setAutoMeasureEnabled(true);
    recyclerView.setAdapter(adapter);
    recyclerView.setLayoutManager(layoutManager);
    recyclerView.setHasFixedSize(true);
    recyclerView.setNestedScrollingEnabled(false);
}
 
Example 14
Source File: SelectPhotosActivity.java    From Expert-Android-Programming with MIT License 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_select_photos);

    item = (BucketItem) getIntent().getSerializableExtra(Constant.DATA);
    allSelected = DaoController.getPhotoItems(context);

    title = (TextView) findViewById(R.id.title);

    allList = new ArrayList<>();
    adapter = new BucketPhotoAdapter(context, allList);
    adapter.setClickListener(new BucketPhotoAdapter.ClickListener() {
        @Override
        public void onItemClickListener(View v, int pos) {

            boolean b = allList.get(pos).isSelected();
            allList.get(pos).setSelected(!b);
            adapter.refresh(allList, pos);

            countSelected();

        }
    });

    recyclerView = (RecyclerView) findViewById(R.id.recyclerView);
    recyclerView.setNestedScrollingEnabled(false);
    recyclerView.setLayoutManager(new GridLayoutManager(context, 3));
    recyclerView.setAdapter(adapter);

    marshmallowPermission = new MarshmallowPermission(this);

    title.setText(item.getName());

    checkPermissions();
}
 
Example 15
Source File: BrowserHistoryFragment.java    From alpha-wallet-android with MIT License 5 votes vote down vote up
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container,
                         @Nullable Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.layout_browser_history, container, false);
    adapter = new BrowserHistoryAdapter(
            getData(),
            onDappClickListener,
            this::onHistoryItemRemoved);
    RecyclerView list = view.findViewById(R.id.my_dapps_list);
    list.setNestedScrollingEnabled(false);
    list.setLayoutManager(new LinearLayoutManager(getActivity()));
    list.setAdapter(adapter);

    noHistory = view.findViewById(R.id.no_history);
    clear = view.findViewById(R.id.clear);
    clear.setOnClickListener(v -> {
        dialog = new AWalletAlertDialog(getActivity());
        dialog.setTitle(R.string.dialog_title_clear);
        dialog.setMessage(R.string.dialog_message_clear);
        dialog.setIcon(AWalletAlertDialog.NONE);
        dialog.setButtonText(R.string.action_clear);
        dialog.setButtonListener(v1 -> {
            clearHistory();
            dialog.dismiss();
        });
        dialog.setSecondaryButtonText(R.string.dialog_cancel_back);
        dialog.show();
    });

    showOrHideViews();
    return view;
}
 
Example 16
Source File: TransitionAnimationActivity.java    From Android-Animation-Set with Apache License 2.0 5 votes vote down vote up
private void initRecyclerView() {
    RecyclerView recyclerView = (RecyclerView) findViewById(R.id.rv_share_elements);
    recyclerView.setFocusable(false);
    recyclerView.setLayoutManager(new GridLayoutManager(this, 2));
    recyclerView.setNestedScrollingEnabled(false);
    recyclerView.addItemDecoration(new GridSpacingItemDecoration(2, 5, false));
    recyclerView.setAdapter(new MyRecyclerViewAdapter(this));
}
 
Example 17
Source File: SettingsActivity.java    From BrainPhaser with GNU General Public License v3.0 4 votes vote down vote up
/**
 * This method is called when the activity is created
 *
 * @param savedInstanceState handed over to super constructor
 */
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.activity_settings);

    Toolbar myChildToolbar =
        (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(myChildToolbar);

    // Get a support ActionBar corresponding to this toolbar
    ActionBar ab = getSupportActionBar();

    // Enable the Up button
    ab.setDisplayHomeAsUpEnabled(true);

    //loading of the components
    RecyclerView settingsList = (RecyclerView) findViewById(R.id.settingsList);
    settingsList.addItemDecoration(new DividerItemDecoration(this, DividerItemDecoration.VERTICAL_LIST));

    // use a linear layout manager
    LinearLayoutManager layoutManager = new LinearLayoutManager(this);
    layoutManager.setAutoMeasureEnabled(true);
    settingsList.setLayoutManager(layoutManager);
    settingsList.setNestedScrollingEnabled(false);

    //Create the View
    //Adapter which sets all users into the list
    mSettingsAdapter = new SettingsAdapter(mUserManager.getCurrentUser().getSettings(), this, mSettingsLogic);
    settingsList.setAdapter(mSettingsAdapter);

    // Avoid scrolldown
    settingsList.setFocusable(false);
    (findViewById(R.id.heading)).requestFocus();

    final SettingsActivity self = this;
    Button resetButton = (Button) findViewById(R.id.resetButton);
    resetButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            self.resetSettings();
        }
    });
}
 
Example 18
Source File: MatchesActivity.java    From TinderClone with MIT License 4 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_matches);

    cusrrentUserID = FirebaseAuth.getInstance().getCurrentUser().getUid();

    mRecyclerView = (RecyclerView) findViewById(R.id.recyclerView);
    mRecyclerView.setNestedScrollingEnabled(false);
    mRecyclerView.setHasFixedSize(true);
    mMatchesLayoutManager = new LinearLayoutManager(MatchesActivity.this);
    mRecyclerView.setLayoutManager(mMatchesLayoutManager);
    mMatchesAdapter = new MatchesAdapter(getDataSetMatches(), MatchesActivity.this);
    mRecyclerView.setAdapter(mMatchesAdapter);

    getUserMatchId();





}
 
Example 19
Source File: RecyclerWidget.java    From relight with Apache License 2.0 4 votes vote down vote up
@Override
public void initView(RecyclerView view) {
    super.initView(view);
    view.setNestedScrollingEnabled(false);
}
 
Example 20
Source File: BehaviorActivity.java    From AndroidPlayground with MIT License 4 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_behavoir);

    final TextView title = findById(this, R.id.mTvTitle);
    LinearLayout lLStatistics = findById(this, R.id.mLlStatistics);

    NestedScrollView nestedScrollView = findById(this, R.id.mNestedScrollView);
    nestedScrollView.getViewTreeObserver()
            .addOnScrollChangedListener(new NSVHeaderScrollOutPercentListener(
                    new NSVHeaderScrollOutPercentListener.HeaderScrollOutPercentageListener() {
                        @Override
                        public void onHeaderScrollOffPercent(float percent) {
                            int alpha = (int) (percent * 191);
                            title.setTextColor(alpha << 24 | 0xFFFFFF);
                        }
                    }, lLStatistics, 0.47F, 0.64F));

    final TextView tvName = findById(this, R.id.mTvPublisherName);

    RecyclerView detailRV = findById(this, R.id.mRvDetails);
    final DetailAdapter detailAdapter = new DetailAdapter(this);
    detailRV.setNestedScrollingEnabled(false);
    detailRV.setLayoutManager(new FixedHeightGridLayoutManager(this, 4));
    detailRV.setAdapter(detailAdapter);

    RecyclerView publishersRV = findById(this, R.id.mRvPublishers);
    final PublisherAdapter publisherAdapter =
            new PublisherAdapter(new PublisherAdapter.OnClickListener() {

                @Override
                public void onClicked(String name) {
                    tvName.setText(name + " 的打赏详情");
                    detailAdapter.setName(name);
                }
            });
    publishersRV.setLayoutManager(
            new WrapContentHorizontalLinearLayoutManager(this, false, 59, 53, 5, 5, 0, 0));
    publishersRV.setAdapter(publisherAdapter);

    detailRV.postDelayed(new Runnable() {
        @Override
        public void run() {
            detailAdapter.setName("A");
            detailAdapter.setContentCount(100);
            publisherAdapter.setContentCount(10);
            tvName.setText("A 的打赏详情");
        }
    }, 200);

    findById(this, R.id.mIbClose).setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            publisherAdapter.setContentCount(3);
        }
    });
}