Skip to content

Commit

Permalink
Design: 향후계획 ui 글씨체 적용 및 화면 조정 #50
Browse files Browse the repository at this point in the history
  • Loading branch information
dkyuuum committed Feb 19, 2024
1 parent 588f2db commit aee7b39
Show file tree
Hide file tree
Showing 11 changed files with 206 additions and 194 deletions.
12 changes: 6 additions & 6 deletions .idea/deploymentTargetDropDown.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,9 @@ class PlanSettingFragment : Fragment() {
container: ViewGroup?,
savedInstanceState: Bundle?
): View {
// PlanTimeTabMainBinding을 인플레이트하여 루트 뷰를 가져옴
_binding = PlanTimeTabMainBinding.inflate(inflater, container, false)
val view = binding.root



// 탭 레이아웃 및 뷰페이저 초기화
initTabLayout()
initViewPager()
Expand All @@ -57,11 +54,9 @@ class PlanSettingFragment : Fragment() {

val tabTitle = arrayOf("시간표", "자격증", "자유")


viewPager = binding.viewPagerTimeTabMain
tabLayout = binding.tabLayoutPlanTime


val adapter = PlanVPAdapter(this)

adapter.addFragment(PlanTimeFragment())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,125 +16,124 @@ import umc.com.mobile.project.R
import umc.com.mobile.project.databinding.FragmentPlanlicenseBinding

class PlanlicenseFragment : Fragment() {
private var _binding: FragmentPlanlicenseBinding? = null
private val viewModel: PlanViewModel by activityViewModels()
private val binding get() = _binding!!
private var _binding: FragmentPlanlicenseBinding? = null
private val viewModel: PlanViewModel by activityViewModels()
private val binding get() = _binding!!

override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View {
_binding = FragmentPlanlicenseBinding.inflate(inflater, container, false)
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View {
_binding = FragmentPlanlicenseBinding.inflate(inflater, container, false)



viewModel.getLicenseInfo() // api 연결
viewModel.getLicenseInfo() // api 연결




// UPlicenseResponse-자격증 정보 불러오기
viewModel.licenseInfo.observe(viewLifecycleOwner) { licenseInfo ->
licenseInfo?.result?.let { resultList ->
// 첫 번째 Result 객체에 접근하여 데이터 매핑
resultList.getOrNull(0)?.let { firstResult ->
binding.planLicenseName.setText(firstResult.name)
binding.planLicenseDate.setText(firstResult.date)
}
// UPlicenseResponse-자격증 정보 불러오기
viewModel.licenseInfo.observe(viewLifecycleOwner) { licenseInfo ->
licenseInfo?.result?.let { resultList ->
// 첫 번째 Result 객체에 접근하여 데이터 매핑
resultList.getOrNull(0)?.let { firstResult ->
binding.planLicenseName.setText(firstResult.name)
binding.planLicenseDate.setText(firstResult.date)
}

// 두 번째 Result 객체에 접근하여 데이터 매핑
resultList.getOrNull(1)?.let { secondResult ->
binding.planLicenseName2.setText(secondResult.name)
binding.planLicenseDate2.setText(secondResult.date)
// 두 번째 Result 객체에 접근하여 데이터 매핑
resultList.getOrNull(1)?.let { secondResult ->
binding.planLicenseName2.setText(secondResult.name)
binding.planLicenseDate2.setText(secondResult.date)

}
}

resultList.getOrNull(2)?.let { thirdResult ->
binding.planLicenseName3.setText(thirdResult.name)
binding.planLicenseDate3.setText(thirdResult.date)
resultList.getOrNull(2)?.let { thirdResult ->
binding.planLicenseName3.setText(thirdResult.name)
binding.planLicenseDate3.setText(thirdResult.date)


}
}

resultList.getOrNull(3)?.let { fourthResult ->
binding.planLicenseName4.setText(fourthResult.name)
binding.planLicenseDate4.setText(fourthResult.date)
}
}
}
resultList.getOrNull(3)?.let { fourthResult ->
binding.planLicenseName4.setText(fourthResult.name)
binding.planLicenseDate4.setText(fourthResult.date)
}
}
}


return binding.root
}
return binding.root
}

private fun submitData() {
private fun submitData() {

val name = binding.planLicenseName.text.toString()
val date = binding.planLicenseDate.text.toString()
val name = binding.planLicenseName.text.toString()
val date = binding.planLicenseDate.text.toString()

// SaveInfo 객체 리스트 생성
val saveInfoList = listOf(SaveInfo(name, date))
// SaveInfo 객체 리스트 생성
val saveInfoList = listOf(SaveInfo(name, date))

// SavelicenseRequest 객체 생성
// SavelicenseRequest 객체 생성


// API 호출
viewModel.saveLicense(saveInfoList)
// API 호출
viewModel.saveLicense(saveInfoList)

}
}


private fun setupEditTextListener(){
val textWatcher = object : TextWatcher {
override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) {
// 필요 없음
}
private fun setupEditTextListener(){
val textWatcher = object : TextWatcher {
override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) {
// 필요 없음
}

override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) {
// 입력이 변경될 때마다 호출됩니다.
checkIfAnyInputIsFilled()
}
override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) {
// 입력이 변경될 때마다 호출됩니다.
checkIfAnyInputIsFilled()
}

override fun afterTextChanged(s: Editable?) {
// 필요 없음
}
}
binding.planLicenseName.addTextChangedListener(textWatcher)
}
override fun afterTextChanged(s: Editable?) {
// 필요 없음
}
}
binding.planLicenseName.addTextChangedListener(textWatcher)
}

private fun checkIfAnyInputIsFilled() {
val isAnyFieldFilled = binding.planLicenseName.text.trim().isNotEmpty()
//버튼 활성화 업데이트
binding.licenseButtonStore.isEnabled = isAnyFieldFilled
private fun checkIfAnyInputIsFilled() {
val isAnyFieldFilled = binding.planLicenseName.text.trim().isNotEmpty()
//버튼 활성화 업데이트
binding.licenseButtonStore.isEnabled = isAnyFieldFilled

// 버튼 색상도 업데이트
val colorResId = if (isAnyFieldFilled) R.color.skyBlue else R.color.gray
val color = ContextCompat.getColor(requireContext(), colorResId)
binding.licenseButtonStore.backgroundTintList = ColorStateList.valueOf(color)
// 버튼 색상도 업데이트
val colorResId = if (isAnyFieldFilled) R.color.skyBlue else R.color.gray
val color = ContextCompat.getColor(requireContext(), colorResId)
binding.licenseButtonStore.backgroundTintList = ColorStateList.valueOf(color)



}
}

override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
setupEditTextListener()
checkIfAnyInputIsFilled() // 초기 상태 확인
binding.licenseButtonStore.setOnClickListener {
submitData() // 사용자 입력을 기반으로 API 호출
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
setupEditTextListener()
checkIfAnyInputIsFilled() // 초기 상태 확인
binding.licenseButtonStore.setOnClickListener {
submitData() // 사용자 입력을 기반으로 API 호출
}





}

override fun onDestroyView() {
super.onDestroyView()
_binding = null
}
}
}

override fun onDestroyView() {
super.onDestroyView()
_binding = null
}
}

5 changes: 5 additions & 0 deletions app/src/main/res/color/selector_selected_pink_else_gray.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:color="@color/pink" android:state_selected="true" />
<item android:color="@color/gray" android:state_selected="false" />
</selector>
16 changes: 16 additions & 0 deletions app/src/main/res/drawable/bg_plan_tab_radius_17.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:left="17dp"
android:right="17dp">
<shape android:shape="rectangle">
<corners android:radius="50dp" />
<solid
android:width="1dp"
android:color="@color/selector_selected_pink_else_gray" />
<stroke
android:width="1dp"
android:color="@color/selector_selected_pink_else_gray" />
</shape>
</item>
</layer-list>
8 changes: 4 additions & 4 deletions app/src/main/res/layout/fragment_grad_info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@
android:layout_height="wrap_content"
android:layout_marginStart="19dp"
android:layout_marginTop="43dp"
android:textColor="@color/black"
android:text="졸업요건"
android:textColor="@color/black"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

<com.google.android.material.tabs.TabLayout
android:id="@+id/tabLayout_grad_info"
style="@style/SemiBoldFont.16"
style="@style/SemiBoldFont.15"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
Expand All @@ -34,13 +34,13 @@
app:tabGravity="fill"
app:tabIconTint="@android:color/transparent"
app:tabIndicatorHeight="0dp"
app:tabMinWidth="85dp"
app:tabMaxWidth="0dp"
app:tabMode="fixed"
app:tabPaddingEnd="17dp"
app:tabPaddingStart="17dp"
app:tabRippleColor="@null"
app:tabSelectedTextColor="@color/white"
app:tabTextAppearance="@style/SemiBoldFont.14"
app:tabTextAppearance="@style/SemiBoldFont.15"
app:tabTextColor="@color/text_gray"
app:tabUnboundedRipple="false" />

Expand Down
Loading

0 comments on commit aee7b39

Please sign in to comment.