Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ class MyPageFragment : Fragment() {
Toast.makeText(context, "Error: $message", Toast.LENGTH_SHORT).show()
}


private fun setNickname() {
val sharedPreferences = requireActivity().getSharedPreferences("MyPrefs", Context.MODE_PRIVATE)
val email = sharedPreferences.getString("currentEmail", null)
Expand All @@ -134,6 +135,7 @@ class MyPageFragment : Fragment() {
val nickname = sharedPreferences.getString("${email}_nickname", null)
binding.tvNickname.text = nickname ?: "닉네임 없음" // 닉네임이 없는 경우의 기본 값
binding.tvStudyNickname.text = nickname ?: "닉네임 없음"
binding.tvEmail.text = email ?: "이메일 없음"

// 로그인 플랫폼 확인
val loginPlatform = sharedPreferences.getString("loginPlatform", null)
Expand All @@ -142,6 +144,7 @@ class MyPageFragment : Fragment() {
"naver" -> sharedPreferences.getString("${email}_naverProfileImageUrl", null)
else -> null
}
binding.tvPhone.text = loginPlatform?.replaceFirstChar { it.uppercaseChar() } ?: "플랫폼 없음"

// Glide를 사용하여 이미지 로드
Glide.with(binding.root.context)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import android.view.ViewGroup
import android.widget.LinearLayout
import android.widget.TextView
import android.widget.Toast
import androidx.core.content.res.ResourcesCompat
import com.example.spoteam_android.R
import com.example.spoteam_android.Region
import com.example.spoteam_android.RegionApiResponse
Expand Down Expand Up @@ -48,7 +49,7 @@ class RegionPreferenceFragment : Fragment() {
}

// 이유 수정 버튼 클릭 시
binding.regionEditIv.setOnClickListener {
binding.checklistspotLocationEditBt.setOnClickListener {
val fragment = TemporaryRegionFragment()
val bundle = Bundle().apply {
putStringArrayList("SELECTED_REGIONS", ArrayList(selectedRegions))
Expand Down Expand Up @@ -129,16 +130,19 @@ class RegionPreferenceFragment : Fragment() {

val textView = TextView(requireContext()).apply {
text = regionText // 서버에서 받은 지역 데이터를 그대로 사용
textSize = 16f // 16sp
setPadding(50, 15, 50, 15) // 패딩 설정
textSize = 12f // 16sp
setPadding(30, 35, 50, 35) // 패딩 설정
setTextColor(resources.getColor(R.color.custom_chip_text, null))
setBackgroundResource(R.drawable.theme_selected_corner) // 커스텀 배경 적용
setBackgroundResource(R.drawable.button_background) // 커스텀 배경 적용
typeface = ResourcesCompat.getFont(requireContext(), R.font.suit_semi_bold)


val params = LinearLayout.LayoutParams(
LinearLayout.LayoutParams.WRAP_CONTENT,
LinearLayout.LayoutParams.MATCH_PARENT,
LinearLayout.LayoutParams.WRAP_CONTENT
).apply {
marginStart = 15
marginEnd = 15
topMargin = 30
}
layoutParams = params
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@ package com.example.spoteam_android.ui.mypage
import android.content.Context
import android.os.Bundle
import android.util.Log
import android.util.TypedValue
import androidx.fragment.app.Fragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.LinearLayout
import android.widget.TextView
import androidx.core.content.res.ResourcesCompat
import com.example.spoteam_android.R
import com.example.spoteam_android.RegionsPreferences
import com.example.spoteam_android.RetrofitInstance
Expand Down Expand Up @@ -40,13 +42,15 @@ class TemporaryRegionFragment : Fragment() {

// Regions 로그 출력
if (receivedRegions != null) {
selectedRegions.clear()
selectedRegions.addAll(receivedRegions)
Log.d("TemporaryRegionFragment", "Received Regions: $receivedRegions")
displaySelectedRegions()
}

// Regions Code 로그 출력
if (receivedRegionsCode != null) {
selectedRegionsCode.clear()
selectedRegionsCode.addAll(receivedRegionsCode)
Log.d("TemporaryRegionFragment", "Received RegionsCode: $receivedRegionsCode")
}
Expand Down Expand Up @@ -109,25 +113,39 @@ class TemporaryRegionFragment : Fragment() {

private fun displaySelectedRegions() {
val chipContainer = binding.chipContainer
chipContainer.removeAllViews() // 기존 Chips를 모두 제거
chipContainer.removeAllViews()

val uniqueRegions = mutableSetOf<String>()

for (regionText in selectedRegions) {
val chip = createLocationChip(regionText)
val chipGroup = ChipGroup(requireContext()).apply {
layoutParams = LinearLayout.LayoutParams(
LinearLayout.LayoutParams.MATCH_PARENT,
LinearLayout.LayoutParams.WRAP_CONTENT
)
addView(chip)
if (!uniqueRegions.contains(regionText)) {
uniqueRegions.add(regionText)

val chip = createStyledChip(regionText)
chipContainer.addView(chip)
}
chipContainer.addView(chipGroup)
}
}

private fun createLocationChip(address: String): Chip {

private fun createStyledChip(address: String): Chip {
return Chip(requireContext()).apply {
text = address
setTextColor(resources.getColor(R.color.active_blue, null))
setTextColor(resources.getColor(R.color.custom_chip_text, null))
setTextSize(TypedValue.COMPLEX_UNIT_SP, 12f) // sp 단위 사용
typeface = ResourcesCompat.getFont(requireContext(), R.font.suit_semi_bold)

// Chip 기본 크기 조정 (TextView와 비슷하게 설정)
minHeight = 36 // TextView의 기본 높이에 맞춰 조정

// Chip의 기본 패딩을 제거
chipStartPadding = 0f
chipEndPadding = 0f
textStartPadding = 0f
textEndPadding = 0f
chipMinHeight = 36f // 기본 높이 조정

// Custom Chip 스타일 적용
setChipDrawable(
ChipDrawable.createFromAttributes(
requireContext(),
Expand All @@ -136,27 +154,36 @@ class TemporaryRegionFragment : Fragment() {
R.style.CustomChipCloseStyle
)
)

// Chip의 marginTop을 조정
val params = LinearLayout.LayoutParams(
LinearLayout.LayoutParams.MATCH_PARENT,
LinearLayout.LayoutParams.WRAP_CONTENT
).apply {
topMargin = 50 // TextView와 동일한 marginTop 적용
marginStart = 15
marginEnd = 15
}
layoutParams = params

isCloseIconVisible = true
setOnCloseIconClickListener {
val chipContainer = binding.chipContainer
chipContainer.removeView(this.parent as View)
chipContainer.removeView(this)

// 삭제할 주소의 인덱스를 찾음
val index = selectedRegions.indexOf(address)
if (index != -1) {
// 주소와 코드 리스트에서 각각 해당 항목을 삭제
selectedRegions.removeAt(index)
selectedRegionsCode.removeAt(index)
}

updateFinishButtonState() // 버튼 상태 업데이트
if (selectedRegions.isEmpty()) {
binding.activityChecklistLocationCl.visibility = View.VISIBLE
}
updateFinishButtonState()
}
}
}



private fun showCompletionDialog() {
val dialog = RegionUploadCompleteDialog(requireContext())
dialog.start(parentFragmentManager)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:color="@color/b500" android:state_checked="true" />
<item android:color="#1E1E1E" />
<item android:color="@color/b500" />

</selector>
6 changes: 3 additions & 3 deletions SPOTeam_android/app/src/main/res/layout/fragment_mypage.xml
Original file line number Diff line number Diff line change
Expand Up @@ -416,10 +416,10 @@
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_weight="1"
android:text="전화번호"
android:text="소셜로그인"
android:textFontWeight="700"
android:textColor="@color/black"
android:textSize="16sp"/>
android:textSize="16dp"/>

<TextView
android:id="@+id/tv_phone"
Expand All @@ -429,7 +429,7 @@
android:text="010-0000-0000"
android:textFontWeight="700"
android:textColor="@color/g400"
android:textSize="16sp"/>
android:textSize="16dp"/>
</LinearLayout>


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,68 +6,50 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
tools:context=".ui.mypage.RegionPreferenceFragment">


<LinearLayout
android:id="@+id/fragment_region_preference_ll"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
app:layout_constraintTop_toTopOf="parent"
android:layout_marginTop="30dp"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent">
app:layout_constraintEnd_toEndOf="parent"
android:layout_marginStart="15dp">

<ImageButton
<ImageView
android:id="@+id/fragment_region_preference_back_bt"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_back_resize"
android:background="@color/white"/>

android:src="@drawable/ic_arrow"/>

<TextView
android:id="@+id/fragment_region_preference_mypage_tv"
android:text="마이페이지"
android:text="관심 지역"
android:textColor="@color/black"
android:textSize="16sp"
android:fontFamily="@font/pretendard"
android:textSize="16dp"
android:layout_marginStart="20dp"
android:fontFamily="@font/suit_semi_bold"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="15dp" />
android:drawablePadding="20dp"/>

</LinearLayout>

<ProgressBar
android:id="@+id/fragment_region_preference_pb"
android:layout_width="match_parent"
android:layout_height="4dp"
android:background="#D8D8D8"
android:layout_marginTop="20dp"
app:layout_constraintTop_toBottomOf="@id/fragment_region_preference_ll"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"/>

<TextView
android:id="@+id/fragment_region_preference_tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="내 관심 지역은?"
android:text="내 스터디 관심 지역은"
android:textColor="@color/black"
android:textSize="18sp"
android:textStyle="bold"
android:fontFamily="@font/pretendard"
android:layout_marginTop="30dp"
android:textSize="18dp"
android:fontFamily="@font/suit_bold"
android:layout_marginTop="40dp"
android:layout_marginStart="15dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/fragment_region_preference_pb"/>

<ImageView
android:id="@+id/region_edit_iv"
android:layout_width="15dp"
android:layout_height="15dp"
android:src="@drawable/mypageedit"
android:layout_marginTop="35dp"
android:layout_marginStart="10dp"
app:layout_constraintStart_toEndOf="@id/fragment_region_preference_tv"
app:layout_constraintTop_toBottomOf="@id/fragment_region_preference_pb"/>
app:layout_constraintTop_toBottomOf="@id/fragment_region_preference_ll"/>


<LinearLayout
Expand Down Expand Up @@ -155,6 +137,25 @@
android:textStyle="bold" />
</LinearLayout>

<android.widget.Button
android:id="@+id/checklistspot_location_edit_bt"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:background="@drawable/button_background"
android:enabled="true"
android:text="수정"
android:fontFamily="@font/suit_bold"
android:textColor="@color/b500"
android:textSize="16sp"
android:textStyle="bold"
android:layout_marginStart="15dp"
android:layout_marginEnd="15dp"
android:layout_marginBottom="15dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"/>



</androidx.constraintlayout.widget.ConstraintLayout>
Loading