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

Seminar7 #6

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
Open

Seminar7 #6

wants to merge 10 commits into from

Conversation

cbj0010
Copy link
Contributor

@cbj0010 cbj0010 commented Jun 10, 2022

No description provided.

Copy link
Member

@papajj06 papajj06 left a comment

Choose a reason for hiding this comment

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

윤정이도 마지막 과제까지 넘 고생많았으~!! 체고다 체고!! 성장상승 가보자고!!

app:layout_constraintTop_toTopOf="parent" />

<TextView
android:id="@+id/textView"
Copy link
Member

Choose a reason for hiding this comment

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

ㅋㅋ잡았다 요놈!

Comment on lines 31 to 35
val intent = Intent(context,SignInActivity::class.java)
startActivity(intent)
activity?.finish()
}
}
Copy link
Member

Choose a reason for hiding this comment

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

Good!! 처리 잘해줬숨다 잘한다 짜란다!!

Copy link

@hansh0101 hansh0101 left a comment

Choose a reason for hiding this comment

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

수고하셨습니다. 👍

binding.btnNext.setOnClickListener {
val intent = Intent(context, SignInActivity::class.java)
startActivity(intent)
activity?.finish()

Choose a reason for hiding this comment

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

activity보다는 저는 requireActivity()를 즐겨 씁니다. 이전에 이런 글을 봤는데, requireActivity()가 더 명시적인 예외를 발생시킨다고 하네요.

https://stackoverflow.com/questions/61045573/what-is-the-difference-between-requireactivity-and-onactivitycreated

Comment on lines 25 to 26
val intent = Intent(this, SignInActivity::class.java)
startActivity(intent)

Choose a reason for hiding this comment

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

이렇게 구현하면 로그아웃을 하고 로그인 Activity를 열게 될 것입니다. 그런데 문제가 생길 수 있습니다. 로그인 화면으로 이동한 뒤 뒤로가기 버튼을 누르면 어떻게 될까요?

Comment on lines +65 to +82
fun <ResponseType> Call<ResponseType>.enqueueUtil(
onSuccess: (ResponseType) -> Unit,
onError: ((stateCode: Int) -> Unit)? = null
) {
this.enqueue(object : Callback<ResponseType> {
override fun onResponse(call: Call<ResponseType>, response: Response<ResponseType>) {
if (response.isSuccessful) {
onSuccess.invoke(response.body() ?: return)
} else {
onError?.invoke(response.code())
}
}

override fun onFailure(call: Call<ResponseType>, t: Throwable) {
Log.d("NetworkTest", "error: $t")
}
})
}

Choose a reason for hiding this comment

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

다른 YB들 코드리뷰에서도 이야기하긴 했는데, 이 확장함수(Retrofit Call에 대한 확장함수)는 이 Activity에서만 쓰이는게 아니잖아요? 그래서 따로 파일에 구현을 빼놔도 좋을 것 같습니다.

settingactivity에서 뒤로가기 했을 때 종료되는거 수정함
Copy link

@hansh0101 hansh0101 left a comment

Choose a reason for hiding this comment

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

수고하셨습니다. 👍

@@ -23,6 +24,7 @@ class SettingActivity : AppCompatActivity() {
LOGINSharedPreferences.setLogin(this)
Toast.makeText(this, "자동로그인이 해제되었습니다.", Toast.LENGTH_SHORT).show()
val intent = Intent(this, SignInActivity::class.java)
finishAffinity()

Choose a reason for hiding this comment

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

오 최근에 이런 코드를 짰어야해서 찾아보고 짜긴 했는데 이런 메서드는 처음 보네요 저도 한 수 배워갑니다. 👍

Copy link
Contributor Author

Choose a reason for hiding this comment

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

준원오빠가 알려주었습니다 👍 👍

Copy link
Member

@uxri uxri left a comment

Choose a reason for hiding this comment

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

코드리뷰 받는거 말고 나도 해달라고 최윤정

@@ -39,6 +39,9 @@ dependencies {
implementation "com.squareup.retrofit2:converter-gson:2.9.0"
implementation "com.google.code.gson:gson:2.8.6"

implementation 'androidx.navigation:navigation-fragment-ktx:2.4.2'
implementation 'androidx.navigation:navigation-ui-ktx:2.4.2'
Copy link
Member

Choose a reason for hiding this comment

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

네비게이션 추가하셨구나

import com.example.num1.view.activity.HomeActivity
import com.example.num1.view.activity.SignInActivity

class SettingActivity : AppCompatActivity() {
Copy link
Member

Choose a reason for hiding this comment

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

BaseActivity 써보시는 거 추천드려욧 ㅎㅎ

Copy link
Contributor Author

Choose a reason for hiding this comment

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

한번 써볼게요!

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.

4 participants