-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[UI/#66] 여행 친구 조회 뷰 / UI 수정
- Loading branch information
Showing
11 changed files
with
693 additions
and
9 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
73 changes: 73 additions & 0 deletions
73
presentation/src/main/java/com/going/presentation/checkfriends/CheckFriendsActivity.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,73 @@ | ||
package com.going.presentation.checkfriends | ||
|
||
import android.os.Bundle | ||
import android.view.View | ||
import androidx.activity.viewModels | ||
import com.going.presentation.R | ||
import com.going.presentation.databinding.ActivityCheckFriendsBinding | ||
import com.going.presentation.todo.ourtodo.OurTodoFriendAdapter | ||
import com.going.ui.base.BaseActivity | ||
import com.going.ui.extension.setOnSingleClickListener | ||
|
||
class CheckFriendsActivity : | ||
BaseActivity<ActivityCheckFriendsBinding>(R.layout.activity_check_friends) { | ||
|
||
private var _adapter: OurTodoFriendAdapter? = null | ||
private val adapter | ||
get() = requireNotNull(_adapter) { getString(R.string.adapter_not_initialized_error_msg) } | ||
|
||
private val viewModel by viewModels<CheckFriendsViewModel>() | ||
|
||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
|
||
initBackClickListener() | ||
initAdapter() | ||
setProgressBarStatus() | ||
|
||
} | ||
|
||
private fun initBackClickListener() { | ||
binding.btnCheckFriendsBack.setOnSingleClickListener { | ||
finish() | ||
} | ||
} | ||
|
||
private fun initAdapter() { | ||
_adapter = OurTodoFriendAdapter() | ||
binding.rvCheckFriendsMember.adapter = adapter | ||
adapter.submitList(viewModel.mockParticipantsList) | ||
} | ||
|
||
private fun setProgressBarStatus() { | ||
// styleA의 평균 값이 1이라고 가정 | ||
binding.progressBarCheckFriends1.progress = 1 | ||
if (binding.progressBarCheckFriends1.progress <= 2) { | ||
// 평균 값이 0 ~2면 1 더하기 | ||
binding.progressBarCheckFriends1.progress = 1 + 1 | ||
binding.progressBarCheckFriends2.progress = 2 + 1 | ||
binding.progressBarCheckFriends3.progress = 0 + 1 | ||
} | ||
|
||
// styleD의 평균 값이 3이라고 가정 | ||
binding.progressBarCheckFriends4.progress = 3 | ||
if (binding.progressBarCheckFriends4.progress > 2) { | ||
// 프로그레스바 반대 방향으로 적용 | ||
binding.progressBarCheckFriends4.visibility = View.INVISIBLE | ||
binding.progressBarCheckFriends4Revert.visibility = View.VISIBLE | ||
|
||
binding.progressBarCheckFriends5.visibility = View.INVISIBLE | ||
binding.progressBarCheckFriends5Revert.visibility = View.VISIBLE | ||
|
||
// 평균 값이 4 ~5 라면 2 빼기 | ||
binding.progressBarCheckFriends4Revert.progress = 3 - 2 | ||
binding.progressBarCheckFriends5Revert.progress = 4 - 2 | ||
} | ||
} | ||
|
||
override fun onDestroy() { | ||
super.onDestroy() | ||
_adapter = null | ||
} | ||
|
||
} |
17 changes: 17 additions & 0 deletions
17
presentation/src/main/java/com/going/presentation/checkfriends/CheckFriendsViewModel.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,17 @@ | ||
package com.going.presentation.checkfriends | ||
|
||
import androidx.lifecycle.ViewModel | ||
import com.going.domain.entity.response.TripParticipantsListModel | ||
|
||
class CheckFriendsViewModel : ViewModel() { | ||
|
||
val mockParticipantsList: List<TripParticipantsListModel.TripParticipantModel> = listOf( | ||
TripParticipantsListModel.TripParticipantModel(0, "일지민", 100), | ||
TripParticipantsListModel.TripParticipantModel(1, "이지민", 100), | ||
TripParticipantsListModel.TripParticipantModel(2, "삼지민", 100), | ||
TripParticipantsListModel.TripParticipantModel(3, "사지민", 100), | ||
TripParticipantsListModel.TripParticipantModel(4, "오지민", 100), | ||
TripParticipantsListModel.TripParticipantModel(5, "육지민", 100), | ||
) | ||
|
||
} |
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
23 changes: 23 additions & 0 deletions
23
presentation/src/main/java/com/going/presentation/todo/ourtodo/OurTodoDecoration.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,23 @@ | ||
package com.going.presentation.todo.ourtodo | ||
|
||
import android.content.Context | ||
import android.graphics.Rect | ||
import android.view.View | ||
import androidx.recyclerview.widget.RecyclerView | ||
|
||
class OurTodoDecoration(val context: Context) : RecyclerView.ItemDecoration() { | ||
|
||
override fun getItemOffsets( | ||
outRect: Rect, | ||
view: View, | ||
parent: RecyclerView, | ||
state: RecyclerView.State | ||
) { | ||
super.getItemOffsets(outRect, view, parent, state) | ||
val position = parent.getChildAdapterPosition(view) | ||
|
||
if (position == parent.adapter?.itemCount?.minus(1)) { | ||
outRect.right = 150 | ||
} | ||
} | ||
} |
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
18 changes: 18 additions & 0 deletions
18
presentation/src/main/res/drawable/layer_list_trip_friends_progress_bar.xml
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,18 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android"> | ||
<item android:id="@android:id/background"> | ||
<shape> | ||
<corners android:radius="4dp"/> | ||
<solid android:color="@color/gray_50"/> | ||
</shape> | ||
</item> | ||
|
||
<item android:id="@android:id/progress"> | ||
<scale android:scaleWidth="100%"> | ||
<shape> | ||
<corners android:radius="4dp"/> | ||
<solid android:color="@color/gray_400"/> | ||
</shape> | ||
</scale> | ||
</item> | ||
</layer-list> |
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
8 changes: 8 additions & 0 deletions
8
presentation/src/main/res/drawable/shape_rect_6_white000_fill_gray200_line.xml
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,8 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<shape xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:shape="rectangle"> | ||
<solid android:color="@color/white_000" /> | ||
<stroke android:width="1dp" /> | ||
<stroke android:color="@color/gray_200" /> | ||
<corners android:radius="6dp" /> | ||
</shape> |
Oops, something went wrong.