-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #18 from ttoklip/faet/#2_마이페이지_구현
Faet/#2 마이페이지 UI 중간 병합
- Loading branch information
Showing
65 changed files
with
3,695 additions
and
96 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 0 additions & 60 deletions
60
app/src/main/java/com/umc/ttoklip/presentation/MyFragment.kt
This file was deleted.
Oops, something went wrong.
44 changes: 44 additions & 0 deletions
44
app/src/main/java/com/umc/ttoklip/presentation/base/BaseBottomSheetDialogFragment.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package com.umc.ttoklip.presentation.base | ||
|
||
import android.os.Bundle | ||
import android.view.LayoutInflater | ||
import android.view.View | ||
import android.view.ViewGroup | ||
import androidx.annotation.LayoutRes | ||
import androidx.databinding.DataBindingUtil | ||
import androidx.databinding.ViewDataBinding | ||
import com.google.android.material.bottomsheet.BottomSheetDialogFragment | ||
|
||
abstract class BaseBottomSheetDialogFragment<V : ViewDataBinding>(@LayoutRes val layoutResource: Int) : | ||
BottomSheetDialogFragment() { | ||
private var _binding: V? = null | ||
protected val binding: V get() = _binding!! | ||
abstract fun initObserver() | ||
abstract fun initView() | ||
|
||
override fun onCreateView( | ||
inflater: LayoutInflater, | ||
container: ViewGroup?, | ||
savedInstanceState: Bundle? | ||
): View { | ||
_binding = DataBindingUtil.inflate( | ||
layoutInflater, | ||
layoutResource, | ||
null, | ||
false | ||
) | ||
binding.lifecycleOwner = this | ||
return binding.root | ||
} | ||
|
||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) { | ||
super.onViewCreated(view, savedInstanceState) | ||
initObserver() | ||
initView() | ||
} | ||
|
||
override fun onDestroyView() { | ||
super.onDestroyView() | ||
_binding = null | ||
} | ||
} |
105 changes: 105 additions & 0 deletions
105
app/src/main/java/com/umc/ttoklip/presentation/mypage/ChooseMainInterestDialogFragment.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
package com.umc.ttoklip.presentation.mypage | ||
|
||
import android.util.Log | ||
import com.google.android.material.chip.Chip | ||
import com.umc.ttoklip.R | ||
import com.umc.ttoklip.databinding.FragmentChooseMainInterestBinding | ||
import com.umc.ttoklip.presentation.base.BaseBottomSheetDialogFragment | ||
import dagger.hilt.android.AndroidEntryPoint | ||
|
||
@AndroidEntryPoint | ||
class ChooseMainInterestDialogFragment(private val btnClickListener: (List<String>) -> Unit) : | ||
BaseBottomSheetDialogFragment<FragmentChooseMainInterestBinding>(R.layout.fragment_choose_main_interest) { | ||
private val interest = ArrayList<String>() | ||
override fun initObserver() = Unit | ||
|
||
override fun initView() { | ||
with(binding) { | ||
noInterestChip.setOnClickListener { | ||
removeAllInterest() | ||
} | ||
houseworkChip.setOnClickListener { | ||
changeInterest(houseworkChip) | ||
} | ||
cookingChip.setOnClickListener { | ||
changeInterest(cookingChip) | ||
} | ||
safeLifeChip.setOnClickListener { | ||
changeInterest(safeLifeChip) | ||
} | ||
fraudChip.setOnClickListener { | ||
changeInterest(fraudChip) | ||
} | ||
welfarePolicyChip.setOnClickListener { | ||
changeInterest(welfarePolicyChip) | ||
} | ||
chooseBtn.setOnClickListener { | ||
if (interest.isNotEmpty()) { | ||
btnClickListener(interest.toList()) | ||
dismiss() | ||
} | ||
} | ||
} | ||
} | ||
|
||
private fun changeInterest(chip: Chip) { | ||
Log.d("chip", chip.text.toString()) | ||
if (binding.noInterestChip.tag == YES_INTERESTING) { | ||
removeInterest(binding.noInterestChip) | ||
} | ||
if (chip.tag == NOT_INTERESTING) { | ||
addInterest(chip) | ||
} else { | ||
removeInterest(chip) | ||
} | ||
checkInterest() | ||
} | ||
|
||
private fun removeAllInterest() { | ||
with(binding) { | ||
if (noInterestChip.tag == NOT_INTERESTING) { | ||
removeInterest(houseworkChip) | ||
removeInterest(cookingChip) | ||
removeInterest(safeLifeChip) | ||
removeInterest(fraudChip) | ||
removeInterest(welfarePolicyChip) | ||
addInterest(noInterestChip) | ||
} else { | ||
removeInterest(noInterestChip) | ||
} | ||
} | ||
checkInterest() | ||
} | ||
|
||
private fun addInterest(chip: Chip) { | ||
chip.tag = YES_INTERESTING | ||
chip.setChipBackgroundColorResource(R.color.yellow) | ||
chip.setChipStrokeColorResource(R.color.yellow) | ||
interest.add(chip.text.toString()) | ||
} | ||
|
||
private fun removeInterest(chip: Chip) { | ||
chip.tag = NOT_INTERESTING | ||
chip.setChipBackgroundColorResource(R.color.white) | ||
chip.setChipStrokeColorResource(R.color.gray40) | ||
interest.remove(chip.text.toString()) | ||
} | ||
|
||
private fun checkInterest() { | ||
with(binding.chooseBtn) { | ||
if (interest.isNotEmpty()) { | ||
setBackgroundResource(R.drawable.yellow_btn_background) | ||
setTextAppearance(R.style.TextAppearance_App_16sp_700) | ||
} else { | ||
setBackgroundResource(R.drawable.rectangle_corner_10_strok_1_black) | ||
setTextAppearance(R.style.TextAppearance_App_16sp_500) | ||
} | ||
} | ||
|
||
} | ||
|
||
companion object { | ||
private const val NOT_INTERESTING = "NO" | ||
private const val YES_INTERESTING = "YES" | ||
} | ||
} |
47 changes: 47 additions & 0 deletions
47
...src/main/java/com/umc/ttoklip/presentation/mypage/InputIndependentCareerDialogFragment.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package com.umc.ttoklip.presentation.mypage | ||
|
||
import android.os.Build | ||
import android.view.ViewGroup.LayoutParams.WRAP_CONTENT | ||
import android.widget.NumberPicker | ||
import androidx.annotation.RequiresApi | ||
import com.umc.ttoklip.R | ||
import com.umc.ttoklip.databinding.FragmentInputIndependentCareerBinding | ||
import com.umc.ttoklip.presentation.base.BaseBottomSheetDialogFragment | ||
import dagger.hilt.android.AndroidEntryPoint | ||
|
||
@AndroidEntryPoint | ||
class InputIndependentCareerDialogFragment(private val btnClickListener: (Int, Int) -> Unit) : | ||
BaseBottomSheetDialogFragment<FragmentInputIndependentCareerBinding>(R.layout.fragment_input_independent_career) { | ||
override fun initObserver() = Unit | ||
|
||
@RequiresApi(Build.VERSION_CODES.Q) | ||
override fun initView() { | ||
this@InputIndependentCareerDialogFragment.dialog?.window?.setLayout( | ||
WRAP_CONTENT, | ||
WRAP_CONTENT | ||
) | ||
with(binding.yearSelector) { | ||
minValue = PERIOD_START | ||
maxValue = YEAR_END | ||
descendantFocusability = NumberPicker.FOCUS_BLOCK_DESCENDANTS | ||
selectionDividerHeight = DIVIDER_HEIGHT_ZERO | ||
} | ||
with(binding.monthSelector) { | ||
minValue = PERIOD_START | ||
maxValue = MONTH_END | ||
descendantFocusability = NumberPicker.FOCUS_BLOCK_DESCENDANTS | ||
selectionDividerHeight = DIVIDER_HEIGHT_ZERO | ||
} | ||
binding.chooseBtn.setOnClickListener { | ||
btnClickListener(binding.yearSelector.value, binding.monthSelector.value) | ||
this@InputIndependentCareerDialogFragment.dismiss() | ||
} | ||
} | ||
|
||
companion object { | ||
private const val PERIOD_START = 0 | ||
private const val YEAR_END = 99 | ||
private const val MONTH_END = 12 | ||
private const val DIVIDER_HEIGHT_ZERO = 0 | ||
} | ||
} |
Oops, something went wrong.