-
Notifications
You must be signed in to change notification settings - Fork 1
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
[Feature/#17] onboarding sensor #22
Conversation
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.
이남자 맛있다..
|
||
class OnboardingMeasureFragment : | ||
BaseFragment<FragmentOnboardingMeasureBinding>(R.layout.fragment_onboarding_measure), | ||
SensorEventListener { |
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.
리스너를 프래그먼트 선언부에 넣어주는 이유는 무엇인가요?
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.
리스너를 상속시켜서 onSensorChanged
와 같은 함수를 override하기 위함입니다~
sensorManager = requireContext().getSystemService(Context.SENSOR_SERVICE) as SensorManager | ||
stepDetectorSensor = sensorManager.getDefaultSensor(Sensor.TYPE_STEP_DETECTOR) |
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.
요 친구들도 함수화 따로 해주는건 어떠려나요 init으로?
그리고 as 사용 괜찮나요 이 과정? (진짜 모름)
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.
함수화 했습니다~ 자주 까먹네용
그리고 여기서 as사용하는건 괜차나요~~ Sensor Service를 반환하여 Manager로 바꿔주고 있기도 하고, Sensor관련으로 사용해주고 있어용
private fun initializeSensor() { | ||
sensorManager = requireContext().getSystemService(Context.SENSOR_SERVICE) as SensorManager | ||
stepDetectorSensor = sensorManager.getDefaultSensor(Sensor.TYPE_STEP_DETECTOR) | ||
} |
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.
오잉 아래 있는데 사용 안하신듯
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.
어머 걍 바보네요...
if (requestCode == 200) { | ||
if (grantResults.isNotEmpty() && grantResults[0] == PackageManager.PERMISSION_GRANTED) { | ||
initializeSensor() | ||
} else { | ||
// 사용자가 권한을 거부한 경우 처리 | ||
// 예: 사용자에게 권한의 필요성을 설명하는 다이얼로그 표시 | ||
} |
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.
200 const val로 상수화해주는게 좋음~ (사실 귀찮아서 안한거 알고있음 ㅋㅋ 코리용 ~)
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.
칫...
override fun onResume() { | ||
super.onResume() | ||
stepDetectorSensor?.let { | ||
sensorManager.registerListener(this, it, SensorManager.SENSOR_DELAY_NORMAL) | ||
} | ||
} | ||
|
||
override fun onPause() { | ||
super.onPause() | ||
sensorManager.unregisterListener(this) | ||
} |
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.
오 이렇게 되면 이 화면이 켜져있을 때에만 스텝이 세어지는 건가요? 1분동안 측정용이라서 그런가보네용
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.
넵넵 맞습니다! 우선은 1분만 하는거기도 해서 화면이 켜져있어야만 가능하도록 했어요
⛳️ Work Description
📢 To Reviewers