diff --git a/app/build.gradle b/app/build.gradle index ef8934d..6c7146e 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -15,6 +15,7 @@ android { versionName "1.0" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" + } buildTypes { @@ -30,6 +31,9 @@ android { kotlinOptions { jvmTarget = '17' } + buildFeatures { + viewBinding true + } } dependencies { @@ -38,6 +42,7 @@ dependencies { implementation 'androidx.appcompat:appcompat:1.6.1' implementation 'com.google.android.material:material:1.11.0' implementation 'androidx.constraintlayout:constraintlayout:2.1.4' + implementation 'androidx.recyclerview:recyclerview:1.3.2' testImplementation 'junit:junit:4.13.2' androidTestImplementation 'androidx.test.ext:junit:1.1.5' androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1' diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 3b8f448..042b163 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -13,14 +13,28 @@ android:theme="@style/Theme.NOWSOPTAndroid" tools:targetApi="31"> + + + + + + + + \ No newline at end of file diff --git a/app/src/main/java/com/sopt/now/Activity/HomeActivity.kt b/app/src/main/java/com/sopt/now/Activity/HomeActivity.kt new file mode 100644 index 0000000..f22c8b2 --- /dev/null +++ b/app/src/main/java/com/sopt/now/Activity/HomeActivity.kt @@ -0,0 +1,75 @@ +package com.sopt.now.Activity + +import android.os.Bundle +import android.util.Log +import androidx.appcompat.app.AppCompatActivity +import androidx.fragment.app.Fragment +import com.sopt.now.Fragment.HomeFragment +import com.sopt.now.Fragment.MyPageFragment +import com.sopt.now.Fragment.SearchFragment +import com.sopt.now.R +import com.sopt.now.databinding.ActivityHomeBinding +class HomeActivity : AppCompatActivity() { + private lateinit var binding: ActivityHomeBinding + private val nameId="ID" + private val namePassword = "PASSWORD" + private val nameNickname = "NICKNAME" + private val nameMbti = "MBTI" + + private lateinit var userId: String + private lateinit var userPassword: String + private lateinit var userNickname: String + private lateinit var userMbti: String + + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + binding = ActivityHomeBinding.inflate(layoutInflater) + setContentView(binding.root) + + Log.d("HomeActivity","HomeActivity onCreate") + + + userId = intent.getStringExtra(nameId).toString() + userPassword = intent.getStringExtra(namePassword).toString() + userNickname = intent.getStringExtra(nameNickname).toString() + userMbti = intent.getStringExtra(nameMbti).toString() + + clickBottomNavigation() + + val currentFragment = supportFragmentManager.findFragmentById(binding.fcvHome.id) + if (currentFragment == null) { + supportFragmentManager.beginTransaction() + .add(binding.fcvHome.id, HomeFragment(userNickname)) + .commit() + } + } + + private fun clickBottomNavigation() { + binding.bnvHome.setOnItemSelectedListener { + when (it.itemId) { + R.id.menu_home -> { + replaceFragment(HomeFragment(userNickname)) + true + } + + R.id.menu_search -> { + replaceFragment(SearchFragment()) + true + } + + R.id.menu_mypage -> { + replaceFragment(MyPageFragment(userId,userPassword,userNickname,userMbti)) + true + } + + else -> false + } + } + } + + private fun replaceFragment(fragment: Fragment) { + supportFragmentManager.beginTransaction() + .replace(binding.fcvHome.id, fragment) + .commit() + } +} diff --git a/app/src/main/java/com/sopt/now/Activity/LoginActivity.kt b/app/src/main/java/com/sopt/now/Activity/LoginActivity.kt new file mode 100644 index 0000000..5bcac09 --- /dev/null +++ b/app/src/main/java/com/sopt/now/Activity/LoginActivity.kt @@ -0,0 +1,75 @@ +package com.sopt.now.Activity + + +import android.content.Intent +import android.os.Bundle +import android.util.Log +import androidx.appcompat.app.AppCompatActivity +import com.google.android.material.snackbar.Snackbar +import com.sopt.now.databinding.ActivityLoginBinding + +class LoginActivity : AppCompatActivity() { + private lateinit var binding: ActivityLoginBinding + private val nameId = "ID" + private val namePassword = "PASSWORD" + private val nameNickname = "NICKNAME" + private val nameMbti = "MBTI" + + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + binding = ActivityLoginBinding.inflate(layoutInflater) + setContentView(binding.root) + + val id = intent.getStringExtra(nameId) + val password = intent.getStringExtra(namePassword) + val nickname = intent.getStringExtra(nameNickname) + val mbti = intent.getStringExtra(nameMbti) + + + binding.loginBtn.setOnClickListener { + val enteredId = binding.editTextId.text.toString() + val enteredPassword = binding.editTextPw.text.toString() + + when { + enteredId != id -> { + Snackbar.make( + binding.root, + "아이디를 확인하세요.", + Snackbar.LENGTH_SHORT + ).show() + } + + enteredPassword != password -> { + Snackbar.make( + binding.root, + "비밀번호를 확인하세요.", + Snackbar.LENGTH_SHORT + ).show() + } + + else -> { + Log.d("Login Success", "Login Success") + val intentHome = Intent(this, HomeActivity::class.java).apply { + putExtra(nameId, id) + putExtra(namePassword, password) + putExtra(nameNickname, nickname) + putExtra(nameMbti, mbti) + } + Snackbar.make( + binding.root, + "로그인 성공!", + Snackbar.LENGTH_SHORT + ).show() + startActivity(intentHome) + + } + } + + } + binding.goSignupBtn.setOnClickListener { + val intentSignup = Intent(this, SignUpActivity::class.java) + startActivity(intentSignup) + } + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/sopt/now/Activity/MainActivity.kt b/app/src/main/java/com/sopt/now/Activity/MainActivity.kt new file mode 100644 index 0000000..cbe42ea --- /dev/null +++ b/app/src/main/java/com/sopt/now/Activity/MainActivity.kt @@ -0,0 +1,77 @@ +package com.sopt.now.Activity + +import android.os.Bundle +import androidx.appcompat.app.AppCompatActivity +import com.google.android.material.snackbar.Snackbar +import com.sopt.now.R +import com.sopt.now.databinding.ActivityMainBinding + +class MainActivity : AppCompatActivity() { + private lateinit var binding: ActivityMainBinding + private val nameId="ID" + private val namePassword = "PASSWORD" + private val nameNickname = "NICKNAME" + private val nameMbti = "MBTI" + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + binding = ActivityMainBinding.inflate(layoutInflater) //TODO: inflate 두 번 하면 오류 공부 + setContentView(binding.root) + + + + val id = intent.getStringExtra(nameId) + val password = intent.getStringExtra(namePassword) + val nickname = intent.getStringExtra(nameNickname) + val mbti = intent.getStringExtra(nameMbti) + + Snackbar.make( + binding.root, + "로그인 성공!", + Snackbar.LENGTH_SHORT + ).show() + + + binding.textNickname.text = getString(R.string.nickname,nickname) + binding.textMbti.text = getString(R.string.mbti,mbti) + binding.textId.text="$id" + binding.textPw.text="$password" + + + + val mbtiImageName = mbti?.lowercase() + ".png" + val mbtiImageId = mbtiImageName.let { resources.getIdentifier(it, "drawable", packageName) } + // TODO: getIdentifier 말고 다른 방법으로 파일 찾아보기 + if (mbtiImageId != 0) { + binding.imageMbti.setImageResource(mbtiImageId) + + } + + val mbtiDescriptionMap = mapOf( + "ISFP" to R.string.isfp, + "ISFJ" to R.string.isfj, + "ISTP" to R.string.istp, + "ISTJ" to R.string.istj, + "INFP" to R.string.infp, + "INFJ" to R.string.infj, + "INTP" to R.string.intp, + "INTJ" to R.string.intj, + "ESFP" to R.string.esfp, + "ESFJ" to R.string.esfj, + "ESTP" to R.string.estp, + "ESTJ" to R.string.estj, + "ENFP" to R.string.enfp, + "ENFJ" to R.string.enfj, + "ENTP" to R.string.entp, + "ENTJ" to R.string.entj + + ) + + val mbtiDescriptionResId = mbti?.let { mbtiDescriptionMap[it] } + + + val mbtiDescription = mbtiDescriptionResId?.let { getString(it) } ?: getString(R.string.default_description) + + binding.textMbtiDes.text = mbtiDescription + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/sopt/now/Activity/SignUpActivity.kt b/app/src/main/java/com/sopt/now/Activity/SignUpActivity.kt new file mode 100644 index 0000000..872b1b7 --- /dev/null +++ b/app/src/main/java/com/sopt/now/Activity/SignUpActivity.kt @@ -0,0 +1,81 @@ +package com.sopt.now.Activity + +import android.content.Intent +import android.os.Bundle +import androidx.appcompat.app.AppCompatActivity +import com.google.android.material.snackbar.Snackbar +import com.sopt.now.databinding.ActivitySignUpBinding + +class SignUpActivity : AppCompatActivity() { + private lateinit var binding: ActivitySignUpBinding + private val nameId="ID" + private val namePassword = "PASSWORD" + private val nameNickname = "NICKNAME" + private val nameMbti = "MBTI" + + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + binding = ActivitySignUpBinding.inflate(layoutInflater) + setContentView(binding.root) + + + binding.signupBtn.setOnClickListener { + val mbtiInput = binding.editTextMbti.text.toString().uppercase() + + val id = binding.editTextId.text.toString() + val password = binding.editTextPw.text.toString() + val nickname = binding.editTextNn.text.toString() + val mbti = binding.editTextMbti.text.toString().uppercase() + + when { + id.length !in 6..10 -> { + Snackbar.make( + binding.root, + "ID는 6~10글자여야 합니다.", + Snackbar.LENGTH_SHORT + ).show() + } + password.length !in 8..12 -> { + Snackbar.make( + binding.root, + "Password는 8~12글자여야 합니다.", + Snackbar.LENGTH_SHORT + ).show() + } + nickname.isEmpty() -> { + Snackbar.make( + binding.root, + "닉네임은 한 글자 이상이어야 합니다.", + Snackbar.LENGTH_SHORT + ).show() + } + mbtiInput.length != 4 || !validMBTI(mbtiInput) -> { + Snackbar.make( + binding.root, + "MBTI 형식이 올바르지 않습니다. (E/I, S/N, F/T, P/J)", + Snackbar.LENGTH_SHORT + ).show() + } + else -> { + val intent = Intent(this, LoginActivity::class.java).apply { + putExtra(nameId, id) + putExtra(namePassword, password) + putExtra(nameNickname, nickname) + putExtra(nameMbti, mbti) + } + Snackbar.make( + binding.root, + "회원가입 성공", + Snackbar.LENGTH_SHORT + ).show() + startActivity(intent) + } + } + } + } +} + +fun validMBTI(mbti:String):Boolean{ + val validMBTIPattern = Regex("[EI][SN][TF][JP]") + return validMBTIPattern.matches(mbti) +} diff --git a/app/src/main/java/com/sopt/now/Adapter/FriendAdapter.kt b/app/src/main/java/com/sopt/now/Adapter/FriendAdapter.kt new file mode 100644 index 0000000..34b690c --- /dev/null +++ b/app/src/main/java/com/sopt/now/Adapter/FriendAdapter.kt @@ -0,0 +1,29 @@ +package com.sopt.now.Adapter + +import android.view.LayoutInflater +import android.view.ViewGroup +import androidx.recyclerview.widget.RecyclerView +import com.sopt.now.DataFile.Friend +import com.sopt.now.ViewHolder.FriendViewHolder +import com.sopt.now.databinding.ItemFriendBinding + +class FriendAdapter : RecyclerView.Adapter() { + private var friendList: List = emptyList() + + override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): FriendViewHolder { + val inflater = LayoutInflater.from(parent.context) + val binding = ItemFriendBinding.inflate(inflater, parent, false) + return FriendViewHolder(binding) + } + + override fun onBindViewHolder(holder: FriendViewHolder, position: Int) { + holder.onBind(friendList[position]) + } + + override fun getItemCount() = friendList.size + + fun setFriendList(friendList: List) { + this.friendList = friendList.toList() + notifyDataSetChanged() + } +} \ No newline at end of file diff --git a/app/src/main/java/com/sopt/now/Adapter/MyProfileAdapter.kt b/app/src/main/java/com/sopt/now/Adapter/MyProfileAdapter.kt new file mode 100644 index 0000000..3ca26f9 --- /dev/null +++ b/app/src/main/java/com/sopt/now/Adapter/MyProfileAdapter.kt @@ -0,0 +1,31 @@ +package com.sopt.now.Adapter + +import android.view.LayoutInflater +import android.view.ViewGroup +import androidx.recyclerview.widget.RecyclerView +import com.sopt.now.DataFile.MyProfile +import com.sopt.now.ViewHolder.MyProfileHolder +import com.sopt.now.databinding.ItemMyprofileBinding + +class MyProfileAdapter : RecyclerView.Adapter() { + // 임시의 빈 리스트 + private var myprofile: List = emptyList() + + + override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): MyProfileHolder { + val inflater = LayoutInflater.from(parent.context) + val binding = ItemMyprofileBinding.inflate(inflater, parent, false) + return MyProfileHolder(binding) + } + + override fun onBindViewHolder(holder: MyProfileHolder, position: Int) { + holder.onBind(myprofile[position]) + } + + override fun getItemCount() = myprofile.size + + fun setMyProfile(myprofile: List) { + this.myprofile = myprofile.toList() + notifyDataSetChanged() + } +} \ No newline at end of file diff --git a/app/src/main/java/com/sopt/now/DataFile/Friend.kt b/app/src/main/java/com/sopt/now/DataFile/Friend.kt new file mode 100644 index 0000000..4dd7696 --- /dev/null +++ b/app/src/main/java/com/sopt/now/DataFile/Friend.kt @@ -0,0 +1,9 @@ +package com.sopt.now.DataFile + +import androidx.annotation.DrawableRes + +data class Friend( + @DrawableRes val profileImage: Int, + val name: String, + val selfDescription: String, +) \ No newline at end of file diff --git a/app/src/main/java/com/sopt/now/DataFile/MyProfile.kt b/app/src/main/java/com/sopt/now/DataFile/MyProfile.kt new file mode 100644 index 0000000..74aafd1 --- /dev/null +++ b/app/src/main/java/com/sopt/now/DataFile/MyProfile.kt @@ -0,0 +1,9 @@ +package com.sopt.now.DataFile + +import androidx.annotation.DrawableRes + +data class MyProfile( + @DrawableRes val profileImage: Int, + val name: String, + val selfDescription: String, +) \ No newline at end of file diff --git a/app/src/main/java/com/sopt/now/Fragment/HomeFragment.kt b/app/src/main/java/com/sopt/now/Fragment/HomeFragment.kt new file mode 100644 index 0000000..4765a1a --- /dev/null +++ b/app/src/main/java/com/sopt/now/Fragment/HomeFragment.kt @@ -0,0 +1,180 @@ +package com.sopt.now.Fragment + +import android.os.Bundle +import android.view.LayoutInflater +import android.view.View +import android.view.ViewGroup +import androidx.fragment.app.Fragment +import androidx.recyclerview.widget.ConcatAdapter +import androidx.recyclerview.widget.LinearLayoutManager +import com.sopt.now.Adapter.FriendAdapter +import com.sopt.now.Adapter.MyProfileAdapter +import com.sopt.now.DataFile.Friend +import com.sopt.now.DataFile.MyProfile +import com.sopt.now.R +import com.sopt.now.databinding.FragmentHomeBinding + +class HomeFragment(userncikname: String) : Fragment() { + private var _binding: FragmentHomeBinding? = null + private val binding: FragmentHomeBinding + get() = requireNotNull(_binding) { + "바인딩 객체 생성 완료" + } + + override fun onCreateView( + inflater: LayoutInflater, + container: ViewGroup?, + savedInstanceState: Bundle? + ): View { + _binding = FragmentHomeBinding.inflate(inflater, container, false) + return binding.root + } + + override fun onViewCreated(view: View, savedInstanceState: Bundle?) { + super.onViewCreated(view, savedInstanceState) + val myprofileAdapter = MyProfileAdapter() + val friendAdapter = FriendAdapter() + + + val concatAdapter = ConcatAdapter(myprofileAdapter, friendAdapter) + + + binding.rvFriends.run { + adapter = concatAdapter + layoutManager = LinearLayoutManager(requireContext()) + } + myprofileAdapter.setMyProfile(myProfile) + friendAdapter.setFriendList(mockFriendList) + + } + + override fun onDestroyView() { + super.onDestroyView() + _binding = null + } + + private val myProfile = listOf( + MyProfile( + profileImage = R.drawable.baseline_person_outline_24, + name = userncikname, + selfDescription = "내 프로필 소개 텍스트" + ) + ) + val friendIcon = R.drawable.baseline_person_24 + + private val mockFriendList = listOf( + Friend( + profileImage = friendIcon, + name = "강문수", + selfDescription = "34기 안드로이드 YB", + ), Friend( + profileImage = friendIcon, + name = "공세영", + selfDescription = "34기 안드로이드 YB", + ), Friend( + profileImage = friendIcon, + name = "김명석", + selfDescription = "34기 안드로이드 YB", + ), Friend( + profileImage = friendIcon, + name = "김아린", + selfDescription = "34기 안드로이드 YB", + ), Friend( + profileImage = friendIcon, + name = "김언지", + selfDescription = "34기 안드로이드 OB", + ), Friend( + profileImage = friendIcon, + name = "김윤서", + selfDescription = "34기 안드로이드 YB", + ), Friend( + profileImage = friendIcon, + name = "박동민", + selfDescription = "34기 안드로이드 OB", + ), Friend( + profileImage = friendIcon, + name = "박유진", + selfDescription = "34기 안드로이드 YB", + ), Friend( + profileImage = friendIcon, + name = "배지현", + selfDescription = "34기 안드로이드 OB", + ), Friend( + profileImage = friendIcon, + name = "배찬우", + selfDescription = "34기 안드로이드 OB", + ), Friend( + profileImage = friendIcon, + name = "손민재", + selfDescription = "34기 안드로이드 YB", + ), Friend( + profileImage = friendIcon, + name = "송혜음", + selfDescription = "34기 안드로이드 YB", + ), Friend( + profileImage = friendIcon, + name = "우상욱", + selfDescription = "34기 안드로이드 OB", + ), Friend( + profileImage = friendIcon, + name = "유정현", + selfDescription = "34기 안드로이드 YB", + ), Friend( + profileImage = friendIcon, + name = "윤서희", + selfDescription = "34기 안드로이드 YB", + ), Friend( + profileImage = friendIcon, + name = "곽의진", + selfDescription = "34기 안드로이드 파트장", + ), Friend( + profileImage = friendIcon, + name = "이가을", + selfDescription = "34기 안드로이드 YB", + ), Friend( + profileImage = friendIcon, + name = "이나경", + selfDescription = "34기 안드로이드 YB", + ), Friend( + profileImage = friendIcon, + name = "이석준", + selfDescription = "34기 안드로이드 YB", + ), + Friend( + profileImage = friendIcon, + name = "이석찬", + selfDescription = "34기 안드로이드 YB", + ), Friend( + profileImage = friendIcon, + name = "이연진", + selfDescription = "34기 안드로이드 YB", + ), Friend( + profileImage = friendIcon, + name = "이유빈", + selfDescription = "34기 안드로이드 OB", + ), Friend( + profileImage = friendIcon, + name = "임하늘", + selfDescription = "34기 안드로이드 YB", + ), Friend( + profileImage = friendIcon, + name = "주효은", + selfDescription = "34기 안드로이드 YB", + ), Friend( + profileImage = friendIcon, + name = "최준서", + selfDescription = "34기 안드로이드 OB", + ), Friend( + profileImage = friendIcon, + name = "이현진", + selfDescription = "34기 안드로이드 YB", + ), Friend( + profileImage = friendIcon, + name = "박효빈", + selfDescription = "34기 안드로이드 YB", + ) + + ) + + +} \ No newline at end of file diff --git a/app/src/main/java/com/sopt/now/Fragment/MyPageFragment.kt b/app/src/main/java/com/sopt/now/Fragment/MyPageFragment.kt new file mode 100644 index 0000000..61b80a7 --- /dev/null +++ b/app/src/main/java/com/sopt/now/Fragment/MyPageFragment.kt @@ -0,0 +1,90 @@ +package com.sopt.now.Fragment +import android.os.Bundle +import android.view.LayoutInflater +import android.view.View +import android.view.ViewGroup +import androidx.fragment.app.Fragment +import com.sopt.now.R +import com.sopt.now.databinding.FragmentMypageBinding + +class MyPageFragment(userId:String,userPassword:String,userNickname:String,userMbti:String): Fragment() { + private var _binding: FragmentMypageBinding? = null + private val binding: FragmentMypageBinding + get() = requireNotNull(_binding) { + "바인딩 객체 생성 완료" + } + + private val id = userId + private val password = userPassword + private val nickname = userNickname + private val mbti = userMbti + + + + override fun onCreateView( + inflater: LayoutInflater, + container: ViewGroup?, + savedInstanceState: Bundle? + ): View { + _binding = FragmentMypageBinding.inflate(inflater, container, false) + return binding.root + + + } + + override fun onViewCreated(view: View, savedInstanceState: Bundle?) { + super.onViewCreated(view, savedInstanceState) + + + binding.textNickname.text = getString(R.string.nickname,nickname) + binding.textMbti.text = getString(R.string.mbti,mbti) + binding.textId.text=id + binding.textPw.text=password + + + + val mbtiImageName = mbti.lowercase() + ".png" + val mbtiImageId = mbtiImageName.let { resources.getIdentifier(it, "drawable",null) } + if (mbtiImageId != 0) { + binding.imageMbti.setImageResource(mbtiImageId) + + } + + val mbtiDescriptionMap = mapOf( + "ISFP" to R.string.isfp, + "ISFJ" to R.string.isfj, + "ISTP" to R.string.istp, + "ISTJ" to R.string.istj, + "INFP" to R.string.infp, + "INFJ" to R.string.infj, + "INTP" to R.string.intp, + "INTJ" to R.string.intj, + "ESFP" to R.string.esfp, + "ESFJ" to R.string.esfj, + "ESTP" to R.string.estp, + "ESTJ" to R.string.estj, + "ENFP" to R.string.enfp, + "ENFJ" to R.string.enfj, + "ENTP" to R.string.entp, + "ENTJ" to R.string.entj + + ) + + val mbtiDescriptionResId = mbti.let { mbtiDescriptionMap[it] } + + + val mbtiDescription = mbtiDescriptionResId?.let { getString(it) } ?: getString(R.string.default_description) + + binding.textMbtiDes.text = mbtiDescription + + + + } + + override fun onDestroyView() { + super.onDestroyView() + _binding = null + } + + +} \ No newline at end of file diff --git a/app/src/main/java/com/sopt/now/Fragment/SearchFragment.kt b/app/src/main/java/com/sopt/now/Fragment/SearchFragment.kt new file mode 100644 index 0000000..b627981 --- /dev/null +++ b/app/src/main/java/com/sopt/now/Fragment/SearchFragment.kt @@ -0,0 +1,35 @@ +package com.sopt.now.Fragment +import android.os.Bundle +import android.view.LayoutInflater +import android.view.View +import android.view.ViewGroup +import androidx.fragment.app.Fragment +import com.sopt.now.databinding.FragmentSearchBinding + +class SearchFragment: Fragment() { + + private var _binding: FragmentSearchBinding? = null + private val binding: FragmentSearchBinding + get() = requireNotNull(_binding) { + "바인딩 객체 생성 완료" + } + + override fun onCreateView( + inflater: LayoutInflater, + container: ViewGroup?, + savedInstanceState: Bundle? + ): View { + _binding = FragmentSearchBinding.inflate(inflater, container, false) + return binding.root + } + + override fun onViewCreated(view: View, savedInstanceState: Bundle?) { + super.onViewCreated(view, savedInstanceState) + // TODO: 기존 액티비티의 onCreate에 작성했던 init로직을 이제는 여기에 작성합니다. + } + + override fun onDestroyView() { + super.onDestroyView() + _binding = null + } +} \ No newline at end of file diff --git a/app/src/main/java/com/sopt/now/MainActivity.kt b/app/src/main/java/com/sopt/now/MainActivity.kt deleted file mode 100644 index 23e7302..0000000 --- a/app/src/main/java/com/sopt/now/MainActivity.kt +++ /dev/null @@ -1,15 +0,0 @@ -package com.sopt.now - -import android.os.Bundle -import androidx.activity.enableEdgeToEdge -import androidx.appcompat.app.AppCompatActivity -import androidx.core.view.ViewCompat -import androidx.core.view.WindowInsetsCompat - -class MainActivity : AppCompatActivity() { - override fun onCreate(savedInstanceState: Bundle?) { - super.onCreate(savedInstanceState) - setContentView(R.layout.activity_main) - - } -} \ No newline at end of file diff --git a/app/src/main/java/com/sopt/now/ViewHolder/FriendViewHolder.kt b/app/src/main/java/com/sopt/now/ViewHolder/FriendViewHolder.kt new file mode 100644 index 0000000..3d936b3 --- /dev/null +++ b/app/src/main/java/com/sopt/now/ViewHolder/FriendViewHolder.kt @@ -0,0 +1,16 @@ +package com.sopt.now.ViewHolder + +import androidx.recyclerview.widget.RecyclerView +import com.sopt.now.DataFile.Friend +import com.sopt.now.databinding.ItemFriendBinding + +class FriendViewHolder(private val binding: ItemFriendBinding) : RecyclerView.ViewHolder(binding.root) { + + fun onBind(friendData: Friend) { + binding.run { + ivProfile.setImageResource(friendData.profileImage) + tvName.text = friendData.name + tvSelfDescription.text = friendData.selfDescription + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/sopt/now/ViewHolder/MyProfileHolder.kt b/app/src/main/java/com/sopt/now/ViewHolder/MyProfileHolder.kt new file mode 100644 index 0000000..7e1ca40 --- /dev/null +++ b/app/src/main/java/com/sopt/now/ViewHolder/MyProfileHolder.kt @@ -0,0 +1,16 @@ +package com.sopt.now.ViewHolder + +import androidx.recyclerview.widget.RecyclerView +import com.sopt.now.DataFile.MyProfile +import com.sopt.now.databinding.ItemMyprofileBinding + +class MyProfileHolder(val binding: ItemMyprofileBinding) : RecyclerView.ViewHolder(binding.root) { + + fun onBind(profileData: MyProfile) { + binding.run { + ivProfile.setImageResource(profileData.profileImage) + tvName.text = profileData.name + tvSelfDescription.text = profileData.selfDescription + } + } +} \ No newline at end of file diff --git a/app/src/main/res/drawable/baseline_home_24.xml b/app/src/main/res/drawable/baseline_home_24.xml new file mode 100644 index 0000000..20cb4d6 --- /dev/null +++ b/app/src/main/res/drawable/baseline_home_24.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/app/src/main/res/drawable/baseline_person_24.xml b/app/src/main/res/drawable/baseline_person_24.xml new file mode 100644 index 0000000..a37d9a8 --- /dev/null +++ b/app/src/main/res/drawable/baseline_person_24.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/app/src/main/res/drawable/baseline_person_outline_24.xml b/app/src/main/res/drawable/baseline_person_outline_24.xml new file mode 100644 index 0000000..a3be1b8 --- /dev/null +++ b/app/src/main/res/drawable/baseline_person_outline_24.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/app/src/main/res/drawable/baseline_search_24.xml b/app/src/main/res/drawable/baseline_search_24.xml new file mode 100644 index 0000000..d29c6ea --- /dev/null +++ b/app/src/main/res/drawable/baseline_search_24.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/app/src/main/res/drawable/enfj.png b/app/src/main/res/drawable/enfj.png new file mode 100644 index 0000000..b17899c Binary files /dev/null and b/app/src/main/res/drawable/enfj.png differ diff --git a/app/src/main/res/drawable/enfp.png b/app/src/main/res/drawable/enfp.png new file mode 100644 index 0000000..0138913 Binary files /dev/null and b/app/src/main/res/drawable/enfp.png differ diff --git a/app/src/main/res/drawable/entj.png b/app/src/main/res/drawable/entj.png new file mode 100644 index 0000000..d652a63 Binary files /dev/null and b/app/src/main/res/drawable/entj.png differ diff --git a/app/src/main/res/drawable/entp.png b/app/src/main/res/drawable/entp.png new file mode 100644 index 0000000..eaafd7f Binary files /dev/null and b/app/src/main/res/drawable/entp.png differ diff --git a/app/src/main/res/drawable/esfj.png b/app/src/main/res/drawable/esfj.png new file mode 100644 index 0000000..9452a0a Binary files /dev/null and b/app/src/main/res/drawable/esfj.png differ diff --git a/app/src/main/res/drawable/esfp.png b/app/src/main/res/drawable/esfp.png new file mode 100644 index 0000000..4b0ed00 Binary files /dev/null and b/app/src/main/res/drawable/esfp.png differ diff --git a/app/src/main/res/drawable/estj.png b/app/src/main/res/drawable/estj.png new file mode 100644 index 0000000..34a6f9b Binary files /dev/null and b/app/src/main/res/drawable/estj.png differ diff --git a/app/src/main/res/drawable/estp.png b/app/src/main/res/drawable/estp.png new file mode 100644 index 0000000..4e8cbdb Binary files /dev/null and b/app/src/main/res/drawable/estp.png differ diff --git a/app/src/main/res/drawable/infj.png b/app/src/main/res/drawable/infj.png new file mode 100644 index 0000000..26f24df Binary files /dev/null and b/app/src/main/res/drawable/infj.png differ diff --git a/app/src/main/res/drawable/infp.png b/app/src/main/res/drawable/infp.png new file mode 100644 index 0000000..6fb3d44 Binary files /dev/null and b/app/src/main/res/drawable/infp.png differ diff --git a/app/src/main/res/drawable/intj.png b/app/src/main/res/drawable/intj.png new file mode 100644 index 0000000..8acc68d Binary files /dev/null and b/app/src/main/res/drawable/intj.png differ diff --git a/app/src/main/res/drawable/intp.png b/app/src/main/res/drawable/intp.png new file mode 100644 index 0000000..aa8e210 Binary files /dev/null and b/app/src/main/res/drawable/intp.png differ diff --git a/app/src/main/res/drawable/isfj.png b/app/src/main/res/drawable/isfj.png new file mode 100644 index 0000000..6275396 Binary files /dev/null and b/app/src/main/res/drawable/isfj.png differ diff --git a/app/src/main/res/drawable/isfp.png b/app/src/main/res/drawable/isfp.png new file mode 100644 index 0000000..20371c2 Binary files /dev/null and b/app/src/main/res/drawable/isfp.png differ diff --git a/app/src/main/res/drawable/istj.png b/app/src/main/res/drawable/istj.png new file mode 100644 index 0000000..51c4c55 Binary files /dev/null and b/app/src/main/res/drawable/istj.png differ diff --git a/app/src/main/res/drawable/istp.png b/app/src/main/res/drawable/istp.png new file mode 100644 index 0000000..f595d2c Binary files /dev/null and b/app/src/main/res/drawable/istp.png differ diff --git a/app/src/main/res/layout/activity_home.xml b/app/src/main/res/layout/activity_home.xml new file mode 100644 index 0000000..5d256cc --- /dev/null +++ b/app/src/main/res/layout/activity_home.xml @@ -0,0 +1,40 @@ + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/activity_login.xml b/app/src/main/res/layout/activity_login.xml new file mode 100644 index 0000000..83a30ed --- /dev/null +++ b/app/src/main/res/layout/activity_login.xml @@ -0,0 +1,104 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + +