Java Code Examples for com.marshalchen.ultimaterecyclerview.UltimateRecyclerView#setAdapter()

The following examples show how to use com.marshalchen.ultimaterecyclerview.UltimateRecyclerView#setAdapter() . 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: MaterialListSection.java    From KickAssSlidingMenu with Apache License 2.0 6 votes vote down vote up
@SuppressLint("WrongViewCast")
@Override
public View init(View view) {
    indicator = (ImageView) view.findViewById(R.id.indicatorIcon);
    text = (CustomTextView) view.findViewById(R.id.section_text);
    notificationtext = (CustomTextView) view.findViewById(R.id.section_notification);
    listview = (UltimateRecyclerView) view.findViewById(R.id.ultimate_recycler_view);
    // listview.disableLoadmore();
    listview.setSaveEnabled(false);
    CustomLinearLayoutManager mlayout = new CustomLinearLayoutManager(view.getContext(), LinearLayoutManager.VERTICAL, false);
    listview.setLayoutManager(mlayout);
    listview.setHasFixedSize(false);
    listview.setAdapter(renderer);
    mContainer = view;

    submenu_item_height = view.getContext().getResources().getDimensionPixelSize(R.dimen.sectionNormalHeight);

    animate_indicator = true;

    final Resources resources = view.getContext().getResources();
    int resourceId = resources.getIdentifier("navigation_bar_height", "dimen", "android");
    if (resourceId > 0) {
        bottomNavigationHeight = resources.getDimensionPixelSize(resourceId);
    }
    return view;
}
 
Example 2
Source File: MenuFragment.java    From KickAssSlidingMenu with Apache License 2.0 6 votes vote down vote up
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    ultimateRecyclerView = (UltimateRecyclerView) view.findViewById(R.id.ultimate_recycler_view_menu);
    ultimateRecyclerView.setHasFixedSize(false);
    /**
     * this is the adapter for the expanx
     */
    simpleRecyclerViewAdapter = new expCustomAdapter(getActivity());
    simpleRecyclerViewAdapter.addAll(expCustomAdapter.getPreCodeMenu(
                    sampledatagroup1,
                    sampledatagroup2,
                    sampledatagroup3),
            0);

    linearLayoutManager = new LinearLayoutManager(getActivity());
    ultimateRecyclerView.setLayoutManager(linearLayoutManager);
    ultimateRecyclerView.setAdapter(simpleRecyclerViewAdapter);
    ultimateRecyclerView.setRecylerViewBackgroundColor(Color.parseColor("#ffffff"));
    addExpandableFeatures();

}
 
Example 3
Source File: DebugNoHeaderLoadMoreActivity.java    From UltimateRecyclerView with Apache License 2.0 6 votes vote down vote up
@Override
protected void doURV(UltimateRecyclerView ultimateRecyclerView) {
    //  ultimateRecyclerView.setInflater(LayoutInflater.from(getApplicationContext()));
    ultimateRecyclerView.setHasFixedSize(false);
    ArrayList<String> list = new ArrayList<>();
    list.add("o2fn31");
    list.add("of2n32");
    list.add("of3n36");
    simpleRecyclerViewAdapter = new sectionZeroAdapter(list);
    configLinearLayoutManager(ultimateRecyclerView);
    //enableParallaxHeader();
    enableEmptyViewPolicy();
    enableLoadMore();
    ultimateRecyclerView.setRecylerViewBackgroundColor(Color.parseColor("#ff4fcccf"));
    enableRefresh();
    // enableScrollControl();
    // enableSwipe();
    // enableItemClick();
    ultimateRecyclerView.setItemViewCacheSize(simpleRecyclerViewAdapter.getAdditionalItems());


    ultimateRecyclerView.setAdapter(simpleRecyclerViewAdapter);
}
 
Example 4
Source File: DebugLoadMoreActivity.java    From UltimateRecyclerView with Apache License 2.0 6 votes vote down vote up
@Override
protected void doURV(UltimateRecyclerView ultimateRecyclerView) {
    ultimateRecyclerView.setHasFixedSize(false);
    simpleRecyclerViewAdapter = new sectionZeroAdapter(new ArrayList<String>());
    configLinearLayoutManager(ultimateRecyclerView);
    enableParallaxHeader();
    enableEmptyViewPolicy();
    enableLoadMore();
    ultimateRecyclerView.setRecylerViewBackgroundColor(Color.parseColor("#ffff66ff"));
    enableRefresh();
    // enableScrollControl();
    // enableSwipe();
    // enableItemClick();
    //ultimateRecyclerView.setItemViewCacheSize(simpleRecyclerViewAdapter.getAdditionalItems());
    ultimateRecyclerView.setAdapter(simpleRecyclerViewAdapter);
}
 
Example 5
Source File: TestExpandableRV.java    From UltimateRecyclerView with Apache License 2.0 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_loadmore);
    toolbar = (Toolbar) findViewById(R.id.tool_bar);
    setSupportActionBar(toolbar);
    getSupportActionBar().setDisplayShowTitleEnabled(false);
    ultimateRecyclerView = (UltimateRecyclerView) findViewById(R.id.ultimate_recycler_view);
    ultimateRecyclerView.setHasFixedSize(false);
    /**
     * this is the adapter for the expanx
     */
    simpleRecyclerViewAdapter = new ExpCustomAdapter(this);
    simpleRecyclerViewAdapter.addAll(ExpCustomAdapter.getPreCodeMenu(sampledatagroup1, sampledatagroup2, sampledatagroup3), 0);

    linearLayoutManager = new LinearLayoutManager(this);
    ultimateRecyclerView.setLayoutManager(linearLayoutManager);
    ultimateRecyclerView.setAdapter(simpleRecyclerViewAdapter);
    ultimateRecyclerView.setRecylerViewBackgroundColor(Color.parseColor("#ffffff"));
    addExpandableFeatures();
}
 
Example 6
Source File: catelogLinear.java    From KickAssSlidingMenu with Apache License 2.0 5 votes vote down vote up
protected void renderviewlayout(View view) throws Exception {
    listview_layout = (UltimateRecyclerView) view.findViewById(getUltimate_recycler_viewResId());
    listview_layout.setHasFixedSize(true);
    listview_layout.setSaveEnabled(true);
    listview_layout.setAdapter(madapter = getAdatperWithdata());
    if (mLayoutManager == null) {
        mLayoutManager = new ScrollSmoothLineaerLayoutManager(view.getContext(), LinearLayoutManager.VERTICAL, false, getSmoothDuration());
    }
    listview_layout.setLayoutManager(mLayoutManager);
    getProgressbar(view, R.id.urv_main_progress_bar);
    setUltimateRecyclerViewExtra(listview_layout, madapter);
}
 
Example 7
Source File: catelogLinear.java    From KickAssSlidingMenu with Apache License 2.0 5 votes vote down vote up
protected void renderviewlayout(View view) throws Exception {
    listview_layout = (UltimateRecyclerView) view.findViewById(getUltimate_recycler_viewResId());
    listview_layout.setHasFixedSize(true);
    listview_layout.setSaveEnabled(true);

    if (mLayoutManager == null) {
        mLayoutManager = new ScrollSmoothLineaerLayoutManager(view.getContext(), LinearLayoutManager.VERTICAL, false, getSmoothDuration());
    }
    listview_layout.setLayoutManager(mLayoutManager);
    listview_layout.setAdapter(madapter = getAdatperWithdata());
    setUltimateRecyclerViewExtra(listview_layout, madapter);
}
 
Example 8
Source File: catelogLinear.java    From UltimateRecyclerView with Apache License 2.0 5 votes vote down vote up
protected void renderviewlayout(View view) throws Exception {
    listview_layout = (UltimateRecyclerView) view.findViewById(getUltimate_recycler_viewResId());
    listview_layout.setHasFixedSize(true);
    listview_layout.setSaveEnabled(true);
    if (mLayoutManager == null) {
        mLayoutManager = new ScrollSmoothLineaerLayoutManager(view.getContext(), LinearLayoutManager.VERTICAL, false, getSmoothDuration());
    }
    listview_layout.setLayoutManager(mLayoutManager);
    listview_layout.setAdapter(madapter = getAdatperWithdata());
    getProgressbar(view);
    setUltimateRecyclerViewExtra(listview_layout, madapter);
}
 
Example 9
Source File: catelogLinear.java    From UltimateRecyclerView with Apache License 2.0 5 votes vote down vote up
protected void renderviewlayout(View view) throws Exception {
    listview_layout = (UltimateRecyclerView) view.findViewById(getUltimate_recycler_viewResId());
    listview_layout.setHasFixedSize(true);
    listview_layout.setSaveEnabled(true);
    if (mLayoutManager == null) {
        mLayoutManager = new ScrollSmoothLineaerLayoutManager(view.getContext(), LinearLayoutManager.VERTICAL, false, getSmoothDuration());
    }
    listview_layout.setLayoutManager(mLayoutManager);
    listview_layout.setAdapter(madapter = getAdatperWithdata());
    getProgressbar(view);
    setUltimateRecyclerViewExtra(listview_layout, madapter);
}
 
Example 10
Source File: TestAdMobClassicActivity.java    From UltimateRecyclerView with Apache License 2.0 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_loadmore);
    toolbar = (Toolbar) findViewById(R.id.tool_bar);
    setSupportActionBar(toolbar);
    getSupportActionBar().setDisplayShowTitleEnabled(false);
    ultimateRecyclerView = (UltimateRecyclerView) findViewById(R.id.ultimate_recycler_view);
    ultimateRecyclerView.setHasFixedSize(false);

    /**
     * wokring example 1 implementation of Admob banner with static Adview
     */
    //  simpleRecyclerViewAdapter = new admobdfpadapter(createadmob(), 5, stringList);
    /**
     * working example 2 with multiple called Adviews
     */
    simpleRecyclerViewAdapter = new ZeroStickyAdvertistmentAdapter(createadmob(), SampleDataboxset.newListFromGen());
    linearLayoutManager = new LinearLayoutManager(this);
    ultimateRecyclerView.setLayoutManager(linearLayoutManager);
    ultimateRecyclerView.setAdapter(simpleRecyclerViewAdapter);
    ultimateRecyclerView.setItemViewCacheSize(3);
    ultimateRecyclerView.setRecylerViewBackgroundColor(Color.parseColor("#f5f5ff"));
    enableEmptyView();
    enableRefresh();
    enableLoadMore();
    enableClick();
    impleAddDrop();
}
 
Example 11
Source File: BaseFragment.java    From UltimateRecyclerView with Apache License 2.0 4 votes vote down vote up
protected void setDummyData(UltimateRecyclerView recyclerView) {
    recyclerView.setAdapter(new sectionZeroAdapter(getDummyData()));
}
 
Example 12
Source File: GridLayoutRVTest.java    From UltimateRecyclerView with Apache License 2.0 4 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(getMainLayout());
    mToolbar = (Toolbar) findViewById(R.id.tool_bar);
    setSupportActionBar(mToolbar);
    getSupportActionBar().setDisplayShowTitleEnabled(true);
    listuv = (UltimateRecyclerView) findViewById(R.id.ultimate_recycler_view);
    mGridAdapter = new GridJRAdapter(getJRList());
    mGridAdapter.setSpanColumns(columns);
    mGridLayoutManager = new BasicGridLayoutManager(this, columns, mGridAdapter);
    listuv.setLayoutManager(mGridLayoutManager);
    listuv.setHasFixedSize(true);
    listuv.setSaveEnabled(true);
    listuv.setClipToPadding(false);


    // mGridAdapter.setCustomLoadMoreView(LayoutInflater.from(this).inflate(R.layout.custom_bottom_progressbar, null));
    listuv.setNormalHeader(setupHeaderView());
    final Handler f = new Handler();
    listuv.setOnLoadMoreListener(new UltimateRecyclerView.OnLoadMoreListener() {
        @Override
        public void loadMore(int itemsCount, int maxLastVisiblePosition) {
            //   Log.d(TAG, itemsCount + " :: " + itemsCount);
            f.postDelayed(new Runnable() {
                @Override
                public void run() {
                    mGridAdapter.insert(SampleDataboxset.genJRList(5));
                    afterAdd();
                }
            }, 2000);
        }
    });

    // listuv.enableLoadmore();
    //    listuv.disableLoadmore();
    listuv.setLoadMoreView(R.layout.custom_bottom_progressbar);

    listuv.setAdapter(mGridAdapter);
    listuv.setItemAnimator(new DefaultItemAnimator());

    harness_control();
}
 
Example 13
Source File: MultiViewTypesActivity.java    From UltimateRecyclerView with Apache License 2.0 4 votes vote down vote up
@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_loadmore);

        toolbar = (Toolbar) findViewById(R.id.tool_bar);
        setSupportActionBar(toolbar);
        getSupportActionBar().setDisplayShowTitleEnabled(false);


        ultimateRecyclerView = (UltimateRecyclerView) findViewById(R.id.ultimate_recycler_view);
        ultimateRecyclerView.setHasFixedSize(false);
        List<String> stringList = new ArrayList<>();

        stringList.add("111");
        stringList.add("aaa");
        stringList.add("222");
        stringList.add("33");
        stringList.add("44");
        stringList.add("55");


        simpleRecyclerViewAdapter = new MultiViewTypesRecyclerViewAdapter(stringList);
        simpleRecyclerViewAdapter.setCustomLoadMoreView(
                LayoutInflater.from(this).inflate(R.layout.custom_bottom_progressbar, null));

//        stringList.add("66");
//        stringList.add("11771");
        linearLayoutManager = new LinearLayoutManager(this);
        ultimateRecyclerView.setLayoutManager(linearLayoutManager);
        // ultimateRecyclerView.setAdapter(simpleRecyclerViewAdapter);
        ultimateRecyclerView.setAdapter(simpleRecyclerViewAdapter);
        ultimateRecyclerView.setDefaultOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
            @Override
            public void onRefresh() {
                new Handler().postDelayed(new Runnable() {
                    @Override
                    public void run() {
                        simpleRecyclerViewAdapter.insert("Refresh things", 0);
                        ultimateRecyclerView.setRefreshing(false);
                        //   ultimateRecyclerView.scrollBy(0, -50);
                        linearLayoutManager.scrollToPosition(0);
                    }
                }, 1000);
            }
        });

        Paint paint = new Paint();
        paint.setStrokeWidth(5);
        paint.setColor(Color.BLUE);
        paint.setAntiAlias(true);
        paint.setPathEffect(new DashPathEffect(new float[]{25.0f, 25.0f}, 0));
        if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.HONEYCOMB) {
            ultimateRecyclerView.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
        }
        ultimateRecyclerView.addItemDecoration(new HorizontalDividerItemDecoration.Builder(this).paint(paint).build());

      //  simpleRecyclerViewAdapter.ad

    }