Skip to content
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

스터디 찾기 분류 조건 설정 후 제거시 제대로된 데이터가 나오지않음 #9

Open
ss99x2002 opened this issue Aug 20, 2022 · 1 comment

Comments

@ss99x2002
Copy link
Member

ss99x2002 commented Aug 20, 2022

스터디 찾기 분류 조건 설정 후 제거시 제대로된 데이터가 나오지않음

@ss99x2002
Copy link
Member Author

ss99x2002 commented Aug 20, 2022

최초 스터디 찾기 실행시에는 아무 조건이 없다.
따라서 분류 조건의 인덱스가 0일때 데이터가 아예 로드되지 않도록 조건문을 설정했다.
하지만 분류 조건을 사용자가 여러번 바꾸면서 분류조건을 제거시 0일때도 데이터가 로드되어야 하므로 spinner의 최초실행때 onselected position이 적용되지 않도록 search filter 상수를 이용했다.

코드는 다음과 같다.

spinnerInterest1.onItemSelectedListener = object : AdapterView.OnItemSelectedListener{
                    override fun onItemSelected(p0: AdapterView<*>?, p1: View?, position: Int, p3: Long) {
                        if (searchFilter == 1)
                        {
                            if (position == 0)
                            {
                                select_interest1=null
                                loadData(search_title,select_region, select_interest1, select_interest2, select_sort)
                                initScrollListener()
                            }
                            else
                            {
                                select_interest1=position
                                loadData(search_title,select_region, select_interest1, select_interest2, select_sort)
                                initScrollListener()
                            }
                        }
                    }
                    override fun onNothingSelected(p0: AdapterView<*>?) {
                    }
                }
spinnerInterest1.setOnTouchListener(OnTouchListener{ v, event ->
                    searchFilter =1
                    false
                })

사용자가 spinner를 터치해야하만 position 반영이 되도록 수정하였다.

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

No branches or pull requests

1 participant