diff --git a/.idea/deploymentTargetDropDown.xml b/.idea/deploymentTargetDropDown.xml
index d310854..949dc96 100644
--- a/.idea/deploymentTargetDropDown.xml
+++ b/.idea/deploymentTargetDropDown.xml
@@ -1,17 +1,17 @@
-
+
-
+
-
-
+
+
-
-
+
+
\ No newline at end of file
diff --git a/app/src/main/java/com/example/infraandroid/category/model/ProjectService.kt b/app/src/main/java/com/example/infraandroid/category/model/ProjectService.kt
index 052a66a..cb8dbb9 100644
--- a/app/src/main/java/com/example/infraandroid/category/model/ProjectService.kt
+++ b/app/src/main/java/com/example/infraandroid/category/model/ProjectService.kt
@@ -14,4 +14,12 @@ interface ProjectService {
fun postApplyProject(
@Body body : RequestApplyProjectData
): Call
+
+ @GET("/project/contact")
+ fun viewProject(
+ @Header("X-ACCESS-TOKEN") jwt: String,
+ @Header("X-REFRESH-TOKEN") refreshToken: String,
+ @Query("pj_num") projectNum : Int,
+ @Query("user_id") userId : String
+ ): Call
}
\ No newline at end of file
diff --git a/app/src/main/java/com/example/infraandroid/category/model/ResponseViewIdeaData.kt b/app/src/main/java/com/example/infraandroid/category/model/ResponseViewIdeaData.kt
new file mode 100644
index 0000000..6d73348
--- /dev/null
+++ b/app/src/main/java/com/example/infraandroid/category/model/ResponseViewIdeaData.kt
@@ -0,0 +1,27 @@
+package com.example.infraandroid.category.model
+
+data class ResponseViewIdeaData(
+ val code: Int,
+ val isSuccess: Boolean,
+ val message: String,
+ val result: Result
+){
+ data class Result(
+ val hashtag: List,
+ val pjLikeCount: Int,
+ val pj_categoryName: String,
+ val pj_content: String,
+ val pj_deadline: String,
+ val pj_endTerm: String,
+ val pj_header: String,
+ val pj_progress: String,
+ val pj_recruitPerson: String,
+ val pj_startTerm: String,
+ val pj_subCategoryName: String,
+ val pj_totalPerson: String,
+ val pj_views: Int,
+ val user_id: String,
+ val user_nickname: String,
+ val user_prPhoto: String
+ )
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/example/infraandroid/category/view/adapter/IdeaListAdapter.kt b/app/src/main/java/com/example/infraandroid/category/view/adapter/IdeaListAdapter.kt
index b6f395a..f0979a3 100644
--- a/app/src/main/java/com/example/infraandroid/category/view/adapter/IdeaListAdapter.kt
+++ b/app/src/main/java/com/example/infraandroid/category/view/adapter/IdeaListAdapter.kt
@@ -33,7 +33,6 @@ class IdeaListAdapter(): RecyclerView.Adapter() {
fun onBind(ideaListInfo: ResponseLookUpAllProjectData.Result){
ImageRound.roundAll(binding.projectImageView, 36f)
binding.projectList = ideaListInfo
-
itemView.setOnClickListener {
it.findNavController().navigate(R.id.action_idea_list_fragment_to_categoryViewIdeaFragment)
diff --git a/app/src/main/java/com/example/infraandroid/category/view/fragment/CategoryIdeaFragment.kt b/app/src/main/java/com/example/infraandroid/category/view/fragment/CategoryIdeaFragment.kt
index c9d1917..e5002d2 100644
--- a/app/src/main/java/com/example/infraandroid/category/view/fragment/CategoryIdeaFragment.kt
+++ b/app/src/main/java/com/example/infraandroid/category/view/fragment/CategoryIdeaFragment.kt
@@ -4,10 +4,12 @@ import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
+import android.widget.Toast
import androidx.fragment.app.Fragment
import androidx.navigation.findNavController
import com.example.infraandroid.R
import com.example.infraandroid.databinding.FragmentCategoryIdeaBinding
+import com.example.infraandroid.home.view.fragment.HomeFragmentDirections
// 카테고리의 아이디어 탭
@@ -37,6 +39,16 @@ class CategoryIdeaFragment : Fragment() {
mBinding?.lookMyIdeaButton?.setOnClickListener {
it.findNavController().navigate(R.id.action_category_fragment_to_myInfoMyIdeaFragment)
}
+
+ mBinding?.categorySearchImageView?.setOnClickListener {
+ if(mBinding?.categoryIdeaSearchEditText?.text.toString().length>=2){
+ val action = CategoryFragmentDirections.actionCategoryFragmentToIdeaListFragment(mBinding?.categoryIdeaSearchEditText?.text.toString())
+ it.findNavController().navigate(action)
+ }
+ else{
+ Toast.makeText(requireActivity(), "검색어 2글자 이상 입력해주세요", Toast.LENGTH_SHORT).show()
+ }
+ }
}
override fun onDestroyView() {
diff --git a/app/src/main/java/com/example/infraandroid/category/view/fragment/IdeaListFragment.kt b/app/src/main/java/com/example/infraandroid/category/view/fragment/IdeaListFragment.kt
index f969145..5ec9d86 100644
--- a/app/src/main/java/com/example/infraandroid/category/view/fragment/IdeaListFragment.kt
+++ b/app/src/main/java/com/example/infraandroid/category/view/fragment/IdeaListFragment.kt
@@ -2,6 +2,7 @@ package com.example.infraandroid.category.view.fragment
import android.util.Log
import androidx.navigation.findNavController
+import androidx.navigation.fragment.navArgs
import com.example.infraandroid.R
import com.example.infraandroid.category.model.ResponseLookUpAllProjectData
import com.example.infraandroid.category.view.adapter.IdeaListAdapter
@@ -25,40 +26,68 @@ class IdeaListFragment : BaseFragment(R.layout.fragment
}
- override fun FragmentIdeaListBinding.onViewCreated(){
+ override fun FragmentIdeaListBinding.onViewCreated(){
binding.ideaListRecyclerView.adapter = ideaListAdapter
+ val args: IdeaListFragmentArgs by navArgs()
+ val searchKeyword = args.searchKeyword
+ Log.d(TAG, "onViewCreated: $searchKeyword")
+ if(searchKeyword==null){
+ val call: Call = ServiceCreator.projectService
+ .getLookUpAllProject(InfraApplication.prefs.getString("jwt","null"), InfraApplication.prefs.getString("userId", "null"))
- val call: Call = ServiceCreator.projectService
- .getLookUpAllProject(InfraApplication.prefs.getString("jwt","null"), InfraApplication.prefs.getString("userId", "null"))
-
- call.enqueue(object : Callback{
- override fun onResponse(
- call: Call,
- response: Response
- ) {
- if(response.isSuccessful){
- val body = response.body()
- if (body != null) {
- when(body.code){
- 1000 -> {
- val data = body.result
- if (data != null) {
- ideaListAdapter.ideaList = data
+ call.enqueue(object : Callback{
+ override fun onResponse(
+ call: Call,
+ response: Response
+ ) {
+ if(response.isSuccessful){
+ val body = response.body()
+ if (body != null) {
+ when(body.code){
+ 1000 -> {
+ val data = body.result
+ if (data != null) {
+ ideaListAdapter.ideaList = data
+ }
+ ideaListAdapter.notifyDataSetChanged()
+ }
+ }
+ }
+ }
+ }
+ override fun onFailure(call: Call, t: Throwable) {
+ Log.d(TAG, "onFailure: $t")
+ }
+ })
+ }
+ else{
+ val call: Call = ServiceCreator.createProjectService
+ .searchProject(InfraApplication.prefs.getString("jwt","null"),searchKeyword,InfraApplication.prefs.getString("userId", "null"))
+ call.enqueue(object:Callback{
+ override fun onResponse(
+ call: Call,
+ response: Response
+ ) {
+ if(response.isSuccessful){
+ val body = response.body()
+ if(body!=null){
+ when(body.code){
+ 1000->{
+ val data = body.result
+ if(data!=null){
+ ideaListAdapter.ideaList = data
+ }
}
- ideaListAdapter.notifyDataSetChanged()
}
}
}
}
- }
-
- override fun onFailure(call: Call, t: Throwable) {
- Log.d(TAG, "onFailure: $t")
- }
-
- })
-
+ override fun onFailure(call: Call, t: Throwable) {
+ TODO("Not yet implemented")
+ }
+ })
+ }
binding.ideaListBackButton.setOnClickListener {
it.findNavController().navigate(R.id.action_idea_list_fragment_to_category_fragment)
diff --git a/app/src/main/java/com/example/infraandroid/home/model/CreateProjectService.kt b/app/src/main/java/com/example/infraandroid/home/model/CreateProjectService.kt
index b029778..1a61a17 100644
--- a/app/src/main/java/com/example/infraandroid/home/model/CreateProjectService.kt
+++ b/app/src/main/java/com/example/infraandroid/home/model/CreateProjectService.kt
@@ -1,5 +1,6 @@
package com.example.infraandroid.home.model
+import com.example.infraandroid.category.model.ResponseLookUpAllProjectData
import com.example.infraandroid.id.model.RequestLoginData
import com.example.infraandroid.id.model.ResponseLoginData
import okhttp3.MultipartBody
@@ -15,4 +16,11 @@ interface CreateProjectService {
@Part ("jsonList") jsonList: RequestBody,
@Part images: MultipartBody.Part?,
): Call
+
+ @GET("/project/inquiry?")
+ fun searchProject(
+ @Header("X-ACCESS-TOKEN") jwt: String,
+ @Query("search") searchKeyword : String,
+ @Query("user_id") userId : String
+ ): Call
}
\ No newline at end of file
diff --git a/app/src/main/java/com/example/infraandroid/home/model/ResponseCreateProjectData.kt b/app/src/main/java/com/example/infraandroid/home/model/ResponseCreateProjectData.kt
index 5f02f14..526b090 100644
--- a/app/src/main/java/com/example/infraandroid/home/model/ResponseCreateProjectData.kt
+++ b/app/src/main/java/com/example/infraandroid/home/model/ResponseCreateProjectData.kt
@@ -12,4 +12,4 @@ data class ResponseCreateProjectData(
@SerializedName("pj_name")
val projectTitle : String
)
-}
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/example/infraandroid/home/model/ResponseSearchProjectData.kt b/app/src/main/java/com/example/infraandroid/home/model/ResponseSearchProjectData.kt
new file mode 100644
index 0000000..563519d
--- /dev/null
+++ b/app/src/main/java/com/example/infraandroid/home/model/ResponseSearchProjectData.kt
@@ -0,0 +1,24 @@
+package com.example.infraandroid.home.model
+
+data class ResponseSearchProjectData(
+ val code: Int,
+ val isSuccess: Boolean,
+ val message: String,
+ val result: List
+){
+ data class Result(
+ val hashtag: Any,
+ val pj_categoryName: String,
+ val pj_daysub: Int,
+ val pj_deadline: String,
+ val pj_header: String,
+ val pj_like: Int,
+ val pj_num: Int,
+ val pj_photo: List,
+ val pj_progress: String,
+ val pj_recruit: String,
+ val pj_recruitPerson: Int,
+ val pj_totalPerson: Int,
+ val user_id: String
+ )
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/example/infraandroid/home/view/fragment/HomeFragment.kt b/app/src/main/java/com/example/infraandroid/home/view/fragment/HomeFragment.kt
index f602232..2b4b413 100644
--- a/app/src/main/java/com/example/infraandroid/home/view/fragment/HomeFragment.kt
+++ b/app/src/main/java/com/example/infraandroid/home/view/fragment/HomeFragment.kt
@@ -4,6 +4,7 @@ import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
+import android.widget.Toast
import androidx.fragment.app.Fragment
import androidx.navigation.findNavController
import com.example.infraandroid.util.InfraApplication
@@ -78,6 +79,16 @@ class HomeFragment : Fragment() {
mBinding?.homeBtnMakeNewProj?.setOnClickListener {
it.findNavController().navigate(R.id.action_home_fragment_to_createProjectFragment)
}
+
+ mBinding?.homeKeywordSearchIv?.setOnClickListener{
+ if(mBinding?.homeSearchEt?.text.toString().length>=2){
+ val action = HomeFragmentDirections.actionHomeFragmentToIdeaListFragment(mBinding?.homeSearchEt?.text.toString())
+ it.findNavController().navigate(action)
+ }
+ else{
+ Toast.makeText(requireActivity(), "검색어 2글자 이상 입력해주세요", Toast.LENGTH_SHORT).show()
+ }
+ }
}
override fun onDestroyView() {
mBinding = null
diff --git a/app/src/main/res/layout/fragment_category_idea.xml b/app/src/main/res/layout/fragment_category_idea.xml
index 1e6a2b9..da4f1ef 100644
--- a/app/src/main/res/layout/fragment_category_idea.xml
+++ b/app/src/main/res/layout/fragment_category_idea.xml
@@ -1,10 +1,11 @@
+ xmlns:tools="http://schemas.android.com/tools"
+ android:background="@color/infra_blue_d"
+ tools:context="com.example.infraandroid.category.view.fragment.CategoryIdeaFragment">
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/navigation/nav_graph.xml b/app/src/main/res/navigation/nav_graph.xml
index fcff7ca..4970c76 100644
--- a/app/src/main/res/navigation/nav_graph.xml
+++ b/app/src/main/res/navigation/nav_graph.xml
@@ -16,6 +16,9 @@
+
+
+ tools:layout="@layout/fragment_view_idea" >
+
+