-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
(리나)Feat: 정보등록1,2,3 화면 구현
- Loading branch information
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package com.notation.campusnote | ||
|
||
import android.app.Application | ||
import android.util.Log | ||
import com.kakao.sdk.common.KakaoSdk | ||
import com.kakao.sdk.common.util.Utility | ||
|
||
|
||
class GlobalApplication : Application() { | ||
override fun onCreate() { | ||
super.onCreate() | ||
|
||
//Kakao SDK 초기화 | ||
KakaoSdk.init(this, "3fb9a572bb1f2e3cd66d370d2f7888dd") | ||
|
||
Log.d("hash", "keyhash : ${Utility.getKeyHash(this)}") | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package com.notation.campusnote | ||
|
||
import android.os.Bundle | ||
import android.util.Log | ||
import androidx.appcompat.app.AppCompatActivity | ||
import com.notation.campusnote.databinding.ActivityLoginBinding | ||
import com.kakao.sdk.auth.model.OAuthToken | ||
import com.kakao.sdk.user.UserApiClient | ||
|
||
class LoginActivity :AppCompatActivity(){ | ||
private val TAG = "KakaoLoginExample" | ||
private lateinit var binding: ActivityLoginBinding | ||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
binding = ActivityLoginBinding.inflate(layoutInflater) | ||
setContentView(binding.root) | ||
|
||
binding.kakaoLoginButton.setOnClickListener { | ||
login() | ||
} | ||
} | ||
|
||
private fun login() { | ||
// 카카오계정으로 로그인 공통 콜백 설정 | ||
val callback: (OAuthToken?, Throwable?) -> Unit = { token, error -> | ||
if (error != null) { | ||
Log.e(TAG, "카카오계정으로 로그인 실패", error) | ||
} else if (token != null) { | ||
Log.i(TAG, "카카오계정으로 로그인 성공 ${token.accessToken}") | ||
} | ||
} | ||
|
||
// 카카오톡이 설치되어 있으면 카카오톡으로 로그인, 아니면 카카오계정으로 로그인 | ||
if (UserApiClient.instance.isKakaoTalkLoginAvailable(this)) { | ||
UserApiClient.instance.loginWithKakaoTalk(this) { token, error -> | ||
if (error != null) { | ||
Log.e(TAG, "카카오톡으로 로그인 실패", error) | ||
|
||
// 특정 상황(취소 등)에 대한 처리 추가 | ||
} else if (token != null) { | ||
Log.i(TAG, "카카오톡으로 로그인 성공 ${token.accessToken}") | ||
// 성공적인 로그인 처리 추가 | ||
} | ||
} | ||
} else { | ||
UserApiClient.instance.loginWithKakaoAccount(this, callback = callback) | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
package com.notation.campusnote.signUp | ||
|
||
import android.os.Bundle | ||
import androidx.fragment.app.Fragment | ||
import android.view.LayoutInflater | ||
import android.view.View | ||
import android.view.ViewGroup | ||
import com.notation.campusnote.R | ||
import com.notation.campusnote.databinding.FragmentSignUp1Binding | ||
|
||
class SignUp1Fragment : Fragment() { | ||
private var _binding: FragmentSignUp1Binding? = null | ||
// This property is only valid between onCreateView and | ||
// onDestroyView. | ||
private val binding get() = _binding!! | ||
|
||
override fun onCreateView( | ||
inflater: LayoutInflater, container: ViewGroup?, | ||
savedInstanceState: Bundle? | ||
): View? { | ||
_binding = FragmentSignUp1Binding.inflate(inflater, container, false) | ||
|
||
// // 다음 버튼 클릭 리스너 안에서 | ||
// binding.signUp1NextBtn.setOnClickListener { | ||
// // signUp2Fragment 인스턴스 생성 | ||
// val signUp2Fragment = SignUp2Fragment() | ||
// | ||
// // Activity에서 FragmentManager를 가져와서 트랜잭션 시작 | ||
// activity?.supportFragmentManager?.beginTransaction()?.apply { | ||
// // FrameLayout에 SignUp2Fragment 교체 | ||
// replace(R.id.sign_up_frame, signUp2Fragment) | ||
// // 트랜잭션을 백 스택에 추가 | ||
// addToBackStack(null) | ||
// // 트랜잭션 커밋 | ||
// commit() | ||
// } | ||
// } | ||
|
||
return binding.root | ||
} | ||
|
||
override fun onResume() { | ||
super.onResume() | ||
(activity as? OnFragmentInteractionListener)?.onFirstFragmentShown(true) | ||
} | ||
|
||
override fun onDestroyView() { | ||
super.onDestroyView() | ||
_binding = null | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package com.notation.campusnote.signUp | ||
|
||
import android.os.Bundle | ||
import androidx.fragment.app.Fragment | ||
import android.view.LayoutInflater | ||
import android.view.View | ||
import android.view.ViewGroup | ||
import com.notation.campusnote.R | ||
import com.notation.campusnote.databinding.FragmentSignUp2Binding | ||
|
||
class SignUp2Fragment : Fragment() { | ||
private var _binding: FragmentSignUp2Binding? = null | ||
private val binding get() = _binding!! | ||
override fun onCreateView( | ||
inflater: LayoutInflater, container: ViewGroup?, | ||
savedInstanceState: Bundle? | ||
): View? { | ||
_binding = FragmentSignUp2Binding.inflate(inflater, container, false) | ||
|
||
// // 다음 버튼 클릭 리스너 안에서 | ||
// binding.signUp2NextBtn.setOnClickListener { | ||
// // signUp3Fragment 인스턴스 생성 | ||
// val signUp3Fragment = SignUp3Fragment() | ||
// | ||
// // Activity에서 FragmentManager를 가져와서 트랜잭션 시작 | ||
// activity?.supportFragmentManager?.beginTransaction()?.apply { | ||
// // FrameLayout에 SignUp2Fragment 교체 | ||
// replace(R.id.sign_up_frame, signUp3Fragment) | ||
// // 트랜잭션을 백 스택에 추가 | ||
// addToBackStack(null) | ||
// // 트랜잭션 커밋 | ||
// commit() | ||
// } | ||
// } | ||
|
||
return binding.root | ||
} | ||
|
||
override fun onResume() { | ||
super.onResume() | ||
(activity as? SignUpActivity)?.onFragmentInteraction(isFinalFragment = false) | ||
(activity as? OnFragmentInteractionListener)?.onFirstFragmentShown(false) | ||
} | ||
|
||
override fun onDestroyView() { | ||
super.onDestroyView() | ||
_binding = null | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package com.notation.campusnote.signUp | ||
|
||
import android.os.Bundle | ||
import androidx.fragment.app.Fragment | ||
import android.view.LayoutInflater | ||
import android.view.View | ||
import android.view.ViewGroup | ||
import com.notation.campusnote.R | ||
import com.notation.campusnote.databinding.FragmentSignUp3Binding | ||
|
||
class SignUp3Fragment : Fragment() { | ||
private var _binding: FragmentSignUp3Binding? = null | ||
private val binding get() = _binding!! | ||
override fun onCreateView( | ||
inflater: LayoutInflater, container: ViewGroup?, | ||
savedInstanceState: Bundle? | ||
): View? { | ||
_binding = FragmentSignUp3Binding.inflate(inflater, container, false) | ||
return binding.root | ||
} | ||
|
||
override fun onResume() { | ||
super.onResume() | ||
(activity as? SignUpActivity)?.onFragmentInteraction(isFinalFragment = false) | ||
(activity as? OnFragmentInteractionListener)?.onFirstFragmentShown(false) | ||
} | ||
|
||
override fun onDestroyView() { | ||
super.onDestroyView() | ||
_binding = null | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package com.notation.campusnote.signUp | ||
|
||
import android.os.Bundle | ||
import androidx.fragment.app.Fragment | ||
import android.view.LayoutInflater | ||
import android.view.View | ||
import android.view.ViewGroup | ||
import com.notation.campusnote.R | ||
import com.notation.campusnote.databinding.FragmentSignUp4Binding | ||
|
||
class SignUp4Fragment : Fragment() { | ||
private var _binding: FragmentSignUp4Binding? = null | ||
private val binding get() = _binding!! | ||
|
||
override fun onCreateView( | ||
inflater: LayoutInflater, container: ViewGroup?, | ||
savedInstanceState: Bundle? | ||
): View? { | ||
_binding = FragmentSignUp4Binding.inflate(inflater, container, false) | ||
return binding.root | ||
} | ||
|
||
override fun onResume() { | ||
super.onResume() | ||
(activity as? SignUpActivity)?.onFragmentInteraction(isFinalFragment = true) | ||
(activity as? OnFragmentInteractionListener)?.onFirstFragmentShown(false) | ||
} | ||
|
||
override fun onDestroyView() { | ||
super.onDestroyView() | ||
_binding = null | ||
} | ||
} |