Skip to content

Commit

Permalink
Merge pull request #102 from INFRAcp/seungmin
Browse files Browse the repository at this point in the history
[feat] #101 Change View
  • Loading branch information
peter-j0y authored Mar 7, 2022
2 parents 269ca55 + 9188c52 commit f6cbf08
Show file tree
Hide file tree
Showing 30 changed files with 1,018 additions and 404 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
package com.example.infraandroid.category.model

import retrofit2.Call
import retrofit2.http.GET
import retrofit2.http.Header
import retrofit2.http.Query
import retrofit2.http.*

interface LookUpAllProjectService {
interface ProjectService {
@GET("/project/inquiry?")
fun getLookUpAllProject(
@Header("X-ACCESS-TOKEN") jwt: String,
@Query("user_id") user_id : String
): Call<ResponseLookUpAllProjectData>

@POST("/project/apply")
fun postApplyProject(
@Body body : RequestApplyProjectData
): Call<ResponseApplyProjectData>
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ class IdeaListAdapter(): RecyclerView.Adapter<RecyclerView.ViewHolder>() {

itemView.setOnClickListener {
it.findNavController().navigate(R.id.action_idea_list_fragment_to_categoryViewIdeaFragment)

}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.fragment.app.Fragment
import androidx.navigation.findNavController
import androidx.viewpager2.widget.ViewPager2
import com.example.infraandroid.R
import com.example.infraandroid.category.view.adapter.CategoryPagerAdapter
import com.example.infraandroid.databinding.FragmentCategoryBinding
import com.google.android.material.tabs.TabLayout
Expand Down Expand Up @@ -37,6 +39,11 @@ class CategoryFragment : Fragment() {
}

override fun onViewCreated(view: View, savedInstanceState: Bundle?) {

mBinding?.createProjectConstraintLayout?.setOnClickListener {
it.findNavController().navigate(R.id.action_category_fragment_to_createProjectFragment)
}

super.onViewCreated(view, savedInstanceState)
}

Expand All @@ -58,10 +65,8 @@ class CategoryFragment : Fragment() {

TabLayoutMediator(tabLayout, viewPager){tab, position ->
when(position){
0->{
tab.text = "아이디어"
}
1->tab.text = "팀원"
0-> tab.text = "아이디어"
1-> tab.text = "팀원"
}
}.attach()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class CategoryViewIdeaFragment : Fragment(){
userId = InfraApplication.prefs.getString("userId", "null")
)

val call: Call<ResponseApplyProjectData> = ServiceCreator.applyProjectService
val call: Call<ResponseApplyProjectData> = ServiceCreator.projectService
.postApplyProject(requestApplyProjectData)
call.enqueue(object:Callback<ResponseApplyProjectData>{
override fun onResponse(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class IdeaListFragment : BaseFragment<FragmentIdeaListBinding>(R.layout.fragment
override fun FragmentIdeaListBinding.onViewCreated(){
binding.ideaListRecyclerView.adapter = ideaListAdapter

val call: Call<ResponseLookUpAllProjectData> = ServiceCreator.lookUpAllProjectService
val call: Call<ResponseLookUpAllProjectData> = ServiceCreator.projectService
.getLookUpAllProject(InfraApplication.prefs.getString("jwt","null"), InfraApplication.prefs.getString("userId", "null"))

call.enqueue(object : Callback<ResponseLookUpAllProjectData>{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,12 +105,71 @@ class CreateProjectFragment : Fragment() {
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
val cal = Calendar.getInstance()
val projectRecruitStart = mBinding?.projectStartDateEditTextView
val projectRecruitEnd = mBinding?.projectEndDateEditTextView
val projectMakingStart = mBinding?.setProjectStartDateTextView
val projectMakingEnd = mBinding?.projectEndMakingDateEditTextView
val addFileButton = mBinding?.addFileTextView

viewModel?.hashTag?.observe(viewLifecycleOwner, Observer{
when(it.size){
0 -> {
mBinding?.hashTagOneConstraintLayout?.isVisible = false
mBinding?.hashTagTwoConstraintLayout?.isVisible = false
mBinding?.hashTagThreeConstraintLayout?.isVisible = false
mBinding?.hashTagFourConstraintLayout?.isVisible = false
hashTagString = ""
}
1 -> {
mBinding?.hashTagOneTextView?.text = it[0]
mBinding?.hashTagOneConstraintLayout?.isVisible = true
mBinding?.hashTagTwoConstraintLayout?.isVisible = false
mBinding?.hashTagThreeConstraintLayout?.isVisible = false
mBinding?.hashTagFourConstraintLayout?.isVisible = false
hashTagString = "\"${it[0]}\""
}
2 -> {
mBinding?.hashTagTwoTextView?.text = it[1]
mBinding?.hashTagOneConstraintLayout?.isVisible = true
mBinding?.hashTagTwoConstraintLayout?.isVisible = true
mBinding?.hashTagThreeConstraintLayout?.isVisible = false
mBinding?.hashTagFourConstraintLayout?.isVisible = false
hashTagString = "\"${it[0]}\",\"${it[1]}\""
}
3 -> {
mBinding?.hashTagThreeTextView?.text = it[2]
mBinding?.hashTagOneConstraintLayout?.isVisible = true
mBinding?.hashTagTwoConstraintLayout?.isVisible = true
mBinding?.hashTagThreeConstraintLayout?.isVisible = true
mBinding?.hashTagFourConstraintLayout?.isVisible = false
hashTagString = "\"${it[0]}\",\"${it[1]}\",\"${it[2]}\""
}
4 -> {
mBinding?.hashTagFourTextView?.text = it[3]
mBinding?.hashTagOneConstraintLayout?.isVisible = true
mBinding?.hashTagTwoConstraintLayout?.isVisible = true
mBinding?.hashTagThreeConstraintLayout?.isVisible = true
mBinding?.hashTagFourConstraintLayout?.isVisible = true
hashTagString = "\"${it[0]}\",\"${it[1]}\",\"${it[2]}\",\"${it[3]}\""
}
}
})

mBinding?.hashTagOneConstraintLayout?.setOnClickListener {
viewModel?.deleteHashTag(0)
}

mBinding?.hashTagTwoConstraintLayout?.setOnClickListener {
viewModel?.deleteHashTag(1)
}

mBinding?.hashTagThreeConstraintLayout?.setOnClickListener {
viewModel?.deleteHashTag(2)
}

mBinding?.hashTagFourConstraintLayout?.setOnClickListener {
viewModel?.deleteHashTag(3)
}

// 파일 첨부 버튼 눌렀을 때
addFileButton?.setOnClickListener {
requestPermission()
Expand Down Expand Up @@ -267,30 +326,6 @@ class CreateProjectFragment : Fragment() {
if(mBinding?.hashTagEditText?.text.toString() != "")
viewModel?.updateHashTag(mBinding?.hashTagEditText?.text.toString())
mBinding?.hashTagEditText?.setText("")
viewModel?.hashTag?.observe(viewLifecycleOwner, Observer{
when(it.size){
1 -> {
mBinding?.hashTagOneTextView?.text = it[0]
mBinding?.hashTagOneTextView?.isVisible = true
hashTagString = "\"${it[0]}\""
}
2 -> {
mBinding?.hashTagTwoTextView?.text = it[1]
mBinding?.hashTagTwoTextView?.isVisible = true
hashTagString = "\"${it[0]}\",\"${it[1]}\""
}
3 -> {
mBinding?.hashTagThreeTextView?.text = it[2]
mBinding?.hashTagThreeTextView?.isVisible = true
hashTagString = "\"${it[0]}\",\"${it[1]}\",\"${it[2]}\""
}
4 -> {
mBinding?.hashTagFourTextView?.text = it[3]
mBinding?.hashTagFourTextView?.isVisible = true
hashTagString = "\"${it[0]}\",\"${it[1]}\",\"${it[2]}\",\"${it[3]}\""
}
}
})
}

// 날짜 선택하는 datepicker
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,4 +94,11 @@ class CreateProjectViewModel : ViewModel() {
_currentHashTag.value = hashTagArrayList
}
}

fun deleteHashTag(index: Int){
if(hashTagArrayList.size>0) {
hashTagArrayList.removeAt(index)
_currentHashTag.value = hashTagArrayList
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
package com.example.infraandroid.myinfo.myideamanage.view

import android.content.res.Resources
import android.graphics.Rect
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.fragment.app.DialogFragment
import com.example.infraandroid.R
import com.example.infraandroid.databinding.MyInfoMyProjectDeleteWarningBinding

class WarningDeleteDialog: DialogFragment() {
private var mBinding : MyInfoMyProjectDeleteWarningBinding? = null

override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
val binding = MyInfoMyProjectDeleteWarningBinding.inflate(inflater, container, false)
mBinding = binding

return mBinding?.root
}

override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)

mBinding?.warningOkayButton?.setOnClickListener {
// 삭제 버튼 눌렀을 때
}

mBinding?.warningCancelButton?.setOnClickListener {
dismiss()
}
}

override fun onActivityCreated(savedInstanceState: Bundle?) {
super.onActivityCreated(savedInstanceState)

setWidthPercent(90)
}

fun DialogFragment.setWidthPercent(percentage: Int) {
val percent = percentage.toFloat() / 100
val dm = Resources.getSystem().displayMetrics
val rect = dm.run { Rect(0, 0, widthPixels, heightPixels) }
val percentWidth = rect.width() * percent
dialog?.window?.setLayout(percentWidth.toInt(), ViewGroup.LayoutParams.WRAP_CONTENT)
dialog?.window?.setBackgroundDrawableResource(R.drawable.warning_background)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@ class MyIdeaFragment : Fragment() {

override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)

val bottomSheetDialogFragment = MyProjectMoreMenuBottomSheetFragment()

mBinding?.moreImageButton?.setOnClickListener {
activity?.supportFragmentManager?.let { it1 -> bottomSheetDialogFragment.show(it1, bottomSheetDialogFragment.tag) }
}
}

override fun onActivityCreated(savedInstanceState: Bundle?) {
Expand All @@ -54,6 +60,7 @@ class MyIdeaFragment : Fragment() {
}
})


TabLayoutMediator(tabLayout, viewPager){tab, position ->
when(position){
0->{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
package com.example.infraandroid.myinfo.myideamanage.view.fragment

import android.annotation.SuppressLint
import android.app.Dialog
import android.content.DialogInterface
import android.os.Bundle
import android.util.Log
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.navigation.findNavController
import androidx.navigation.fragment.NavHostFragment.findNavController
import androidx.navigation.fragment.findNavController
import com.example.infraandroid.R
import com.example.infraandroid.databinding.MyProjectMoreMenuBinding
import com.example.infraandroid.id.viewmodel.SignUpViewModel.Companion.TAG
import com.example.infraandroid.myinfo.myideamanage.view.WarningDeleteDialog
import com.google.android.material.bottomsheet.BottomSheetDialogFragment

class MyProjectMoreMenuBottomSheetFragment : BottomSheetDialogFragment() {
private var mBinding : MyProjectMoreMenuBinding? = null

override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
val binding = MyProjectMoreMenuBinding.inflate(inflater, container, false)
mBinding = binding

return mBinding?.root
}

override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)

val warningDeleteDialog = WarningDeleteDialog()

mBinding?.editProjectConstraintLayout?.setOnClickListener {
dismiss()
findNavController().navigate(R.id.action_myInfoTeamIdeaFragment_to_myInfoProjectModifyFragment)
}
mBinding?.deleteProjectConstraintLayout?.setOnClickListener {
dismiss()
activity?.supportFragmentManager?.let { it1 -> warningDeleteDialog.show(it1, warningDeleteDialog.tag) }
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import android.content.res.ColorStateList
import android.graphics.Color
import android.widget.ImageView
import android.widget.TextView
import androidx.constraintlayout.widget.ConstraintLayout
import androidx.core.view.isGone
import androidx.core.view.isVisible
import androidx.databinding.BindingAdapter
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
package com.example.infraandroid.util

import com.example.infraandroid.category.model.ApplyProjectService
import com.example.infraandroid.category.model.LookUpAllProjectService
import com.example.infraandroid.category.model.ProjectService
import com.example.infraandroid.home.model.CreateProjectService
import com.example.infraandroid.home.viewmodel.CreateProjectViewModel
import com.example.infraandroid.myinfo.myintroductionpage.model.ProfileViewService
import com.example.infraandroid.id.model.LoginService
import com.example.infraandroid.id.model.SMSService
Expand Down Expand Up @@ -35,6 +33,5 @@ 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 projectService : ProjectService = retrofit.create(ProjectService::class.java)
}
2 changes: 1 addition & 1 deletion app/src/main/res/drawable/edittext_box_background.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@
android:topLeftRadius="19dp"
android:topRightRadius="19dp"/>
<stroke
android:width="0.8dp"
android:width="1dp"
android:color="@color/infra_gray_t" />
</shape>
9 changes: 9 additions & 0 deletions app/src/main/res/drawable/ic_create_project.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="17dp"
android:height="17dp"
android:viewportWidth="17"
android:viewportHeight="17">
<path
android:pathData="M2.5,13.3382H6.0333C6.143,13.3388 6.2517,13.3178 6.3533,13.2763C6.4548,13.2348 6.5471,13.1737 6.625,13.0965L12.3917,7.3215L14.7583,5.0048C14.8364,4.9274 14.8984,4.8352 14.9407,4.7337C14.9831,4.6321 15.0048,4.5232 15.0048,4.4132C15.0048,4.3032 14.9831,4.1942 14.9407,4.0927C14.8984,3.9911 14.8364,3.899 14.7583,3.8215L11.225,0.2465C11.1475,0.1684 11.0554,0.1064 10.9538,0.0641C10.8523,0.0218 10.7433,0 10.6333,0C10.5233,0 10.4144,0.0218 10.3129,0.0641C10.2113,0.1064 10.1191,0.1684 10.0417,0.2465L7.6917,2.6048L1.9083,8.3798C1.8311,8.4577 1.77,8.55 1.7285,8.6516C1.687,8.7531 1.666,8.8618 1.6667,8.9715V12.5048C1.6667,12.7258 1.7545,12.9378 1.9107,13.0941C2.067,13.2504 2.279,13.3382 2.5,13.3382ZM10.6333,2.0132L12.9917,4.3715L11.8083,5.5548L9.45,3.1965L10.6333,2.0132ZM3.3333,9.3132L8.275,4.3715L10.6333,6.7298L5.6917,11.6715H3.3333V9.3132ZM15.8333,15.0048H0.8333C0.6123,15.0048 0.4004,15.0926 0.2441,15.2489C0.0878,15.4052 0,15.6172 0,15.8382C0,16.0592 0.0878,16.2711 0.2441,16.4274C0.4004,16.5837 0.6123,16.6715 0.8333,16.6715H15.8333C16.0543,16.6715 16.2663,16.5837 16.4226,16.4274C16.5789,16.2711 16.6667,16.0592 16.6667,15.8382C16.6667,15.6172 16.5789,15.4052 16.4226,15.2489C16.2663,15.0926 16.0543,15.0048 15.8333,15.0048Z"
android:fillColor="#666666"/>
</vector>
9 changes: 9 additions & 0 deletions app/src/main/res/drawable/ic_delete_hashtag.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="10dp"
android:height="10dp"
android:viewportWidth="10"
android:viewportHeight="10">
<path
android:pathData="M0.8074,0.8075C0.8655,0.7493 0.9344,0.7031 1.0103,0.6716C1.0863,0.6401 1.1677,0.6239 1.2499,0.6239C1.3321,0.6239 1.4135,0.6401 1.4894,0.6716C1.5654,0.7031 1.6343,0.7493 1.6924,0.8075L4.9999,4.1163L8.3074,0.8075C8.3655,0.7494 8.4345,0.7033 8.5104,0.6719C8.5863,0.6404 8.6677,0.6242 8.7499,0.6242C8.8321,0.6242 8.9135,0.6404 8.9894,0.6719C9.0653,0.7033 9.1343,0.7494 9.1924,0.8075C9.2505,0.8656 9.2966,0.9346 9.328,1.0105C9.3595,1.0865 9.3757,1.1678 9.3757,1.25C9.3757,1.3322 9.3595,1.4136 9.328,1.4895C9.2966,1.5654 9.2505,1.6344 9.1924,1.6925L5.8836,5L9.1924,8.3075C9.2505,8.3656 9.2966,8.4346 9.328,8.5105C9.3595,8.5865 9.3757,8.6678 9.3757,8.75C9.3757,8.8322 9.3595,8.9136 9.328,8.9895C9.2966,9.0654 9.2505,9.1344 9.1924,9.1925C9.1343,9.2506 9.0653,9.2967 8.9894,9.3282C8.9135,9.3596 8.8321,9.3758 8.7499,9.3758C8.6677,9.3758 8.5863,9.3596 8.5104,9.3282C8.4345,9.2967 8.3655,9.2506 8.3074,9.1925L4.9999,5.8838L1.6924,9.1925C1.6343,9.2506 1.5653,9.2967 1.4894,9.3282C1.4135,9.3596 1.3321,9.3758 1.2499,9.3758C1.1677,9.3758 1.0863,9.3596 1.0104,9.3282C0.9345,9.2967 0.8655,9.2506 0.8074,9.1925C0.7493,9.1344 0.7032,9.0654 0.6717,8.9895C0.6403,8.9136 0.6241,8.8322 0.6241,8.75C0.6241,8.6678 0.6403,8.5865 0.6717,8.5105C0.7032,8.4346 0.7493,8.3656 0.8074,8.3075L4.1161,5L0.8074,1.6925C0.7492,1.6345 0.703,1.5655 0.6715,1.4896C0.64,1.4136 0.6238,1.3322 0.6238,1.25C0.6238,1.1678 0.64,1.0864 0.6715,1.0105C0.703,0.9345 0.7492,0.8656 0.8074,0.8075Z"
android:fillColor="#4B8EFF"/>
</vector>
Loading

0 comments on commit f6cbf08

Please sign in to comment.