-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'feat/#4_wishList_select' into feat/#1
- Loading branch information
Showing
47 changed files
with
889 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,3 +13,7 @@ | |
.externalNativeBuild | ||
.cxx | ||
local.properties | ||
|
||
.idea/ | ||
api.properties | ||
manifest-api.properties |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package com.wish.bunny | ||
|
||
import android.app.Application | ||
/*import com.kakao.sdk.common.KakaoSdk | ||
import com.wish.bunny.BuildConfig.NATIVE_APP_KEY*/ | ||
|
||
/** | ||
작성자: 엄상은 | ||
처리 내용: 카카오 로그인 SDK 초기화 | ||
*/ | ||
class GlobalApplication : Application() { | ||
override fun onCreate() { | ||
super.onCreate() | ||
// Kakao SDK 초기화 | ||
// KakaoSdk.init(this, "${NATIVE_APP_KEY}") | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,45 @@ | ||
package com.wish.bunny | ||
|
||
import android.os.Bundle | ||
import com.google.android.material.bottomnavigation.BottomNavigationView | ||
import androidx.appcompat.app.AppCompatActivity | ||
import android.util.Log | ||
import com.kakao.sdk.common.util.Utility | ||
import com.wish.bunny.databinding.ActivityMainBinding | ||
import com.wish.bunny.friend.FriendFragment | ||
import com.wish.bunny.home.HomeFragment | ||
import com.wish.bunny.mypage.MypageFragment | ||
|
||
class MainActivity : AppCompatActivity() { | ||
private lateinit var binding: ActivityMainBinding | ||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
setContentView(R.layout.activity_main) | ||
binding = ActivityMainBinding.inflate(layoutInflater) // 뷰 바인딩 | ||
setContentView(binding.root) | ||
var keyhash = Utility.getKeyHash(this) | ||
Log.d("MainActivity", keyhash) | ||
|
||
binding.bottomNavi.run { setOnNavigationItemSelectedListener { | ||
when(it.itemId) { | ||
R.id.navi_home -> { | ||
// 다른 프래그먼트 화면으로 이동하는 기능 | ||
val homeFragment = HomeFragment() | ||
supportFragmentManager.beginTransaction().replace(R.id.fragment_container, homeFragment).commit() | ||
} | ||
R.id.navi_friend -> { | ||
val boardFragment = FriendFragment() | ||
supportFragmentManager.beginTransaction().replace(R.id.fragment_container, boardFragment).commit() | ||
} | ||
R.id.navi_mypage -> { | ||
val settingFragment = MypageFragment() | ||
supportFragmentManager.beginTransaction().replace(R.id.fragment_container, settingFragment).commit() | ||
} | ||
} | ||
true | ||
} | ||
selectedItemId = R.id.navi_home | ||
} | ||
} | ||
|
||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package com.wish.bunny.friend | ||
|
||
import android.os.Bundle | ||
import androidx.fragment.app.Fragment | ||
import android.view.LayoutInflater | ||
import android.view.View | ||
import android.view.ViewGroup | ||
import com.wish.bunny.R | ||
|
||
class FriendFragment : Fragment() { | ||
|
||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
} | ||
|
||
override fun onCreateView( | ||
inflater: LayoutInflater, container: ViewGroup?, | ||
savedInstanceState: Bundle? | ||
): View? { | ||
// Inflate the layout for this fragment | ||
return inflater.inflate(R.layout.fragment_friend, container, false) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package com.wish.bunny.home | ||
|
||
import android.os.Bundle | ||
import androidx.fragment.app.Fragment | ||
import android.view.LayoutInflater | ||
import android.view.View | ||
import android.view.ViewGroup | ||
import com.wish.bunny.R | ||
|
||
class HomeFragment : Fragment() { | ||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
} | ||
|
||
override fun onCreateView( | ||
inflater: LayoutInflater, container: ViewGroup?, | ||
savedInstanceState: Bundle? | ||
): View? { | ||
// Inflate the layout for this fragment | ||
return inflater.inflate(R.layout.fragment_friend, container, false) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
package com.wish.bunny.home | ||
|
||
import androidx.appcompat.app.AppCompatActivity | ||
import android.os.Bundle | ||
import android.util.Log | ||
import android.widget.ImageView | ||
import com.kakao.sdk.auth.model.OAuthToken | ||
import com.kakao.sdk.common.model.ClientError | ||
import com.kakao.sdk.common.model.ClientErrorCause | ||
import com.kakao.sdk.user.UserApiClient | ||
import com.wish.bunny.R | ||
|
||
/** | ||
작성자: 엄상은 | ||
처리 내용: 카카오 로그인 액티비티 | ||
*/ | ||
class LoginActivity : AppCompatActivity() { | ||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
setContentView(R.layout.activity_login) | ||
val kakaoLoginButton = findViewById<ImageView>(R.id.kakao_login) | ||
|
||
kakaoLoginButton.setOnClickListener { | ||
// 카카오계정으로 로그인 공통 callback 구성 | ||
// 카카오톡으로 로그인 할 수 없어 카카오계정으로 로그인할 경우 사용됨 | ||
val callback: (OAuthToken?, Throwable?) -> Unit = { token, error -> | ||
if (error != null) { | ||
Log.e("KAKAO LOGIN", "카카오계정으로 로그인 실패", error) | ||
} else if (token != null) { | ||
Log.i("KAKAO LOGIN", "카카오계정으로 로그인 성공 ${token.accessToken}") | ||
} | ||
} | ||
|
||
// 카카오톡이 설치되어 있으면 카카오톡으로 로그인, 아니면 카카오계정으로 로그인 | ||
if (UserApiClient.instance.isKakaoTalkLoginAvailable(this)) { | ||
UserApiClient.instance.loginWithKakaoTalk(this) { token, error -> | ||
if (error != null) { | ||
Log.e("KAKAO LOGIN", "카카오톡으로 로그인 실패", error) | ||
// 사용자가 카카오톡 설치 후 디바이스 권한 요청 화면에서 로그인을 취소한 경우, | ||
// 의도적인 로그인 취소로 보고 카카오계정으로 로그인 시도 없이 로그인 취소로 처리 (예: 뒤로 가기) | ||
if (error is ClientError && error.reason == ClientErrorCause.Cancelled) { | ||
return@loginWithKakaoTalk | ||
} | ||
// 카카오톡에 연결된 카카오계정이 없는 경우, 카카오계정으로 로그인 시도 | ||
UserApiClient.instance.loginWithKakaoAccount(this, callback = callback) | ||
} else if (token != null) { | ||
Log.i("KAKAO LOGIN", "카카오톡으로 로그인 성공 ${token.accessToken}") | ||
} | ||
} | ||
} else { | ||
UserApiClient.instance.loginWithKakaoAccount(this, callback = callback) | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package com.wish.bunny.mypage | ||
|
||
import android.os.Bundle | ||
import androidx.fragment.app.Fragment | ||
import android.view.LayoutInflater | ||
import android.view.View | ||
import android.view.ViewGroup | ||
import com.wish.bunny.R | ||
|
||
class MypageFragment : Fragment() { | ||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
} | ||
|
||
override fun onCreateView( | ||
inflater: LayoutInflater, container: ViewGroup?, | ||
savedInstanceState: Bundle? | ||
): View? { | ||
// Inflate the layout for this fragment | ||
return inflater.inflate(R.layout.fragment_friend, container, false) | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
app/src/main/java/com/wish/bunny/retrofit/RetrofitConnection.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package com.wish.bunny.retrofit | ||
|
||
import retrofit2.Retrofit | ||
import retrofit2.converter.gson.GsonConverterFactory | ||
|
||
/** | ||
작성자: 엄상은 | ||
처리 내용: 레트로핏 연결 설정 (싱글톤 객체) | ||
*/ | ||
class RetrofitConnection { | ||
companion object { | ||
private const val BASE_URL = "http://10.0.2.2:8080/" | ||
private var INSTANCE: Retrofit? = null | ||
|
||
fun getInstance(): Retrofit { | ||
if (INSTANCE == null) { | ||
INSTANCE = Retrofit.Builder() | ||
.baseUrl(BASE_URL) | ||
.addConverterFactory(GsonConverterFactory.create()) | ||
.build() | ||
} | ||
return INSTANCE!! | ||
} | ||
} | ||
} |
Oops, something went wrong.