j'ai des cards sympa et j'aimerias build stp
This commit is contained in:
2
.idea/deploymentTargetSelector.xml
generated
2
.idea/deploymentTargetSelector.xml
generated
@@ -4,7 +4,7 @@
|
|||||||
<selectionStates>
|
<selectionStates>
|
||||||
<SelectionState runConfigName="app">
|
<SelectionState runConfigName="app">
|
||||||
<option name="selectionMode" value="DROPDOWN" />
|
<option name="selectionMode" value="DROPDOWN" />
|
||||||
<DropdownSelection timestamp="2024-09-23T14:20:43.802418800Z">
|
<DropdownSelection timestamp="2024-12-10T15:57:20.856438200Z">
|
||||||
<Target type="DEFAULT_BOOT">
|
<Target type="DEFAULT_BOOT">
|
||||||
<handle>
|
<handle>
|
||||||
<DeviceId pluginId="PhysicalDevice" identifier="serial=QV78052U8K" />
|
<DeviceId pluginId="PhysicalDevice" identifier="serial=QV78052U8K" />
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
plugins {
|
plugins {
|
||||||
alias(libs.plugins.android.application)
|
alias(libs.plugins.android.application)
|
||||||
alias(libs.plugins.jetbrains.kotlin.android)
|
alias(libs.plugins.jetbrains.kotlin.android)
|
||||||
|
kotlin("kapt")
|
||||||
}
|
}
|
||||||
|
|
||||||
android {
|
android {
|
||||||
@@ -70,6 +71,8 @@ dependencies {
|
|||||||
implementation("com.squareup.retrofit2:retrofit:2.9.0") //internet, api etc...
|
implementation("com.squareup.retrofit2:retrofit:2.9.0") //internet, api etc...
|
||||||
implementation("com.squareup.retrofit2:converter-gson:2.9.0") // Si tu veux utiliser Gson pour la sérialisation
|
implementation("com.squareup.retrofit2:converter-gson:2.9.0") // Si tu veux utiliser Gson pour la sérialisation
|
||||||
implementation("com.squareup.okhttp3:logging-interceptor:4.9.0") // Pour le logging
|
implementation("com.squareup.okhttp3:logging-interceptor:4.9.0") // Pour le logging
|
||||||
|
implementation("com.github.bumptech.glide:glide:4.15.1") // Pour curl des images d'internet en gros
|
||||||
|
kapt("com.github.bumptech.glide:compiler:4.15.1")
|
||||||
testImplementation(libs.junit)
|
testImplementation(libs.junit)
|
||||||
androidTestImplementation(libs.androidx.junit)
|
androidTestImplementation(libs.androidx.junit)
|
||||||
androidTestImplementation(libs.androidx.espresso.core)
|
androidTestImplementation(libs.androidx.espresso.core)
|
||||||
|
|||||||
@@ -0,0 +1,4 @@
|
|||||||
|
package com.dreamteam.timelapse;
|
||||||
|
|
||||||
|
public class ProjectActivity : AppCompatActivity() {
|
||||||
|
}
|
||||||
@@ -3,13 +3,20 @@ package com.dreamteam.timelapse
|
|||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
|
import android.widget.ImageView
|
||||||
import android.widget.TextView
|
import android.widget.TextView
|
||||||
|
import androidx.core.content.ContextCompat
|
||||||
|
import androidx.core.graphics.drawable.DrawableCompat
|
||||||
import androidx.recyclerview.widget.RecyclerView
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
|
import com.bumptech.glide.Glide
|
||||||
|
|
||||||
class ProjectAdapter(private val projects: List<Project>) : RecyclerView.Adapter<ProjectAdapter.ProjectViewHolder>() {
|
class ProjectAdapter(private val projects: List<Project>) : RecyclerView.Adapter<ProjectAdapter.ProjectViewHolder>() {
|
||||||
|
|
||||||
class ProjectViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
|
class ProjectViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
|
||||||
val projectTitle: TextView = itemView.findViewById(R.id.projectTitle)
|
val projectTitle: TextView = itemView.findViewById(R.id.projectTitle)
|
||||||
|
val projectDescription: TextView = itemView.findViewById(R.id.projectDescription)
|
||||||
|
val projectBadge: TextView = itemView.findViewById(R.id.projectBadge)
|
||||||
|
val projectImage: ImageView = itemView.findViewById(R.id.projectImage)
|
||||||
}
|
}
|
||||||
|
|
||||||
//crée les éléments dans le fragment
|
//crée les éléments dans le fragment
|
||||||
@@ -22,6 +29,21 @@ class ProjectAdapter(private val projects: List<Project>) : RecyclerView.Adapter
|
|||||||
override fun onBindViewHolder(holder: ProjectViewHolder, position: Int) {
|
override fun onBindViewHolder(holder: ProjectViewHolder, position: Int) {
|
||||||
val project = projects[position]
|
val project = projects[position]
|
||||||
holder.projectTitle.text = project.titre // Affiche le titre du projet
|
holder.projectTitle.text = project.titre // Affiche le titre du projet
|
||||||
|
holder.projectDescription.text = project.description
|
||||||
|
holder.projectBadge.text = project.status
|
||||||
|
val context = holder.itemView.context
|
||||||
|
val color = when (project.status) {
|
||||||
|
"En Cours" -> R.color.en_cours
|
||||||
|
"Terminé" -> R.color.termine
|
||||||
|
"Annulé" -> R.color.annule
|
||||||
|
"Brouillon" -> R.color.brouillon
|
||||||
|
else -> R.color.default_badge
|
||||||
|
}
|
||||||
|
Glide.with(holder.projectImage.context)
|
||||||
|
.load("https://timelapse.kerboul.me/api/smile") // L'URL de l'image
|
||||||
|
.into(holder.projectImage)
|
||||||
|
DrawableCompat.setTint(holder.projectBadge.background, ContextCompat.getColor(context, color))
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getItemCount(): Int {
|
override fun getItemCount(): Int {
|
||||||
|
|||||||
5
app/src/main/res/drawable/rounded_badge.xml
Normal file
5
app/src/main/res/drawable/rounded_badge.xml
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<solid android:color="#FF5722" />
|
||||||
|
<corners android:radius="50dp" />
|
||||||
|
</shape>
|
||||||
@@ -1,33 +1,87 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<FrameLayout 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"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content">
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
<androidx.cardview.widget.CardView
|
<androidx.cardview.widget.CardView
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_margin="8dp"
|
android:layout_marginLeft="16dp"
|
||||||
tools:ignore="MissingConstraints">
|
android:layout_marginRight="16dp"
|
||||||
|
|
||||||
<LinearLayout
|
android:layout_marginTop="8dp"
|
||||||
|
android:layout_marginBottom="8dp"
|
||||||
|
|
||||||
|
app:cardCornerRadius="10dp"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
tools:ignore="MissingConstraints"
|
||||||
|
tools:layout_editor_absoluteX="0dp"
|
||||||
|
android:clipChildren="false"
|
||||||
|
android:clipToPadding="false">
|
||||||
|
|
||||||
|
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="vertical"
|
|
||||||
android:padding="16dp">
|
android:padding="16dp">
|
||||||
|
|
||||||
<TextView
|
<!-- Initialement invisible -->
|
||||||
android:id="@+id/projectTitle"
|
|
||||||
android:layout_width="wrap_content"
|
<ImageView
|
||||||
|
android:id="@+id/projectImage"
|
||||||
|
android:layout_width="180dp"
|
||||||
|
android:layout_height="120dp"
|
||||||
|
android:scaleType="centerCrop"
|
||||||
|
android:src="@drawable/not_found"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
tools:layout_editor_absoluteY="7dp" />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="152dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="Project Title"
|
android:orientation="vertical"
|
||||||
android:textSize="18sp"
|
app:layout_constraintEnd_toStartOf="@+id/projectImage"
|
||||||
android:textStyle="bold"/>
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/projectTitle"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="Project Title"
|
||||||
|
android:textSize="18sp"
|
||||||
|
android:textStyle="bold"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/projectDescription"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="Description"
|
||||||
|
android:textSize="12sp" />
|
||||||
|
</LinearLayout>
|
||||||
<!-- Ajouter d'autres vues comme une image ou une description -->
|
<!-- Ajouter d'autres vues comme une image ou une description -->
|
||||||
</LinearLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
</androidx.cardview.widget.CardView>
|
</androidx.cardview.widget.CardView>
|
||||||
|
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/projectBadge"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:background="@drawable/rounded_badge"
|
||||||
|
android:padding="4dp"
|
||||||
|
android:text="En cours"
|
||||||
|
android:textColor="@android:color/white"
|
||||||
|
android:textSize="12sp"
|
||||||
|
android:layout_gravity="end|top"
|
||||||
|
android:translationX="-1dp"
|
||||||
|
android:translationY="5dp"
|
||||||
|
android:elevation="8dp"
|
||||||
|
/>
|
||||||
|
</FrameLayout>
|
||||||
@@ -1,5 +1,12 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<resources>
|
<resources>
|
||||||
|
<color name="en_cours">#7297CF</color>
|
||||||
|
<color name="annule">#919191</color>
|
||||||
|
<color name="brouillon">#91A885</color>
|
||||||
|
<color name="termine">#389E03</color>
|
||||||
|
<color name="default_badge">#000000</color>
|
||||||
|
|
||||||
|
|
||||||
<color name="purple_200">#FFBB86FC</color>
|
<color name="purple_200">#FFBB86FC</color>
|
||||||
<color name="purple_500">#FF6200EE</color>
|
<color name="purple_500">#FF6200EE</color>
|
||||||
<color name="purple_700">#FF3700B3</color>
|
<color name="purple_700">#FF3700B3</color>
|
||||||
|
|||||||
Reference in New Issue
Block a user