Skip to content

Commit

Permalink
Merge pull request #1 from UMC-5th-Notation/dev
Browse files Browse the repository at this point in the history
(리나)Feat: 정보등록1,2,3 화면 구현
  • Loading branch information
Dev-Corgi authored Jan 31, 2024
2 parents 7716644 + b1978c0 commit 4eb19e6
Show file tree
Hide file tree
Showing 29 changed files with 853 additions and 10 deletions.
1 change: 1 addition & 0 deletions .idea/.name

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions .idea/deploymentTargetDropDown.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions .idea/discord.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions .idea/migrations.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,14 @@ android {
kotlinOptions {
jvmTarget = "1.8"
}

buildFeatures {
viewBinding = true
}
}

dependencies {
implementation ("com.kakao.sdk:v2-user:2.19.0") // 카카오 로그인

implementation("androidx.core:core-ktx:1.9.0")
implementation("androidx.appcompat:appcompat:1.6.1")
Expand Down
25 changes: 24 additions & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">

<uses-permission android:name="android.permission.INTERNET" />

<application
android:name=".GlobalApplication"
android:allowBackup="true"
android:dataExtractionRules="@xml/data_extraction_rules"
android:fullBackupContent="@xml/backup_rules"
Expand All @@ -12,15 +15,35 @@
android:supportsRtl="true"
android:theme="@style/Theme.CampusNote"
tools:targetApi="31">

<activity android:name=".MainActivity"
android:exported="false"/>

<activity
android:name=".MainActivity"
android:name=".LoginActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>

<activity android:name="com.kakao.sdk.auth.AuthCodeHandlerActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />

<data android:host="oauth"
android:scheme="kakao3fb9a572bb1f2e3cd66d370d2f7888dd" />
</intent-filter>
</activity>

<activity android:name=".signUp.SignUpActivity"
android:exported="false"/>

</application>

</manifest>
18 changes: 18 additions & 0 deletions app/src/main/java/com/notation/campusnote/GlobalApplication.kt
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)}")
}
}
49 changes: 49 additions & 0 deletions app/src/main/java/com/notation/campusnote/LoginActivity.kt
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
}
}
Loading

0 comments on commit 4eb19e6

Please sign in to comment.