From 119c2605a6002d912e4cc1353c2ac9698b105ae9 Mon Sep 17 00:00:00 2001
From: hyeumm <20221159@sungshin.ac.kr>
Date: Thu, 11 Apr 2024 02:12:42 +0900
Subject: [PATCH 01/29] =?UTF-8?q?feat/#5:=20=EB=A9=94=EB=89=B4=EB=B0=94=20?=
=?UTF-8?q?=EC=83=9D=EC=84=B1?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../main/res/drawable/ic_home_white_24.xml | 5 +++++
.../main/res/drawable/ic_person_white_24.xml | 5 +++++
.../main/res/drawable/ic_search_white_24.xml | 5 +++++
app/src/main/res/layout/activity_main.xml | 20 ++++++++++++++++++
app/src/main/res/menu/menu_main.xml | 21 +++++++++++++++++++
5 files changed, 56 insertions(+)
create mode 100644 app/src/main/res/drawable/ic_home_white_24.xml
create mode 100644 app/src/main/res/drawable/ic_person_white_24.xml
create mode 100644 app/src/main/res/drawable/ic_search_white_24.xml
create mode 100644 app/src/main/res/menu/menu_main.xml
diff --git a/app/src/main/res/drawable/ic_home_white_24.xml b/app/src/main/res/drawable/ic_home_white_24.xml
new file mode 100644
index 0000000..5f2fcbc
--- /dev/null
+++ b/app/src/main/res/drawable/ic_home_white_24.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
diff --git a/app/src/main/res/drawable/ic_person_white_24.xml b/app/src/main/res/drawable/ic_person_white_24.xml
new file mode 100644
index 0000000..ddc8322
--- /dev/null
+++ b/app/src/main/res/drawable/ic_person_white_24.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
diff --git a/app/src/main/res/drawable/ic_search_white_24.xml b/app/src/main/res/drawable/ic_search_white_24.xml
new file mode 100644
index 0000000..f4e055b
--- /dev/null
+++ b/app/src/main/res/drawable/ic_search_white_24.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml
index b0d39af..e0d6959 100644
--- a/app/src/main/res/layout/activity_main.xml
+++ b/app/src/main/res/layout/activity_main.xml
@@ -33,6 +33,25 @@
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/tv_main_title" />
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/menu/menu_main.xml b/app/src/main/res/menu/menu_main.xml
new file mode 100644
index 0000000..4e34e53
--- /dev/null
+++ b/app/src/main/res/menu/menu_main.xml
@@ -0,0 +1,21 @@
+
+
\ No newline at end of file
From c872be5910f4473e972ff31eb44df35d0018e5b4 Mon Sep 17 00:00:00 2001
From: hyeumm <20221159@sungshin.ac.kr>
Date: Thu, 11 Apr 2024 02:17:22 +0900
Subject: [PATCH 02/29] =?UTF-8?q?feat/#5:=20=ED=94=84=EB=9E=98=EA=B7=B8?=
=?UTF-8?q?=EB=A8=BC=ED=8A=B8=20=EC=83=9D=EC=84=B1?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../main/java/com/sopt/now/HomeFragment.kt | 59 +++++++++++++++++++
.../main/java/com/sopt/now/MyPageFragment.kt | 59 +++++++++++++++++++
.../main/java/com/sopt/now/SearchFragment.kt | 59 +++++++++++++++++++
app/src/main/res/layout/fragment_home.xml | 14 +++++
app/src/main/res/layout/fragment_my_page.xml | 14 +++++
app/src/main/res/layout/fragment_search.xml | 14 +++++
6 files changed, 219 insertions(+)
create mode 100644 app/src/main/java/com/sopt/now/HomeFragment.kt
create mode 100644 app/src/main/java/com/sopt/now/MyPageFragment.kt
create mode 100644 app/src/main/java/com/sopt/now/SearchFragment.kt
create mode 100644 app/src/main/res/layout/fragment_home.xml
create mode 100644 app/src/main/res/layout/fragment_my_page.xml
create mode 100644 app/src/main/res/layout/fragment_search.xml
diff --git a/app/src/main/java/com/sopt/now/HomeFragment.kt b/app/src/main/java/com/sopt/now/HomeFragment.kt
new file mode 100644
index 0000000..7efb36b
--- /dev/null
+++ b/app/src/main/java/com/sopt/now/HomeFragment.kt
@@ -0,0 +1,59 @@
+package com.sopt.now
+
+import android.os.Bundle
+import androidx.fragment.app.Fragment
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+
+// TODO: Rename parameter arguments, choose names that match
+// the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
+private const val ARG_PARAM1 = "param1"
+private const val ARG_PARAM2 = "param2"
+
+/**
+ * A simple [Fragment] subclass.
+ * Use the [HomeFragment.newInstance] factory method to
+ * create an instance of this fragment.
+ */
+class HomeFragment : Fragment() {
+ // TODO: Rename and change types of parameters
+ private var param1: String? = null
+ private var param2: String? = null
+
+ override fun onCreate(savedInstanceState: Bundle?) {
+ super.onCreate(savedInstanceState)
+ arguments?.let {
+ param1 = it.getString(ARG_PARAM1)
+ param2 = it.getString(ARG_PARAM2)
+ }
+ }
+
+ override fun onCreateView(
+ inflater: LayoutInflater, container: ViewGroup?,
+ savedInstanceState: Bundle?
+ ): View? {
+ // Inflate the layout for this fragment
+ return inflater.inflate(R.layout.fragment_home, container, false)
+ }
+
+ companion object {
+ /**
+ * Use this factory method to create a new instance of
+ * this fragment using the provided parameters.
+ *
+ * @param param1 Parameter 1.
+ * @param param2 Parameter 2.
+ * @return A new instance of fragment HomeFragment.
+ */
+ // TODO: Rename and change types and number of parameters
+ @JvmStatic
+ fun newInstance(param1: String, param2: String) =
+ HomeFragment().apply {
+ arguments = Bundle().apply {
+ putString(ARG_PARAM1, param1)
+ putString(ARG_PARAM2, param2)
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/sopt/now/MyPageFragment.kt b/app/src/main/java/com/sopt/now/MyPageFragment.kt
new file mode 100644
index 0000000..91801dc
--- /dev/null
+++ b/app/src/main/java/com/sopt/now/MyPageFragment.kt
@@ -0,0 +1,59 @@
+package com.sopt.now
+
+import android.os.Bundle
+import androidx.fragment.app.Fragment
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+
+// TODO: Rename parameter arguments, choose names that match
+// the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
+private const val ARG_PARAM1 = "param1"
+private const val ARG_PARAM2 = "param2"
+
+/**
+ * A simple [Fragment] subclass.
+ * Use the [MyPageFragment.newInstance] factory method to
+ * create an instance of this fragment.
+ */
+class MyPageFragment : Fragment() {
+ // TODO: Rename and change types of parameters
+ private var param1: String? = null
+ private var param2: String? = null
+
+ override fun onCreate(savedInstanceState: Bundle?) {
+ super.onCreate(savedInstanceState)
+ arguments?.let {
+ param1 = it.getString(ARG_PARAM1)
+ param2 = it.getString(ARG_PARAM2)
+ }
+ }
+
+ override fun onCreateView(
+ inflater: LayoutInflater, container: ViewGroup?,
+ savedInstanceState: Bundle?
+ ): View? {
+ // Inflate the layout for this fragment
+ return inflater.inflate(R.layout.fragment_my_page, container, false)
+ }
+
+ companion object {
+ /**
+ * Use this factory method to create a new instance of
+ * this fragment using the provided parameters.
+ *
+ * @param param1 Parameter 1.
+ * @param param2 Parameter 2.
+ * @return A new instance of fragment MyPageFragment.
+ */
+ // TODO: Rename and change types and number of parameters
+ @JvmStatic
+ fun newInstance(param1: String, param2: String) =
+ MyPageFragment().apply {
+ arguments = Bundle().apply {
+ putString(ARG_PARAM1, param1)
+ putString(ARG_PARAM2, param2)
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/sopt/now/SearchFragment.kt b/app/src/main/java/com/sopt/now/SearchFragment.kt
new file mode 100644
index 0000000..c2897b5
--- /dev/null
+++ b/app/src/main/java/com/sopt/now/SearchFragment.kt
@@ -0,0 +1,59 @@
+package com.sopt.now
+
+import android.os.Bundle
+import androidx.fragment.app.Fragment
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+
+// TODO: Rename parameter arguments, choose names that match
+// the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
+private const val ARG_PARAM1 = "param1"
+private const val ARG_PARAM2 = "param2"
+
+/**
+ * A simple [Fragment] subclass.
+ * Use the [SearchFragment.newInstance] factory method to
+ * create an instance of this fragment.
+ */
+class SearchFragment : Fragment() {
+ // TODO: Rename and change types of parameters
+ private var param1: String? = null
+ private var param2: String? = null
+
+ override fun onCreate(savedInstanceState: Bundle?) {
+ super.onCreate(savedInstanceState)
+ arguments?.let {
+ param1 = it.getString(ARG_PARAM1)
+ param2 = it.getString(ARG_PARAM2)
+ }
+ }
+
+ override fun onCreateView(
+ inflater: LayoutInflater, container: ViewGroup?,
+ savedInstanceState: Bundle?
+ ): View? {
+ // Inflate the layout for this fragment
+ return inflater.inflate(R.layout.fragment_search, container, false)
+ }
+
+ companion object {
+ /**
+ * Use this factory method to create a new instance of
+ * this fragment using the provided parameters.
+ *
+ * @param param1 Parameter 1.
+ * @param param2 Parameter 2.
+ * @return A new instance of fragment SearchFragment.
+ */
+ // TODO: Rename and change types and number of parameters
+ @JvmStatic
+ fun newInstance(param1: String, param2: String) =
+ SearchFragment().apply {
+ arguments = Bundle().apply {
+ putString(ARG_PARAM1, param1)
+ putString(ARG_PARAM2, param2)
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/res/layout/fragment_home.xml b/app/src/main/res/layout/fragment_home.xml
new file mode 100644
index 0000000..27a4d2c
--- /dev/null
+++ b/app/src/main/res/layout/fragment_home.xml
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/fragment_my_page.xml b/app/src/main/res/layout/fragment_my_page.xml
new file mode 100644
index 0000000..cc5d881
--- /dev/null
+++ b/app/src/main/res/layout/fragment_my_page.xml
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/fragment_search.xml b/app/src/main/res/layout/fragment_search.xml
new file mode 100644
index 0000000..b6198d4
--- /dev/null
+++ b/app/src/main/res/layout/fragment_search.xml
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
\ No newline at end of file
From 39cc7715b8552497d4e2015ec4f91f59340b5c0c Mon Sep 17 00:00:00 2001
From: hyeumm <20221159@sungshin.ac.kr>
Date: Thu, 11 Apr 2024 02:25:19 +0900
Subject: [PATCH 03/29] =?UTF-8?q?feat/#5:=20=EB=A9=94=EB=89=B4=EC=99=80=20?=
=?UTF-8?q?=ED=94=84=EB=9E=98=EA=B7=B8=EB=A8=BC=ED=8A=B8=20=EC=97=B0?=
=?UTF-8?q?=EA=B2=B0?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../main/java/com/sopt/now/HomeFragment.kt | 37 ---------------
.../main/java/com/sopt/now/MainActivity.kt | 46 +++++++++++++++++--
.../main/java/com/sopt/now/MyPageFragment.kt | 37 ---------------
.../main/java/com/sopt/now/SearchFragment.kt | 33 -------------
app/src/main/res/layout/activity_main.xml | 8 ++--
app/src/main/res/layout/fragment_home.xml | 2 +-
app/src/main/res/layout/fragment_my_page.xml | 2 +-
app/src/main/res/layout/fragment_search.xml | 2 +-
.../res/menu/{menu_main.xml => menu_home.xml} | 0
app/src/main/res/values/strings.xml | 2 +
10 files changed, 50 insertions(+), 119 deletions(-)
rename app/src/main/res/menu/{menu_main.xml => menu_home.xml} (100%)
diff --git a/app/src/main/java/com/sopt/now/HomeFragment.kt b/app/src/main/java/com/sopt/now/HomeFragment.kt
index 7efb36b..9a29d1f 100644
--- a/app/src/main/java/com/sopt/now/HomeFragment.kt
+++ b/app/src/main/java/com/sopt/now/HomeFragment.kt
@@ -6,27 +6,10 @@ import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
-// TODO: Rename parameter arguments, choose names that match
-// the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
-private const val ARG_PARAM1 = "param1"
-private const val ARG_PARAM2 = "param2"
-
-/**
- * A simple [Fragment] subclass.
- * Use the [HomeFragment.newInstance] factory method to
- * create an instance of this fragment.
- */
class HomeFragment : Fragment() {
- // TODO: Rename and change types of parameters
- private var param1: String? = null
- private var param2: String? = null
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
- arguments?.let {
- param1 = it.getString(ARG_PARAM1)
- param2 = it.getString(ARG_PARAM2)
- }
}
override fun onCreateView(
@@ -36,24 +19,4 @@ class HomeFragment : Fragment() {
// Inflate the layout for this fragment
return inflater.inflate(R.layout.fragment_home, container, false)
}
-
- companion object {
- /**
- * Use this factory method to create a new instance of
- * this fragment using the provided parameters.
- *
- * @param param1 Parameter 1.
- * @param param2 Parameter 2.
- * @return A new instance of fragment HomeFragment.
- */
- // TODO: Rename and change types and number of parameters
- @JvmStatic
- fun newInstance(param1: String, param2: String) =
- HomeFragment().apply {
- arguments = Bundle().apply {
- putString(ARG_PARAM1, param1)
- putString(ARG_PARAM2, param2)
- }
- }
- }
}
\ 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
index a44b2f8..834d650 100644
--- a/app/src/main/java/com/sopt/now/MainActivity.kt
+++ b/app/src/main/java/com/sopt/now/MainActivity.kt
@@ -2,6 +2,7 @@ package com.sopt.now
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
+import androidx.fragment.app.Fragment
import com.sopt.now.databinding.ActivityMainBinding
class MainActivity : AppCompatActivity() {
@@ -11,12 +12,47 @@ class MainActivity : AppCompatActivity() {
binding= ActivityMainBinding.inflate(layoutInflater)
setContentView(binding.root)
+ val currentFragment = supportFragmentManager.findFragmentById(binding.fcvHome.id)
+ if (currentFragment == null) {
+ supportFragmentManager.beginTransaction()
+ .add(R.id.fcv_home, HomeFragment())
+ .commit()
+ }
+
+ clickBottomNavigation()
//로그인화면에서 받아온 id/pw 화면에 출력
- getUserInfo()
+ //getUserInfo()
+ }
+ private fun clickBottomNavigation() {
+ binding.bnvHome.setOnItemSelectedListener{
+ when (it.itemId) {
+ R.id.menu_home-> {
+ replaceFragment(HomeFragment())
+ true
+ }
+
+ R.id.menu_search-> {
+ replaceFragment(SearchFragment())
+ true
+ }
+
+ R.id.menu_mypage-> {
+ replaceFragment(MyPageFragment())
+ true
+ }
+
+ else -> false
+ }
+ }
}
- private fun getUserInfo() {
- binding.tvMainNick.text = intent.getStringExtra("nick")
- binding.tvMainId.text = intent.getStringExtra("id")
- binding.tvMainPw.text = intent.getStringExtra("pw")
+ private fun replaceFragment(fragment: Fragment) {
+ supportFragmentManager.beginTransaction()
+ .replace(R.id.fcv_home, fragment)
+ .commit()
}
+// private fun getUserInfo() {
+// binding.tvMainNick.text = intent.getStringExtra("nick")
+// binding.tvMainId.text = intent.getStringExtra("id")
+// binding.tvMainPw.text = intent.getStringExtra("pw")
+// }
}
\ No newline at end of file
diff --git a/app/src/main/java/com/sopt/now/MyPageFragment.kt b/app/src/main/java/com/sopt/now/MyPageFragment.kt
index 91801dc..1780051 100644
--- a/app/src/main/java/com/sopt/now/MyPageFragment.kt
+++ b/app/src/main/java/com/sopt/now/MyPageFragment.kt
@@ -6,27 +6,10 @@ import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
-// TODO: Rename parameter arguments, choose names that match
-// the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
-private const val ARG_PARAM1 = "param1"
-private const val ARG_PARAM2 = "param2"
-
-/**
- * A simple [Fragment] subclass.
- * Use the [MyPageFragment.newInstance] factory method to
- * create an instance of this fragment.
- */
class MyPageFragment : Fragment() {
- // TODO: Rename and change types of parameters
- private var param1: String? = null
- private var param2: String? = null
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
- arguments?.let {
- param1 = it.getString(ARG_PARAM1)
- param2 = it.getString(ARG_PARAM2)
- }
}
override fun onCreateView(
@@ -36,24 +19,4 @@ class MyPageFragment : Fragment() {
// Inflate the layout for this fragment
return inflater.inflate(R.layout.fragment_my_page, container, false)
}
-
- companion object {
- /**
- * Use this factory method to create a new instance of
- * this fragment using the provided parameters.
- *
- * @param param1 Parameter 1.
- * @param param2 Parameter 2.
- * @return A new instance of fragment MyPageFragment.
- */
- // TODO: Rename and change types and number of parameters
- @JvmStatic
- fun newInstance(param1: String, param2: String) =
- MyPageFragment().apply {
- arguments = Bundle().apply {
- putString(ARG_PARAM1, param1)
- putString(ARG_PARAM2, param2)
- }
- }
- }
}
\ No newline at end of file
diff --git a/app/src/main/java/com/sopt/now/SearchFragment.kt b/app/src/main/java/com/sopt/now/SearchFragment.kt
index c2897b5..6487a8d 100644
--- a/app/src/main/java/com/sopt/now/SearchFragment.kt
+++ b/app/src/main/java/com/sopt/now/SearchFragment.kt
@@ -6,16 +6,6 @@ import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
-// TODO: Rename parameter arguments, choose names that match
-// the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
-private const val ARG_PARAM1 = "param1"
-private const val ARG_PARAM2 = "param2"
-
-/**
- * A simple [Fragment] subclass.
- * Use the [SearchFragment.newInstance] factory method to
- * create an instance of this fragment.
- */
class SearchFragment : Fragment() {
// TODO: Rename and change types of parameters
private var param1: String? = null
@@ -23,10 +13,6 @@ class SearchFragment : Fragment() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
- arguments?.let {
- param1 = it.getString(ARG_PARAM1)
- param2 = it.getString(ARG_PARAM2)
- }
}
override fun onCreateView(
@@ -37,23 +23,4 @@ class SearchFragment : Fragment() {
return inflater.inflate(R.layout.fragment_search, container, false)
}
- companion object {
- /**
- * Use this factory method to create a new instance of
- * this fragment using the provided parameters.
- *
- * @param param1 Parameter 1.
- * @param param2 Parameter 2.
- * @return A new instance of fragment SearchFragment.
- */
- // TODO: Rename and change types and number of parameters
- @JvmStatic
- fun newInstance(param1: String, param2: String) =
- SearchFragment().apply {
- arguments = Bundle().apply {
- putString(ARG_PARAM1, param1)
- putString(ARG_PARAM2, param2)
- }
- }
- }
}
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml
index e0d6959..5f697ed 100644
--- a/app/src/main/res/layout/activity_main.xml
+++ b/app/src/main/res/layout/activity_main.xml
@@ -35,22 +35,22 @@
app:layout_constraintTop_toBottomOf="@+id/tv_main_title" />
+ app:menu="@menu/menu_home"/>
+ Hello blank fragment
\ No newline at end of file
From 03a21c448bf2ab6defd5569223cb10731eb20e9b Mon Sep 17 00:00:00 2001
From: hyeumm <20221159@sungshin.ac.kr>
Date: Thu, 11 Apr 2024 02:52:31 +0900
Subject: [PATCH 04/29] =?UTF-8?q?feat/#5:=20=EB=A6=AC=EC=8B=B8=EC=9D=B4?=
=?UTF-8?q?=ED=81=B4=EB=9F=AC=EB=B7=B0=20=EC=97=B0=EA=B2=B0?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/src/main/java/com/sopt/now/Friend.kt | 9 ++++
.../main/java/com/sopt/now/FriendAdapter.kt | 28 ++++++++++++
.../java/com/sopt/now/FriendViewHolder.kt | 14 ++++++
.../main/java/com/sopt/now/MyPageFragment.kt | 38 +++++++++++++---
app/src/main/res/layout/fragment_my_page.xml | 10 +++--
app/src/main/res/layout/item_friend.xml | 43 +++++++++++++++++++
6 files changed, 133 insertions(+), 9 deletions(-)
create mode 100644 app/src/main/java/com/sopt/now/Friend.kt
create mode 100644 app/src/main/java/com/sopt/now/FriendAdapter.kt
create mode 100644 app/src/main/java/com/sopt/now/FriendViewHolder.kt
create mode 100644 app/src/main/res/layout/item_friend.xml
diff --git a/app/src/main/java/com/sopt/now/Friend.kt b/app/src/main/java/com/sopt/now/Friend.kt
new file mode 100644
index 0000000..f6d3ea0
--- /dev/null
+++ b/app/src/main/java/com/sopt/now/Friend.kt
@@ -0,0 +1,9 @@
+package com.sopt.now
+
+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/FriendAdapter.kt b/app/src/main/java/com/sopt/now/FriendAdapter.kt
new file mode 100644
index 0000000..57c710c
--- /dev/null
+++ b/app/src/main/java/com/sopt/now/FriendAdapter.kt
@@ -0,0 +1,28 @@
+package com.sopt.now
+
+import android.view.LayoutInflater
+import android.view.ViewGroup
+import androidx.recyclerview.widget.RecyclerView
+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/FriendViewHolder.kt b/app/src/main/java/com/sopt/now/FriendViewHolder.kt
new file mode 100644
index 0000000..85375be
--- /dev/null
+++ b/app/src/main/java/com/sopt/now/FriendViewHolder.kt
@@ -0,0 +1,14 @@
+package com.sopt.now
+
+import androidx.recyclerview.widget.RecyclerView
+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/MyPageFragment.kt b/app/src/main/java/com/sopt/now/MyPageFragment.kt
index 1780051..bb34054 100644
--- a/app/src/main/java/com/sopt/now/MyPageFragment.kt
+++ b/app/src/main/java/com/sopt/now/MyPageFragment.kt
@@ -5,18 +5,44 @@ import androidx.fragment.app.Fragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
+import androidx.recyclerview.widget.LinearLayoutManager
+import com.sopt.now.databinding.FragmentMyPageBinding
class MyPageFragment : Fragment() {
+ private lateinit var binding:FragmentMyPageBinding
- override fun onCreate(savedInstanceState: Bundle?) {
- super.onCreate(savedInstanceState)
- }
-
+ private val mockFriendList = listOf(
+ Friend(
+ profileImage = R.drawable.ic_home_white_24,
+ name = "이의경",
+ selfDescription = "다들 빨리 끝내고 뒤풀이 가고 싶지? ㅎㅎ 아직 반도 안왔어 ^&^",
+ ),
+ Friend(
+ profileImage = R.drawable.ic_home_white_24,
+ name = "우상욱",
+ selfDescription = "나보다 안드 잘하는 사람 있으면 나와봐",
+ ),
+ Friend(
+ profileImage = R.drawable.ic_home_white_24,
+ name = "배지현",
+ selfDescription = "표정 풀자 ^^",
+ ),
+ )
override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
- // Inflate the layout for this fragment
- return inflater.inflate(R.layout.fragment_my_page, container, false)
+ binding=FragmentMyPageBinding.inflate(inflater)
+ return binding.root
}
+ override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
+ super.onViewCreated(view, savedInstanceState)
+ val friendAdapter = FriendAdapter()
+ binding.rvFriends.run {
+ adapter = friendAdapter
+ layoutManager = LinearLayoutManager(requireContext())
+ }
+ friendAdapter.setFriendList(mockFriendList)
+ }
+
}
\ No newline at end of file
diff --git a/app/src/main/res/layout/fragment_my_page.xml b/app/src/main/res/layout/fragment_my_page.xml
index 3fd4134..30979a5 100644
--- a/app/src/main/res/layout/fragment_my_page.xml
+++ b/app/src/main/res/layout/fragment_my_page.xml
@@ -3,12 +3,16 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
+ xmlns:app="http://schemas.android.com/apk/res-auto"
tools:context=".MyPageFragment">
-
-
+ android:orientation="vertical"
+ app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
+ tools:listitem="@layout/item_friend"
+ android:paddingVertical="5dp"/>
\ No newline at end of file
diff --git a/app/src/main/res/layout/item_friend.xml b/app/src/main/res/layout/item_friend.xml
new file mode 100644
index 0000000..2b3bf0d
--- /dev/null
+++ b/app/src/main/res/layout/item_friend.xml
@@ -0,0 +1,43 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
From 8f52e11c7a8215f9a1a74fab41218b5932642db5 Mon Sep 17 00:00:00 2001
From: hyeumm <20221159@sungshin.ac.kr>
Date: Thu, 11 Apr 2024 02:56:57 +0900
Subject: [PATCH 05/29] =?UTF-8?q?feat/#5:=20=EC=9C=A0=EC=A0=80=EC=9D=98=20?=
=?UTF-8?q?=EC=83=81=ED=83=9C=EB=A9=94=EC=84=B8=EC=A7=80=EA=B0=80=20?=
=?UTF-8?q?=EA=B8=B8=EA=B1=B0=EB=82=98=20=EC=9D=B4=EB=A6=84=EC=9D=B4=20?=
=?UTF-8?q?=EA=B8=B8=EB=95=8C=20=EB=A7=90=EC=A4=84=EC=9E=84=ED=91=9C?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/src/main/res/layout/item_friend.xml | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/app/src/main/res/layout/item_friend.xml b/app/src/main/res/layout/item_friend.xml
index 2b3bf0d..93d9c95 100644
--- a/app/src/main/res/layout/item_friend.xml
+++ b/app/src/main/res/layout/item_friend.xml
@@ -25,6 +25,8 @@
android:text="친구의 이름"
android:textSize="16sp"
android:textStyle="bold"
+ android:maxLines="1"
+ android:ellipsize="end"
app:layout_constraintBottom_toBottomOf="@id/iv_profile"
app:layout_constraintStart_toEndOf="@id/iv_profile"
app:layout_constraintTop_toTopOf="@id/iv_profile" />
@@ -33,11 +35,13 @@
android:id="@+id/tv_self_description"
android:layout_width="0dp"
android:layout_height="wrap_content"
- android:layout_marginEnd="20dp"
+ android:layout_marginHorizontal="20dp"
android:maxLines="1"
+ android:ellipsize="end"
android:text="친구의 대화명"
app:layout_constraintBottom_toBottomOf="@id/iv_profile"
app:layout_constraintEnd_toEndOf="parent"
- app:layout_constraintTop_toTopOf="@id/iv_profile" />
+ app:layout_constraintTop_toTopOf="@id/iv_profile"
+ app:layout_constraintStart_toEndOf="@+id/tv_name"/>
\ No newline at end of file
From 131ba8813fe13f745d98fcf89f90aea6b9ec3a82 Mon Sep 17 00:00:00 2001
From: hyeumm <20221159@sungshin.ac.kr>
Date: Fri, 12 Apr 2024 00:23:21 +0900
Subject: [PATCH 06/29] =?UTF-8?q?mod/#5:=20=EB=A7=88=EC=9D=B4=ED=8E=98?=
=?UTF-8?q?=EC=9D=B4=EC=A7=80<->=ED=99=88=20=EB=B3=80=EA=B2=BD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/src/main/java/com/sopt/now/Friend.kt | 5 ++
.../main/java/com/sopt/now/HomeFragment.kt | 38 +++++++--
.../main/java/com/sopt/now/LoginActivity.kt | 15 +++-
.../main/java/com/sopt/now/MyPageFragment.kt | 41 +++------
app/src/main/res/layout/fragment_home.xml | 10 ++-
app/src/main/res/layout/fragment_my_page.xml | 83 ++++++++++++++++---
6 files changed, 139 insertions(+), 53 deletions(-)
diff --git a/app/src/main/java/com/sopt/now/Friend.kt b/app/src/main/java/com/sopt/now/Friend.kt
index f6d3ea0..5a7c81c 100644
--- a/app/src/main/java/com/sopt/now/Friend.kt
+++ b/app/src/main/java/com/sopt/now/Friend.kt
@@ -2,6 +2,11 @@ package com.sopt.now
import androidx.annotation.DrawableRes
+data class User(
+ @DrawableRes val profileImage: Int,
+ val name: String,
+ val selfDescription: String
+)
data class Friend(
@DrawableRes val profileImage: Int,
val name: String,
diff --git a/app/src/main/java/com/sopt/now/HomeFragment.kt b/app/src/main/java/com/sopt/now/HomeFragment.kt
index 9a29d1f..2917642 100644
--- a/app/src/main/java/com/sopt/now/HomeFragment.kt
+++ b/app/src/main/java/com/sopt/now/HomeFragment.kt
@@ -5,18 +5,44 @@ import androidx.fragment.app.Fragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
+import androidx.recyclerview.widget.LinearLayoutManager
+import com.sopt.now.databinding.FragmentHomeBinding
class HomeFragment : Fragment() {
+ private lateinit var binding: FragmentHomeBinding
- override fun onCreate(savedInstanceState: Bundle?) {
- super.onCreate(savedInstanceState)
- }
-
+ private val mockFriendList = listOf(
+ Friend(
+ profileImage = R.drawable.ic_home_white_24,
+ name = "이의경",
+ selfDescription = "다들 빨리 끝내고 뒤풀이 가고 싶지? ㅎㅎ 아직 반도 안왔어 ^&^",
+ ),
+ Friend(
+ profileImage = R.drawable.ic_home_white_24,
+ name = "우상욱",
+ selfDescription = "나보다 안드 잘하는 사람 있으면 나와봐",
+ ),
+ Friend(
+ profileImage = R.drawable.ic_home_white_24,
+ name = "배지현",
+ selfDescription = "표정 풀자 ^^",
+ ),
+ )
override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
- // Inflate the layout for this fragment
- return inflater.inflate(R.layout.fragment_home, container, false)
+ binding=FragmentHomeBinding.inflate(inflater)
+ return binding.root
}
+ override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
+ super.onViewCreated(view, savedInstanceState)
+ val friendAdapter = FriendAdapter()
+ binding.rvFriends.run {
+ adapter = friendAdapter
+ layoutManager = LinearLayoutManager(requireContext())
+ }
+ friendAdapter.setFriendList(mockFriendList)
+ }
+
}
\ No newline at end of file
diff --git a/app/src/main/java/com/sopt/now/LoginActivity.kt b/app/src/main/java/com/sopt/now/LoginActivity.kt
index f9b649f..23c1d48 100644
--- a/app/src/main/java/com/sopt/now/LoginActivity.kt
+++ b/app/src/main/java/com/sopt/now/LoginActivity.kt
@@ -37,6 +37,7 @@ class LoginActivity : AppCompatActivity() {
}
}
binding.btnLogin.setOnClickListener {
+ startMainActivity()
sendData(id,pw,nick)
}
}
@@ -61,12 +62,18 @@ class LoginActivity : AppCompatActivity() {
Toast.makeText(this,message,Toast.LENGTH_SHORT).show()
return loginBool
}
+ private fun startMainActivity(){
+ val intent = Intent(this, MainActivity::class.java)
+ startActivity(intent)
+ }
private fun sendData(id:String,pw:String,nick:String){
if (isLoginAvailable(id, pw)) {
- val intent = Intent(this, MainActivity::class.java)
- //메인 액티비티로 데이터를 보냄
- intent.putExtra("id", id).putExtra("pw", pw).putExtra("nick", nick)
- startActivity(intent)
+ var mypagefragment = MyPageFragment()
+ var bundle = Bundle()
+ bundle.putString("id",id)
+ bundle.putString("pw",pw)
+ bundle.putString("nick",nick)
+ mypagefragment.arguments = bundle
}
}
}
diff --git a/app/src/main/java/com/sopt/now/MyPageFragment.kt b/app/src/main/java/com/sopt/now/MyPageFragment.kt
index bb34054..527dc24 100644
--- a/app/src/main/java/com/sopt/now/MyPageFragment.kt
+++ b/app/src/main/java/com/sopt/now/MyPageFragment.kt
@@ -5,44 +5,29 @@ import androidx.fragment.app.Fragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
-import androidx.recyclerview.widget.LinearLayoutManager
import com.sopt.now.databinding.FragmentMyPageBinding
class MyPageFragment : Fragment() {
- private lateinit var binding:FragmentMyPageBinding
+ private lateinit var binding: FragmentMyPageBinding
+
+ private var param1: String? = null
+ private var param2: String? = null
+
+ override fun onCreate(savedInstanceState: Bundle?) {
+ super.onCreate(savedInstanceState)
+ }
- private val mockFriendList = listOf(
- Friend(
- profileImage = R.drawable.ic_home_white_24,
- name = "이의경",
- selfDescription = "다들 빨리 끝내고 뒤풀이 가고 싶지? ㅎㅎ 아직 반도 안왔어 ^&^",
- ),
- Friend(
- profileImage = R.drawable.ic_home_white_24,
- name = "우상욱",
- selfDescription = "나보다 안드 잘하는 사람 있으면 나와봐",
- ),
- Friend(
- profileImage = R.drawable.ic_home_white_24,
- name = "배지현",
- selfDescription = "표정 풀자 ^^",
- ),
- )
override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
binding=FragmentMyPageBinding.inflate(inflater)
+ getUserInfo()
return binding.root
}
- override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
- super.onViewCreated(view, savedInstanceState)
- val friendAdapter = FriendAdapter()
- binding.rvFriends.run {
- adapter = friendAdapter
- layoutManager = LinearLayoutManager(requireContext())
- }
- friendAdapter.setFriendList(mockFriendList)
+ private fun getUserInfo() {
+ binding.tvMainNick.text = arguments?.getString("nick")
+ binding.tvMainId.text = arguments?.getString("id")
+ binding.tvMainPw.text = arguments?.getString("pw")
}
-
}
\ No newline at end of file
diff --git a/app/src/main/res/layout/fragment_home.xml b/app/src/main/res/layout/fragment_home.xml
index 7eb0b33..5815c2f 100644
--- a/app/src/main/res/layout/fragment_home.xml
+++ b/app/src/main/res/layout/fragment_home.xml
@@ -3,12 +3,16 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
+ xmlns:app="http://schemas.android.com/apk/res-auto"
tools:context=".HomeFragment">
-
-
+ android:orientation="vertical"
+ app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
+ tools:listitem="@layout/item_friend"
+ android:paddingVertical="5dp"/>
\ No newline at end of file
diff --git a/app/src/main/res/layout/fragment_my_page.xml b/app/src/main/res/layout/fragment_my_page.xml
index 30979a5..a323054 100644
--- a/app/src/main/res/layout/fragment_my_page.xml
+++ b/app/src/main/res/layout/fragment_my_page.xml
@@ -1,18 +1,77 @@
-
+
+
+
+
+
+
-
-
-
\ No newline at end of file
+
\ No newline at end of file
From 3205e16d46a21268e89d12c35e1832d7396f256a Mon Sep 17 00:00:00 2001
From: hyeumm <20221159@sungshin.ac.kr>
Date: Fri, 12 Apr 2024 00:42:45 +0900
Subject: [PATCH 07/29] =?UTF-8?q?del/#5=20user=20=EB=8D=B0=EC=9D=B4?=
=?UTF-8?q?=ED=84=B0=20=ED=81=B4=EB=9E=98=EC=8A=A4=20=EC=82=AD=EC=A0=9C?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/src/main/java/com/sopt/now/Friend.kt | 5 -----
1 file changed, 5 deletions(-)
diff --git a/app/src/main/java/com/sopt/now/Friend.kt b/app/src/main/java/com/sopt/now/Friend.kt
index 5a7c81c..f6d3ea0 100644
--- a/app/src/main/java/com/sopt/now/Friend.kt
+++ b/app/src/main/java/com/sopt/now/Friend.kt
@@ -2,11 +2,6 @@ package com.sopt.now
import androidx.annotation.DrawableRes
-data class User(
- @DrawableRes val profileImage: Int,
- val name: String,
- val selfDescription: String
-)
data class Friend(
@DrawableRes val profileImage: Int,
val name: String,
From 40c4f30dd157b137d93c3475ee7c764625f1e4d8 Mon Sep 17 00:00:00 2001
From: hyeumm <20221159@sungshin.ac.kr>
Date: Sun, 14 Apr 2024 01:53:41 +0900
Subject: [PATCH 08/29] =?UTF-8?q?feat/#5:=20=EB=A9=80=ED=8B=B0=EB=B7=B0=20?=
=?UTF-8?q?=EB=A6=AC=EC=8B=B8=EC=9D=B4=ED=81=B4=EB=9F=AC=EB=B7=B0=20?=
=?UTF-8?q?=EC=83=9D=EC=84=B1?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/src/main/java/com/sopt/now/Friend.kt | 8 +++-
.../main/java/com/sopt/now/FriendAdapter.kt | 48 +++++++++++++++----
.../java/com/sopt/now/FriendViewHolder.kt | 21 ++++----
.../main/java/com/sopt/now/HomeFragment.kt | 15 ++++--
.../main/java/com/sopt/now/LoginActivity.kt | 4 +-
app/src/main/res/layout/item_friend.xml | 2 +-
app/src/main/res/layout/item_user.xml | 48 +++++++++++++++++++
7 files changed, 121 insertions(+), 25 deletions(-)
create mode 100644 app/src/main/res/layout/item_user.xml
diff --git a/app/src/main/java/com/sopt/now/Friend.kt b/app/src/main/java/com/sopt/now/Friend.kt
index f6d3ea0..031fead 100644
--- a/app/src/main/java/com/sopt/now/Friend.kt
+++ b/app/src/main/java/com/sopt/now/Friend.kt
@@ -6,4 +6,10 @@ data class Friend(
@DrawableRes val profileImage: Int,
val name: String,
val selfDescription: String,
-)
\ No newline at end of file
+ val viewType : Int
+) {
+ companion object {
+ const val VIEW_TYPE_USER = 0
+ const val VIEW_TYPE_FRIEND = 1
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/sopt/now/FriendAdapter.kt b/app/src/main/java/com/sopt/now/FriendAdapter.kt
index 57c710c..014d53c 100644
--- a/app/src/main/java/com/sopt/now/FriendAdapter.kt
+++ b/app/src/main/java/com/sopt/now/FriendAdapter.kt
@@ -1,26 +1,54 @@
package com.sopt.now
import android.view.LayoutInflater
+import android.view.View
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
-import com.sopt.now.databinding.ItemFriendBinding
+import java.lang.RuntimeException
-class FriendAdapter() : RecyclerView.Adapter() {
+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 onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder {
+ val adapterLayout : View?
+ return when(viewType){
+ Friend.VIEW_TYPE_USER -> {
+ adapterLayout = LayoutInflater.from(parent.context)
+ .inflate(R.layout.item_user,parent,false)
+ UserViewHolder(adapterLayout)
+ }
+ Friend.VIEW_TYPE_FRIEND -> {
+ adapterLayout = LayoutInflater.from(parent.context)
+ .inflate(R.layout.item_friend,parent,false)
+ FriendViewHolder(adapterLayout)
+ }
+ else -> throw RuntimeException("알 수 없는 뷰타입입니다.")
+ }
}
- override fun onBindViewHolder(holder: FriendViewHolder, position: Int) {
- holder.onBind(friendList[position])
+ override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) {
+ val item = friendList[position]
+ when(item.viewType){
+ Friend.VIEW_TYPE_USER -> {
+ (holder as UserViewHolder).ivProfile.setImageResource(item.profileImage)
+ holder.tvName.text = item.name
+ holder.tvSelfDescription.text = item.selfDescription
+ holder.setIsRecyclable(false)
+ }
+ Friend.VIEW_TYPE_FRIEND -> {
+ (holder as FriendViewHolder).ivProfile.setImageResource(item.profileImage)
+ holder.tvName.text = item.name
+ holder.tvSelfDescription.text = item.selfDescription
+ holder.setIsRecyclable(false)
+ }
+ else -> throw RuntimeException("알 수 없는 뷰타입입니다.")
+ }
}
override fun getItemCount() = friendList.size
-
+ override fun getItemViewType(position: Int): Int {
+ return friendList[position].viewType
+ }
fun setFriendList(friendList: List) {
this.friendList = friendList.toList()
notifyDataSetChanged()
diff --git a/app/src/main/java/com/sopt/now/FriendViewHolder.kt b/app/src/main/java/com/sopt/now/FriendViewHolder.kt
index 85375be..5e255ee 100644
--- a/app/src/main/java/com/sopt/now/FriendViewHolder.kt
+++ b/app/src/main/java/com/sopt/now/FriendViewHolder.kt
@@ -1,14 +1,19 @@
package com.sopt.now
+import android.view.View
+import android.widget.ImageView
+import android.widget.TextView
import androidx.recyclerview.widget.RecyclerView
import com.sopt.now.databinding.ItemFriendBinding
+import com.sopt.now.databinding.ItemUserBinding
-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
- }
- }
+class FriendViewHolder(private val view: View) : RecyclerView.ViewHolder(view) {
+ val ivProfile : ImageView = view.findViewById(R.id.iv_profile)
+ val tvName : TextView = view.findViewById(R.id.tv_name)
+ val tvSelfDescription : TextView = view.findViewById(R.id.tv_self_description)
+}
+class UserViewHolder(private val view: View) : RecyclerView.ViewHolder(view) {
+ val ivProfile : ImageView = view.findViewById(R.id.iv_profile)
+ val tvName : TextView = view.findViewById(R.id.tv_name)
+ val tvSelfDescription : TextView = view.findViewById(R.id.tv_self_description)
}
\ No newline at end of file
diff --git a/app/src/main/java/com/sopt/now/HomeFragment.kt b/app/src/main/java/com/sopt/now/HomeFragment.kt
index 2917642..922b00e 100644
--- a/app/src/main/java/com/sopt/now/HomeFragment.kt
+++ b/app/src/main/java/com/sopt/now/HomeFragment.kt
@@ -13,19 +13,28 @@ class HomeFragment : Fragment() {
private val mockFriendList = listOf(
Friend(
- profileImage = R.drawable.ic_home_white_24,
+ profileImage = R.drawable.main,
+ name = "송혜음",
+ selfDescription = "멀티 뷰 리싸이클러뷰!",
+ 0
+ ),
+ Friend(
+ profileImage = R.drawable.main,
name = "이의경",
selfDescription = "다들 빨리 끝내고 뒤풀이 가고 싶지? ㅎㅎ 아직 반도 안왔어 ^&^",
+ 1
),
Friend(
- profileImage = R.drawable.ic_home_white_24,
+ profileImage = R.drawable.main,
name = "우상욱",
selfDescription = "나보다 안드 잘하는 사람 있으면 나와봐",
+ 1
),
Friend(
- profileImage = R.drawable.ic_home_white_24,
+ profileImage = R.drawable.main,
name = "배지현",
selfDescription = "표정 풀자 ^^",
+ 1
),
)
override fun onCreateView(
diff --git a/app/src/main/java/com/sopt/now/LoginActivity.kt b/app/src/main/java/com/sopt/now/LoginActivity.kt
index 23c1d48..78e1356 100644
--- a/app/src/main/java/com/sopt/now/LoginActivity.kt
+++ b/app/src/main/java/com/sopt/now/LoginActivity.kt
@@ -68,8 +68,8 @@ class LoginActivity : AppCompatActivity() {
}
private fun sendData(id:String,pw:String,nick:String){
if (isLoginAvailable(id, pw)) {
- var mypagefragment = MyPageFragment()
- var bundle = Bundle()
+ val mypagefragment = MyPageFragment()
+ val bundle = Bundle()
bundle.putString("id",id)
bundle.putString("pw",pw)
bundle.putString("nick",nick)
diff --git a/app/src/main/res/layout/item_friend.xml b/app/src/main/res/layout/item_friend.xml
index 93d9c95..bd00c96 100644
--- a/app/src/main/res/layout/item_friend.xml
+++ b/app/src/main/res/layout/item_friend.xml
@@ -11,7 +11,7 @@
android:layout_marginStart="20dp"
android:scaleType="centerCrop"
android:layout_marginVertical="10dp"
- android:src="@drawable/ic_person_white_24"
+ android:src="@drawable/main"
app:layout_constraintDimensionRatio="1"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
diff --git a/app/src/main/res/layout/item_user.xml b/app/src/main/res/layout/item_user.xml
new file mode 100644
index 0000000..fa7ba00
--- /dev/null
+++ b/app/src/main/res/layout/item_user.xml
@@ -0,0 +1,48 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
From f6a8a70e8caadc5625a02a0b8e714653f011fd5d Mon Sep 17 00:00:00 2001
From: hyeumm <20221159@sungshin.ac.kr>
Date: Sun, 14 Apr 2024 03:34:36 +0900
Subject: [PATCH 09/29] =?UTF-8?q?fix/#5:=EA=B3=B5=EB=B0=B1=20=EB=A1=9C?=
=?UTF-8?q?=EA=B7=B8=EC=9D=B8=20=EC=84=B1=EA=B3=B5=20=EC=98=A4=EB=A5=98=20?=
=?UTF-8?q?=ED=95=B4=EA=B2=B0?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/src/main/java/com/sopt/now/LoginActivity.kt | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/app/src/main/java/com/sopt/now/LoginActivity.kt b/app/src/main/java/com/sopt/now/LoginActivity.kt
index 78e1356..dc55c08 100644
--- a/app/src/main/java/com/sopt/now/LoginActivity.kt
+++ b/app/src/main/java/com/sopt/now/LoginActivity.kt
@@ -37,7 +37,6 @@ class LoginActivity : AppCompatActivity() {
}
}
binding.btnLogin.setOnClickListener {
- startMainActivity()
sendData(id,pw,nick)
}
}
@@ -53,6 +52,7 @@ class LoginActivity : AppCompatActivity() {
val userId = binding.etvLoginId.text.toString()
val userPw = binding.etvLoginPw.text.toString()
val message = when{
+ userId == "" || userPw == "" -> "모든 항목을 입력해주세요."
userId != id || userPw != pw -> "아이디 혹은 비밀번호가 일치하지 않습니다."
else -> {
loginBool = true
@@ -62,18 +62,16 @@ class LoginActivity : AppCompatActivity() {
Toast.makeText(this,message,Toast.LENGTH_SHORT).show()
return loginBool
}
- private fun startMainActivity(){
- val intent = Intent(this, MainActivity::class.java)
- startActivity(intent)
- }
private fun sendData(id:String,pw:String,nick:String){
if (isLoginAvailable(id, pw)) {
+ val intent = Intent(this, MainActivity::class.java)
val mypagefragment = MyPageFragment()
val bundle = Bundle()
bundle.putString("id",id)
bundle.putString("pw",pw)
bundle.putString("nick",nick)
mypagefragment.arguments = bundle
+ startActivity(intent)
}
}
}
From b379d7219587f37980973ef3d043c43a74a0b2ec Mon Sep 17 00:00:00 2001
From: hyeumm <20221159@sungshin.ac.kr>
Date: Mon, 15 Apr 2024 00:51:26 +0900
Subject: [PATCH 10/29] =?UTF-8?q?fix/#5:=20=EB=A7=88=EC=9D=B4=ED=8E=98?=
=?UTF-8?q?=EC=9D=B4=EC=A7=80=20=EB=8D=B0=EC=9D=B4=ED=84=B0=20=EB=AF=B8?=
=?UTF-8?q?=EC=A0=84=EB=8B=AC=20=ED=95=B4=EA=B2=B0?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../main/java/com/sopt/now/LoginActivity.kt | 23 ++++++++++++-------
.../main/java/com/sopt/now/MyPageFragment.kt | 16 +++++--------
2 files changed, 21 insertions(+), 18 deletions(-)
diff --git a/app/src/main/java/com/sopt/now/LoginActivity.kt b/app/src/main/java/com/sopt/now/LoginActivity.kt
index dc55c08..698531f 100644
--- a/app/src/main/java/com/sopt/now/LoginActivity.kt
+++ b/app/src/main/java/com/sopt/now/LoginActivity.kt
@@ -37,7 +37,7 @@ class LoginActivity : AppCompatActivity() {
}
}
binding.btnLogin.setOnClickListener {
- sendData(id,pw,nick)
+ moveToMain(id,pw,nick)
}
}
private fun moveToSignUp(){
@@ -62,16 +62,23 @@ class LoginActivity : AppCompatActivity() {
Toast.makeText(this,message,Toast.LENGTH_SHORT).show()
return loginBool
}
- private fun sendData(id:String,pw:String,nick:String){
+ private fun moveToMain(id:String,pw:String,nick:String){
if (isLoginAvailable(id, pw)) {
val intent = Intent(this, MainActivity::class.java)
- val mypagefragment = MyPageFragment()
- val bundle = Bundle()
- bundle.putString("id",id)
- bundle.putString("pw",pw)
- bundle.putString("nick",nick)
- mypagefragment.arguments = bundle
+ saveUserInfo(id,pw,nick)
startActivity(intent)
}
}
+ private fun saveUserInfo(id:String,pw:String,nick:String) {
+ if (isLoginAvailable(id, pw)) {
+ val sharedPreferences = getSharedPreferences("userInfo", MODE_PRIVATE)
+ val editor = sharedPreferences.edit()
+
+ editor
+ .putString("userId", id)
+ .putString("userPw", pw)
+ .putString("userNick", nick)
+ .apply()
+ }
+ }
}
diff --git a/app/src/main/java/com/sopt/now/MyPageFragment.kt b/app/src/main/java/com/sopt/now/MyPageFragment.kt
index 527dc24..f4b2e64 100644
--- a/app/src/main/java/com/sopt/now/MyPageFragment.kt
+++ b/app/src/main/java/com/sopt/now/MyPageFragment.kt
@@ -1,6 +1,8 @@
package com.sopt.now
+import android.content.Context
import android.os.Bundle
+import android.util.Log
import androidx.fragment.app.Fragment
import android.view.LayoutInflater
import android.view.View
@@ -10,13 +12,6 @@ import com.sopt.now.databinding.FragmentMyPageBinding
class MyPageFragment : Fragment() {
private lateinit var binding: FragmentMyPageBinding
- private var param1: String? = null
- private var param2: String? = null
-
- override fun onCreate(savedInstanceState: Bundle?) {
- super.onCreate(savedInstanceState)
- }
-
override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?
@@ -26,8 +21,9 @@ class MyPageFragment : Fragment() {
return binding.root
}
private fun getUserInfo() {
- binding.tvMainNick.text = arguments?.getString("nick")
- binding.tvMainId.text = arguments?.getString("id")
- binding.tvMainPw.text = arguments?.getString("pw")
+ val userInfo = activity?.getSharedPreferences("userInfo",Context.MODE_PRIVATE)
+ binding.tvMainNick.text = userInfo?.getString("userNick","")
+ binding.tvMainId.text = userInfo?.getString("userId","")
+ binding.tvMainPw.text = userInfo?.getString("userPw","")
}
}
\ No newline at end of file
From 69ccff059ded0e4b7c9ba5bd2021a9c8ac59970e Mon Sep 17 00:00:00 2001
From: hyeumm <20221159@sungshin.ac.kr>
Date: Mon, 15 Apr 2024 01:06:01 +0900
Subject: [PATCH 11/29] =?UTF-8?q?mod/#5:=20=EB=B7=B0=ED=99=80=EB=8D=94=20?=
=?UTF-8?q?=EB=B6=84=EB=A6=AC=20=EB=8D=B0=EC=9D=B4=ED=84=B0=20=EB=B6=84?=
=?UTF-8?q?=EB=A6=AC?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../java/com/sopt/now/FriendViewHolder.kt | 8 ---
.../main/java/com/sopt/now/HomeFragment.kt | 28 +-------
.../main/java/com/sopt/now/MockFriendList.kt | 66 +++++++++++++++++++
.../main/java/com/sopt/now/UserViewHolder.kt | 12 ++++
4 files changed, 79 insertions(+), 35 deletions(-)
create mode 100644 app/src/main/java/com/sopt/now/MockFriendList.kt
create mode 100644 app/src/main/java/com/sopt/now/UserViewHolder.kt
diff --git a/app/src/main/java/com/sopt/now/FriendViewHolder.kt b/app/src/main/java/com/sopt/now/FriendViewHolder.kt
index 5e255ee..bc292e1 100644
--- a/app/src/main/java/com/sopt/now/FriendViewHolder.kt
+++ b/app/src/main/java/com/sopt/now/FriendViewHolder.kt
@@ -4,16 +4,8 @@ import android.view.View
import android.widget.ImageView
import android.widget.TextView
import androidx.recyclerview.widget.RecyclerView
-import com.sopt.now.databinding.ItemFriendBinding
-import com.sopt.now.databinding.ItemUserBinding
-
class FriendViewHolder(private val view: View) : RecyclerView.ViewHolder(view) {
val ivProfile : ImageView = view.findViewById(R.id.iv_profile)
val tvName : TextView = view.findViewById(R.id.tv_name)
val tvSelfDescription : TextView = view.findViewById(R.id.tv_self_description)
-}
-class UserViewHolder(private val view: View) : RecyclerView.ViewHolder(view) {
- val ivProfile : ImageView = view.findViewById(R.id.iv_profile)
- val tvName : TextView = view.findViewById(R.id.tv_name)
- val tvSelfDescription : TextView = view.findViewById(R.id.tv_self_description)
}
\ No newline at end of file
diff --git a/app/src/main/java/com/sopt/now/HomeFragment.kt b/app/src/main/java/com/sopt/now/HomeFragment.kt
index 922b00e..03a5310 100644
--- a/app/src/main/java/com/sopt/now/HomeFragment.kt
+++ b/app/src/main/java/com/sopt/now/HomeFragment.kt
@@ -11,32 +11,6 @@ import com.sopt.now.databinding.FragmentHomeBinding
class HomeFragment : Fragment() {
private lateinit var binding: FragmentHomeBinding
- private val mockFriendList = listOf(
- Friend(
- profileImage = R.drawable.main,
- name = "송혜음",
- selfDescription = "멀티 뷰 리싸이클러뷰!",
- 0
- ),
- Friend(
- profileImage = R.drawable.main,
- name = "이의경",
- selfDescription = "다들 빨리 끝내고 뒤풀이 가고 싶지? ㅎㅎ 아직 반도 안왔어 ^&^",
- 1
- ),
- Friend(
- profileImage = R.drawable.main,
- name = "우상욱",
- selfDescription = "나보다 안드 잘하는 사람 있으면 나와봐",
- 1
- ),
- Friend(
- profileImage = R.drawable.main,
- name = "배지현",
- selfDescription = "표정 풀자 ^^",
- 1
- ),
- )
override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?
@@ -51,7 +25,7 @@ class HomeFragment : Fragment() {
adapter = friendAdapter
layoutManager = LinearLayoutManager(requireContext())
}
- friendAdapter.setFriendList(mockFriendList)
+ friendAdapter.setFriendList(MockFriendList.mockFriendList)
}
}
\ No newline at end of file
diff --git a/app/src/main/java/com/sopt/now/MockFriendList.kt b/app/src/main/java/com/sopt/now/MockFriendList.kt
new file mode 100644
index 0000000..9bcb4c5
--- /dev/null
+++ b/app/src/main/java/com/sopt/now/MockFriendList.kt
@@ -0,0 +1,66 @@
+package com.sopt.now
+
+object MockFriendList {
+ val mockFriendList = listOf(
+ Friend(
+ profileImage = R.drawable.main,
+ name = "송혜음",
+ selfDescription = "멀티 뷰 리싸이클러뷰!",
+ 0
+ ),
+ Friend(
+ profileImage = R.drawable.main,
+ name = "이의경",
+ selfDescription = "다들 빨리 끝내고 뒤풀이 가고 싶지? ㅎㅎ 아직 반도 안왔어 ^&^",
+ 1
+ ),
+ Friend(
+ profileImage = R.drawable.main,
+ name = "우상욱",
+ selfDescription = "나보다 안드 잘하는 사람 있으면 나와봐",
+ 1
+ ),
+ Friend(
+ profileImage = R.drawable.main,
+ name = "배지현",
+ selfDescription = "표정 풀자 ^^",
+ 1
+ ),
+ Friend(
+ profileImage = R.drawable.main,
+ name = "이의경",
+ selfDescription = "다들 빨리 끝내고 뒤풀이 가고 싶지? ㅎㅎ 아직 반도 안왔어 ^&^",
+ 1
+ ),
+ Friend(
+ profileImage = R.drawable.main,
+ name = "우상욱",
+ selfDescription = "나보다 안드 잘하는 사람 있으면 나와봐",
+ 1
+ ),
+ Friend(
+ profileImage = R.drawable.main,
+ name = "배지현",
+ selfDescription = "표정 풀자 ^^",
+ 1
+ ),
+ Friend(
+ profileImage = R.drawable.main,
+ name = "이의경",
+ selfDescription = "다들 빨리 끝내고 뒤풀이 가고 싶지? ㅎㅎ 아직 반도 안왔어 ^&^",
+ 1
+ ),
+ Friend(
+ profileImage = R.drawable.main,
+ name = "우상욱",
+ selfDescription = "나보다 안드 잘하는 사람 있으면 나와봐",
+ 1
+ ),
+ Friend(
+ profileImage = R.drawable.main,
+ name = "배지현",
+ selfDescription = "표정 풀자 ^^",
+ 1
+ )
+ )
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/sopt/now/UserViewHolder.kt b/app/src/main/java/com/sopt/now/UserViewHolder.kt
new file mode 100644
index 0000000..315f65b
--- /dev/null
+++ b/app/src/main/java/com/sopt/now/UserViewHolder.kt
@@ -0,0 +1,12 @@
+package com.sopt.now
+
+import android.view.View
+import android.widget.ImageView
+import android.widget.TextView
+import androidx.recyclerview.widget.RecyclerView
+
+class UserViewHolder(private val view: View) : RecyclerView.ViewHolder(view) {
+ val ivProfile : ImageView = view.findViewById(R.id.iv_profile)
+ val tvName : TextView = view.findViewById(R.id.tv_name)
+ val tvSelfDescription : TextView = view.findViewById(R.id.tv_self_description)
+}
\ No newline at end of file
From d712b654fa0cd242a77b3a7f0e2a6442c4cadf83 Mon Sep 17 00:00:00 2001
From: hyeumm <20221159@sungshin.ac.kr>
Date: Mon, 15 Apr 2024 01:29:26 +0900
Subject: [PATCH 12/29] =?UTF-8?q?mod/#5:=201=EC=A3=BC=EC=B0=A8=20=ED=94=BC?=
=?UTF-8?q?=EB=93=9C=EB=B0=B1=20=EB=B0=98=EC=98=81?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../main/java/com/sopt/now/LoginActivity.kt | 33 ++++++++---------
.../main/java/com/sopt/now/MainActivity.kt | 7 ----
.../main/java/com/sopt/now/SearchFragment.kt | 8 -----
.../main/java/com/sopt/now/SignUpActivity.kt | 12 +++----
app/src/main/res/layout/activity_login.xml | 2 +-
app/src/main/res/layout/activity_sign_up.xml | 20 +++++------
app/src/main/res/layout/fragment_search.xml | 3 +-
app/src/main/res/values/strings.xml | 36 ++++++++++++-------
8 files changed, 56 insertions(+), 65 deletions(-)
diff --git a/app/src/main/java/com/sopt/now/LoginActivity.kt b/app/src/main/java/com/sopt/now/LoginActivity.kt
index 698531f..28d889f 100644
--- a/app/src/main/java/com/sopt/now/LoginActivity.kt
+++ b/app/src/main/java/com/sopt/now/LoginActivity.kt
@@ -23,7 +23,7 @@ class LoginActivity : AppCompatActivity() {
moveToSignUp()
}
- private fun getUser() { // 아쉬운 부분
+ private fun getUser() {
var id = ""
var pw = ""
var nick = ""
@@ -47,21 +47,6 @@ class LoginActivity : AppCompatActivity() {
resultLauncher.launch(intent)
}
}
- private fun isLoginAvailable(id: String, pw: String) :Boolean {
- var loginBool = false
- val userId = binding.etvLoginId.text.toString()
- val userPw = binding.etvLoginPw.text.toString()
- val message = when{
- userId == "" || userPw == "" -> "모든 항목을 입력해주세요."
- userId != id || userPw != pw -> "아이디 혹은 비밀번호가 일치하지 않습니다."
- else -> {
- loginBool = true
- "로그인에 성공했습니다."
- }
- }
- Toast.makeText(this,message,Toast.LENGTH_SHORT).show()
- return loginBool
- }
private fun moveToMain(id:String,pw:String,nick:String){
if (isLoginAvailable(id, pw)) {
val intent = Intent(this, MainActivity::class.java)
@@ -70,15 +55,27 @@ class LoginActivity : AppCompatActivity() {
}
}
private fun saveUserInfo(id:String,pw:String,nick:String) {
- if (isLoginAvailable(id, pw)) {
val sharedPreferences = getSharedPreferences("userInfo", MODE_PRIVATE)
val editor = sharedPreferences.edit()
-
editor
.putString("userId", id)
.putString("userPw", pw)
.putString("userNick", nick)
.apply()
+ }
+ private fun isLoginAvailable(id: String, pw: String) :Boolean {
+ var loginBool = false
+ val userId = binding.etvLoginId.text.toString()
+ val userPw = binding.etvLoginPw.text.toString()
+ val message = when{
+ userId == "" || userPw == "" -> getString(R.string.login_error_blank)
+ userId != id || userPw != pw -> getString(R.string.login_error_different)
+ else -> {
+ loginBool = true
+ getString(R.string.login_success)
+ }
}
+ Toast.makeText(this,message,Toast.LENGTH_SHORT).show()
+ return loginBool
}
}
diff --git a/app/src/main/java/com/sopt/now/MainActivity.kt b/app/src/main/java/com/sopt/now/MainActivity.kt
index 834d650..53578b1 100644
--- a/app/src/main/java/com/sopt/now/MainActivity.kt
+++ b/app/src/main/java/com/sopt/now/MainActivity.kt
@@ -20,8 +20,6 @@ class MainActivity : AppCompatActivity() {
}
clickBottomNavigation()
- //로그인화면에서 받아온 id/pw 화면에 출력
- //getUserInfo()
}
private fun clickBottomNavigation() {
binding.bnvHome.setOnItemSelectedListener{
@@ -50,9 +48,4 @@ class MainActivity : AppCompatActivity() {
.replace(R.id.fcv_home, fragment)
.commit()
}
-// private fun getUserInfo() {
-// binding.tvMainNick.text = intent.getStringExtra("nick")
-// binding.tvMainId.text = intent.getStringExtra("id")
-// binding.tvMainPw.text = intent.getStringExtra("pw")
-// }
}
\ No newline at end of file
diff --git a/app/src/main/java/com/sopt/now/SearchFragment.kt b/app/src/main/java/com/sopt/now/SearchFragment.kt
index 6487a8d..cef48f5 100644
--- a/app/src/main/java/com/sopt/now/SearchFragment.kt
+++ b/app/src/main/java/com/sopt/now/SearchFragment.kt
@@ -7,19 +7,11 @@ import android.view.View
import android.view.ViewGroup
class SearchFragment : Fragment() {
- // TODO: Rename and change types of parameters
- private var param1: String? = null
- private var param2: String? = null
-
- 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_search, container, false)
}
diff --git a/app/src/main/java/com/sopt/now/SignUpActivity.kt b/app/src/main/java/com/sopt/now/SignUpActivity.kt
index 9cff89e..8ee35ef 100644
--- a/app/src/main/java/com/sopt/now/SignUpActivity.kt
+++ b/app/src/main/java/com/sopt/now/SignUpActivity.kt
@@ -39,14 +39,14 @@ class SignUpActivity : AppCompatActivity() {
private fun isSignUpAvailable(id:String,pw:String,nick:String,etc:String):Boolean {
var signUpBool = false
val message = when {
- id.isEmpty() || pw.isEmpty() || nick.isEmpty() || etc.isEmpty() -> "모든 항목을 입력해주세요."
- id.length !in 6..10 -> "아이디를 다시 설정하세요."
- pw.length !in 8..12 -> "비밀번호를 다시 설정하세요."
- nick.isBlank() || nick.length != nick.trim().length -> "닉네임을 다시 설정하세요."
- etc.length !in 1..Int.MAX_VALUE -> "하고싶은 말을 다시 설정하세요."
+ id.isEmpty() || pw.isEmpty() || nick.isEmpty() || etc.isEmpty() -> getString(R.string.sign_up_error_blank)
+ id.length !in 6..10 -> getString(R.string.sign_up_error_id)
+ pw.length !in 8..12 -> getString(R.string.sign_up_error_pw)
+ nick.isBlank() || nick.length != nick.trim().length -> getString(R.string.sign_up_error_nick)
+ etc.length !in 1..Int.MAX_VALUE -> getString(R.string.sign_up_error_etc)
else -> {
signUpBool = true
- "회원가입에 성공했습니다."
+ getString(R.string.sign_up_success)
}
}
Toast.makeText(this, message, Toast.LENGTH_SHORT).show()
diff --git a/app/src/main/res/layout/activity_login.xml b/app/src/main/res/layout/activity_login.xml
index 06af7f1..4e11b9e 100644
--- a/app/src/main/res/layout/activity_login.xml
+++ b/app/src/main/res/layout/activity_login.xml
@@ -79,7 +79,7 @@
android:id="@+id/btn_login_sign_in"
android:layout_width="0dp"
android:layout_height="wrap_content"
- android:text="@string/sign_in_btn"
+ android:text="@string/sign_up_btn"
android:textAlignment="center"
app:layout_constraintTop_toBottomOf="@+id/btn_login"
app:layout_constraintStart_toStartOf="parent"
diff --git a/app/src/main/res/layout/activity_sign_up.xml b/app/src/main/res/layout/activity_sign_up.xml
index cee823f..91ceac3 100644
--- a/app/src/main/res/layout/activity_sign_up.xml
+++ b/app/src/main/res/layout/activity_sign_up.xml
@@ -13,7 +13,7 @@
android:layout_height="wrap_content"
android:layout_marginHorizontal="30dp"
android:padding="30dp"
- android:text="@string/sign_in_title"
+ android:text="@string/sign_up_title"
android:textColor="@color/color_sopt"
android:textSize="35sp"
android:textStyle="bold"
@@ -35,7 +35,7 @@
android:id="@+id/tv_sign_in_id_hint"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:text="@string/sign_in_condition"
+ android:text="@string/sign_up_condition"
android:textSize="15sp"
android:layout_marginHorizontal="30dp"
app:layout_constraintTop_toBottomOf="@id/tv_sign_in_id"
@@ -44,7 +44,7 @@
android:id="@+id/etv_sign_in_id"
android:layout_width="0dp"
android:layout_height="wrap_content"
- android:hint="@string/sign_in_id_hint"
+ android:hint="@string/sign_up_id_hint"
android:singleLine="true"
android:layout_marginHorizontal="30dp"
app:layout_constraintTop_toBottomOf="@id/tv_sign_in_id_hint"
@@ -65,7 +65,7 @@
android:id="@+id/tv_sign_in_pw_hint"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:text="@string/sign_in_pw_condition"
+ android:text="@string/sign_up_pw_condition"
android:textSize="15sp"
android:layout_marginHorizontal="30dp"
app:layout_constraintTop_toBottomOf="@id/tv_sign_in_pw"
@@ -74,7 +74,7 @@
android:id="@+id/etv_sign_in_pw"
android:layout_width="0dp"
android:layout_height="wrap_content"
- android:hint="@string/sign_in_pw_hint"
+ android:hint="@string/sign_up_pw_hint"
android:singleLine="true"
android:layout_marginHorizontal="30dp"
app:layout_constraintTop_toBottomOf="@id/tv_sign_in_pw_hint"
@@ -95,7 +95,7 @@
android:id="@+id/tv_sign_in_nivk_hint"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:text="@string/sign_in_nick_text"
+ android:text="@string/sign_up_nick_text"
android:textSize="15sp"
android:layout_marginHorizontal="30dp"
app:layout_constraintTop_toBottomOf="@id/tv_sign_in_nick"
@@ -104,7 +104,7 @@
android:id="@+id/etv_sign_in_nick"
android:layout_width="0dp"
android:layout_height="wrap_content"
- android:hint="@string/sign_in_nick_hint"
+ android:hint="@string/sign_up_nick_hint"
android:singleLine="true"
android:layout_marginHorizontal="30dp"
app:layout_constraintTop_toBottomOf="@id/tv_sign_in_nivk_hint"
@@ -125,7 +125,7 @@
android:id="@+id/tv_sign_in_etc_hint"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:text="@string/sign_in_etc_text"
+ android:text="@string/sign_up_etc_text"
android:textSize="15sp"
android:layout_marginHorizontal="30dp"
app:layout_constraintTop_toBottomOf="@id/tv_sign_in_etc"
@@ -134,7 +134,7 @@
android:id="@+id/etv_sign_in_etc"
android:layout_width="0dp"
android:layout_height="wrap_content"
- android:hint="@string/sign_in_etc_hint"
+ android:hint="@string/sign_up_etc_hint"
android:singleLine="true"
android:layout_marginHorizontal="30dp"
app:layout_constraintTop_toBottomOf="@id/tv_sign_in_etc_hint"
@@ -147,7 +147,7 @@
android:layout_marginHorizontal="30dp"
android:layout_marginBottom="60dp"
android:backgroundTint="@color/color_sopt"
- android:text="@string/sign_up_btn"
+ android:text="@string/sign_up_btn2"
android:textColor="#000000"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
diff --git a/app/src/main/res/layout/fragment_search.xml b/app/src/main/res/layout/fragment_search.xml
index 07de9d3..7307b6c 100644
--- a/app/src/main/res/layout/fragment_search.xml
+++ b/app/src/main/res/layout/fragment_search.xml
@@ -5,8 +5,7 @@
android:layout_height="match_parent"
tools:context=".SearchFragment">
-
-
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 7d4ea11..209f0d0 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -6,21 +6,31 @@
비밀번호
비밀번호를 입력해주세요
로그인 하기
- ]]>
NOW SOPT
SHOUT OUR PASSION TOGETHER
- SIGN UP
- *6-10자 입력해주세요.
- 아이디를 입력해주세요
- *8-12자 입력해주세요.
- 비밀번호를 입력해주세요
닉네임
- *한 글자 이상 입력해주세요.
- 닉네임을 입력해주세요
하고싶은 말
- *한 글자 이상 입력해주세요.
- 하고싶은 말을 입력해주세요
- 회원가입 하기
-
- Hello blank fragment
+
+ 모든 항목을 입력해주세요.
+ 아이디 혹은 비밀번호가 일치하지 않습니다.
+ 로그인에 성공했습니다.
+
+ ]]>
+ 회원가입 하기
+ SIGN UP
+ *6-10자 입력해주세요.
+ 아이디를 입력해주세요
+ *8-12자 입력해주세요.
+ 비밀번호를 입력해주세요
+ *한 글자 이상 입력해주세요.
+ 닉네임을 입력해주세요
+ *한 글자 이상 입력해주세요.
+ 하고싶은 말을 입력해주세요
+ 회원가입에 성공했습니다.
+
+ 모든 항목을 입력해주세요.
+ 아이디를 다시 설정하세요.
+ 비밀번호를 다시 설정하세요.
+ 닉네임을 다시 설정하세요.
+ 하고싶은 말을 다시 설정하세요.
\ No newline at end of file
From 5012ed1484ac40d36f769f72ad10472528e405e8 Mon Sep 17 00:00:00 2001
From: hyeumm <20221159@sungshin.ac.kr>
Date: Mon, 15 Apr 2024 01:44:17 +0900
Subject: [PATCH 13/29] =?UTF-8?q?mod/#5:=20=ED=9A=8C=EC=9B=90=EA=B0=80?=
=?UTF-8?q?=EC=9E=85=20=EC=A1=B0=EA=B1=B4=20=EC=83=81=EC=88=98=ED=99=94?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/src/main/java/com/sopt/now/SignUpActivity.kt | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/app/src/main/java/com/sopt/now/SignUpActivity.kt b/app/src/main/java/com/sopt/now/SignUpActivity.kt
index 8ee35ef..848b34c 100644
--- a/app/src/main/java/com/sopt/now/SignUpActivity.kt
+++ b/app/src/main/java/com/sopt/now/SignUpActivity.kt
@@ -8,6 +8,7 @@ import com.sopt.now.databinding.ActivitySignUpBinding
class SignUpActivity : AppCompatActivity() {
private lateinit var binding:ActivitySignUpBinding
+
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
binding = ActivitySignUpBinding.inflate(layoutInflater)
@@ -40,8 +41,8 @@ class SignUpActivity : AppCompatActivity() {
var signUpBool = false
val message = when {
id.isEmpty() || pw.isEmpty() || nick.isEmpty() || etc.isEmpty() -> getString(R.string.sign_up_error_blank)
- id.length !in 6..10 -> getString(R.string.sign_up_error_id)
- pw.length !in 8..12 -> getString(R.string.sign_up_error_pw)
+ id.length !in MIN_ID_LENGTH..MAX_ID_LENGTH -> getString(R.string.sign_up_error_id)
+ pw.length !in MIN_PW_LENGTH..MAX_PW_LENGTH -> getString(R.string.sign_up_error_pw)
nick.isBlank() || nick.length != nick.trim().length -> getString(R.string.sign_up_error_nick)
etc.length !in 1..Int.MAX_VALUE -> getString(R.string.sign_up_error_etc)
else -> {
@@ -52,4 +53,11 @@ class SignUpActivity : AppCompatActivity() {
Toast.makeText(this, message, Toast.LENGTH_SHORT).show()
return signUpBool
}
+ companion object {
+ //회원가입 조건 상수화
+ const val MIN_ID_LENGTH = 6
+ const val MAX_ID_LENGTH = 10
+ const val MIN_PW_LENGTH = 8
+ const val MAX_PW_LENGTH = 12
+ }
}
\ No newline at end of file
From b27970a44722fa1aee78893a625eab301029fe1e Mon Sep 17 00:00:00 2001
From: hyeumm <20221159@sungshin.ac.kr>
Date: Fri, 19 Apr 2024 00:36:21 +0900
Subject: [PATCH 14/29] =?UTF-8?q?mod/#5:=20scope=20=ED=95=A8=EC=88=98=20?=
=?UTF-8?q?=EC=82=AC=EC=9A=A9=ED=95=B4=EB=B3=B4=EA=B8=B0?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/src/main/java/com/sopt/now/LoginActivity.kt | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/app/src/main/java/com/sopt/now/LoginActivity.kt b/app/src/main/java/com/sopt/now/LoginActivity.kt
index 28d889f..1f48dfb 100644
--- a/app/src/main/java/com/sopt/now/LoginActivity.kt
+++ b/app/src/main/java/com/sopt/now/LoginActivity.kt
@@ -31,9 +31,11 @@ class LoginActivity : AppCompatActivity() {
ActivityResultContracts.StartActivityForResult()
) { result ->
if (result.resultCode == RESULT_OK) {
- id = result.data?.getStringExtra("id") ?: ""
- pw = result.data?.getStringExtra("pw") ?: ""
- nick = result.data?.getStringExtra("nick") ?: ""
+ result.data?.let { data ->
+ id = data.getStringExtra("id") ?: ""
+ pw = data.getStringExtra("pw") ?: ""
+ nick = data.getStringExtra("nick") ?: ""
+ }
}
}
binding.btnLogin.setOnClickListener {
From 5bc08ee37e62e7e39ff7cc9bba9558a888f5f944 Mon Sep 17 00:00:00 2001
From: hyeumm <20221159@sungshin.ac.kr>
Date: Fri, 19 Apr 2024 00:54:12 +0900
Subject: [PATCH 15/29] =?UTF-8?q?rename/#5:=20=ED=99=88=EC=97=90=20?=
=?UTF-8?q?=EC=9E=88=EB=8A=94=20rc=20=EA=B4=80=EB=A0=A8=20=ED=8C=8C?=
=?UTF-8?q?=EC=9D=BC=20=EC=9D=B4=EB=A6=84=20=EB=B3=80=EA=B2=BD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../main/java/com/sopt/now/HomeFragment.kt | 6 ++---
.../com/sopt/now/{Friend.kt => HomeList.kt} | 2 +-
.../{FriendAdapter.kt => HomeListAdapter.kt} | 22 ++++++++---------
.../{MockFriendList.kt => HomeListData.kt} | 24 +++++++++----------
...endViewHolder.kt => HomeListViewHolder.kt} | 5 ++++
.../main/java/com/sopt/now/UserViewHolder.kt | 12 ----------
6 files changed, 32 insertions(+), 39 deletions(-)
rename app/src/main/java/com/sopt/now/{Friend.kt => HomeList.kt} (93%)
rename app/src/main/java/com/sopt/now/{FriendAdapter.kt => HomeListAdapter.kt} (75%)
rename app/src/main/java/com/sopt/now/{MockFriendList.kt => HomeListData.kt} (88%)
rename app/src/main/java/com/sopt/now/{FriendViewHolder.kt => HomeListViewHolder.kt} (60%)
delete mode 100644 app/src/main/java/com/sopt/now/UserViewHolder.kt
diff --git a/app/src/main/java/com/sopt/now/HomeFragment.kt b/app/src/main/java/com/sopt/now/HomeFragment.kt
index 03a5310..115aef6 100644
--- a/app/src/main/java/com/sopt/now/HomeFragment.kt
+++ b/app/src/main/java/com/sopt/now/HomeFragment.kt
@@ -20,12 +20,12 @@ class HomeFragment : Fragment() {
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
- val friendAdapter = FriendAdapter()
+ val homeListAdapter = HomeListAdapter()
binding.rvFriends.run {
- adapter = friendAdapter
+ adapter = homeListAdapter
layoutManager = LinearLayoutManager(requireContext())
}
- friendAdapter.setFriendList(MockFriendList.mockFriendList)
+ homeListAdapter.setFriendList(HomeListData.homeListData)
}
}
\ No newline at end of file
diff --git a/app/src/main/java/com/sopt/now/Friend.kt b/app/src/main/java/com/sopt/now/HomeList.kt
similarity index 93%
rename from app/src/main/java/com/sopt/now/Friend.kt
rename to app/src/main/java/com/sopt/now/HomeList.kt
index 031fead..80c7aa8 100644
--- a/app/src/main/java/com/sopt/now/Friend.kt
+++ b/app/src/main/java/com/sopt/now/HomeList.kt
@@ -2,7 +2,7 @@ package com.sopt.now
import androidx.annotation.DrawableRes
-data class Friend(
+data class HomeList(
@DrawableRes val profileImage: Int,
val name: String,
val selfDescription: String,
diff --git a/app/src/main/java/com/sopt/now/FriendAdapter.kt b/app/src/main/java/com/sopt/now/HomeListAdapter.kt
similarity index 75%
rename from app/src/main/java/com/sopt/now/FriendAdapter.kt
rename to app/src/main/java/com/sopt/now/HomeListAdapter.kt
index 014d53c..2a9cf7b 100644
--- a/app/src/main/java/com/sopt/now/FriendAdapter.kt
+++ b/app/src/main/java/com/sopt/now/HomeListAdapter.kt
@@ -6,18 +6,18 @@ import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
import java.lang.RuntimeException
-class FriendAdapter() : RecyclerView.Adapter() {
+class HomeListAdapter() : RecyclerView.Adapter() {
// 임시의 빈 리스트
- private var friendList: List = emptyList()
+ private var homeListList: List = emptyList()
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder {
val adapterLayout : View?
return when(viewType){
- Friend.VIEW_TYPE_USER -> {
+ HomeList.VIEW_TYPE_USER -> {
adapterLayout = LayoutInflater.from(parent.context)
.inflate(R.layout.item_user,parent,false)
UserViewHolder(adapterLayout)
}
- Friend.VIEW_TYPE_FRIEND -> {
+ HomeList.VIEW_TYPE_FRIEND -> {
adapterLayout = LayoutInflater.from(parent.context)
.inflate(R.layout.item_friend,parent,false)
FriendViewHolder(adapterLayout)
@@ -27,15 +27,15 @@ class FriendAdapter() : RecyclerView.Adapter() {
}
override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) {
- val item = friendList[position]
+ val item = homeListList[position]
when(item.viewType){
- Friend.VIEW_TYPE_USER -> {
+ HomeList.VIEW_TYPE_USER -> {
(holder as UserViewHolder).ivProfile.setImageResource(item.profileImage)
holder.tvName.text = item.name
holder.tvSelfDescription.text = item.selfDescription
holder.setIsRecyclable(false)
}
- Friend.VIEW_TYPE_FRIEND -> {
+ HomeList.VIEW_TYPE_FRIEND -> {
(holder as FriendViewHolder).ivProfile.setImageResource(item.profileImage)
holder.tvName.text = item.name
holder.tvSelfDescription.text = item.selfDescription
@@ -45,12 +45,12 @@ class FriendAdapter() : RecyclerView.Adapter() {
}
}
- override fun getItemCount() = friendList.size
+ override fun getItemCount() = homeListList.size
override fun getItemViewType(position: Int): Int {
- return friendList[position].viewType
+ return homeListList[position].viewType
}
- fun setFriendList(friendList: List) {
- this.friendList = friendList.toList()
+ fun setFriendList(homeListList: List) {
+ this.homeListList = homeListList.toList()
notifyDataSetChanged()
}
}
\ No newline at end of file
diff --git a/app/src/main/java/com/sopt/now/MockFriendList.kt b/app/src/main/java/com/sopt/now/HomeListData.kt
similarity index 88%
rename from app/src/main/java/com/sopt/now/MockFriendList.kt
rename to app/src/main/java/com/sopt/now/HomeListData.kt
index 9bcb4c5..02665de 100644
--- a/app/src/main/java/com/sopt/now/MockFriendList.kt
+++ b/app/src/main/java/com/sopt/now/HomeListData.kt
@@ -1,62 +1,62 @@
package com.sopt.now
-object MockFriendList {
- val mockFriendList = listOf(
- Friend(
+object HomeListData {
+ val homeListData = listOf(
+ HomeList(
profileImage = R.drawable.main,
name = "송혜음",
selfDescription = "멀티 뷰 리싸이클러뷰!",
0
),
- Friend(
+ HomeList(
profileImage = R.drawable.main,
name = "이의경",
selfDescription = "다들 빨리 끝내고 뒤풀이 가고 싶지? ㅎㅎ 아직 반도 안왔어 ^&^",
1
),
- Friend(
+ HomeList(
profileImage = R.drawable.main,
name = "우상욱",
selfDescription = "나보다 안드 잘하는 사람 있으면 나와봐",
1
),
- Friend(
+ HomeList(
profileImage = R.drawable.main,
name = "배지현",
selfDescription = "표정 풀자 ^^",
1
),
- Friend(
+ HomeList(
profileImage = R.drawable.main,
name = "이의경",
selfDescription = "다들 빨리 끝내고 뒤풀이 가고 싶지? ㅎㅎ 아직 반도 안왔어 ^&^",
1
),
- Friend(
+ HomeList(
profileImage = R.drawable.main,
name = "우상욱",
selfDescription = "나보다 안드 잘하는 사람 있으면 나와봐",
1
),
- Friend(
+ HomeList(
profileImage = R.drawable.main,
name = "배지현",
selfDescription = "표정 풀자 ^^",
1
),
- Friend(
+ HomeList(
profileImage = R.drawable.main,
name = "이의경",
selfDescription = "다들 빨리 끝내고 뒤풀이 가고 싶지? ㅎㅎ 아직 반도 안왔어 ^&^",
1
),
- Friend(
+ HomeList(
profileImage = R.drawable.main,
name = "우상욱",
selfDescription = "나보다 안드 잘하는 사람 있으면 나와봐",
1
),
- Friend(
+ HomeList(
profileImage = R.drawable.main,
name = "배지현",
selfDescription = "표정 풀자 ^^",
diff --git a/app/src/main/java/com/sopt/now/FriendViewHolder.kt b/app/src/main/java/com/sopt/now/HomeListViewHolder.kt
similarity index 60%
rename from app/src/main/java/com/sopt/now/FriendViewHolder.kt
rename to app/src/main/java/com/sopt/now/HomeListViewHolder.kt
index bc292e1..8332de5 100644
--- a/app/src/main/java/com/sopt/now/FriendViewHolder.kt
+++ b/app/src/main/java/com/sopt/now/HomeListViewHolder.kt
@@ -8,4 +8,9 @@ class FriendViewHolder(private val view: View) : RecyclerView.ViewHolder(view) {
val ivProfile : ImageView = view.findViewById(R.id.iv_profile)
val tvName : TextView = view.findViewById(R.id.tv_name)
val tvSelfDescription : TextView = view.findViewById(R.id.tv_self_description)
+}
+class UserViewHolder(private val view: View) : RecyclerView.ViewHolder(view) {
+ val ivProfile : ImageView = view.findViewById(R.id.iv_profile)
+ val tvName : TextView = view.findViewById(R.id.tv_name)
+ val tvSelfDescription : TextView = view.findViewById(R.id.tv_self_description)
}
\ No newline at end of file
diff --git a/app/src/main/java/com/sopt/now/UserViewHolder.kt b/app/src/main/java/com/sopt/now/UserViewHolder.kt
deleted file mode 100644
index 315f65b..0000000
--- a/app/src/main/java/com/sopt/now/UserViewHolder.kt
+++ /dev/null
@@ -1,12 +0,0 @@
-package com.sopt.now
-
-import android.view.View
-import android.widget.ImageView
-import android.widget.TextView
-import androidx.recyclerview.widget.RecyclerView
-
-class UserViewHolder(private val view: View) : RecyclerView.ViewHolder(view) {
- val ivProfile : ImageView = view.findViewById(R.id.iv_profile)
- val tvName : TextView = view.findViewById(R.id.tv_name)
- val tvSelfDescription : TextView = view.findViewById(R.id.tv_self_description)
-}
\ No newline at end of file
From 2420f0ba3d68cdb332f33cd0e8847b6975f36491 Mon Sep 17 00:00:00 2001
From: hyeumm <20221159@sungshin.ac.kr>
Date: Fri, 19 Apr 2024 00:55:50 +0900
Subject: [PATCH 16/29] =?UTF-8?q?chore/#5:=20=EB=A6=AC=EC=8A=A4=ED=8A=B8?=
=?UTF-8?q?=20=EB=8D=B0=EC=9D=B4=ED=84=B0=20=EC=B6=94=EA=B0=80?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/src/main/java/com/sopt/now/HomeListData.kt | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/app/src/main/java/com/sopt/now/HomeListData.kt b/app/src/main/java/com/sopt/now/HomeListData.kt
index 02665de..721c0c7 100644
--- a/app/src/main/java/com/sopt/now/HomeListData.kt
+++ b/app/src/main/java/com/sopt/now/HomeListData.kt
@@ -8,6 +8,24 @@ object HomeListData {
selfDescription = "멀티 뷰 리싸이클러뷰!",
0
),
+ HomeList(
+ profileImage = R.drawable.main,
+ name = "박동민",
+ selfDescription = "곽의진...얼굴 재치 실력 모든걸 다 가진 남자... 하지만 밀양박씨 36대손인 나 박동민은 가지지 못했지",
+ 1
+ ),
+ HomeList(
+ profileImage = R.drawable.main,
+ name = "이석준",
+ selfDescription = "죄송합니다 저 도핑했습니다... 안드-로이더 \uD83D\uDC89",
+ 1
+ ),
+ HomeList(
+ profileImage = R.drawable.main,
+ name = "박유진",
+ selfDescription = "(ง˙∇˙)ว 에라 모르겠다",
+ 1
+ ),
HomeList(
profileImage = R.drawable.main,
name = "이의경",
From 4dd9b1b98c8b01a98a981c1117abb6d81a534fd4 Mon Sep 17 00:00:00 2001
From: hyeumm <20221159@sungshin.ac.kr>
Date: Fri, 19 Apr 2024 00:57:16 +0900
Subject: [PATCH 17/29] =?UTF-8?q?delete/#5:=20=EC=A3=BC=EC=84=9D=20?=
=?UTF-8?q?=EC=82=AD=EC=A0=9C?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/src/main/java/com/sopt/now/HomeListAdapter.kt | 1 -
app/src/main/java/com/sopt/now/LoginActivity.kt | 4 ----
app/src/main/java/com/sopt/now/SearchFragment.kt | 1 -
app/src/main/java/com/sopt/now/SignUpActivity.kt | 4 ----
4 files changed, 10 deletions(-)
diff --git a/app/src/main/java/com/sopt/now/HomeListAdapter.kt b/app/src/main/java/com/sopt/now/HomeListAdapter.kt
index 2a9cf7b..d61dc74 100644
--- a/app/src/main/java/com/sopt/now/HomeListAdapter.kt
+++ b/app/src/main/java/com/sopt/now/HomeListAdapter.kt
@@ -7,7 +7,6 @@ import androidx.recyclerview.widget.RecyclerView
import java.lang.RuntimeException
class HomeListAdapter() : RecyclerView.Adapter() {
- // 임시의 빈 리스트
private var homeListList: List = emptyList()
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder {
val adapterLayout : View?
diff --git a/app/src/main/java/com/sopt/now/LoginActivity.kt b/app/src/main/java/com/sopt/now/LoginActivity.kt
index 1f48dfb..837407c 100644
--- a/app/src/main/java/com/sopt/now/LoginActivity.kt
+++ b/app/src/main/java/com/sopt/now/LoginActivity.kt
@@ -16,12 +16,9 @@ class LoginActivity : AppCompatActivity() {
binding = ActivityLoginBinding.inflate(layoutInflater)
setContentView(binding.root)
- //회원가입에서 사용자 정보 받아옴
getUser()
- //회원가입 페이지로 넘어가기
moveToSignUp()
-
}
private fun getUser() {
var id = ""
@@ -45,7 +42,6 @@ class LoginActivity : AppCompatActivity() {
private fun moveToSignUp(){
binding.btnLoginSignIn.setOnClickListener {
val intent = Intent(this, SignUpActivity::class.java)
- //회원가입 데이터를 받아오기 위해 startActivity가 아닌 resultLauncher사용
resultLauncher.launch(intent)
}
}
diff --git a/app/src/main/java/com/sopt/now/SearchFragment.kt b/app/src/main/java/com/sopt/now/SearchFragment.kt
index cef48f5..56eb256 100644
--- a/app/src/main/java/com/sopt/now/SearchFragment.kt
+++ b/app/src/main/java/com/sopt/now/SearchFragment.kt
@@ -7,7 +7,6 @@ import android.view.View
import android.view.ViewGroup
class SearchFragment : Fragment() {
-
override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?
diff --git a/app/src/main/java/com/sopt/now/SignUpActivity.kt b/app/src/main/java/com/sopt/now/SignUpActivity.kt
index 848b34c..d83adac 100644
--- a/app/src/main/java/com/sopt/now/SignUpActivity.kt
+++ b/app/src/main/java/com/sopt/now/SignUpActivity.kt
@@ -14,7 +14,6 @@ class SignUpActivity : AppCompatActivity() {
binding = ActivitySignUpBinding.inflate(layoutInflater)
setContentView(binding.root)
- //사용자 정보 가져오기
getUserInfo()
}
private fun getUserInfo() {
@@ -30,13 +29,11 @@ class SignUpActivity : AppCompatActivity() {
private fun sendUserInfo(id:String,pw:String,nick:String,etc:String){
if(isSignUpAvailable(id,pw,nick,etc)) {
val intent= Intent(this,LoginActivity::class.java)
- //로그인 액티비티로 데이터를 보냄
intent.putExtra("id",id).putExtra("pw",pw).putExtra("nick",nick)
setResult(RESULT_OK,intent)
finish()
}
}
- //회원가입 가능한지 검사
private fun isSignUpAvailable(id:String,pw:String,nick:String,etc:String):Boolean {
var signUpBool = false
val message = when {
@@ -54,7 +51,6 @@ class SignUpActivity : AppCompatActivity() {
return signUpBool
}
companion object {
- //회원가입 조건 상수화
const val MIN_ID_LENGTH = 6
const val MAX_ID_LENGTH = 10
const val MIN_PW_LENGTH = 8
From 12e8cccb04a3458da0743623ebf18c713cef1b7f Mon Sep 17 00:00:00 2001
From: hyeumm <20221159@sungshin.ac.kr>
Date: Fri, 19 Apr 2024 00:59:52 +0900
Subject: [PATCH 18/29] =?UTF-8?q?chore/#5:=20=EC=BD=94=EB=93=9C=20?=
=?UTF-8?q?=EC=A0=95=EB=A0=AC=20=EB=B0=8F=20=ED=95=A8=EC=88=98=EB=AA=85=20?=
=?UTF-8?q?=EB=B3=80=EA=B2=BD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../main/java/com/sopt/now/HomeFragment.kt | 5 +++--
app/src/main/java/com/sopt/now/HomeList.kt | 2 +-
.../main/java/com/sopt/now/HomeListAdapter.kt | 2 +-
.../java/com/sopt/now/HomeListViewHolder.kt | 14 +++++++------
.../main/java/com/sopt/now/LoginActivity.kt | 4 ++--
.../main/java/com/sopt/now/MainActivity.kt | 12 ++++++-----
.../main/java/com/sopt/now/MyPageFragment.kt | 11 +++++-----
.../main/java/com/sopt/now/SignUpActivity.kt | 20 +++++++++++--------
8 files changed, 40 insertions(+), 30 deletions(-)
diff --git a/app/src/main/java/com/sopt/now/HomeFragment.kt b/app/src/main/java/com/sopt/now/HomeFragment.kt
index 115aef6..b8fe372 100644
--- a/app/src/main/java/com/sopt/now/HomeFragment.kt
+++ b/app/src/main/java/com/sopt/now/HomeFragment.kt
@@ -15,9 +15,10 @@ class HomeFragment : Fragment() {
inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
- binding=FragmentHomeBinding.inflate(inflater)
+ binding = FragmentHomeBinding.inflate(inflater)
return binding.root
}
+
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
val homeListAdapter = HomeListAdapter()
@@ -25,7 +26,7 @@ class HomeFragment : Fragment() {
adapter = homeListAdapter
layoutManager = LinearLayoutManager(requireContext())
}
- homeListAdapter.setFriendList(HomeListData.homeListData)
+ homeListAdapter.setHomeList(HomeListData.homeListData)
}
}
\ No newline at end of file
diff --git a/app/src/main/java/com/sopt/now/HomeList.kt b/app/src/main/java/com/sopt/now/HomeList.kt
index 80c7aa8..f3552df 100644
--- a/app/src/main/java/com/sopt/now/HomeList.kt
+++ b/app/src/main/java/com/sopt/now/HomeList.kt
@@ -6,7 +6,7 @@ data class HomeList(
@DrawableRes val profileImage: Int,
val name: String,
val selfDescription: String,
- val viewType : Int
+ val viewType: Int
) {
companion object {
const val VIEW_TYPE_USER = 0
diff --git a/app/src/main/java/com/sopt/now/HomeListAdapter.kt b/app/src/main/java/com/sopt/now/HomeListAdapter.kt
index d61dc74..f616e47 100644
--- a/app/src/main/java/com/sopt/now/HomeListAdapter.kt
+++ b/app/src/main/java/com/sopt/now/HomeListAdapter.kt
@@ -48,7 +48,7 @@ class HomeListAdapter() : RecyclerView.Adapter() {
override fun getItemViewType(position: Int): Int {
return homeListList[position].viewType
}
- fun setFriendList(homeListList: List) {
+ fun setHomeList(homeListList: List) {
this.homeListList = homeListList.toList()
notifyDataSetChanged()
}
diff --git a/app/src/main/java/com/sopt/now/HomeListViewHolder.kt b/app/src/main/java/com/sopt/now/HomeListViewHolder.kt
index 8332de5..fb63e91 100644
--- a/app/src/main/java/com/sopt/now/HomeListViewHolder.kt
+++ b/app/src/main/java/com/sopt/now/HomeListViewHolder.kt
@@ -4,13 +4,15 @@ import android.view.View
import android.widget.ImageView
import android.widget.TextView
import androidx.recyclerview.widget.RecyclerView
+
class FriendViewHolder(private val view: View) : RecyclerView.ViewHolder(view) {
- val ivProfile : ImageView = view.findViewById(R.id.iv_profile)
- val tvName : TextView = view.findViewById(R.id.tv_name)
- val tvSelfDescription : TextView = view.findViewById(R.id.tv_self_description)
+ val ivProfile: ImageView = view.findViewById(R.id.iv_profile)
+ val tvName: TextView = view.findViewById(R.id.tv_name)
+ val tvSelfDescription: TextView = view.findViewById(R.id.tv_self_description)
}
+
class UserViewHolder(private val view: View) : RecyclerView.ViewHolder(view) {
- val ivProfile : ImageView = view.findViewById(R.id.iv_profile)
- val tvName : TextView = view.findViewById(R.id.tv_name)
- val tvSelfDescription : TextView = view.findViewById(R.id.tv_self_description)
+ val ivProfile: ImageView = view.findViewById(R.id.iv_profile)
+ val tvName: TextView = view.findViewById(R.id.tv_name)
+ val tvSelfDescription: TextView = view.findViewById(R.id.tv_self_description)
}
\ No newline at end of file
diff --git a/app/src/main/java/com/sopt/now/LoginActivity.kt b/app/src/main/java/com/sopt/now/LoginActivity.kt
index 837407c..7091879 100644
--- a/app/src/main/java/com/sopt/now/LoginActivity.kt
+++ b/app/src/main/java/com/sopt/now/LoginActivity.kt
@@ -16,11 +16,11 @@ class LoginActivity : AppCompatActivity() {
binding = ActivityLoginBinding.inflate(layoutInflater)
setContentView(binding.root)
- getUser()
+ getUserInfo()
moveToSignUp()
}
- private fun getUser() {
+ private fun getUserInfo() {
var id = ""
var pw = ""
var nick = ""
diff --git a/app/src/main/java/com/sopt/now/MainActivity.kt b/app/src/main/java/com/sopt/now/MainActivity.kt
index 53578b1..258b069 100644
--- a/app/src/main/java/com/sopt/now/MainActivity.kt
+++ b/app/src/main/java/com/sopt/now/MainActivity.kt
@@ -9,7 +9,7 @@ class MainActivity : AppCompatActivity() {
private lateinit var binding: ActivityMainBinding
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
- binding= ActivityMainBinding.inflate(layoutInflater)
+ binding = ActivityMainBinding.inflate(layoutInflater)
setContentView(binding.root)
val currentFragment = supportFragmentManager.findFragmentById(binding.fcvHome.id)
@@ -21,20 +21,21 @@ class MainActivity : AppCompatActivity() {
clickBottomNavigation()
}
+
private fun clickBottomNavigation() {
- binding.bnvHome.setOnItemSelectedListener{
+ binding.bnvHome.setOnItemSelectedListener {
when (it.itemId) {
- R.id.menu_home-> {
+ R.id.menu_home -> {
replaceFragment(HomeFragment())
true
}
- R.id.menu_search-> {
+ R.id.menu_search -> {
replaceFragment(SearchFragment())
true
}
- R.id.menu_mypage-> {
+ R.id.menu_mypage -> {
replaceFragment(MyPageFragment())
true
}
@@ -43,6 +44,7 @@ class MainActivity : AppCompatActivity() {
}
}
}
+
private fun replaceFragment(fragment: Fragment) {
supportFragmentManager.beginTransaction()
.replace(R.id.fcv_home, fragment)
diff --git a/app/src/main/java/com/sopt/now/MyPageFragment.kt b/app/src/main/java/com/sopt/now/MyPageFragment.kt
index f4b2e64..89c551a 100644
--- a/app/src/main/java/com/sopt/now/MyPageFragment.kt
+++ b/app/src/main/java/com/sopt/now/MyPageFragment.kt
@@ -16,14 +16,15 @@ class MyPageFragment : Fragment() {
inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
- binding=FragmentMyPageBinding.inflate(inflater)
+ binding = FragmentMyPageBinding.inflate(inflater)
getUserInfo()
return binding.root
}
+
private fun getUserInfo() {
- val userInfo = activity?.getSharedPreferences("userInfo",Context.MODE_PRIVATE)
- binding.tvMainNick.text = userInfo?.getString("userNick","")
- binding.tvMainId.text = userInfo?.getString("userId","")
- binding.tvMainPw.text = userInfo?.getString("userPw","")
+ val userInfo = activity?.getSharedPreferences("userInfo", Context.MODE_PRIVATE)
+ binding.tvMainNick.text = userInfo?.getString("userNick", "")
+ binding.tvMainId.text = userInfo?.getString("userId", "")
+ binding.tvMainPw.text = userInfo?.getString("userPw", "")
}
}
\ No newline at end of file
diff --git a/app/src/main/java/com/sopt/now/SignUpActivity.kt b/app/src/main/java/com/sopt/now/SignUpActivity.kt
index d83adac..48b0d23 100644
--- a/app/src/main/java/com/sopt/now/SignUpActivity.kt
+++ b/app/src/main/java/com/sopt/now/SignUpActivity.kt
@@ -7,7 +7,7 @@ import androidx.appcompat.app.AppCompatActivity
import com.sopt.now.databinding.ActivitySignUpBinding
class SignUpActivity : AppCompatActivity() {
- private lateinit var binding:ActivitySignUpBinding
+ private lateinit var binding: ActivitySignUpBinding
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
@@ -16,6 +16,7 @@ class SignUpActivity : AppCompatActivity() {
getUserInfo()
}
+
private fun getUserInfo() {
binding.btnSignIn.setOnClickListener {
val id = binding.etvSignInId.text.toString()
@@ -23,18 +24,20 @@ class SignUpActivity : AppCompatActivity() {
val nick = binding.etvSignInNick.text.toString()
val etc = binding.etvSignInEtc.text.toString()
- sendUserInfo(id,pw,nick,etc)
+ sendUserInfo(id, pw, nick, etc)
}
}
- private fun sendUserInfo(id:String,pw:String,nick:String,etc:String){
- if(isSignUpAvailable(id,pw,nick,etc)) {
- val intent= Intent(this,LoginActivity::class.java)
- intent.putExtra("id",id).putExtra("pw",pw).putExtra("nick",nick)
- setResult(RESULT_OK,intent)
+
+ private fun sendUserInfo(id: String, pw: String, nick: String, etc: String) {
+ if (isSignUpAvailable(id, pw, nick, etc)) {
+ val intent = Intent(this, LoginActivity::class.java)
+ intent.putExtra("id", id).putExtra("pw", pw).putExtra("nick", nick)
+ setResult(RESULT_OK, intent)
finish()
}
}
- private fun isSignUpAvailable(id:String,pw:String,nick:String,etc:String):Boolean {
+
+ private fun isSignUpAvailable(id: String, pw: String, nick: String, etc: String): Boolean {
var signUpBool = false
val message = when {
id.isEmpty() || pw.isEmpty() || nick.isEmpty() || etc.isEmpty() -> getString(R.string.sign_up_error_blank)
@@ -50,6 +53,7 @@ class SignUpActivity : AppCompatActivity() {
Toast.makeText(this, message, Toast.LENGTH_SHORT).show()
return signUpBool
}
+
companion object {
const val MIN_ID_LENGTH = 6
const val MAX_ID_LENGTH = 10
From b1a4e75f907089d250f27e7d60c573c739d076ec Mon Sep 17 00:00:00 2001
From: hyeumm <20221159@sungshin.ac.kr>
Date: Fri, 19 Apr 2024 01:08:08 +0900
Subject: [PATCH 19/29] =?UTF-8?q?delete/#5:=20=EC=93=B8=EB=AA=A8=EC=97=86?=
=?UTF-8?q?=EB=8A=94=20=EC=BD=94=EB=93=9C=20=EC=82=AD=EC=A0=9C?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/src/main/java/com/sopt/now/HomeListAdapter.kt | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/src/main/java/com/sopt/now/HomeListAdapter.kt b/app/src/main/java/com/sopt/now/HomeListAdapter.kt
index f616e47..ef882d5 100644
--- a/app/src/main/java/com/sopt/now/HomeListAdapter.kt
+++ b/app/src/main/java/com/sopt/now/HomeListAdapter.kt
@@ -6,7 +6,7 @@ import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
import java.lang.RuntimeException
-class HomeListAdapter() : RecyclerView.Adapter() {
+class HomeListAdapter : RecyclerView.Adapter() {
private var homeListList: List = emptyList()
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder {
val adapterLayout : View?
From e2e4d11179d282d8a92505dfe193a0e3252a0f4e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=EC=86=A1=ED=98=9C=EC=9D=8C?=
<118244028+hyeumm@users.noreply.github.com>
Date: Fri, 19 Apr 2024 01:45:24 +0900
Subject: [PATCH 20/29] Update README.md
---
README.md | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/README.md b/README.md
index cff8ba4..1b9a4d2 100644
--- a/README.md
+++ b/README.md
@@ -1 +1,14 @@
# Now Sopt Android
+- **[FEAT]** : 새로운 기능 구현
+- **[MOD]** : 코드 수정 및 내부 파일 수정
+- **[ADD]** : 부수적인 코드 추가 및 라이브러리 추가, 새로운 파일 생성
+- **[CHORE]** : 버전 코드 수정, 패키지 구조 변경, 타입 및 변수명 변경 등의 작은 작업
+- **[DEL]** : 쓸모없는 코드나 파일 삭제
+- **[UI]** : UI 작업
+- **[FIX]** : 버그 및 오류 해결
+- **[HOTFIX]** : issue나 QA에서 문의된 급한 버그 및 오류 해결
+- **[MERGE]** : 다른 브랜치와의 MERGE
+- **[MOVE]** : 프로젝트 내 파일이나 코드의 이동
+- **[RENAME]** : 파일 이름 변경
+- **[REFACTOR]** : 전면 수정
+- **[DOCS]** : README나 WIKI 등의 문서 개정
From d0f0261f5643b68505d4263fc48ae4514f2188b2 Mon Sep 17 00:00:00 2001
From: hyeumm <20221159@sungshin.ac.kr>
Date: Sat, 27 Apr 2024 00:35:54 +0900
Subject: [PATCH 21/29] =?UTF-8?q?feat/#5:=20fragment=20notnull=20=EC=B2=98?=
=?UTF-8?q?=EB=A6=AC?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/src/main/java/com/sopt/now/HomeFragment.kt | 13 ++++++++++---
app/src/main/java/com/sopt/now/MyPageFragment.kt | 12 ++++++++++--
app/src/main/java/com/sopt/now/SearchFragment.kt | 10 ++++++++++
3 files changed, 30 insertions(+), 5 deletions(-)
diff --git a/app/src/main/java/com/sopt/now/HomeFragment.kt b/app/src/main/java/com/sopt/now/HomeFragment.kt
index b8fe372..036f89a 100644
--- a/app/src/main/java/com/sopt/now/HomeFragment.kt
+++ b/app/src/main/java/com/sopt/now/HomeFragment.kt
@@ -9,13 +9,15 @@ import androidx.recyclerview.widget.LinearLayoutManager
import com.sopt.now.databinding.FragmentHomeBinding
class HomeFragment : Fragment() {
- private lateinit var binding: FragmentHomeBinding
+ private val binding:FragmentHomeBinding
+ get()= requireNotNull(_binding){"_binding이 null이 아닌 경우만 _binding 반환"}
+ private var _binding: FragmentHomeBinding ?= null
override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?
- ): View? {
- binding = FragmentHomeBinding.inflate(inflater)
+ ): View {
+ _binding = FragmentHomeBinding.inflate(inflater,container,false)
return binding.root
}
@@ -29,4 +31,9 @@ class HomeFragment : Fragment() {
homeListAdapter.setHomeList(HomeListData.homeListData)
}
+ override fun onDestroyView() {
+ super.onDestroyView()
+ _binding = null
+ }
+
}
\ No newline at end of file
diff --git a/app/src/main/java/com/sopt/now/MyPageFragment.kt b/app/src/main/java/com/sopt/now/MyPageFragment.kt
index 89c551a..3db5ae2 100644
--- a/app/src/main/java/com/sopt/now/MyPageFragment.kt
+++ b/app/src/main/java/com/sopt/now/MyPageFragment.kt
@@ -7,16 +7,19 @@ import androidx.fragment.app.Fragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
+import com.sopt.now.databinding.FragmentHomeBinding
import com.sopt.now.databinding.FragmentMyPageBinding
class MyPageFragment : Fragment() {
- private lateinit var binding: FragmentMyPageBinding
+ private val binding: FragmentMyPageBinding
+ get()= requireNotNull(_binding){"_binding이 null이 아닌 경우만 _binding 반환"}
+ private var _binding: FragmentMyPageBinding?= null
override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
- binding = FragmentMyPageBinding.inflate(inflater)
+ _binding = FragmentMyPageBinding.inflate(inflater,container,false)
getUserInfo()
return binding.root
}
@@ -27,4 +30,9 @@ class MyPageFragment : Fragment() {
binding.tvMainId.text = userInfo?.getString("userId", "")
binding.tvMainPw.text = userInfo?.getString("userPw", "")
}
+
+ override fun onDestroyView() {
+ super.onDestroyView()
+ _binding = null
+ }
}
\ No newline at end of file
diff --git a/app/src/main/java/com/sopt/now/SearchFragment.kt b/app/src/main/java/com/sopt/now/SearchFragment.kt
index 56eb256..5c3307e 100644
--- a/app/src/main/java/com/sopt/now/SearchFragment.kt
+++ b/app/src/main/java/com/sopt/now/SearchFragment.kt
@@ -5,8 +5,14 @@ import androidx.fragment.app.Fragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
+import com.sopt.now.databinding.FragmentMyPageBinding
+import com.sopt.now.databinding.FragmentSearchBinding
class SearchFragment : Fragment() {
+ private val binding: FragmentSearchBinding
+ get()= requireNotNull(_binding){"_binding이 null이 아닌 경우만 _binding 반환"}
+ private var _binding: FragmentSearchBinding?= null
+
override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?
@@ -14,4 +20,8 @@ class SearchFragment : Fragment() {
return inflater.inflate(R.layout.fragment_search, container, false)
}
+ override fun onDestroyView() {
+ super.onDestroyView()
+ _binding = null
+ }
}
\ No newline at end of file
From 9169ea03a010ec2d768109583af2b519522fd760 Mon Sep 17 00:00:00 2001
From: hyeumm <20221159@sungshin.ac.kr>
Date: Sat, 27 Apr 2024 00:47:28 +0900
Subject: [PATCH 22/29] =?UTF-8?q?mod/#5:=20PR=20=EC=A0=81=EC=9A=A9=20-=20g?=
=?UTF-8?q?etOrNull?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../main/java/com/sopt/now/HomeListAdapter.kt | 32 +++++++++----------
1 file changed, 16 insertions(+), 16 deletions(-)
diff --git a/app/src/main/java/com/sopt/now/HomeListAdapter.kt b/app/src/main/java/com/sopt/now/HomeListAdapter.kt
index ef882d5..d0821ee 100644
--- a/app/src/main/java/com/sopt/now/HomeListAdapter.kt
+++ b/app/src/main/java/com/sopt/now/HomeListAdapter.kt
@@ -16,31 +16,31 @@ class HomeListAdapter : RecyclerView.Adapter() {
.inflate(R.layout.item_user,parent,false)
UserViewHolder(adapterLayout)
}
- HomeList.VIEW_TYPE_FRIEND -> {
+ else -> {
adapterLayout = LayoutInflater.from(parent.context)
.inflate(R.layout.item_friend,parent,false)
FriendViewHolder(adapterLayout)
}
- else -> throw RuntimeException("알 수 없는 뷰타입입니다.")
}
}
override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) {
- val item = homeListList[position]
- when(item.viewType){
- HomeList.VIEW_TYPE_USER -> {
- (holder as UserViewHolder).ivProfile.setImageResource(item.profileImage)
- holder.tvName.text = item.name
- holder.tvSelfDescription.text = item.selfDescription
- holder.setIsRecyclable(false)
- }
- HomeList.VIEW_TYPE_FRIEND -> {
- (holder as FriendViewHolder).ivProfile.setImageResource(item.profileImage)
- holder.tvName.text = item.name
- holder.tvSelfDescription.text = item.selfDescription
- holder.setIsRecyclable(false)
+ val item = homeListList.getOrNull(position)
+ if (item != null) {
+ when(item.viewType){
+ HomeList.VIEW_TYPE_USER -> {
+ (holder as UserViewHolder).ivProfile.setImageResource(item.profileImage)
+ holder.tvName.text = item.name
+ holder.tvSelfDescription.text = item.selfDescription
+ holder.setIsRecyclable(false)
+ }
+ else -> {
+ (holder as FriendViewHolder).ivProfile.setImageResource(item.profileImage)
+ holder.tvName.text = item.name
+ holder.tvSelfDescription.text = item.selfDescription
+ holder.setIsRecyclable(false)
+ }
}
- else -> throw RuntimeException("알 수 없는 뷰타입입니다.")
}
}
From db71fd82ff6a1afa73c181cc18ee8dfe9ba6dac6 Mon Sep 17 00:00:00 2001
From: hyeumm <20221159@sungshin.ac.kr>
Date: Sat, 27 Apr 2024 00:51:06 +0900
Subject: [PATCH 23/29] =?UTF-8?q?mod/#5:=20PR=20=EC=A0=81=EC=9A=A9=20-=20w?=
=?UTF-8?q?ith?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../main/java/com/sopt/now/HomeListAdapter.kt | 20 +++++++++++--------
1 file changed, 12 insertions(+), 8 deletions(-)
diff --git a/app/src/main/java/com/sopt/now/HomeListAdapter.kt b/app/src/main/java/com/sopt/now/HomeListAdapter.kt
index d0821ee..657b1fa 100644
--- a/app/src/main/java/com/sopt/now/HomeListAdapter.kt
+++ b/app/src/main/java/com/sopt/now/HomeListAdapter.kt
@@ -29,16 +29,20 @@ class HomeListAdapter : RecyclerView.Adapter() {
if (item != null) {
when(item.viewType){
HomeList.VIEW_TYPE_USER -> {
- (holder as UserViewHolder).ivProfile.setImageResource(item.profileImage)
- holder.tvName.text = item.name
- holder.tvSelfDescription.text = item.selfDescription
- holder.setIsRecyclable(false)
+ with(holder as UserViewHolder) {
+ ivProfile.setImageResource(item.profileImage)
+ tvName.text = item.name
+ tvSelfDescription.text = item.selfDescription
+ setIsRecyclable(false)
+ }
}
else -> {
- (holder as FriendViewHolder).ivProfile.setImageResource(item.profileImage)
- holder.tvName.text = item.name
- holder.tvSelfDescription.text = item.selfDescription
- holder.setIsRecyclable(false)
+ with(holder as FriendViewHolder) {
+ ivProfile.setImageResource(item.profileImage)
+ tvName.text = item.name
+ tvSelfDescription.text = item.selfDescription
+ setIsRecyclable(false)
+ }
}
}
}
From fa0ef1983ad1318ec63f898b6c998aa27c252934 Mon Sep 17 00:00:00 2001
From: hyeumm <20221159@sungshin.ac.kr>
Date: Sat, 27 Apr 2024 00:55:13 +0900
Subject: [PATCH 24/29] =?UTF-8?q?mod/#5:=20PR=20=EC=A0=81=EC=9A=A9=20-=20i?=
=?UTF-8?q?sBlank?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/src/main/java/com/sopt/now/LoginActivity.kt | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/src/main/java/com/sopt/now/LoginActivity.kt b/app/src/main/java/com/sopt/now/LoginActivity.kt
index 7091879..a534893 100644
--- a/app/src/main/java/com/sopt/now/LoginActivity.kt
+++ b/app/src/main/java/com/sopt/now/LoginActivity.kt
@@ -66,7 +66,7 @@ class LoginActivity : AppCompatActivity() {
val userId = binding.etvLoginId.text.toString()
val userPw = binding.etvLoginPw.text.toString()
val message = when{
- userId == "" || userPw == "" -> getString(R.string.login_error_blank)
+ userId.isBlank() || userPw.isBlank() -> getString(R.string.login_error_blank)
userId != id || userPw != pw -> getString(R.string.login_error_different)
else -> {
loginBool = true
From 3d31950144ef29e4df011d816c226f4dc92372b4 Mon Sep 17 00:00:00 2001
From: hyeumm <20221159@sungshin.ac.kr>
Date: Sat, 27 Apr 2024 01:00:32 +0900
Subject: [PATCH 25/29] =?UTF-8?q?mod/#5:=20PR=20=EC=A0=81=EC=9A=A9=20-=20?=
=?UTF-8?q?=EC=88=AB=EC=9E=90=20=EB=8C=80=EC=8B=A0=20=ED=83=80=EC=9E=85?=
=?UTF-8?q?=EC=83=81=EC=88=98=ED=99=94?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../main/java/com/sopt/now/HomeListData.kt | 26 +++++++++----------
1 file changed, 13 insertions(+), 13 deletions(-)
diff --git a/app/src/main/java/com/sopt/now/HomeListData.kt b/app/src/main/java/com/sopt/now/HomeListData.kt
index 721c0c7..8757b52 100644
--- a/app/src/main/java/com/sopt/now/HomeListData.kt
+++ b/app/src/main/java/com/sopt/now/HomeListData.kt
@@ -6,79 +6,79 @@ object HomeListData {
profileImage = R.drawable.main,
name = "송혜음",
selfDescription = "멀티 뷰 리싸이클러뷰!",
- 0
+ HomeList.VIEW_TYPE_USER
),
HomeList(
profileImage = R.drawable.main,
name = "박동민",
selfDescription = "곽의진...얼굴 재치 실력 모든걸 다 가진 남자... 하지만 밀양박씨 36대손인 나 박동민은 가지지 못했지",
- 1
+ HomeList.VIEW_TYPE_FRIEND
),
HomeList(
profileImage = R.drawable.main,
name = "이석준",
selfDescription = "죄송합니다 저 도핑했습니다... 안드-로이더 \uD83D\uDC89",
- 1
+ HomeList.VIEW_TYPE_FRIEND
),
HomeList(
profileImage = R.drawable.main,
name = "박유진",
selfDescription = "(ง˙∇˙)ว 에라 모르겠다",
- 1
+ HomeList.VIEW_TYPE_FRIEND
),
HomeList(
profileImage = R.drawable.main,
name = "이의경",
selfDescription = "다들 빨리 끝내고 뒤풀이 가고 싶지? ㅎㅎ 아직 반도 안왔어 ^&^",
- 1
+ HomeList.VIEW_TYPE_FRIEND
),
HomeList(
profileImage = R.drawable.main,
name = "우상욱",
selfDescription = "나보다 안드 잘하는 사람 있으면 나와봐",
- 1
+ HomeList.VIEW_TYPE_FRIEND
),
HomeList(
profileImage = R.drawable.main,
name = "배지현",
selfDescription = "표정 풀자 ^^",
- 1
+ HomeList.VIEW_TYPE_FRIEND
),
HomeList(
profileImage = R.drawable.main,
name = "이의경",
selfDescription = "다들 빨리 끝내고 뒤풀이 가고 싶지? ㅎㅎ 아직 반도 안왔어 ^&^",
- 1
+ HomeList.VIEW_TYPE_FRIEND
),
HomeList(
profileImage = R.drawable.main,
name = "우상욱",
selfDescription = "나보다 안드 잘하는 사람 있으면 나와봐",
- 1
+ HomeList.VIEW_TYPE_FRIEND
),
HomeList(
profileImage = R.drawable.main,
name = "배지현",
selfDescription = "표정 풀자 ^^",
- 1
+ HomeList.VIEW_TYPE_FRIEND
),
HomeList(
profileImage = R.drawable.main,
name = "이의경",
selfDescription = "다들 빨리 끝내고 뒤풀이 가고 싶지? ㅎㅎ 아직 반도 안왔어 ^&^",
- 1
+ HomeList.VIEW_TYPE_FRIEND
),
HomeList(
profileImage = R.drawable.main,
name = "우상욱",
selfDescription = "나보다 안드 잘하는 사람 있으면 나와봐",
- 1
+ HomeList.VIEW_TYPE_FRIEND
),
HomeList(
profileImage = R.drawable.main,
name = "배지현",
selfDescription = "표정 풀자 ^^",
- 1
+ HomeList.VIEW_TYPE_FRIEND
)
)
}
\ No newline at end of file
From ed096f8bdac3d90d4c6f9652ea319ab1c570eb3f Mon Sep 17 00:00:00 2001
From: hyeumm <20221159@sungshin.ac.kr>
Date: Sat, 27 Apr 2024 01:41:38 +0900
Subject: [PATCH 26/29] =?UTF-8?q?mod/#5:=20PR=20=EC=A0=81=EC=9A=A9=20-=20V?=
=?UTF-8?q?iewHolder?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../main/java/com/sopt/now/HomeListAdapter.kt | 41 ++++++-------------
.../java/com/sopt/now/HomeListViewHolder.kt | 29 ++++++++-----
2 files changed, 31 insertions(+), 39 deletions(-)
diff --git a/app/src/main/java/com/sopt/now/HomeListAdapter.kt b/app/src/main/java/com/sopt/now/HomeListAdapter.kt
index 657b1fa..3463924 100644
--- a/app/src/main/java/com/sopt/now/HomeListAdapter.kt
+++ b/app/src/main/java/com/sopt/now/HomeListAdapter.kt
@@ -1,49 +1,34 @@
package com.sopt.now
import android.view.LayoutInflater
-import android.view.View
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
-import java.lang.RuntimeException
+import com.sopt.now.databinding.ItemFriendBinding
+import com.sopt.now.databinding.ItemUserBinding
class HomeListAdapter : RecyclerView.Adapter() {
private var homeListList: List = emptyList()
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder {
- val adapterLayout : View?
+ val inflater = LayoutInflater.from(parent.context)
+ val bindingUser = ItemUserBinding.inflate(inflater, parent, false)
+ val bindingFriend = ItemFriendBinding.inflate(inflater, parent, false)
return when(viewType){
HomeList.VIEW_TYPE_USER -> {
- adapterLayout = LayoutInflater.from(parent.context)
- .inflate(R.layout.item_user,parent,false)
- UserViewHolder(adapterLayout)
+ UserViewHolder(bindingUser)
}
else -> {
- adapterLayout = LayoutInflater.from(parent.context)
- .inflate(R.layout.item_friend,parent,false)
- FriendViewHolder(adapterLayout)
+ FriendViewHolder(bindingFriend)
}
}
}
override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) {
- val item = homeListList.getOrNull(position)
- if (item != null) {
- when(item.viewType){
- HomeList.VIEW_TYPE_USER -> {
- with(holder as UserViewHolder) {
- ivProfile.setImageResource(item.profileImage)
- tvName.text = item.name
- tvSelfDescription.text = item.selfDescription
- setIsRecyclable(false)
- }
- }
- else -> {
- with(holder as FriendViewHolder) {
- ivProfile.setImageResource(item.profileImage)
- tvName.text = item.name
- tvSelfDescription.text = item.selfDescription
- setIsRecyclable(false)
- }
- }
+ when(homeListList.getOrNull(position)?.viewType){
+ HomeList.VIEW_TYPE_USER -> {
+ (holder as UserViewHolder).onBind(homeListList[position])
+ }
+ else -> {
+ (holder as FriendViewHolder).onBind(homeListList[position])
}
}
}
diff --git a/app/src/main/java/com/sopt/now/HomeListViewHolder.kt b/app/src/main/java/com/sopt/now/HomeListViewHolder.kt
index fb63e91..2e77535 100644
--- a/app/src/main/java/com/sopt/now/HomeListViewHolder.kt
+++ b/app/src/main/java/com/sopt/now/HomeListViewHolder.kt
@@ -1,18 +1,25 @@
package com.sopt.now
-import android.view.View
-import android.widget.ImageView
-import android.widget.TextView
import androidx.recyclerview.widget.RecyclerView
+import com.sopt.now.databinding.ItemFriendBinding
+import com.sopt.now.databinding.ItemUserBinding
-class FriendViewHolder(private val view: View) : RecyclerView.ViewHolder(view) {
- val ivProfile: ImageView = view.findViewById(R.id.iv_profile)
- val tvName: TextView = view.findViewById(R.id.tv_name)
- val tvSelfDescription: TextView = view.findViewById(R.id.tv_self_description)
+class FriendViewHolder(private val binding:ItemFriendBinding) : RecyclerView.ViewHolder(binding.root) {
+ fun onBind(friendData: HomeList) {
+ binding.run {
+ ivProfile.setImageResource(friendData.profileImage)
+ tvName.text = friendData.name
+ tvSelfDescription.text = friendData.selfDescription
+ }
+ }
}
-class UserViewHolder(private val view: View) : RecyclerView.ViewHolder(view) {
- val ivProfile: ImageView = view.findViewById(R.id.iv_profile)
- val tvName: TextView = view.findViewById(R.id.tv_name)
- val tvSelfDescription: TextView = view.findViewById(R.id.tv_self_description)
+class UserViewHolder(private val binding:ItemUserBinding) : RecyclerView.ViewHolder(binding.root) {
+ fun onBind(friendData: HomeList) {
+ binding.run {
+ ivProfile.setImageResource(friendData.profileImage)
+ tvName.text = friendData.name
+ tvSelfDescription.text = friendData.selfDescription
+ }
+ }
}
\ No newline at end of file
From 480c1477ca2ade060c76f5a1105a73d640629c30 Mon Sep 17 00:00:00 2001
From: hyeumm <20221159@sungshin.ac.kr>
Date: Sat, 27 Apr 2024 01:43:38 +0900
Subject: [PATCH 27/29] =?UTF-8?q?mod/#5:=20PR=20=EC=A0=81=EC=9A=A9=20-=20t?=
=?UTF-8?q?ools?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/src/main/res/layout/item_friend.xml | 7 ++++---
app/src/main/res/layout/item_user.xml | 5 +++--
2 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/app/src/main/res/layout/item_friend.xml b/app/src/main/res/layout/item_friend.xml
index bd00c96..c8f1324 100644
--- a/app/src/main/res/layout/item_friend.xml
+++ b/app/src/main/res/layout/item_friend.xml
@@ -2,7 +2,8 @@
+ android:layout_height="wrap_content"
+ xmlns:tools="http://schemas.android.com/tools">
Date: Sat, 27 Apr 2024 01:50:14 +0900
Subject: [PATCH 28/29] =?UTF-8?q?mod/#5:=20PR=20=EC=A0=81=EC=9A=A9=20-=20s?=
=?UTF-8?q?cope?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/src/main/java/com/sopt/now/LoginActivity.kt | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/app/src/main/java/com/sopt/now/LoginActivity.kt b/app/src/main/java/com/sopt/now/LoginActivity.kt
index a534893..769464b 100644
--- a/app/src/main/java/com/sopt/now/LoginActivity.kt
+++ b/app/src/main/java/com/sopt/now/LoginActivity.kt
@@ -47,8 +47,9 @@ class LoginActivity : AppCompatActivity() {
}
private fun moveToMain(id:String,pw:String,nick:String){
if (isLoginAvailable(id, pw)) {
- val intent = Intent(this, MainActivity::class.java)
- saveUserInfo(id,pw,nick)
+ val intent = Intent(this, MainActivity::class.java).apply {
+ saveUserInfo(id, pw, nick)
+ }
startActivity(intent)
}
}
From 9d4ddfb14d5b6528a7b31104eef77c65d01da3da Mon Sep 17 00:00:00 2001
From: hyeumm <20221159@sungshin.ac.kr>
Date: Sat, 27 Apr 2024 02:03:29 +0900
Subject: [PATCH 29/29] =?UTF-8?q?feat/#5:=20RC=20=EB=B7=B0=EB=AA=A8?=
=?UTF-8?q?=EB=8D=B8=20=EC=A0=81=EC=9A=A9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/build.gradle | 5 +++++
app/src/main/java/com/sopt/now/HomeFragment.kt | 4 +++-
.../java/com/sopt/now/{HomeListData.kt => HomeViewModel.kt} | 4 +++-
3 files changed, 11 insertions(+), 2 deletions(-)
rename app/src/main/java/com/sopt/now/{HomeListData.kt => HomeViewModel.kt} (97%)
diff --git a/app/build.gradle b/app/build.gradle
index 2683f78..2a5b0d9 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -45,4 +45,9 @@ dependencies {
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
+
+ //viewModel
+ implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.6.2"
+ implementation "androidx.fragment:fragment-ktx:1.6.1"
+ implementation "androidx.activity:activity-ktx:1.8.0"
}
\ No newline at end of file
diff --git a/app/src/main/java/com/sopt/now/HomeFragment.kt b/app/src/main/java/com/sopt/now/HomeFragment.kt
index 036f89a..aa2b6ef 100644
--- a/app/src/main/java/com/sopt/now/HomeFragment.kt
+++ b/app/src/main/java/com/sopt/now/HomeFragment.kt
@@ -5,6 +5,7 @@ import androidx.fragment.app.Fragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
+import androidx.fragment.app.viewModels
import androidx.recyclerview.widget.LinearLayoutManager
import com.sopt.now.databinding.FragmentHomeBinding
@@ -12,6 +13,7 @@ class HomeFragment : Fragment() {
private val binding:FragmentHomeBinding
get()= requireNotNull(_binding){"_binding이 null이 아닌 경우만 _binding 반환"}
private var _binding: FragmentHomeBinding ?= null
+ private val viewModel by viewModels()
override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?,
@@ -28,7 +30,7 @@ class HomeFragment : Fragment() {
adapter = homeListAdapter
layoutManager = LinearLayoutManager(requireContext())
}
- homeListAdapter.setHomeList(HomeListData.homeListData)
+ homeListAdapter.setHomeList(viewModel.homeListData)
}
override fun onDestroyView() {
diff --git a/app/src/main/java/com/sopt/now/HomeListData.kt b/app/src/main/java/com/sopt/now/HomeViewModel.kt
similarity index 97%
rename from app/src/main/java/com/sopt/now/HomeListData.kt
rename to app/src/main/java/com/sopt/now/HomeViewModel.kt
index 8757b52..b488844 100644
--- a/app/src/main/java/com/sopt/now/HomeListData.kt
+++ b/app/src/main/java/com/sopt/now/HomeViewModel.kt
@@ -1,6 +1,8 @@
package com.sopt.now
-object HomeListData {
+import androidx.lifecycle.ViewModel
+
+class HomeViewModel : ViewModel() {
val homeListData = listOf(
HomeList(
profileImage = R.drawable.main,