private void initDiscountCardsRecyclerView() { cardsRecyclerView.setHasFixedSize(true); layoutManager = new LinearLayoutManager(getActivity()); cardsRecyclerView.setLayoutManager(layoutManager); Customer customer = new Select().from(Customer.class).executeSingle(); List<DiscountCard> records = customer.discountCards(); adapter = new DiscountCardsListAdapter(records); cardsRecyclerView.setAdapter(adapter); cardsRecyclerView.setItemAnimator(cardsRecyclerView.getItemAnimator()); cardsRecyclerView.addItemDecoration( new HorizontalDividerItemDecoration.Builder(getContext()).build()); cardsRecyclerView.setItemAnimator(new FadeInAnimator()); cardsRecyclerView.getItemAnimator().setRemoveDuration(1000); cardsRecyclerView.setDefaultOnRefreshListener( () -> new Handler() .postDelayed( () -> { // insert things to adapter cardsRecyclerView.setRefreshing(false); layoutManager.scrollToPosition(0); }, 1000)); }
@Override public void onViewCreated(View view, Bundle savedInstanceState) { if (savedInstanceState == null) { try { listview_layout = (UltimateRecyclerView) view.findViewById(R.id.ultimate_recycler_view); CustomLinearLayoutManager mlayout = new CustomLinearLayoutManager(view.getContext(), LinearLayoutManager.VERTICAL, false); listview_layout.setLayoutManager(mlayout); listview_layout.setHasFixedSize(true); listview_layout.setSaveEnabled(false); // listview_layout.set picasso = Picasso.with(getActivity()); listview_layout.setAdapter(getAdatperWithdata()); } catch (Exception e) { Log.d(TAG, e.getMessage()); } } }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); 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(); }
private void addExpandableFeatures() { ultimateRecyclerView.getItemAnimator().setAddDuration(100); ultimateRecyclerView.getItemAnimator().setRemoveDuration(100); ultimateRecyclerView.getItemAnimator().setMoveDuration(200); ultimateRecyclerView.getItemAnimator().setChangeDuration(100); }