Skip to content

Commit

Permalink
[feat] #127 Modify Create Project View & Connect My Project Team Memb…
Browse files Browse the repository at this point in the history
…er API
  • Loading branch information
peter-j0y committed Mar 29, 2022
1 parent b5be23d commit f7376b5
Show file tree
Hide file tree
Showing 20 changed files with 951 additions and 715 deletions.
8 changes: 4 additions & 4 deletions app/src/main/java/com/example/infraandroid/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import com.example.infraandroid.databinding.ActivityMainBinding

import android.view.View
import android.widget.Toast
import androidx.fragment.app.FragmentManager
import com.google.android.material.snackbar.Snackbar
import com.kakao.sdk.common.util.Utility

Expand Down Expand Up @@ -42,12 +43,9 @@ class MainActivity : AppCompatActivity() {
}
}


// 바텀 네비게이션 뷰와 네비게이션을 묶어준다
NavigationUI.setupWithNavController(mBinding.myBottomNav, navController)

val keyHash = Utility.getKeyHash(this)
Log.d("해시키", keyHash)
supportFragmentManager.popBackStack(R.id.splashFragment, FragmentManager.POP_BACK_STACK_INCLUSIVE)
}

override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
Expand All @@ -58,4 +56,6 @@ class MainActivity : AppCompatActivity() {
var displayMetrics = resources.displayMetrics
return Math.round(value * displayMetrics.density)
}


}
Original file line number Diff line number Diff line change
Expand Up @@ -211,10 +211,10 @@ class ChatFragment : Fragment() {
}
mBinding!!.inputMessageEdittext.setText("")
}
val bottomSheetDialogFragment = ChatMoreMenuBottomSheetFragment()
mBinding!!.chatMoreMenuOpenButton.setOnClickListener {
activity?.supportFragmentManager?.let { it1 -> bottomSheetDialogFragment.show(it1, bottomSheetDialogFragment.tag) }
}
// val bottomSheetDialogFragment = ChatMoreMenuBottomSheetFragment()
// mBinding!!.chatMoreMenuOpenButton.setOnClickListener {
// activity?.supportFragmentManager?.let { it1 -> bottomSheetDialogFragment.show(it1, bottomSheetDialogFragment.tag) }
// }

mBinding?.backToChatListButton?.setOnClickListener {
it.findNavController().navigate(R.id.action_chat_fragment_to_chatting_room_list_fragment)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,18 @@ import android.widget.Toast
import androidx.annotation.RequiresApi
import androidx.core.app.ActivityCompat
import androidx.core.content.ContextCompat
import androidx.core.view.isGone
import androidx.core.view.isVisible
import androidx.databinding.DataBindingUtil
import androidx.fragment.app.Fragment
import androidx.lifecycle.Observer
import androidx.lifecycle.ViewModelProvider
import androidx.navigation.NavArgs
import androidx.navigation.findNavController
import androidx.navigation.fragment.findNavController
import androidx.navigation.fragment.navArgs
import com.example.infraandroid.R
import com.example.infraandroid.category.view.fragment.CategoryViewIdeaFragmentArgs
import com.example.infraandroid.databinding.FragmentCreateProjectBinding
import com.example.infraandroid.home.model.ResponseCreateProjectData
import com.example.infraandroid.home.viewmodel.CreateProjectViewModel
Expand Down Expand Up @@ -109,6 +113,7 @@ class CreateProjectFragment : Fragment() {
val projectMakingStart = mBinding?.setProjectStartDateTextView
val projectMakingEnd = mBinding?.projectEndMakingDateEditTextView
val addFileButton = mBinding?.addFileTextView
val args: CreateProjectFragmentArgs by navArgs()

viewModel?.hashTag?.observe(viewLifecycleOwner, Observer{
when(it.size){
Expand Down Expand Up @@ -198,6 +203,15 @@ class CreateProjectFragment : Fragment() {
it.findNavController().navigate(R.id.action_createProjectFragment_to_home_fragment)
}

// 사진 지우기
mBinding?.photoImageView?.setOnClickListener {
mBinding?.addFileTextView?.isVisible = true
mBinding?.photoImageView?.isGone = true
mBinding?.photoBackgroundView?.isGone = true
mBinding?.deletePhotoImageView?.isGone = true
mediaPath = null
}

// 완료 버튼 눌렀을 때 프로젝트 생성 완료
mBinding?.completeTextView?.setOnClickListener {

Expand All @@ -216,9 +230,9 @@ class CreateProjectFragment : Fragment() {

val jsonString = "{\"user_id\" : \""+ InfraApplication.prefs.getString("userId", "null")+"\"," +
"\"pj_header\" : \"" + mBinding?.titleEditText?.text.toString() + "\"," +
"\"pj_categoryName\" : \"개발\"," +
"\"pj_categoryName\" : \""+args.category+"\"," +
"\"pj_content\" : \""+ mBinding?.projectContentEditText?.text.toString() +"\"," +
"\"pj_subCategoryName\" : \"APP\"," +
"\"pj_subCategoryName\" : \""+args.categoryDetail+"\"," +
"\"pj_progress\" : \""+ mBinding?.descriptionEditText?.text.toString() +"\"," +
"\"pj_startTerm\" : "+ startTermString +"," +
"\"pj_endTerm\" : "+ endTermString +"," +
Expand Down Expand Up @@ -278,6 +292,11 @@ class CreateProjectFragment : Fragment() {
ImageDecoder.decodeBitmap(source)
//imageView.setImageBitmap(bitmap)
}
mBinding?.photoImageView?.isVisible = true
mBinding?.addFileTextView?.isGone = true
mBinding?.photoBackgroundView?.isVisible = true
mBinding?.deletePhotoImageView?.isVisible = true
mBinding?.photoImageView?.setImageBitmap(bitmap)
}
}
catch (e: IOException) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import androidx.fragment.app.Fragment
import androidx.navigation.findNavController
import com.example.infraandroid.R
import com.example.infraandroid.databinding.FragmentCreateProjectSelectCategoryBinding
import com.example.infraandroid.myinfo.myideamanage.view.fragment.MyIdeaManageFragmentDirections

// 프로젝트의 종류를 선택하는 spinner와 관련된 .kt파일
// 작성자 : 신승민
Expand All @@ -32,19 +33,22 @@ class CreateProjectSelectCategoryFragment : Fragment(){
super.onViewCreated(view, savedInstanceState)

val categoryItems = resources.getStringArray(R.array.category_array)
val categoryDetailItems = resources.getStringArray(R.array.category_detail_array)
val categoryDetailDevelopItems = resources.getStringArray(R.array.category_detail_develop_array)
// val categoryDetailStudyItems = resources.getStringArray(R.array.category_detail_study_array)
// val categoryDetailActivityItems = resources.getStringArray(R.array.category_detail_activity_array)
val categoryAdapter = ArrayAdapter(requireActivity(), android.R.layout.simple_spinner_dropdown_item, categoryItems)
val categoryDetailAdapter = ArrayAdapter(requireActivity(), android.R.layout.simple_spinner_dropdown_item, categoryDetailItems)
var categoryDetailAdapter = ArrayAdapter(requireActivity(), android.R.layout.simple_spinner_dropdown_item, categoryDetailDevelopItems)
val categorySpinner = mBinding?.categorySpinner
val categoryDetailSpinner = mBinding?.categoryDetailSpinner
var categoryDetailSpinner = mBinding?.categoryDetailSpinner

mBinding?.goBackImageButton?.setOnClickListener {
it.findNavController().navigate(R.id.action_createProjectSelectCategory_to_createProjectFragment)
}

categorySpinner?.adapter = categoryAdapter
categoryDetailSpinner?.adapter = categoryDetailAdapter

mBinding?.goBackImageButton?.setOnClickListener {
val action = CreateProjectSelectCategoryFragmentDirections.actionCreateProjectSelectCategoryToCreateProjectFragment(categorySpinner?.selectedItem.toString(), categoryDetailSpinner?.selectedItem.toString())
it.findNavController().navigate(action)
}
}

override fun onDestroyView() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,5 +115,4 @@ class HomeFragment : BaseFragment<FragmentHomeBinding>(R.layout.fragment_home) {
}
}


}
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,12 @@ interface MyProjectService {
@Header("X-REFRESH-TOKEN") refreshToken: Int,
@Body body: RequestDeleteProjectData
): Call<ResponseDeleteProjectData>

@POST("/project/team?")
fun viewProjectMember(
@Header("X-ACCESS-TOKEN") jwt: String,
@Header("X-REFRESH-TOKEN") refreshToken: Int,
@Query("user_id") userId:String,
@Body body: RequestTeamMemberData
): Call<ResponseTeamMemberData>
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package com.example.infraandroid.myinfo.myideamanage.model

data class RequestTeamMemberData(
val pj_num: Int?
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package com.example.infraandroid.myinfo.myideamanage.model

data class ResponseTeamMemberData(
val code: Int,
val isSuccess: Boolean,
val message: String,
val result: ArrayList<Result>
){
data class Result(
val user_id: String,
val user_nickname: String,
val user_prPhoto: String
)
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.example.infraandroid.myinfo.myideamanage.view.fragment

import android.app.Service
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
Expand All @@ -8,10 +9,7 @@ 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.model.*
import com.example.infraandroid.myinfo.myideamanage.view.adapter.MyIdeaMemberApplyAdapter
import com.example.infraandroid.myinfo.teammembereval.view.adapter.TeamMemberAdapter
import com.example.infraandroid.util.BaseFragment
Expand Down Expand Up @@ -54,6 +52,7 @@ class MyIdeaMemberFragment : BaseFragment<FragmentTeamMemberBinding>(R.layout.fr

//신청 관리 어뎁터 연결
binding.applicationManagementRecyclerview.adapter = teamMemberApplyAdapter
binding.teamMemberManagementRecyclerview.adapter = teamMemberAdapter
val call : Call<ResponseViewProjectApplyData> = ServiceCreator.myProjectService
.viewProjectApply(InfraApplication.prefs.getString("jwt", "null"), InfraApplication.prefs.getString("refreshToken", "null").toInt(),
InfraApplication.prefs.getString("userId", "null"), viewModel.currentObservingProjectNum.value)
Expand All @@ -78,11 +77,42 @@ class MyIdeaMemberFragment : BaseFragment<FragmentTeamMemberBinding>(R.layout.fr
}
}
}

override fun onFailure(call: Call<ResponseViewProjectApplyData>, t: Throwable) {
TODO("Not yet implemented")
}

})

val requestTeamMemberData = RequestTeamMemberData(pj_num = viewModel.currentObservingProjectNum.value)
val projectMemberCall : Call<ResponseTeamMemberData> = ServiceCreator.myProjectService
.viewProjectMember(InfraApplication.prefs.getString("jwt", "null"), InfraApplication.prefs.getString("refreshToken", "null").toInt(),
InfraApplication.prefs.getString("userId", "null"), requestTeamMemberData)

projectMemberCall.enqueue(object: Callback<ResponseTeamMemberData>{
override fun onResponse(
call: Call<ResponseTeamMemberData>,
response: Response<ResponseTeamMemberData>
) {
if(response.isSuccessful){
val body = response.body()
if(body!=null){
when(body.code){
1000->{
val data = body.result
if(data!=null){
teamMemberAdapter.teamMemberList = data
}
teamMemberAdapter.notifyDataSetChanged()
}
}
}
}
}

override fun onFailure(call: Call<ResponseTeamMemberData>, t: Throwable) {
TODO("Not yet implemented")
}

})
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@ import androidx.recyclerview.widget.RecyclerView
import com.example.infraandroid.databinding.ItemTeamMemberRecyclerviewBinding
import com.example.infraandroid.myinfo.myideamanage.view.WarningKickOutDialog
import com.example.infraandroid.myinfo.myideamanage.model.MyIdeaMemberManageInfo
import com.example.infraandroid.myinfo.myideamanage.model.ResponseTeamMemberData

class TeamMemberAdapter(): RecyclerView.Adapter<RecyclerView.ViewHolder>() {
val teamMemderlist = mutableListOf<MyIdeaMemberManageInfo>()
var teamMemberList = mutableListOf<ResponseTeamMemberData.Result>()
private lateinit var context: Context

override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder {
Expand All @@ -23,24 +24,24 @@ class TeamMemberAdapter(): RecyclerView.Adapter<RecyclerView.ViewHolder>() {
}

override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) {
(holder as TeamMemberViewHolder).onBind(teamMemderlist[position])
(holder as TeamMemberViewHolder).onBind(teamMemberList[position])

}

override fun getItemCount(): Int = teamMemderlist.size
override fun getItemCount(): Int = teamMemberList.size

inner class TeamMemberViewHolder(
private val binding: ItemTeamMemberRecyclerviewBinding
) : RecyclerView.ViewHolder(binding.root) {
fun onBind(myIdeaMemberManageInfo: MyIdeaMemberManageInfo) {
binding.teamMemberNameTv.text = myIdeaMemberManageInfo.name
fun onBind(myIdeaMemberManageInfo: ResponseTeamMemberData.Result) {
binding.projectMember = myIdeaMemberManageInfo
//binding.teamMemberProfileIv.setImageResource(teamMemberInfo.profileImg)

//강퇴하기 버튼 클릭시
binding.teamMemberKickOutButton.setOnClickListener {
// val warningKickOutDialog = WarningKickOutDialog(context)
// warningKickOutDialog.show()
}
// binding.teamMemberKickOutButton.setOnClickListener {
//// val warningKickOutDialog = WarningKickOutDialog(context)
//// warningKickOutDialog.show()
// }


}
Expand Down
Binary file added app/src/main/res/drawable/close_photo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
24 changes: 12 additions & 12 deletions app/src/main/res/layout/fragment_chat.xml
Original file line number Diff line number Diff line change
Expand Up @@ -43,18 +43,18 @@
app:layout_constraintBottom_toBottomOf="@id/back_to_chat_list_button"
app:layout_constraintLeft_toRightOf="@id/back_to_chat_list_button"/>

<ImageButton
android:id="@+id/chat_more_menu_open_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@android:color/transparent"
android:src="@drawable/ic_more_menu_icon"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
android:layout_marginRight="10dp"
android:padding="10dp"
/>
<!-- <ImageButton-->
<!-- android:id="@+id/chat_more_menu_open_button"-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:background="@android:color/transparent"-->
<!-- android:src="@drawable/ic_more_menu_icon"-->
<!-- app:layout_constraintRight_toRightOf="parent"-->
<!-- app:layout_constraintTop_toTopOf="parent"-->
<!-- app:layout_constraintBottom_toBottomOf="parent"-->
<!-- android:layout_marginRight="10dp"-->
<!-- android:padding="10dp"-->
<!-- />-->
</androidx.constraintlayout.widget.ConstraintLayout>

<androidx.recyclerview.widget.RecyclerView
Expand Down
Loading

0 comments on commit f7376b5

Please sign in to comment.