-
Notifications
You must be signed in to change notification settings - Fork 0
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
base: main
Are you sure you want to change the base?
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.
윤정이도 마지막 과제까지 넘 고생많았으~!! 체고다 체고!! 성장상승 가보자고!!
app:layout_constraintTop_toTopOf="parent" /> | ||
|
||
<TextView | ||
android:id="@+id/textView" |
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.
ㅋㅋ잡았다 요놈!
val intent = Intent(context,SignInActivity::class.java) | ||
startActivity(intent) | ||
activity?.finish() | ||
} | ||
} |
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.
Good!! 처리 잘해줬숨다 잘한다 짜란다!!
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.
수고하셨습니다. 👍
binding.btnNext.setOnClickListener { | ||
val intent = Intent(context, SignInActivity::class.java) | ||
startActivity(intent) | ||
activity?.finish() |
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.
activity보다는 저는 requireActivity()를 즐겨 씁니다. 이전에 이런 글을 봤는데, requireActivity()가 더 명시적인 예외를 발생시킨다고 하네요.
val intent = Intent(this, SignInActivity::class.java) | ||
startActivity(intent) |
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.
이렇게 구현하면 로그아웃을 하고 로그인 Activity를 열게 될 것입니다. 그런데 문제가 생길 수 있습니다. 로그인 화면으로 이동한 뒤 뒤로가기 버튼을 누르면 어떻게 될까요?
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") | ||
} | ||
}) | ||
} |
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.
다른 YB들 코드리뷰에서도 이야기하긴 했는데, 이 확장함수(Retrofit Call에 대한 확장함수)는 이 Activity에서만 쓰이는게 아니잖아요? 그래서 따로 파일에 구현을 빼놔도 좋을 것 같습니다.
settingactivity에서 뒤로가기 했을 때 종료되는거 수정함
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.
수고하셨습니다. 👍
@@ -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() |
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.
준원오빠가 알려주었습니다 👍 👍
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.
코드리뷰 받는거 말고 나도 해달라고 최윤정
@@ -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' |
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.
네비게이션 추가하셨구나
import com.example.num1.view.activity.HomeActivity | ||
import com.example.num1.view.activity.SignInActivity | ||
|
||
class SettingActivity : AppCompatActivity() { |
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.
BaseActivity 써보시는 거 추천드려욧 ㅎㅎ
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.
한번 써볼게요!
No description provided.