-
Notifications
You must be signed in to change notification settings - Fork 21
무한 스크롤링 호출 시점 변경 #10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
무한 스크롤링 호출 시점 변경 #10
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -23,7 +23,7 @@ public class MainPresenter implements MainContract.Presenter { | |
| private AdapterContract.Model<Movie> adapterModel; | ||
|
|
||
| private String searchKey = ""; // 검색 키워드 | ||
| private final int PAGE_UNIT = 20; // 한번에 가져올 데이터 개수 | ||
| private final int PAGE_UNIT = 10; // 한번에 가져올 데이터 개수 | ||
| private int currentPage = 0; // 현재 페이지 index | ||
| private boolean isEndOfPage = false; // 페이지 끝 flag | ||
|
|
||
|
|
@@ -41,10 +41,9 @@ public void onViewCreated() { | |
| public void loadItems(boolean isRefresh) { | ||
|
|
||
| // refresh true 의 경우 초기화 | ||
| if (isRefresh){ | ||
| if (isRefresh) { | ||
| currentPage = 0; | ||
| isEndOfPage = false; | ||
| adapterModel.clearItems(); | ||
| } | ||
|
|
||
| // 마지막 페이지가 아니고 로딩중 아닌 경우 getMovieList 호출 | ||
|
|
@@ -83,6 +82,11 @@ private void getMovieList(){ | |
| // 로딩 flag OFF | ||
| isLoading.set(false); | ||
|
|
||
| // 검색버튼에 의한 호출일 경우, 기존 list 비우기 | ||
| if(currentPage == 1) { | ||
| adapterModel.clearItems(); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. isRefresh 조건 안에서 기존 list를 비우지 않고 api 호출후 하는 이유가 궁금합니다.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 검색 API 호출은 비동기적으로 구현되어 있기 때문에 공유자원( CallBack 내부로 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. isLoading.set(false)의 위치에 따라 성능적으로 어떻게 차이가 나는지 알 수 있을까요?
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 제가 섣불리 판단했습니다.. |
||
| } | ||
|
|
||
| List<Movie> movieList = response.getMovieList(); | ||
|
|
||
| if(movieList.size() == 0){ // 검색 결과가 없는 경우 | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
20에서 10으로 변경된 이유가 궁금합니다.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
20개씩 호출은 마지막 5번째 아이템까지 닿는데 여러 번 스크롤을 해야 합니다. 스크롤을 두세 번만 내리면서 API가 연속적으로 잘 호출되는지 확인하고 싶었습니다. 감사합니다!