-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
[Feat/#11_devinfo_UI] 개발자 페이지 ui 구현
- Loading branch information
Showing
9 changed files
with
274 additions
and
47 deletions.
There are no files selected for viewing
10 changes: 10 additions & 0 deletions
10
domain/src/main/java/com/zucchini/domain/model/DeveloperInfo.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,10 @@ | ||
package com.zucchini.domain.model | ||
|
||
data class DeveloperInfo( | ||
|
||
val image: Int? = null, | ||
val name: String = "", | ||
val field: String = "", | ||
val githubId: String = "", | ||
val clicked: Int = 0, | ||
) |
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
70 changes: 25 additions & 45 deletions
70
feature/devInfo/src/main/java/com/zucchini/feature/devInfo/DevInfoFragment.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 |
---|---|---|
@@ -1,59 +1,39 @@ | ||
package com.zucchini.feature.devInfo | ||
|
||
import android.os.Bundle | ||
import androidx.fragment.app.Fragment | ||
import android.view.LayoutInflater | ||
import android.view.View | ||
import android.view.ViewGroup | ||
import androidx.fragment.app.Fragment | ||
import androidx.recyclerview.widget.GridLayoutManager | ||
import com.zucchini.feature.devInfo.adapter.DeveloperInfoAdapter | ||
import com.zucchini.feature.devInfo.databinding.FragmentDevInfoBinding | ||
|
||
// TODO: Rename parameter arguments, choose names that match | ||
// the fragment initialization parameters, e.g. ARG_ITEM_NUMBER | ||
private const val ARG_PARAM1 = "param1" | ||
private const val ARG_PARAM2 = "param2" | ||
|
||
/** | ||
* A simple [Fragment] subclass. | ||
* Use the [DevInfoFragment.newInstance] factory method to | ||
* create an instance of this fragment. | ||
*/ | ||
class DevInfoFragment : Fragment() { | ||
// TODO: Rename and change types of parameters | ||
private var param1: String? = null | ||
private var param2: String? = null | ||
private var _binding: FragmentDevInfoBinding? = null | ||
private val binding: FragmentDevInfoBinding get() = _binding!! | ||
|
||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
arguments?.let { | ||
param1 = it.getString(ARG_PARAM1) | ||
param2 = it.getString(ARG_PARAM2) | ||
} | ||
override fun onCreateView( | ||
inflater: LayoutInflater, | ||
container: ViewGroup?, | ||
savedInstanceState: Bundle?, | ||
): View { | ||
_binding = FragmentDevInfoBinding.inflate(inflater, container, false) | ||
|
||
initDeveloperAdapter() | ||
|
||
return binding.root | ||
} | ||
|
||
override fun onCreateView( | ||
inflater: LayoutInflater, container: ViewGroup?, | ||
savedInstanceState: Bundle? | ||
): View? { | ||
// Inflate the layout for this fragment | ||
return inflater.inflate(R.layout.fragment_dev_info, container, false) | ||
private fun initDeveloperAdapter() { | ||
val developerInfoAdapter = DeveloperInfoAdapter() | ||
binding.rvDevinfo.adapter = developerInfoAdapter | ||
binding.rvDevinfo.layoutManager = GridLayoutManager(context, 2) | ||
developerInfoAdapter.submitList(DeveloperInfoDummy.developerInfoList) | ||
} | ||
|
||
companion object { | ||
/** | ||
* Use this factory method to create a new instance of | ||
* this fragment using the provided parameters. | ||
* | ||
* @param param1 Parameter 1. | ||
* @param param2 Parameter 2. | ||
* @return A new instance of fragment DevInfoFragment. | ||
*/ | ||
// TODO: Rename and change types and number of parameters | ||
@JvmStatic | ||
fun newInstance(param1: String, param2: String) = | ||
DevInfoFragment().apply { | ||
arguments = Bundle().apply { | ||
putString(ARG_PARAM1, param1) | ||
putString(ARG_PARAM2, param2) | ||
} | ||
} | ||
override fun onDestroyView() { | ||
super.onDestroyView() | ||
_binding = null | ||
} | ||
} | ||
} |
80 changes: 80 additions & 0 deletions
80
feature/devInfo/src/main/java/com/zucchini/feature/devInfo/DeveloperInfoDummy.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,80 @@ | ||
package com.zucchini.feature.devInfo | ||
|
||
import com.zucchini.domain.model.DeveloperInfo | ||
|
||
object DeveloperInfoDummy { | ||
val developerInfoList = listOf( | ||
DeveloperInfo( | ||
image = R.drawable.developer_default_image, | ||
name = "강유리", | ||
field = "안드로이드 개발\n빅데이터", | ||
githubId = "sjkfjklsdf", | ||
), | ||
DeveloperInfo( | ||
image = R.drawable.developer_default_image, | ||
name = "최숙희", | ||
field = "서버 개발", | ||
githubId = "234543213", | ||
), | ||
DeveloperInfo( | ||
image = R.drawable.developer_default_image, | ||
name = "강유리", | ||
field = "안드로이드 개발", | ||
githubId = "sjkfjklsdf", | ||
), | ||
DeveloperInfo( | ||
image = R.drawable.developer_default_image, | ||
name = "강유리", | ||
field = "안드로이드 개발", | ||
githubId = "sjkfjklsdf", | ||
), | ||
DeveloperInfo( | ||
image = R.drawable.developer_default_image, | ||
name = "강유리", | ||
field = "안드로이드 개발", | ||
githubId = "sjkfjklsdf", | ||
), | ||
DeveloperInfo( | ||
image = R.drawable.developer_default_image, | ||
name = "강유리", | ||
field = "안드로이드 개발", | ||
githubId = "sjkfjklsdf", | ||
), | ||
DeveloperInfo( | ||
image = R.drawable.developer_default_image, | ||
name = "강유리", | ||
field = "안드로이드 개발", | ||
githubId = "sjkfjklsdf", | ||
), | ||
DeveloperInfo( | ||
image = R.drawable.developer_default_image, | ||
name = "강유리", | ||
field = "안드로이드 개발", | ||
githubId = "sjkfjklsdf", | ||
), | ||
DeveloperInfo( | ||
image = R.drawable.developer_default_image, | ||
name = "강유리", | ||
field = "안드로이드 개발", | ||
githubId = "sjkfjklsdf", | ||
), | ||
DeveloperInfo( | ||
image = R.drawable.developer_default_image, | ||
name = "강유리", | ||
field = "안드로이드 개발", | ||
githubId = "sjkfjklsdf", | ||
), | ||
DeveloperInfo( | ||
image = R.drawable.developer_default_image, | ||
name = "강유리", | ||
field = "안드로이드 개발", | ||
githubId = "sjkfjklsdf", | ||
), | ||
DeveloperInfo( | ||
image = R.drawable.developer_default_image, | ||
name = "강유리", | ||
field = "안드로이드 개발", | ||
githubId = "sjkfjklsdf", | ||
), | ||
) | ||
} |
45 changes: 45 additions & 0 deletions
45
feature/devInfo/src/main/java/com/zucchini/feature/devInfo/adapter/DeveloperInfoAdapter.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,45 @@ | ||
package com.zucchini.feature.devInfo.adapter | ||
|
||
import android.view.LayoutInflater | ||
import android.view.ViewGroup | ||
import androidx.recyclerview.widget.ListAdapter | ||
import androidx.recyclerview.widget.RecyclerView | ||
import com.zucchini.domain.model.DeveloperInfo | ||
import com.zucchini.feature.devInfo.R | ||
import com.zucchini.feature.devInfo.databinding.ItemDeveloperBinding | ||
import com.zucchini.view.ItemDiffCallback | ||
|
||
class DeveloperInfoAdapter : | ||
ListAdapter<DeveloperInfo, DeveloperInfoAdapter.DeveloperInfoViewHolder>( | ||
ItemDiffCallback<DeveloperInfo>( | ||
onItemsTheSame = { old, new -> old == new }, | ||
onContentsTheSame = { old, new -> old == new }, | ||
), | ||
) { | ||
|
||
override fun onCreateViewHolder( | ||
parent: ViewGroup, | ||
viewType: Int, | ||
): DeveloperInfoViewHolder { | ||
val inflater = LayoutInflater.from(parent.context) | ||
val binding = ItemDeveloperBinding.inflate(inflater, parent, false) | ||
return DeveloperInfoViewHolder(binding) | ||
} | ||
|
||
override fun onBindViewHolder(holder: DeveloperInfoViewHolder, position: Int) { | ||
holder.bind(getItem(position)) | ||
} | ||
|
||
inner class DeveloperInfoViewHolder(private val binding: ItemDeveloperBinding) : | ||
RecyclerView.ViewHolder(binding.root) { | ||
fun bind(developerInfo: DeveloperInfo) { | ||
binding.ivProjectProfile.setImageResource( | ||
developerInfo.image ?: R.drawable.developer_default_image, | ||
) | ||
binding.tvDeveloperName.text = developerInfo.name | ||
binding.tvDeveloperField.text = developerInfo.field | ||
binding.tvDeveloperGithub.text = "Github: ${developerInfo.githubId}" | ||
binding.tvDeveloperClicked.text = "조회수 +${developerInfo.clicked}" | ||
} | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
feature/devInfo/src/main/res/drawable/developer_default_image.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,12 @@ | ||
<vector xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:width="60dp" | ||
android:height="60dp" | ||
android:viewportWidth="60" | ||
android:viewportHeight="60"> | ||
<path | ||
android:pathData="M10,0L50,0A10,10 0,0 1,60 10L60,50A10,10 0,0 1,50 60L10,60A10,10 0,0 1,0 50L0,10A10,10 0,0 1,10 0z" | ||
android:fillColor="#ffffff"/> | ||
<path | ||
android:pathData="M30.5,30C32.151,30 33.764,29.472 35.137,28.483C36.509,27.494 37.579,26.089 38.211,24.444C38.842,22.8 39.008,20.99 38.686,19.244C38.364,17.498 37.569,15.895 36.402,14.636C35.234,13.377 33.747,12.52 32.128,12.173C30.509,11.826 28.831,12.004 27.306,12.685C25.781,13.366 24.478,14.52 23.56,16C22.643,17.48 22.154,19.22 22.154,21C22.154,23.387 23.033,25.676 24.598,27.364C26.164,29.052 28.287,30 30.5,30ZM30.5,32.571C25.327,32.571 15,36.017 15,42.857V48H46V42.857C46,36.017 35.673,32.571 30.5,32.571Z" | ||
android:fillColor="#A3A3A3"/> | ||
</vector> |
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,9 @@ | ||
<vector xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:width="176dp" | ||
android:height="129dp" | ||
android:viewportWidth="176" | ||
android:viewportHeight="129"> | ||
<path | ||
android:pathData="M10,0L166,0A10,10 0,0 1,176 10L176,119A10,10 0,0 1,166 129L10,129A10,10 0,0 1,0 119L0,10A10,10 0,0 1,10 0z" | ||
android:fillColor="#EDF6EA"/> | ||
</vector> |
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
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,79 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:app="http://schemas.android.com/apk/res-auto" | ||
xmlns:tools="http://schemas.android.com/tools" | ||
android:layout_width="180dp" | ||
android:layout_height="wrap_content" | ||
android:layout_marginVertical="10dp" | ||
android:layout_marginHorizontal="10dp" | ||
android:background="@drawable/devinfo_background"> | ||
|
||
<ImageView | ||
android:id="@+id/iv_project_profile" | ||
android:layout_width="50dp" | ||
android:layout_height="50dp" | ||
android:layout_marginVertical="20dp" | ||
android:layout_marginStart="10dp" | ||
app:layout_constraintEnd_toStartOf="@+id/tv_developer_name" | ||
android:src="@drawable/developer_default_image" | ||
app:layout_constraintStart_toStartOf="parent" | ||
app:layout_constraintTop_toTopOf="parent" /> | ||
|
||
<TextView | ||
android:id="@+id/tv_developer_name" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_marginStart="10dp" | ||
android:fontFamily="@font/pretendardbold" | ||
android:textColor="@color/olive_black" | ||
android:textSize="14sp" | ||
app:layout_constraintBottom_toTopOf="@id/tv_developer_field" | ||
app:layout_constraintStart_toEndOf="@id/iv_project_profile" | ||
app:layout_constraintTop_toTopOf="@+id/iv_project_profile" | ||
tools:text="Name" /> | ||
|
||
<TextView | ||
android:id="@+id/tv_developer_field" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_marginStart="10dp" | ||
android:layout_marginBottom="30dp" | ||
android:fontFamily="@font/pretendardmedium" | ||
android:textColor="@color/olive_black" | ||
android:textSize="12sp" | ||
app:layout_constraintStart_toEndOf="@id/iv_project_profile" | ||
app:layout_constraintTop_toBottomOf="@id/tv_developer_name" | ||
tools:text="서비스" /> | ||
|
||
<TextView | ||
android:id="@+id/tv_developer_github" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_marginStart="10dp" | ||
android:fontFamily="@font/pretendardmedium" | ||
android:textColor="@color/gray1" | ||
app:layout_constraintEnd_toEndOf="parent" | ||
android:textSize="12sp" | ||
app:layout_constraintBottom_toTopOf="@+id/tv_developer_clicked" | ||
android:layout_marginEnd="5dp" | ||
android:layout_marginTop="5dp" | ||
app:layout_constraintStart_toEndOf="@id/iv_project_profile" | ||
app:layout_constraintTop_toBottomOf="@id/tv_developer_field" | ||
tools:text="Github: kangyuri1114" /> | ||
|
||
|
||
<TextView | ||
android:id="@+id/tv_developer_clicked" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_marginEnd="10dp" | ||
android:layout_marginBottom="10dp" | ||
app:layout_constraintTop_toBottomOf="@+id/tv_developer_github" | ||
android:layout_marginTop="10dp" | ||
android:fontFamily="@font/pretendardmedium" | ||
android:textColor="@color/gray1" | ||
android:textSize="10sp" | ||
app:layout_constraintBottom_toBottomOf="parent" | ||
app:layout_constraintEnd_toEndOf="parent" | ||
tools:text="조회수 +100" /> | ||
</androidx.constraintlayout.widget.ConstraintLayout> |