Skip to content

Commit

Permalink
Merge pull request #18 from SSU-Plector/feat/#11-devinfo-ui
Browse files Browse the repository at this point in the history
[Feat/#11_devinfo_UI] 개발자 페이지 ui 구현
  • Loading branch information
kangyuri1114 authored Mar 31, 2024
2 parents c144222 + 557e4f6 commit 82991db
Show file tree
Hide file tree
Showing 9 changed files with 274 additions and 47 deletions.
10 changes: 10 additions & 0 deletions domain/src/main/java/com/zucchini/domain/model/DeveloperInfo.kt
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,
)
1 change: 1 addition & 0 deletions feature/devInfo/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ android {
dependencies {
implementation(project(":domain"))
implementation(project(":core:designsystem"))
implementation(project(":core:common"))

KotlinDependencies.run {
implementation(kotlin)
Expand Down
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
}
}
}
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",
),
)
}
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 feature/devInfo/src/main/res/drawable/developer_default_image.xml
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>
9 changes: 9 additions & 0 deletions feature/devInfo/src/main/res/drawable/devinfo_background.xml
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>
15 changes: 13 additions & 2 deletions feature/devInfo/src/main/res/layout/fragment_dev_info.xml
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
<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="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
tools:context=".DevInfoFragment">

<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/cl_top_app_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="30dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
Expand All @@ -29,14 +30,24 @@
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>

<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_devinfo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="30dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/cl_top_app_bar" />

<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/floating_action_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:layout_margin="16dp"
app:backgroundTint="@color/olive_black"
android:contentDescription="@string/floating_btn"
app:backgroundTint="@color/olive_black"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:srcCompat="@drawable/ic_plus_24" />
Expand Down
79 changes: 79 additions & 0 deletions feature/devInfo/src/main/res/layout/item_developer.xml
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>

0 comments on commit 82991db

Please sign in to comment.