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 b12227f..9801d9c 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 @@ -1,5 +1,6 @@ package com.example.infraandroid.category.model +import com.example.infraandroid.myinfo.myideamanage.model.ResponseModifyProjectData import retrofit2.Call import retrofit2.http.* diff --git a/app/src/main/java/com/example/infraandroid/id/view/LoginFragment.kt b/app/src/main/java/com/example/infraandroid/id/view/LoginFragment.kt index df4f572..0b9d5d7 100644 --- a/app/src/main/java/com/example/infraandroid/id/view/LoginFragment.kt +++ b/app/src/main/java/com/example/infraandroid/id/view/LoginFragment.kt @@ -57,46 +57,7 @@ class LoginFragment : BaseFragment(R.layout.fragment_login // // Automatically sign in when exactly one credential is retrieved. // .setAutoSelectEnabled(true) // .build() - if(InfraApplication.prefs.getUserId().isNotEmpty() - and InfraApplication.prefs.getUserPW().isNotEmpty()){ - val requestLoginData = RequestLoginData( - userId = InfraApplication.prefs.getUserId(), - userPw = InfraApplication.prefs.getUserPW(), - ) - - val call: Call = ServiceCreator.loginService - .postLogin(requestLoginData) - - call.enqueue(object : Callback{ - override fun onResponse( - call: Call, - response: Response - ) { - if(response.isSuccessful){ - val code = response.body()?.code - when(code){ - 1000 -> { - InfraApplication.prefs.setString("jwt", response.body()?.result?.jwt.toString()) - InfraApplication.prefs.setString("refreshToken", response.body()?.result?.refreshToken.toString()) - InfraApplication.prefs.setString("userId", response.body()?.result?.userId.toString()) - InfraApplication.prefs.setString("userNickName", response.body()?.result?.userNickName.toString()) - Toast.makeText(requireActivity(),"요청에 성공하셨습니다.", Toast.LENGTH_SHORT).show() - // 로그인 버튼을 누르면 home_fragment로 이동 - findNavController().navigate(R.id.action_login_fragment_to_home_fragment) - } - 2001 -> {Toast.makeText(requireActivity(),"id가 비어있습니다.", Toast.LENGTH_SHORT).show()} - 3014 -> {Toast.makeText(requireActivity(),"없는 아이디거나 비밀번호가 틀렸습니다.", Toast.LENGTH_SHORT).show()} - 4000 -> {Toast.makeText(requireActivity(),"데이터베이스 연결에 실패하였습니다.", Toast.LENGTH_SHORT).show()} - } - } - } - - override fun onFailure(call: Call, t: Throwable) { - Log.e("login_server_test", "fail") - } - }) - } } override fun FragmentLoginBinding.onViewCreated(){ diff --git a/app/src/main/java/com/example/infraandroid/myinfo/myideamanage/model/MyProjectService.kt b/app/src/main/java/com/example/infraandroid/myinfo/myideamanage/model/MyProjectService.kt index af667a7..7a0cd5d 100644 --- a/app/src/main/java/com/example/infraandroid/myinfo/myideamanage/model/MyProjectService.kt +++ b/app/src/main/java/com/example/infraandroid/myinfo/myideamanage/model/MyProjectService.kt @@ -4,6 +4,7 @@ import com.example.infraandroid.category.model.ResponseLookUpAllProjectData import retrofit2.Call import retrofit2.http.GET import retrofit2.http.Header +import retrofit2.http.PATCH import retrofit2.http.Query interface MyProjectService { @@ -13,4 +14,18 @@ interface MyProjectService { @Header("X-REFRESH-TOKEN") refreshToken: Int, @Query("user_id") userId : String ): Call + + @PATCH("/project/modify") + fun modifyProject( + @Header("X-ACCESS-TOKEN") jwt: String, + @Header("X-REFRESH-TOKEN") refreshToken: Int + ): Call + + @GET("/project/apply-list?") + fun viewProjectApply( + @Header("X-ACCESS-TOKEN") jwt: String, + @Header("X-REFRESH-TOKEN") refreshToken: Int, + @Query("user_id") userId: String, + @Query("pj_num") pjNum: Int? + ): Call } \ No newline at end of file diff --git a/app/src/main/java/com/example/infraandroid/myinfo/myideamanage/model/ResponseModifyProjectData.kt b/app/src/main/java/com/example/infraandroid/myinfo/myideamanage/model/ResponseModifyProjectData.kt new file mode 100644 index 0000000..e0bec7a --- /dev/null +++ b/app/src/main/java/com/example/infraandroid/myinfo/myideamanage/model/ResponseModifyProjectData.kt @@ -0,0 +1,12 @@ +package com.example.infraandroid.myinfo.myideamanage.model + +data class ResponseModifyProjectData( + val code: Int, + val isSuccess: Boolean, + val message: String, + val result: Result +){ + data class Result( + val pj_string: String + ) +} \ No newline at end of file diff --git a/app/src/main/java/com/example/infraandroid/myinfo/myideamanage/model/ResponseViewProjectApplyData.kt b/app/src/main/java/com/example/infraandroid/myinfo/myideamanage/model/ResponseViewProjectApplyData.kt new file mode 100644 index 0000000..f9451a0 --- /dev/null +++ b/app/src/main/java/com/example/infraandroid/myinfo/myideamanage/model/ResponseViewProjectApplyData.kt @@ -0,0 +1,16 @@ +package com.example.infraandroid.myinfo.myideamanage.model + +data class ResponseViewProjectApplyData( + val code: Int, + val isSuccess: Boolean, + val message: String, + val result: ArrayList +){ + data class Result( + val pj_inviteStatus: String, + val user_id: String, + val user_nickname: String, + val user_prphoto: String, + val user_grade: String + ) +} \ No newline at end of file diff --git a/app/src/main/java/com/example/infraandroid/myinfo/myideamanage/view/adapter/MyIdeaMemberApplyAdapter.kt b/app/src/main/java/com/example/infraandroid/myinfo/myideamanage/view/adapter/MyIdeaMemberApplyAdapter.kt index b882b05..ad42ce8 100644 --- a/app/src/main/java/com/example/infraandroid/myinfo/myideamanage/view/adapter/MyIdeaMemberApplyAdapter.kt +++ b/app/src/main/java/com/example/infraandroid/myinfo/myideamanage/view/adapter/MyIdeaMemberApplyAdapter.kt @@ -8,11 +8,12 @@ import com.example.infraandroid.databinding.ItemTeamMemberApplicationRecyclervie import com.example.infraandroid.myinfo.myideamanage.view.WarningAcceptDialog import com.example.infraandroid.myinfo.myideamanage.view.WarningRejectDialog import com.example.infraandroid.myinfo.myideamanage.model.MyIdeaMemberApplyManageInfo +import com.example.infraandroid.myinfo.myideamanage.model.ResponseViewProjectApplyData import com.example.infraandroid.myinfo.myinfomodify.view.MyInfoPhotoMoreMenuBottomSheetFragment //fragmentManager: FragmentManager class MyIdeaMemberApplyAdapter(): RecyclerView.Adapter() { - val teamMemberAppliList = mutableListOf() + var teamMemberApplyList = mutableListOf() private lateinit var context: Context //private var mFragmentManager: FragmentManager @@ -26,29 +27,28 @@ class MyIdeaMemberApplyAdapter(): RecyclerView.Adapter( false ) context = parent.context - return TeamMemberAppliViewHolder(binding) + return TeamMemberApplyViewHolder(binding) } override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) { - (holder as TeamMemberAppliViewHolder).onBind(teamMemberAppliList[position]) + (holder as TeamMemberApplyViewHolder).onBind(teamMemberApplyList[position]) } - override fun getItemCount(): Int = teamMemberAppliList.size + override fun getItemCount(): Int = teamMemberApplyList.size - inner class TeamMemberAppliViewHolder( + inner class TeamMemberApplyViewHolder( private val binding: ItemTeamMemberApplicationRecyclerviewBinding ): RecyclerView.ViewHolder(binding.root){ - fun onBind(myIdeaMemberApplyManageInfo: MyIdeaMemberApplyManageInfo){ - binding.teamMemberNameTv.text = myIdeaMemberApplyManageInfo.name - //binding.teamMemberProfileIv.setImageResource(teamMemberApplicationInfo.profileImg) + fun onBind(myIdeaMemberApplyManageInfo: ResponseViewProjectApplyData.Result){ - //팀원 프로필 클릭시 팀원 소개 페이지 바텀싵 - //bottom sheet layout 설정 - val bottomSheetDialogFragment = MyInfoPhotoMoreMenuBottomSheetFragment() - binding.teamMemberProfileConstraintLayout.setOnClickListener { - //bottomSheetDialogFragment.show(getFragmentManager() , "TAG") - //bottomSheetDialogFragment.show(mFragmentManager, bottomSheetDialogFragment.tag) - } +// //bottom sheet layout 설정 +// val bottomSheetDialogFragment = MyInfoPhotoMoreMenuBottomSheetFragment() +// binding.teamMemberProfileConstraintLayout.setOnClickListener { +// //bottomSheetDialogFragment.show(getFragmentManager() , "TAG") +// //bottomSheetDialogFragment.show(mFragmentManager, bottomSheetDialogFragment.tag) +// } + + binding.applyPerson = myIdeaMemberApplyManageInfo //수락하기 버튼 클릭시 binding.teamMemberApplicationAcceptBoxIv.setOnClickListener { diff --git a/app/src/main/java/com/example/infraandroid/myinfo/myideamanage/view/fragment/MyIdeaMemberFragment.kt b/app/src/main/java/com/example/infraandroid/myinfo/myideamanage/view/fragment/MyIdeaMemberFragment.kt index e48acd3..6d1dd4a 100644 --- a/app/src/main/java/com/example/infraandroid/myinfo/myideamanage/view/fragment/MyIdeaMemberFragment.kt +++ b/app/src/main/java/com/example/infraandroid/myinfo/myideamanage/view/fragment/MyIdeaMemberFragment.kt @@ -5,33 +5,46 @@ import android.view.LayoutInflater import android.view.View import android.view.ViewGroup import androidx.fragment.app.Fragment +import androidx.lifecycle.ViewModelProvider +import com.example.infraandroid.R import com.example.infraandroid.databinding.FragmentTeamMemberBinding import com.example.infraandroid.myinfo.myideamanage.model.MyIdeaMemberManageInfo import com.example.infraandroid.myinfo.myideamanage.model.MyIdeaMemberApplyManageInfo +import com.example.infraandroid.myinfo.myideamanage.model.MyProjectViewModel +import com.example.infraandroid.myinfo.myideamanage.model.ResponseViewProjectApplyData import com.example.infraandroid.myinfo.myideamanage.view.adapter.MyIdeaMemberApplyAdapter import com.example.infraandroid.myinfo.teammembereval.view.adapter.TeamMemberAdapter +import com.example.infraandroid.util.BaseFragment +import com.example.infraandroid.util.InfraApplication +import com.example.infraandroid.util.ServiceCreator +import retrofit2.Call +import retrofit2.Callback +import retrofit2.Response // 내 정보 > 내 아이디어 탭 레이아웃의 팀원 탭 -class MyIdeaMemberFragment : Fragment() { - private var mBinding : FragmentTeamMemberBinding? = null - //private lateinit var mFragmentManager: FragmentManager - private val TeamMemberAdapter = TeamMemberAdapter() - private val TeamMemberAppliAdapter = MyIdeaMemberApplyAdapter() +class MyIdeaMemberFragment : BaseFragment(R.layout.fragment_team_member) { + + private lateinit var viewModel : MyProjectViewModel + + private val teamMemberAdapter = TeamMemberAdapter() + private val teamMemberApplyAdapter = MyIdeaMemberApplyAdapter() private val teamMemberInfo = mutableListOf() private val teamMemberApplicationInfo = mutableListOf() - override fun onCreateView( - inflater: LayoutInflater, - container: ViewGroup?, - savedInstanceState: Bundle? - ): View? { - val binding = FragmentTeamMemberBinding.inflate(inflater, container, false) - mBinding = binding - return mBinding?.root + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + + activity?.run{ + viewModel = ViewModelProvider(this, ViewModelProvider.NewInstanceFactory()) + .get(MyProjectViewModel::class.java) + } } - override fun onViewCreated(view: View, savedInstanceState: Bundle?) { - super.onViewCreated(view, savedInstanceState) + override fun FragmentTeamMemberBinding.onCreateView(){ + + } + + override fun FragmentTeamMemberBinding.onViewCreated() { // //팀원 관리 어뎁터 연결 // mBinding?.teamMemberManagementRecyclerview?.adapter = TeamMemberAdapter @@ -41,15 +54,36 @@ class MyIdeaMemberFragment : Fragment() { // TeamMemberAdapter.notifyDataSetChanged() //신청 관리 어뎁터 연결 - mBinding?.applicationManagementRecyclerview?.adapter = TeamMemberAppliAdapter - val tempDataAppli = MyIdeaMemberApplyManageInfo(3,"나받아줘") - teamMemberApplicationInfo.add(tempDataAppli) - TeamMemberAppliAdapter.teamMemberAppliList.addAll(teamMemberApplicationInfo) - TeamMemberAppliAdapter.notifyDataSetChanged() - } + binding.applicationManagementRecyclerview.adapter = teamMemberApplyAdapter + val call : Call = ServiceCreator.myProjectService + .viewProjectApply(InfraApplication.prefs.getString("jwt", "null"), InfraApplication.prefs.getString("refreshToken", "null").toInt(), + InfraApplication.prefs.getString("userId", "null"), viewModel.currentObservingProjectNum.value) + + 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){ + teamMemberApplyAdapter.teamMemberApplyList = data + } + teamMemberApplyAdapter.notifyDataSetChanged() + } + } + } + } + } + + override fun onFailure(call: Call, t: Throwable) { + TODO("Not yet implemented") + } - override fun onDestroyView() { - mBinding = null - super.onDestroyView() + }) } } \ No newline at end of file diff --git a/app/src/main/java/com/example/infraandroid/myinfo/scrap/view/ScrapFragment.kt b/app/src/main/java/com/example/infraandroid/myinfo/scrap/view/ScrapFragment.kt index 0a8ecf8..e9884a5 100644 --- a/app/src/main/java/com/example/infraandroid/myinfo/scrap/view/ScrapFragment.kt +++ b/app/src/main/java/com/example/infraandroid/myinfo/scrap/view/ScrapFragment.kt @@ -1,15 +1,25 @@ package com.example.infraandroid.myinfo.scrap.view +import android.util.Log +import android.widget.Toast +import androidx.navigation.fragment.findNavController import com.example.infraandroid.R import com.example.infraandroid.databinding.FragmentScrapBinding +import com.example.infraandroid.id.model.RequestLoginData +import com.example.infraandroid.id.model.ResponseLoginData import com.example.infraandroid.util.BaseFragment +import com.example.infraandroid.util.InfraApplication +import com.example.infraandroid.util.ServiceCreator +import retrofit2.Call +import retrofit2.Callback +import retrofit2.Response class ScrapFragment : BaseFragment(R.layout.fragment_scrap){ override fun FragmentScrapBinding.onCreateView(){ + } override fun FragmentScrapBinding.onViewCreated(){ - } } \ No newline at end of file diff --git a/app/src/main/java/com/example/infraandroid/util/ServiceCreator.kt b/app/src/main/java/com/example/infraandroid/util/ServiceCreator.kt index 5befdbb..0d0cdcf 100644 --- a/app/src/main/java/com/example/infraandroid/util/ServiceCreator.kt +++ b/app/src/main/java/com/example/infraandroid/util/ServiceCreator.kt @@ -35,8 +35,6 @@ object ServiceCreator { val sendSMSService : SMSService = retrofit.create(SMSService::class.java) val profileViewService : ProfileViewService = retrofit.create(ProfileViewService::class.java) val createProjectService : CreateProjectService = retrofit.create(CreateProjectService::class.java) - val applyProjectService : ApplyProjectService = retrofit.create(ApplyProjectService::class.java) - val lookUpAllProjectService : LookUpAllProjectService = retrofit.create(LookUpAllProjectService::class.java) val myinfoService : MyInfoService = retrofit.create(MyInfoService::class.java) val projectService : ProjectService = retrofit.create(ProjectService::class.java) val myProjectService : MyProjectService = retrofit.create(MyProjectService::class.java) diff --git a/app/src/main/java/com/example/infraandroid/util/SplashFragment.kt b/app/src/main/java/com/example/infraandroid/util/SplashFragment.kt new file mode 100644 index 0000000..5432729 --- /dev/null +++ b/app/src/main/java/com/example/infraandroid/util/SplashFragment.kt @@ -0,0 +1,68 @@ +package com.example.infraandroid.util + +import android.util.Log +import android.widget.Toast +import androidx.fragment.app.Fragment +import androidx.navigation.fragment.findNavController +import com.example.infraandroid.R +import com.example.infraandroid.databinding.FragmentSplashBinding +import com.example.infraandroid.id.model.RequestLoginData +import com.example.infraandroid.id.model.ResponseLoginData +import retrofit2.Call +import retrofit2.Callback +import retrofit2.Response + +class SplashFragment : BaseFragment(R.layout.fragment_splash){ + override fun FragmentSplashBinding.onCreateView() { + + } + + override fun FragmentSplashBinding.onViewCreated(){ + if(InfraApplication.prefs.getUserId().isNotEmpty() + and InfraApplication.prefs.getUserPW().isNotEmpty()){ + + val requestLoginData = RequestLoginData( + userId = InfraApplication.prefs.getUserId(), + userPw = InfraApplication.prefs.getUserPW(), + ) + + val call: Call = ServiceCreator.loginService + .postLogin(requestLoginData) + + call.enqueue(object : Callback { + override fun onResponse( + call: Call, + response: Response + ) { + if(response.isSuccessful){ + when(response.body()?.code){ + 1000 -> { + InfraApplication.prefs.setString("jwt", response.body()?.result?.jwt.toString()) + InfraApplication.prefs.setString("refreshToken", response.body()?.result?.refreshToken.toString()) + InfraApplication.prefs.setString("userId", response.body()?.result?.userId.toString()) + InfraApplication.prefs.setString("userNickName", response.body()?.result?.userNickName.toString()) + Toast.makeText(requireActivity(),"요청에 성공하셨습니다.", Toast.LENGTH_SHORT).show() + // 로그인 버튼을 누르면 home_fragment로 이동 + findNavController().navigate(R.id.action_splashFragment_to_home_fragment) + } + 2001 -> { + Toast.makeText(requireActivity(),"id가 비어있습니다.", Toast.LENGTH_SHORT).show()} + 3014 -> { + Toast.makeText(requireActivity(),"없는 아이디거나 비밀번호가 틀렸습니다.", Toast.LENGTH_SHORT).show()} + 4000 -> { + Toast.makeText(requireActivity(),"데이터베이스 연결에 실패하였습니다.", Toast.LENGTH_SHORT).show()} + } + } + } + + override fun onFailure(call: Call, t: Throwable) { + Log.e("login_server_test", "fail") + } + }) + } + + else{ + findNavController().navigate(R.id.action_splashFragment_to_login_fragment) + } + } +} \ No newline at end of file diff --git a/app/src/main/res/drawable/splash.png b/app/src/main/res/drawable/splash.png new file mode 100644 index 0000000..497e49a Binary files /dev/null and b/app/src/main/res/drawable/splash.png differ diff --git a/app/src/main/res/layout/fragment_my_info_modify.xml b/app/src/main/res/layout/fragment_my_info_modify.xml index c8e058c..92888cb 100644 --- a/app/src/main/res/layout/fragment_my_info_modify.xml +++ b/app/src/main/res/layout/fragment_my_info_modify.xml @@ -3,9 +3,9 @@ xmlns:tools="http://schemas.android.com/tools" xmlns:app="http://schemas.android.com/apk/res-auto"> - + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_team_member.xml b/app/src/main/res/layout/fragment_team_member.xml index 4d1a4f0..d88825f 100644 --- a/app/src/main/res/layout/fragment_team_member.xml +++ b/app/src/main/res/layout/fragment_team_member.xml @@ -1,59 +1,66 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + android:layout_height="match_parent" + tools:context="com.example.infraandroid.myinfo.myideamanage.view.fragment.MyIdeaMemberFragment"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + - \ No newline at end of file + + \ No newline at end of file diff --git a/app/src/main/res/layout/item_team_member_application_recyclerview.xml b/app/src/main/res/layout/item_team_member_application_recyclerview.xml index 3769eaf..063db12 100644 --- a/app/src/main/res/layout/item_team_member_application_recyclerview.xml +++ b/app/src/main/res/layout/item_team_member_application_recyclerview.xml @@ -1,75 +1,90 @@ - + + + + + + + android:layout_marginStart="31dp" + android:layout_marginEnd="18dp" + android:layout_marginBottom="27dp"> + + + + + + + + + - + + + android:src="@drawable/ic_accept" + app:layout_constraintEnd_toEndOf="@+id/team_member_application_accept_box_iv" + app:layout_constraintStart_toStartOf="@+id/team_member_application_accept_box_iv" + app:layout_constraintTop_toTopOf="parent" + app:layout_constraintBottom_toBottomOf="parent" /> - - - + - - + - \ No newline at end of file + + \ 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 2b7a554..86b94b5 100644 --- a/app/src/main/res/navigation/nav_graph.xml +++ b/app/src/main/res/navigation/nav_graph.xml @@ -3,7 +3,7 @@ xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/nav_graph.xml" - app:startDestination="@id/login_fragment"> + app:startDestination="@id/splashFragment"> + tools:layout="@layout/fragment_my_info_project_modify" > + + + + + + + + \ No newline at end of file