Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[QA] 운동 뷰 QA 1차 수정 #140

Merged
merged 28 commits into from
Apr 8, 2024
Merged
Show file tree
Hide file tree
Changes from 21 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
8f46bb5
Merge branch 'develop' into feat/#117-change-exercise
hyunjium Mar 25, 2024
971f976
Merge branch 'feat/#117-change-exercise' into hotfix/#135-home-qa
hyunjium Mar 27, 2024
0ccade1
Merge branch 'hotfix/#135-home-qa' into feat/#117-change-exercise
hyunjium Mar 27, 2024
f803442
Merge branch 'feat/#117-change-exercise' into develop
hyunjium Mar 27, 2024
05f47c3
Revert "Merge branch 'feat/#117-change-exercise' into develop"
hyunjium Mar 27, 2024
8d36f64
Merge branch 'develop' into feat/#117-change-exercise
hyunjium Mar 27, 2024
bbde544
[feat] #117
hyunjium Mar 27, 2024
ad67a49
[feat] #117 오늘 미션 인증 사진 나오게 수정
hyunjium Mar 27, 2024
3322c0d
[chore] #117 오늘 미션 인증 사진 비율 수정
hyunjium Mar 27, 2024
adcc8db
[mod] #139 운동 뷰 오늘 미션, 히스토리 둘 다 나오게 수정
hyunjium Apr 3, 2024
2591806
[mod] #139 신발 이미지 투명도 제거한 이미지로 변경
hyunjium Apr 3, 2024
61a7fbd
[mod] #139 상대방에 맞춰서 아이콘 설정, 버블 설정
hyunjium Apr 3, 2024
5d6a398
[mod] #139 이미지 짧은 쪽 기준으로 상자 꽉차게 출력되도록 수정
hyunjium Apr 3, 2024
d46c455
[mod] #139 이미지 모서리 둥글게 수정
hyunjium Apr 3, 2024
bba903a
[chore] #139 운동중 버블 변경(디자인팀 색 수정)
hyunjium Apr 3, 2024
2ac639f
[chore] #139 물음표 textview랑 분리
hyunjium Apr 3, 2024
c9185c5
[feat] #139 오늘 미션이랑 히스토리 둘 다 없을 때, 빨간색 파일 화면 나오게 수정
hyunjium Apr 3, 2024
b32142d
Merge branch 'develop' into feat/#117-change-exercise
hyunjium Apr 3, 2024
10fe16b
[chore] #139 빈칸 지움
hyunjium Apr 3, 2024
0c5e094
[chore] #139 빈칸 지움
hyunjium Apr 3, 2024
4e9529c
[chore] #139 red 50 색 변경
hyunjium Apr 3, 2024
f49362d
[chore] #139 물음표 padding 값 수정
hyunjium Apr 3, 2024
fed92f1
[feat] #139 이미지 모서리 둥글게 하기 coil 사용
hyunjium Apr 4, 2024
ad259d0
[chore] #139 글자 잘리는 부분 아래로 내리기
hyunjium Apr 4, 2024
2cb494a
[feat] #139 일단은 말풍선 구현 1차
hyunjium Apr 5, 2024
f74637b
[chore] #139 에러 수정
hyunjium Apr 5, 2024
fe104a8
[feat] #139 말풍선 구현 2차(말풍선 위치 윗쪽으로 수정)
hyunjium Apr 8, 2024
2f25755
[fix] #117 홈 부분 수정
l2zh Apr 8, 2024
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
2 changes: 1 addition & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
<service
android:name=".presentation.home.service.StepCountService"
android:exported="false"
android:foregroundServiceType="health" />
android:foregroundServiceType="health|dataSync" />
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Jokwanhee 이거 health로 둬도 되죠?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@l2zh
네 health로 테스트해봤는데 진행해도 괜찮을 것 같아요!


<activity
android:name=".presentation.SampleDesignActivity"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ data class ResponseExerciseDto(
@Serializable
data class ExerciseHistoryData(
@SerialName("user_type") val userType: String,
@SerialName("opponent_user_type") val opponentUserType: String,
@SerialName("today_mission") val todayMission: MissionContent?,
@SerialName("mission_history") val missionHistory: List<MissionHistory>?,
) {
Expand All @@ -39,8 +40,11 @@ data class ResponseExerciseDto(
}

fun toExerciseData(): ExerciseData {
fun String.removeDayOfTheWeek(): String = this.removeRange(length - 4 until length)
val list: MutableList<ExerciseItemInfo> =
if (data.todayMission == null && data.missionHistory?.isEmpty() == true) {
if (data.todayMission == null && data.missionHistory!!.isEmpty()) {
mutableListOf()
} else if (data.todayMission == null && data.missionHistory!!.size == 1 && data.missionHistory[0].date.removeDayOfTheWeek() == LocalDate.now().prettyString) {
mutableListOf()
} else if (data.todayMission == null) {
mutableListOf(
Expand Down Expand Up @@ -68,7 +72,6 @@ data class ResponseExerciseDto(
}

data.missionHistory?.forEach {
fun String.removeDayOfTheWeek(): String = this.removeRange(length - 4 until length)
if (it.date.removeDayOfTheWeek() != LocalDate.now().prettyString) {
list.add(
ExerciseItemInfo.EachDateItemInfo(
Expand All @@ -83,6 +86,6 @@ data class ResponseExerciseDto(
)
}
}
return ExerciseData(data.userType, list)
return ExerciseData(data.userType, data.opponentUserType, list)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package sopt.motivoo.domain.entity.exercise

class ExerciseData(
val userType: String,
val opponentUserType: String,
val exerciseItemInfoList: List<ExerciseItemInfo>,
) {
sealed class ExerciseItemInfo {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,18 @@ import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
import sopt.motivoo.databinding.ItemExerciseBinding
import sopt.motivoo.databinding.ItemExerciseNoticeBinding
import sopt.motivoo.databinding.ItemExerciseTodayBinding
import sopt.motivoo.domain.entity.exercise.ExerciseData.ExerciseItemInfo

class ExerciseAdapter(private val userType: String) :
class ExerciseAdapter(private val userType: String, private val opponentUserType: String) :
RecyclerView.Adapter<RecyclerView.ViewHolder>() {
private var exerciseItemInfoList: List<ExerciseItemInfo> = emptyList()

override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder {
val inflater = LayoutInflater.from(parent.context)
return when (viewType) {
NOTICE_INFO_TYPE -> {
val binding = ItemExerciseNoticeBinding.inflate(inflater, parent, false)
val binding = ItemExerciseTodayBinding.inflate(inflater, parent, false)
ExerciseNoticeViewHolder(binding)
}

Expand All @@ -30,12 +30,19 @@ class ExerciseAdapter(private val userType: String) :
when (holder) {
is ExerciseNoticeViewHolder -> {
val noticeInfo = exerciseItemInfoList[position]
holder.onBind(noticeInfo as ExerciseItemInfo.NoticeItemInfo, userType)
holder.onBind(
noticeInfo as ExerciseItemInfo.NoticeItemInfo,
userType,
opponentUserType,
itemCount
)
}

is ExerciseEachDateInfoViewHolder -> {
val dateExerciseInfo = exerciseItemInfoList[position]
holder.onBind(dateExerciseInfo as ExerciseItemInfo.EachDateItemInfo, userType, itemCount)
holder.onBind(
dateExerciseInfo as ExerciseItemInfo.EachDateItemInfo, opponentUserType
)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,10 @@ class ExerciseFragment : BindingFragment<FragmentExerciseBinding>(R.layout.fragm
}

private fun initAdapter(exerciseData: ExerciseData) {
val adapter = ExerciseAdapter(userType = exerciseData.userType)
val adapter = ExerciseAdapter(
userType = exerciseData.userType,
opponentUserType = exerciseData.opponentUserType
)
adapter.updateItemList(exerciseList = exerciseData.exerciseItemInfoList)
binding.rvExerciseEachDateExercise.adapter = adapter
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,9 @@ import androidx.recyclerview.widget.RecyclerView
import coil.load
import sopt.motivoo.R
import sopt.motivoo.databinding.ItemExerciseBinding
import sopt.motivoo.databinding.ItemExerciseNoticeBinding
import sopt.motivoo.databinding.ItemExerciseTodayBinding
import sopt.motivoo.domain.entity.exercise.ExerciseData.ExerciseItemInfo
import sopt.motivoo.presentation.exercise.ExerciseFragment.Companion.CHILD
import sopt.motivoo.util.extension.prettyString
import java.time.LocalDate

class ExerciseEachDateInfoViewHolder(
private val binding: ItemExerciseBinding,
Expand All @@ -21,39 +19,27 @@ class ExerciseEachDateInfoViewHolder(

fun onBind(
exerciseItemInfoData: ExerciseItemInfo.EachDateItemInfo,
userType: String,
itemSize: Int,
opponentUserType: String,
) {
setHistoryOrNot(exerciseItemInfoData, userType, itemSize)
setHistory(exerciseItemInfoData, opponentUserType)
}

private fun setHistoryOrNot(
private fun setHistory(
exerciseItemInfoData: ExerciseItemInfo.EachDateItemInfo,
userType: String,
itemSize: Int,
opponentUserType: String,
) {
with(binding) {
fun String.removeDayOfTheWeek(): String = this.removeRange(length - 4 until length)
if (itemSize == 2 && exerciseItemInfoData.date!!.removeDayOfTheWeek() == LocalDate.now().prettyString) {
ivExerciseEmptyHistory.visibility = View.VISIBLE
ivItemExerciseLeftImage.visibility = View.GONE
tvItemExerciseMyExercise.visibility = View.GONE
tvItemExerciseOpponentExercise.visibility = View.GONE
ivItemExerciseRightImage.visibility = View.GONE
} else {
ivExerciseEmptyHistory.visibility = View.GONE
initText(exerciseItemInfoData, binding, userType)
initImage(exerciseItemInfoData, binding)
val context = binding.root.context
checkStatus(exerciseItemInfoData, binding, context)
}
initText(exerciseItemInfoData, binding, opponentUserType)
initImage(exerciseItemInfoData, binding)
val context = binding.root.context
checkStatus(exerciseItemInfoData, binding, context)
}
}

private fun initText(
exerciseItemInfoData: ExerciseItemInfo.EachDateItemInfo,
binding: ItemExerciseBinding,
userType: String,
opponentUserType: String,
) {
with(binding) {
tvItemExerciseDate.text = exerciseItemInfoData.date
Expand All @@ -62,8 +48,8 @@ class ExerciseEachDateInfoViewHolder(
tvItemExerciseMyState.text = exerciseItemInfoData.myMissionStatus
tvItemExerciseParentState.text = exerciseItemInfoData.opponentMissionStatus
tvItemExerciseOpponentExercise.text =
if (userType == CHILD) root.context.getString(R.string.exercise_parent_exercise) else root.context.getString(
R.string.exercise_child_exercise
if (opponentUserType == CHILD) root.context.getString(R.string.exercise_child_exercise) else root.context.getString(
R.string.exercise_parent_exercise
)
}
}
Expand Down Expand Up @@ -126,21 +112,26 @@ class ExerciseEachDateInfoViewHolder(
}
}

class ExerciseNoticeViewHolder(private val binding: ItemExerciseNoticeBinding) :
class ExerciseNoticeViewHolder(private val binding: ItemExerciseTodayBinding) :
RecyclerView.ViewHolder(binding.root) {
fun onBind(exerciseNoticeData: ExerciseItemInfo.NoticeItemInfo, userType: String) {
setCharacterIcon(userType)
fun onBind(
exerciseNoticeData: ExerciseItemInfo.NoticeItemInfo,
userType: String,
opponentUserType: String,
itemCount: Int,
) {
setCharacterIcon(userType, opponentUserType)
setText(exerciseNoticeData)
setEmptyHistory(itemCount)
}

private fun setCharacterIcon(userType: String) {
if (userType == CHILD) {
binding.ivExerciseTodayIconLeft.setImageResource(R.drawable.ic_child_left)
binding.ivExerciseTodayIconRight.setImageResource(R.drawable.ic_parent_right)
} else {
binding.ivExerciseTodayIconLeft.setImageResource(R.drawable.ic_parent_left)
binding.ivExerciseTodayIconRight.setImageResource(R.drawable.ic_child_right)
}
private fun setCharacterIcon(userType: String, opponentUserType: String) {
if (userType == CHILD) binding.ivExerciseTodayIconLeft.setImageResource(R.drawable.ic_child_left) else binding.ivExerciseTodayIconLeft.setImageResource(
R.drawable.ic_parent_left
)
if (opponentUserType == CHILD) binding.ivExerciseTodayIconRight.setImageResource(R.drawable.ic_child_right) else binding.ivExerciseTodayIconRight.setImageResource(
R.drawable.ic_parent_right
)
}

private fun setText(exerciseNoticeData: ExerciseItemInfo.NoticeItemInfo) {
Expand All @@ -156,7 +147,7 @@ class ExerciseNoticeViewHolder(private val binding: ItemExerciseNoticeBinding) :
with(binding) {
tvExerciseTodayExercise.text =
context.getString(R.string.exercise_please_select_today_mission)
clExerciseSelectTodayMission.visibility = View.VISIBLE
clExerciseTodaySelectTodayMission.visibility = View.VISIBLE
tvExerciseTodayMission.visibility = View.GONE
ivExerciseTodayBubbleLeft.visibility = View.GONE
ivExerciseTodayBubbleRight.visibility = View.GONE
Expand All @@ -165,7 +156,7 @@ class ExerciseNoticeViewHolder(private val binding: ItemExerciseNoticeBinding) :
}

private fun setClickEvents() {
binding.clExerciseSelectTodayMission.setOnClickListener {
binding.clExerciseTodaySelectTodayMission.setOnClickListener {
it.findNavController().navigate(R.id.action_exerciseFragment_to_homeFragment)
}
}
Expand All @@ -176,7 +167,7 @@ class ExerciseNoticeViewHolder(private val binding: ItemExerciseNoticeBinding) :
) {
with(binding) {
tvExerciseTodayExercise.text = context.getString(R.string.exercise_today_exercise)
clExerciseSelectTodayMission.visibility = View.GONE
clExerciseTodaySelectTodayMission.visibility = View.GONE
tvExerciseTodayMission.text = exerciseNoticeData.missionContent
}
setTodayImageAndBubble(exerciseNoticeData)
Expand All @@ -200,4 +191,10 @@ class ExerciseNoticeViewHolder(private val binding: ItemExerciseNoticeBinding) :
}
}
}

private fun setEmptyHistory(itemCount: Int) {
if (itemCount >= 2) {
binding.ivExerciseTodayEmptyHistory.visibility = View.GONE
}
}
}
26 changes: 23 additions & 3 deletions app/src/main/java/sopt/motivoo/presentation/home/HomeFragment.kt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import android.provider.Settings
import android.transition.TransitionManager
import android.view.View
import android.view.ViewGroup
import android.widget.Toast
import androidx.activity.OnBackPressedCallback
import androidx.activity.result.contract.ActivityResultContracts
import androidx.core.content.ContextCompat
Expand All @@ -37,6 +38,7 @@ import timber.log.Timber

@AndroidEntryPoint
class HomeFragment : BindingFragment<FragmentHomeBinding>(R.layout.fragment_home) {
private var isCreated = false
private val viewModel: HomeViewModel by activityViewModels()
lateinit var alarmManager: AlarmManager

Expand All @@ -53,9 +55,8 @@ class HomeFragment : BindingFragment<FragmentHomeBinding>(R.layout.fragment_home
educationGranted = true
}
}

if (!permissionGranted) {
if (educationGranted && viewModel.isMissionChoiceFinished.value == true) intentAppSettings() // TODO :: 교육용 팝업
if (educationGranted) intentAppSettings() // TODO :: 교육용 팝업
else permissionDenied()
} else {
permissionGranted()
Expand All @@ -64,6 +65,7 @@ class HomeFragment : BindingFragment<FragmentHomeBinding>(R.layout.fragment_home

override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
isCreated = true
binding.vm = viewModel
alarmManager = context?.getSystemService(Context.ALARM_SERVICE) as AlarmManager
backPressed()
Expand Down Expand Up @@ -168,13 +170,14 @@ class HomeFragment : BindingFragment<FragmentHomeBinding>(R.layout.fragment_home
}

private fun checkPermissionIfUnSelectedMission() {
if (viewModel.isMissionChoiceFinished.value != true) {
if (viewModel.isMissionChoiceFinished.value == false) {
requestHomePermissionRequest.launch(HOME_REQUIRED_PERMISSIONS)
}
}

private fun checkHomeAlarmPermission(homeState: HomeState.FetchHomeData) {
if (checkPermission()) {
val alarmManager = context?.getSystemService(Context.ALARM_SERVICE) as AlarmManager
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
if (!alarmManager.canScheduleExactAlarms()) {
requestScheduleExactAlarm()
Expand Down Expand Up @@ -235,6 +238,16 @@ class HomeFragment : BindingFragment<FragmentHomeBinding>(R.layout.fragment_home
}
}

override fun onResume() {
super.onResume()
if (isCreated) {
isCreated = false
} else {
initHomePermissionsState()
viewModel.postMissionTodayChoice()
}
}

private fun initHomePermissionsState() {
checkPermission().also {
if (it) permissionGranted()
Expand All @@ -249,6 +262,11 @@ class HomeFragment : BindingFragment<FragmentHomeBinding>(R.layout.fragment_home
}

private fun permissionDenied() {
Toast.makeText(
requireContext(),
"Permission request denied",
Toast.LENGTH_SHORT
).show()
updateBlurEffect()
viewModel.isPermissionGranted.value = false
}
Expand All @@ -263,13 +281,15 @@ class HomeFragment : BindingFragment<FragmentHomeBinding>(R.layout.fragment_home
binding.motivooOtherPieChart.updateBlurEffect()
binding.ivMissionCompleted.updateBlurEffect()
binding.ivStepCount.updateBlurEffect()
binding.tvExercisePercent.updateBlurEffect()
}

private fun removeBlurEffect() {
binding.motivooMyPieChart.removeBlurEffect()
binding.motivooOtherPieChart.removeBlurEffect()
binding.ivMissionCompleted.removeBlurEffect()
binding.ivStepCount.removeBlurEffect()
binding.tvExercisePercent.removeBlurEffect()
}

private fun navigateToExerciseMethodNotion() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class HomeViewModel @Inject constructor(
val userType = MutableLiveData<MotivooUserType>()
val anotherUserType = MutableLiveData<MotivooUserType>()
val isPermissionGranted = MutableLiveData<Boolean>()
val isMissionChoiceFinished = MutableLiveData<Boolean>()
val isMissionChoiceFinished = MutableLiveData<Boolean>(false)
val isCompletedStepCount = MutableLiveData<Boolean>()
val isCompletedMission = MutableLiveData<Boolean>()
val isHighFive = MutableLiveData<Boolean>()
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/drawable/background_exercise.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
<corners
android:bottomRightRadius="12dp"
android:bottomLeftRadius="12dp" />
<solid android:color="@color/red_50_FFEDEC" />
<solid android:color="@color/red_50_FFF4F2" />
</shape>
4 changes: 2 additions & 2 deletions app/src/main/res/drawable/ic_bubble_exercising.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
android:viewportHeight="34">
<path
android:pathData="M13.883,0L56.117,0A13.883,13.883 0,0 1,70 13.883L70,13.883A13.883,13.883 0,0 1,56.117 27.767L13.883,27.767A13.883,13.883 0,0 1,0 13.883L0,13.883A13.883,13.883 0,0 1,13.883 0z"
android:fillColor="#F5F5F5"/>
android:fillColor="#F4F5F9"/>
<path
android:pathData="M25.313,14.227V15.43H19.766V18.149H18.266V15.43H12.5V14.227H25.313ZM13.906,10.383C13.898,8.633 15.883,7.547 18.891,7.54C21.898,7.547 23.867,8.633 23.859,10.383C23.867,12.125 21.898,13.212 18.891,13.212C15.883,13.212 13.898,12.125 13.906,10.383ZM14.109,20.915V16.805H15.594V19.696H23.891V20.915H14.109ZM15.5,10.383C15.484,11.391 16.844,12.008 18.891,12.008C20.945,12.008 22.289,11.391 22.297,10.383C22.289,9.344 20.945,8.735 18.891,8.727C16.844,8.735 15.484,9.344 15.5,10.383ZM39.125,14.024V15.212H26.344V14.024H32.016V12.54H27.938V7.852H37.547V9.024H29.406V11.352H37.641V12.54H33.453V14.024H39.125ZM27.859,18.665C27.859,17.04 29.68,16.125 32.719,16.118C35.734,16.125 37.539,17.04 37.547,18.665C37.539,20.29 35.734,21.204 32.719,21.212C29.68,21.204 27.859,20.29 27.859,18.665ZM29.359,18.665C29.352,19.563 30.578,20.055 32.719,20.04C34.828,20.055 36.063,19.563 36.063,18.665C36.063,17.782 34.828,17.274 32.719,17.274C30.578,17.274 29.352,17.782 29.359,18.665ZM56.844,13.696V14.899H51.188V16.243C53.75,16.383 55.273,17.243 55.281,18.712C55.273,20.297 53.461,21.188 50.453,21.18C47.406,21.188 45.594,20.297 45.594,18.712C45.594,17.243 47.117,16.375 49.719,16.243V14.899H44.078V13.696H56.844ZM44.75,11.79C47.266,11.532 49.25,10.391 49.453,9.04H45.25V7.852H55.703V9.04H51.453C51.656,10.399 53.625,11.532 56.188,11.79L55.656,12.962C53.227,12.68 51.219,11.657 50.461,10.172C49.688,11.657 47.695,12.68 45.266,12.962L44.75,11.79ZM47.094,18.712C47.086,19.563 48.313,20.055 50.453,20.04C52.563,20.055 53.797,19.563 53.797,18.712C53.797,17.844 52.563,17.375 50.453,17.368C48.313,17.375 47.086,17.844 47.094,18.712Z"
android:fillColor="#464747"/>
<path
android:pathData="M34.535,33.24C34.117,33.66 33.437,33.66 33.018,33.24L27.648,27.86C26.974,27.184 27.453,26.031 28.407,26.031L39.147,26.031C40.101,26.031 40.579,27.184 39.905,27.86L34.535,33.24Z"
android:fillColor="#F5F5F5"/>
android:fillColor="#F4F5F9"/>
</vector>
Loading
Loading