Skip to content

Commit

Permalink
Merge pull request #570 from DKU-Dgaja/an-refactor(#554)-전체-ui-수정
Browse files Browse the repository at this point in the history
[AN] refactor(#554): 전체 UI 수정
  • Loading branch information
saesang authored Aug 28, 2024
2 parents 492783d + 4fd0102 commit 63bd9e3
Show file tree
Hide file tree
Showing 137 changed files with 1,552 additions and 1,072 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,11 @@ interface GitudyAuthService {
suspend fun getUserInfoUpdatePage(
): Response<UserInfoUpdatePageResponse>

@GET("/auth/update/pushAlarmYn/{pushAlarmEnable}")
suspend fun updatePushAlarmYn(
@Path("pushAlarmEnable") pushAlarmEnable: Boolean
): Response<Void>

@POST("/auth/update")
suspend fun updateUserInfo(
@Body request: UserInfoUpdateRequest
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,21 @@ data class Commit(
@SerializedName("like_count")
val likeCount: LikeCount,
@SerializedName("message")
val message: String,
val message: String?,
@SerializedName("rejection-reason")
val rejectionReason: String,
val rejectionReason: String?,
@SerializedName("status")
val status: CommitStatus,
@SerializedName("study_info_id")
val studyInfoId: Int,
@SerializedName("study_todo_id")
val studyTodoId: Int,
@SerializedName("user_id")
val userId: Int
val userId: Int,
@SerializedName("name")
val name: String,
@SerializedName("profile_image_url")
val profileImageUrl: String?
): Serializable

data class LikeCount(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ data class StudyInfoResponse(
@SerializedName("period_type")
val periodType: StudyPeriodStatus = StudyPeriodStatus.STUDY_PERIOD_WEEK,
@SerializedName("profile_image_url")
val profileImageUrl: String = "#ffffff",
val profileImageUrl: String = "-1",
@SerializedName("score")
val score: Int = 0,
@SerializedName("status")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,8 @@ class GitudyAuthRepository {
suspend fun updateUserInfo(
request: UserInfoUpdateRequest
) = client.updateUserInfo(request)

suspend fun updatePushAlarmYn(
pushAlarmEnable: Boolean
) = client.updatePushAlarmYn(pushAlarmEnable)
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ class TokenManager(context: Context) {


var accessToken: String?
get() = prefs.loadPref(SPKey.ACCESS_TOKEN, "0")
get() = prefs.loadPref(SPKey.ACCESS_TOKEN, "")
set(value) {
prefs.savePref(SPKey.ACCESS_TOKEN, value!!)
}

var refreshToken: String?
get() = prefs.loadPref(SPKey.REFRESH_TOKEN, "0")
get() = prefs.loadPref(SPKey.REFRESH_TOKEN, "")
set(value) {
prefs.savePref(SPKey.REFRESH_TOKEN, value!!)
}
Expand Down
17 changes: 1 addition & 16 deletions android/gitudy/presentation/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,6 @@
<activity
android:name=".ui.home.MainHomeAlertActivity"
android:exported="false" />
<activity
android:name=".ui.mystudy.StudyCommentBoardActivity"
android:exported="false"
android:windowSoftInputMode="adjustResize" />
<activity
android:name=".ui.mystudy.CommitConventionActivity"
android:exported="false"
Expand All @@ -36,20 +32,9 @@
android:name=".ui.feed.StudyApplyActivity"
android:exported="false"
android:windowSoftInputMode="adjustPan" />
<activity
android:name=".ui.mystudy.AddTodoActivity"
android:exported="false"
android:windowSoftInputMode="adjustResize" />
<activity
android:name=".ui.mystudy.MemberStudySettingActivity"
android:exported="false" />
<activity
android:name=".ui.mystudy.CaptainStudySettingActivity"
android:exported="false" />
<activity
android:name=".ui.mystudy.ToDoActivity"
android:exported="false"
android:windowSoftInputMode="adjustResize" />
<activity
android:name=".ui.mystudy.MyStudyMainActivity"
android:exported="false"
Expand All @@ -66,7 +51,7 @@
<activity
android:name=".ui.profile.ProfileEditActivity"
android:exported="false"
android:windowSoftInputMode="adjustResize" />
android:windowSoftInputMode="adjustPan" />
<activity
android:name=".ui.auth.PopupAgreementActivity"
android:exported="false"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import androidx.recyclerview.widget.RecyclerView
import com.takseha.data.dto.feed.Category
import com.takseha.presentation.R
import com.takseha.presentation.databinding.ItemCategoryAllBinding
import com.takseha.presentation.databinding.ItemCategoryBinding

class AllCategoryRVAdapter(
private val context: Context,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,9 @@ package com.takseha.presentation.adapter
import android.content.Context
import android.os.Build
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.annotation.RequiresApi
import androidx.recyclerview.widget.RecyclerView
import com.takseha.presentation.databinding.ItemCategoryBinding
import com.takseha.presentation.databinding.ItemCategoryInStudyBinding

class CategoryInStudyRVAdapter(val context : Context, val categoryList: List<String>) : RecyclerView.Adapter<CategoryInStudyRVAdapter.ViewHolder>() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import com.bumptech.glide.Glide
import com.takseha.data.dto.mystudy.StudyComment
import com.takseha.presentation.R
import com.takseha.presentation.databinding.ItemCommentBinding
import com.takseha.presentation.ui.common.UTCToKoreanTimeConverter
import java.time.LocalDateTime

class CommentListRVAdapter(val context: Context, val commentList: List<StudyComment>) :
Expand All @@ -35,8 +36,8 @@ class CommentListRVAdapter(val context: Context, val commentList: List<StudyComm
.into(holder.profileImg)

holder.content.text = commentList[position].content
holder.date.text =
LocalDateTime.parse(commentList[position].commentSetDate).toLocalDate().toString()
val localDateTime = LocalDateTime.parse(commentList[position].commentSetDate)
holder.date.text = UTCToKoreanTimeConverter().convertToKoreaDate(localDateTime)
}

override fun getItemCount(): Int {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@ import androidx.core.content.ContextCompat
import androidx.recyclerview.widget.RecyclerView
import com.takseha.data.dto.mystudy.Commit
import com.takseha.data.dto.mystudy.CommitStatus
import com.takseha.data.dto.mystudy.LikeCount
import com.takseha.presentation.R
import com.takseha.presentation.databinding.ItemCommitBinding
import com.takseha.presentation.ui.common.UTCToKoreanTimeConverter
import java.time.LocalDateTime

class CommitListRVAdapter(val context : Context, val commitList : List<Commit>, val onClickListener: ToDoListRVAdapter.OnClickListener) : RecyclerView.Adapter<CommitListRVAdapter.ViewHolder>() {

Expand Down Expand Up @@ -40,7 +41,8 @@ class CommitListRVAdapter(val context : Context, val commitList : List<Commit>,
@RequiresApi(Build.VERSION_CODES.O)
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
holder.commitTitle.text = commitList[position].message
holder.commitInfo.text = context.getString(R.string.study_to_do_commit_info, commitList[position].rejectionReason, commitList[position].commitDate)
val localDateTime = LocalDateTime.parse(commitList[position].commitDate)
holder.commitInfo.text = context.getString(R.string.study_to_do_commit_info, commitList[position].name, UTCToKoreanTimeConverter().convertToKoreaDate(localDateTime))
when (commitList[position].status) {
CommitStatus.COMMIT_APPROVAL -> holder.commitStatus.text = "승인완료"
CommitStatus.COMMIT_DELETE -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import com.bumptech.glide.Glide
import com.takseha.data.dto.mystudy.StudyComment
import com.takseha.presentation.R
import com.takseha.presentation.databinding.ItemCommentDetailBinding
import com.takseha.presentation.ui.common.UTCToKoreanTimeConverter
import java.time.LocalDateTime
import java.time.format.DateTimeFormatter
import java.util.Locale
Expand Down Expand Up @@ -53,8 +54,8 @@ class DetailCommentListRVAdapter(val context: Context, val commentList: List<Stu
.into(holder.profileImg)

holder.writerName.text = commentList[position].userInfo.name
holder.date.text =
getCreatedDate(commentList[position].commentSetDate)
val localDateTime = LocalDateTime.parse(commentList[position].commentSetDate)
holder.date.text = UTCToKoreanTimeConverter().convertToKoreaDate(localDateTime)
holder.content.text = commentList[position].content

if (commentList[position].isMyComment) {
Expand All @@ -76,14 +77,6 @@ class DetailCommentListRVAdapter(val context: Context, val commentList: List<Stu

}

@RequiresApi(Build.VERSION_CODES.O)
private fun getCreatedDate(date: String): String {
val dateFormat = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm", Locale.getDefault())
val localDateTime = LocalDateTime.parse(date)

return localDateTime.format(dateFormat)
}

private fun showPopupMenu(view: View, position: Int) {
val popup = PopupMenu(context, view)
popup.inflate(R.menu.delete_menu)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package com.takseha.presentation.adapter
import android.content.Context
import android.os.Build
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.annotation.RequiresApi
import androidx.recyclerview.widget.RecyclerView
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package com.takseha.presentation.adapter

import android.content.Context
import android.graphics.Color
import android.os.Build
import android.util.Log
import android.view.LayoutInflater
Expand All @@ -11,13 +10,14 @@ import androidx.annotation.RequiresApi
import androidx.core.content.ContextCompat
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.takseha.data.dto.feed.StudyInfo
import com.takseha.data.dto.feed.StudyPeriodStatus
import com.takseha.data.dto.feed.UserInfo
import com.takseha.presentation.R
import com.takseha.presentation.databinding.ItemFeedBinding
import com.takseha.presentation.ui.common.UTCToKoreanTimeConverter
import com.takseha.presentation.viewmodel.feed.StudyInfoWithBookmarkStatus
import java.time.LocalDateTime
import java.time.ZoneId
import java.time.temporal.ChronoUnit

class FeedRVAdapter(
Expand All @@ -33,7 +33,7 @@ class FeedRVAdapter(
var onClickListener: OnClickListener? = null

class ViewHolder(val binding: ItemFeedBinding) : RecyclerView.ViewHolder(binding.root) {
val backgroundColor = binding.studyInfoLayout
val studyImg = binding.studyImg
val studyName = binding.studyName
val bookmarkBtn = binding.bookmarkBtn
val commitRule = binding.commitRule
Expand Down Expand Up @@ -80,7 +80,9 @@ class FeedRVAdapter(

@RequiresApi(Build.VERSION_CODES.O)
private fun bindFull(holder: ViewHolder, position: Int) {
holder.backgroundColor.setBackgroundColor(Color.parseColor(studyInfoList[position].studyInfo.profileImageUrl))
val studyImage = setStudyImg(studyInfoList[position].studyInfo.profileImageUrl.toIntOrNull() ?: 0)

holder.studyImg.setImageResource(studyImage)
holder.studyName.text = studyInfoList[position].studyInfo.topic
holder.commitRule.text = setCommitRule(studyInfoList[position].studyInfo.periodType)
holder.teamInfo.text = context.getString(R.string.study_team_rank_full, studyInfoList[position].rank,
Expand Down Expand Up @@ -112,6 +114,21 @@ class FeedRVAdapter(
}
}

private fun setStudyImg(currentIdx: Int): Int {
return when (currentIdx) {
0 -> R.drawable.bg_feed_full_10
1 -> R.drawable.bg_feed_full_9
2 -> R.drawable.bg_feed_full_8
3 -> R.drawable.bg_feed_full_7
4 -> R.drawable.bg_feed_full_6
5 -> R.drawable.bg_feed_full_5
6 -> R.drawable.bg_feed_full_4
7 -> R.drawable.bg_feed_full_3
8 -> R.drawable.bg_feed_full_2
else -> R.drawable.bg_feed_full_1
}
}

private fun setCommitRule(periodType: StudyPeriodStatus): String {
return when (periodType) {
StudyPeriodStatus.STUDY_PERIOD_EVERYDAY -> context.getString(R.string.feed_rule_everyday)
Expand All @@ -123,10 +140,11 @@ class FeedRVAdapter(
@RequiresApi(Build.VERSION_CODES.O)
private fun calculateTotalDayCnt(createdDate: String): Long {
val createdDateLocalDate = LocalDateTime.parse(createdDate)

val utcZonedDateTime = createdDateLocalDate.atZone(ZoneId.of("UTC"))
val koreaZonedDateTime = utcZonedDateTime.withZoneSameInstant(ZoneId.of("Asia/Seoul"))
val nowDate = LocalDateTime.now()

return ChronoUnit.DAYS.between(createdDateLocalDate, nowDate)
return ChronoUnit.DAYS.between(koreaZonedDateTime, nowDate)
}

private fun setCategoryList(holder: ViewHolder, position: Int) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,12 @@ package com.takseha.presentation.adapter
import android.content.Context
import android.os.Build
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.annotation.RequiresApi
import androidx.recyclerview.widget.RecyclerView
import com.bumptech.glide.Glide
import com.takseha.data.dto.feed.UserInfo
import com.takseha.data.dto.mystudy.StudyMember
import com.takseha.presentation.R
import com.takseha.presentation.databinding.ItemMemberInRankBinding
import com.takseha.presentation.databinding.ItemMemberInStudyListBinding

class MemberListRVAdapter(val context : Context, val userInfoList : List<UserInfo>) : RecyclerView.Adapter<MemberListRVAdapter.ViewHolder>() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package com.takseha.presentation.adapter

import android.content.Context
import android.graphics.Color
import android.os.Build
import android.view.LayoutInflater
import android.view.View
Expand All @@ -11,7 +10,6 @@ import android.view.ViewGroup
import androidx.annotation.RequiresApi
import androidx.core.content.ContextCompat
import androidx.recyclerview.widget.RecyclerView
import com.takseha.data.dto.mystudy.TodoStatus
import com.takseha.presentation.R
import com.takseha.presentation.databinding.ItemMystudyBinding
import com.takseha.presentation.viewmodel.home.MyStudyWithTodo
Expand Down Expand Up @@ -61,8 +59,9 @@ class MyStudyRVAdapter(val context : Context, val studyInfoList : List<MyStudyWi
private fun setStudyInfo(holder: ViewHolder, position: Int) {
val studyInfo = studyInfoList[position].studyInfo
val urgentTodo = studyInfoList[position].urgentTodo!!
val studyImage = setStudyImg(studyInfo.profileImageUrl.toIntOrNull() ?: 0)

holder.studyImg.setCardBackgroundColor(Color.parseColor(studyInfo.profileImageUrl))
holder.studyImg.setImageResource(studyImage)
holder.studyName.text = studyInfo.topic
holder.leaderTag.visibility = if (studyInfo.isLeader) VISIBLE else GONE
holder.teamScore.text = "${studyInfo.score}"
Expand Down Expand Up @@ -101,6 +100,21 @@ class MyStudyRVAdapter(val context : Context, val studyInfoList : List<MyStudyWi
}
}

private fun setStudyImg(currentIdx: Int): Int {
return when (currentIdx) {
0 -> R.drawable.bg_mystudy_small_10
1 -> R.drawable.bg_mystudy_small_9
2 -> R.drawable.bg_mystudy_small_8
3 -> R.drawable.bg_mystudy_small_7
4 -> R.drawable.bg_mystudy_small_6
5 -> R.drawable.bg_mystudy_small_5
6 -> R.drawable.bg_mystudy_small_4
7 -> R.drawable.bg_mystudy_small_3
8 -> R.drawable.bg_mystudy_small_2
else -> R.drawable.bg_mystudy_small_1
}
}

override fun getItemCount(): Int {
return studyInfoList.size
}
Expand Down
Loading

0 comments on commit 63bd9e3

Please sign in to comment.