Skip to content

영화앱 필터(장르, 국가) 선택#4

Open
wjddnwls918 wants to merge 4 commits into
boostcampth:masterfrom
wjddnwls918:develop
Open

영화앱 필터(장르, 국가) 선택#4
wjddnwls918 wants to merge 4 commits into
boostcampth:masterfrom
wjddnwls918:develop

Conversation

@wjddnwls918

Copy link
Copy Markdown

개요


  • 보조 검색 기능 추가

내용


  • 영화 검색 필터 (장르, 국가) 선택 추가

필터 버튼을 통해 장르, 국가를 선택하여 검색할 수 있게 구현했습니다. 두개의 AlertDialog를 연속으로 띄우게 했습니다.

필터 버튼은 ObservableField를 통해 갱신을 하였습니다. 문제점은 우선, 필터버튼은 values/array.xml에 있는 값을 통해 갱신합니다. 하지만 API에서 값을 얻어올때는 이를 변환해야 하기 때문에 /view/custom/FilterView에 HashMap 두 개를 만들어서 해당 문자열에 해당하는 value를 통해 영화 데이터를 얻어왔습니다.

Comment thread app/src/main/java/com/example/yeseul/movieapp/view/main/MainActivity.java Outdated
//country = countryMap.get(getResources().getStringArray(R.array.country)[which]);
country = getResources().getStringArray(R.array.country)[which];
}
}).setOnDismissListener(new DialogInterface.OnDismissListener() {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

인터페이스를 람다 표현식으로 사용하는건 어떨까요?
Android Java 8 언어 기능 사용

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

넵 참고하겠습니다

@Override
public void onClick(DialogInterface dialog, int which) {
//genre = Integer.toString(which);
genre = getResources().getStringArray(R.array.genre)[which];

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

which는 다이얼로그 인덱스입니다.
이를 이용하여 장르는 MainPresenterHashMap이 아닌 int값으로 가지고 있어도 괜찮아 보입니다.

private MovieListAdapter adapter;
private String genre;
private String country;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  genrecountryMainPresenter에서 처리되기 때문에 Activity는 해당 정보를 가지고 있지 않는게 좋아 보입니다. 이 값은 Setter를 이용하여 Presenter로 넘겨주면 좋을 것 같습니다.

@@ -0,0 +1,72 @@
package com.example.yeseul.movieapp.view.custom;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

com.example.yeseul.movieapp.view.custom 패키지는 커스텀 뷰를 보관하는 것으로 이해하고 있습니다.
FilterView 는 뷰의 목적이 아닌 값을 보관하기 위한 것 같은데 해당 패키지에 있는 이유가 있나요?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mvp 패턴에 대해 잘 숙지하지 못해서 패키지를 어디에 분류할까 생각하다 넣었네요 .. 만약에 넣는다면 어디가 좋을까요 ??


</string-array>

</resources> No newline at end of file

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

고생하셨습니다. 확실히 영화를 검색하는 것에 있어 필터를 검색하는 것은 좋은 아이디어라고 생각합니다.
저는 기능적으로 모든 필터를 검사하는 것이 아닌, 검색한 결과에 대한 장르만 부분적으로 판별했으면 더 좋았을 것이라고 생각했습니다.
또한 resource에 값을 추가하고, HashMap으로도 관리했던 것 같은데,
두 가지를 더 간단하게 할 수 있는 방법은 없었을까? 생각했습니다.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

위에서 조언해주신대로 presenter에서 처리하는 방법을 생각해봐야겠네요

KaquiIOS added a commit to KaquiIOS/Mission_PullRequest_CodeReview that referenced this pull request Jan 19, 2019
boostcampth#2 NetworkUtil 을 생성 및 BroadcastReceiver 를 이용한 Network 상태 Observe
boostcampth#3 Strategy Pattern 을 이용한 현재 목록 정렬
   ( OS Version 에 따라 다른 로직 수행 )
boostcampth#4 BasePresenter 에 Detached Method 추가
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants