Skip to content

Commit

Permalink
add set recycler view
Browse files Browse the repository at this point in the history
  • Loading branch information
meisam committed Oct 14, 2019
1 parent 9ef8e52 commit a7e7a98
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 133 deletions.
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package com.softrunapps.paginatedrecyclerviewapplication;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.widget.Toast;

import com.softrunapps.paginatedrecyclerview.PaginatedRecyclerView;
import androidx.appcompat.app.AppCompatActivity;

import com.softrunapps.paginatedrecyclerview.PaginatedAdapter;

import java.util.ArrayList;
import java.util.List;
Expand All @@ -14,35 +14,31 @@ public class MainActivity extends AppCompatActivity {

private static final String TAG = "MainActivity";
List<String> data;
PaginationAdapter paginatedAdapter;
int conunt = 15;
PaginationAdapter adapter;
int conunt = 10;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

initData();

paginatedAdapter = new PaginationAdapter();
paginatedAdapter.setFirstPage(2);
paginatedAdapter.setItemCount(15);
PaginatedRecyclerView recyclerView = findViewById(R.id.recyclerView);
recyclerView.setAdapter(paginatedAdapter);
recyclerView.setOnPaginationListener(new PaginatedRecyclerView.OnPaginationListener() {
adapter = new PaginationAdapter();
adapter.setDefaultRecyclerView(this,R.id.recyclerView);
adapter.setOnPaginationListener(new PaginatedAdapter.OnPaginationListener() {
@Override
public void onNextPage(int loadingPage) {
paginatedAdapter.submitItems(getNewItems(loadingPage));
public void onNextPage(int page) {
adapter.submitItems(getNewItems(page));
}

@Override
public void onFinish() {
Toast.makeText(MainActivity.this, "finish", Toast.LENGTH_SHORT).show();
}
});
paginatedAdapter.submitItems(getNewItems(paginatedAdapter.getFirstPage()));


adapter.submitItems(getNewItems(adapter.getStartPage()));
}

private void initData() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
package com.softrunapps.paginatedrecyclerview;

import android.app.Activity;
import android.content.Context;
import android.os.Debug;
import android.util.Log;
import android.view.ViewGroup;

import androidx.annotation.NonNull;
Expand Down

This file was deleted.

0 comments on commit a7e7a98

Please sign in to comment.