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

[Feature/#17] onboarding sensor #22

Merged
merged 6 commits into from
Jul 30, 2024
Merged

Conversation

chattymin
Copy link
Member

@chattymin chattymin commented Jul 30, 2024

⛳️ Work Description

  • 속도 및 보행량 관련 기능 구현
  • sensor 연결

📢 To Reviewers

  • api까지 연결하려 했는데 생각해보니 로그인이 돼야 다른게 되더라구요
  • 후딱 로그인부터 해버리겠습니다!
  • 오메 로띠땜에 줄 수 뻥튀기 됐네요 ㅋㅋ

Copy link
Member

@Marchbreeze Marchbreeze left a 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 {
Copy link
Member

Choose a reason for hiding this comment

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

리스너를 프래그먼트 선언부에 넣어주는 이유는 무엇인가요?

Copy link
Member Author

Choose a reason for hiding this comment

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

리스너를 상속시켜서 onSensorChanged와 같은 함수를 override하기 위함입니다~

Comment on lines +33 to +34
sensorManager = requireContext().getSystemService(Context.SENSOR_SERVICE) as SensorManager
stepDetectorSensor = sensorManager.getDefaultSensor(Sensor.TYPE_STEP_DETECTOR)
Copy link
Member

Choose a reason for hiding this comment

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

요 친구들도 함수화 따로 해주는건 어떠려나요 init으로?
그리고 as 사용 괜찮나요 이 과정? (진짜 모름)

Copy link
Member Author

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관련으로 사용해주고 있어용

Comment on lines 59 to 62
private fun initializeSensor() {
sensorManager = requireContext().getSystemService(Context.SENSOR_SERVICE) as SensorManager
stepDetectorSensor = sensorManager.getDefaultSensor(Sensor.TYPE_STEP_DETECTOR)
}
Copy link
Member

Choose a reason for hiding this comment

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

오잉 아래 있는데 사용 안하신듯

Copy link
Member Author

Choose a reason for hiding this comment

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

어머 걍 바보네요...

Comment on lines 70 to 76
if (requestCode == 200) {
if (grantResults.isNotEmpty() && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
initializeSensor()
} else {
// 사용자가 권한을 거부한 경우 처리
// 예: 사용자에게 권한의 필요성을 설명하는 다이얼로그 표시
}
Copy link
Member

Choose a reason for hiding this comment

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

200 const val로 상수화해주는게 좋음~ (사실 귀찮아서 안한거 알고있음 ㅋㅋ 코리용 ~)

Copy link
Member Author

Choose a reason for hiding this comment

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

칫...

Comment on lines +80 to +90
override fun onResume() {
super.onResume()
stepDetectorSensor?.let {
sensorManager.registerListener(this, it, SensorManager.SENSOR_DELAY_NORMAL)
}
}

override fun onPause() {
super.onPause()
sensorManager.unregisterListener(this)
}
Copy link
Member

Choose a reason for hiding this comment

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

오 이렇게 되면 이 화면이 켜져있을 때에만 스텝이 세어지는 건가요? 1분동안 측정용이라서 그런가보네용

Copy link
Member Author

Choose a reason for hiding this comment

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

넵넵 맞습니다! 우선은 1분만 하는거기도 해서 화면이 켜져있어야만 가능하도록 했어요

@chattymin chattymin merged commit e9c6f6e into develop Jul 30, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[FEATURE] Onboarding / 걸음 속도 측정
2 participants