J'ai des refresh et des call api c'est génial
This commit is contained in:
8
.idea/deploymentTargetSelector.xml
generated
8
.idea/deploymentTargetSelector.xml
generated
@@ -4,6 +4,14 @@
|
||||
<selectionStates>
|
||||
<SelectionState runConfigName="app">
|
||||
<option name="selectionMode" value="DROPDOWN" />
|
||||
<DropdownSelection timestamp="2024-09-23T14:20:43.802418800Z">
|
||||
<Target type="DEFAULT_BOOT">
|
||||
<handle>
|
||||
<DeviceId pluginId="PhysicalDevice" identifier="serial=QV78052U8K" />
|
||||
</handle>
|
||||
</Target>
|
||||
</DropdownSelection>
|
||||
<DialogSelection />
|
||||
</SelectionState>
|
||||
</selectionStates>
|
||||
</component>
|
||||
|
||||
1
.idea/gradle.xml
generated
1
.idea/gradle.xml
generated
@@ -1,5 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="GradleMigrationSettings" migrationVersion="1" />
|
||||
<component name="GradleSettings">
|
||||
<option name="linkedExternalProjectsSettings">
|
||||
<GradleProjectSettings>
|
||||
|
||||
1
.idea/misc.xml
generated
1
.idea/misc.xml
generated
@@ -1,4 +1,3 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="jbr-17" project-jdk-type="JavaSDK">
|
||||
|
||||
@@ -38,6 +38,8 @@ android {
|
||||
}
|
||||
buildFeatures {
|
||||
compose = true
|
||||
viewBinding = true
|
||||
dataBinding = true
|
||||
}
|
||||
composeOptions {
|
||||
kotlinCompilerExtensionVersion = "1.5.1"
|
||||
@@ -59,6 +61,15 @@ dependencies {
|
||||
implementation(libs.androidx.ui.graphics)
|
||||
implementation(libs.androidx.ui.tooling.preview)
|
||||
implementation(libs.androidx.material3)
|
||||
implementation(libs.material)
|
||||
implementation(libs.androidx.appcompat)
|
||||
implementation(libs.androidx.constraintlayout)
|
||||
implementation(libs.androidx.navigation.fragment.ktx)
|
||||
implementation(libs.androidx.navigation.ui.ktx)
|
||||
implementation("androidx.swiperefreshlayout:swiperefreshlayout:1.1.0")
|
||||
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.okhttp3:logging-interceptor:4.9.0") // Pour le logging
|
||||
testImplementation(libs.junit)
|
||||
androidTestImplementation(libs.androidx.junit)
|
||||
androidTestImplementation(libs.androidx.espresso.core)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools">
|
||||
|
||||
<uses-permission android:name="android.permission.INTERNET"/>
|
||||
<application
|
||||
android:allowBackup="true"
|
||||
android:dataExtractionRules="@xml/data_extraction_rules"
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.dreamteam.timelapse
|
||||
|
||||
import android.content.Context
|
||||
import android.util.AttributeSet
|
||||
import android.util.Log
|
||||
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout
|
||||
|
||||
class CustomSwipeRefreshLayout(context: Context, attrs: AttributeSet) : SwipeRefreshLayout(context, attrs) {
|
||||
init {
|
||||
Log.d("CustomSwipeRefreshLayout", "CustomSwipeRefreshLayout instancié")
|
||||
}
|
||||
override fun canChildScrollUp(): Boolean {
|
||||
// Vérifie si l'enfant direct (RecyclerView par exemple) peut encore scroller vers le haut
|
||||
val view = getChildAt(0)
|
||||
//Log.i("CustomSwipeRefreshLayout", "canChildScrollUp: ${view?.canScrollVertically(-1)}")
|
||||
return view != null && view.canScrollVertically(-1)
|
||||
}
|
||||
}
|
||||
@@ -1,47 +1,79 @@
|
||||
package com.dreamteam.timelapse
|
||||
|
||||
import android.R
|
||||
import com.dreamteam.timelapse.R as Rtmp
|
||||
import android.os.Bundle
|
||||
import androidx.activity.ComponentActivity
|
||||
import androidx.activity.compose.setContent
|
||||
import androidx.activity.enableEdgeToEdge
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.material3.Scaffold
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import com.dreamteam.timelapse.ui.theme.TimelapseTheme
|
||||
import android.util.Log
|
||||
import android.view.View
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.navigation.findNavController
|
||||
import androidx.navigation.ui.AppBarConfiguration
|
||||
import androidx.navigation.ui.navigateUp
|
||||
import androidx.navigation.ui.setupActionBarWithNavController
|
||||
import androidx.viewpager2.widget.ViewPager2
|
||||
import com.dreamteam.timelapse.databinding.ActivityMainBinding
|
||||
import com.google.android.material.snackbar.Snackbar
|
||||
import com.google.android.material.tabs.TabLayout
|
||||
import com.google.android.material.tabs.TabLayoutMediator
|
||||
|
||||
|
||||
class MainActivity : AppCompatActivity() {
|
||||
|
||||
private lateinit var appBarConfiguration: AppBarConfiguration
|
||||
private lateinit var binding: ActivityMainBinding
|
||||
|
||||
class MainActivity : ComponentActivity() {
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
// super.onCreate(savedInstanceState)
|
||||
//
|
||||
|
||||
Log.d("mainActivity", "La main activity est créée")
|
||||
|
||||
|
||||
// setSupportActionBar(binding.toolbar)
|
||||
//
|
||||
super.onCreate(savedInstanceState)
|
||||
enableEdgeToEdge()
|
||||
setContent {
|
||||
TimelapseTheme {
|
||||
Scaffold(modifier = Modifier.fillMaxSize()) { innerPadding ->
|
||||
Greeting(
|
||||
name = "caca prout",
|
||||
modifier = Modifier.padding(innerPadding)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//val navController = findNavController(R.id.nav_host_fragment_content_main)
|
||||
//appBarConfiguration = AppBarConfiguration(navController.graph)
|
||||
//setupActionBarWithNavController(navController, appBarConfiguration)
|
||||
|
||||
@Composable
|
||||
fun Greeting(name: String, modifier: Modifier = Modifier) {
|
||||
Text(
|
||||
text = "Hello $name!",
|
||||
modifier = modifier
|
||||
)
|
||||
}
|
||||
// R.layout contient :
|
||||
// - un TabLayout avec l'id tabLayout
|
||||
// - un ViewPager2 avec l'id viewPager
|
||||
// - un FloatingActionButton avec l'id fab
|
||||
|
||||
@Preview(showBackground = true)
|
||||
@Composable
|
||||
fun GreetingPreview() {
|
||||
TimelapseTheme {
|
||||
Greeting("Android")
|
||||
//setContentView(R.layout.activity_main)
|
||||
//ce qui corrigé donne :
|
||||
setContentView(Rtmp.layout.activity_main)
|
||||
val tabLayout = findViewById<View>(Rtmp.id.tabLayout) as TabLayout
|
||||
val viewPager = findViewById<View>(Rtmp.id.viewPager) as ViewPager2
|
||||
|
||||
|
||||
// Configurer l'adapter pour ViewPager2
|
||||
var tabsAdapter = TabsAdapter(this)
|
||||
viewPager.setAdapter(tabsAdapter)
|
||||
|
||||
|
||||
// Connecter le ViewPager au TabLayout
|
||||
TabLayoutMediator(
|
||||
tabLayout, viewPager
|
||||
) { tab: TabLayout.Tab, position: Int ->
|
||||
when (position) {
|
||||
0 -> tab.setText("Mes projets") // Nom du premier onglet
|
||||
1 -> tab.setText("Mes vidéos") // Nom du second onglet
|
||||
}
|
||||
}.attach()
|
||||
|
||||
// Bouton flottant
|
||||
// binding.fab.setOnClickListener { view ->
|
||||
// Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
|
||||
// //.setAction("Action", null) //sert à rien
|
||||
// .setAnchorView(R.id.fab).show() //au dessus du bouton mail
|
||||
// }
|
||||
}
|
||||
|
||||
// override fun onSupportNavigateUp(): Boolean {
|
||||
// val navController = findNavController(R.id.nav_host_fragment_content_main)
|
||||
// return navController.navigateUp(appBarConfiguration)
|
||||
// || super.onSupportNavigateUp()
|
||||
// }
|
||||
}
|
||||
23
app/src/main/java/com/dreamteam/timelapse/Project.kt
Normal file
23
app/src/main/java/com/dreamteam/timelapse/Project.kt
Normal file
@@ -0,0 +1,23 @@
|
||||
package com.dreamteam.timelapse
|
||||
|
||||
import java.util.Date
|
||||
|
||||
//{
|
||||
// "id": 1,
|
||||
// "creation": "2024-10-24T13:46:04.513Z",
|
||||
// "status": "test",
|
||||
// "description": "Projet de Test",
|
||||
// "titre": "Test Project"
|
||||
//}
|
||||
data class Project (
|
||||
val id: Int,
|
||||
val creation: Date,
|
||||
val status: String,
|
||||
val description: String,
|
||||
val titre: String,
|
||||
val thumbnail_url: String?
|
||||
) {
|
||||
// fun getThumbnail(): String {
|
||||
// return images[0]
|
||||
// }
|
||||
}
|
||||
30
app/src/main/java/com/dreamteam/timelapse/ProjectAdapter.kt
Normal file
30
app/src/main/java/com/dreamteam/timelapse/ProjectAdapter.kt
Normal file
@@ -0,0 +1,30 @@
|
||||
package com.dreamteam.timelapse
|
||||
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.TextView
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
|
||||
class ProjectAdapter(private val projects: List<Project>) : RecyclerView.Adapter<ProjectAdapter.ProjectViewHolder>() {
|
||||
|
||||
class ProjectViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
|
||||
val projectTitle: TextView = itemView.findViewById(R.id.projectTitle)
|
||||
}
|
||||
|
||||
//crée les éléments dans le fragment
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ProjectViewHolder {
|
||||
val view = LayoutInflater.from(parent.context).inflate(R.layout.item_project_card, parent, false)
|
||||
return ProjectViewHolder(view)
|
||||
}
|
||||
|
||||
// Remplit le ViewHolder avec les données
|
||||
override fun onBindViewHolder(holder: ProjectViewHolder, position: Int) {
|
||||
val project = projects[position]
|
||||
holder.projectTitle.text = project.titre // Affiche le titre du projet
|
||||
}
|
||||
|
||||
override fun getItemCount(): Int {
|
||||
return projects.size
|
||||
}
|
||||
}
|
||||
102
app/src/main/java/com/dreamteam/timelapse/ProjetsFrag.kt
Normal file
102
app/src/main/java/com/dreamteam/timelapse/ProjetsFrag.kt
Normal file
@@ -0,0 +1,102 @@
|
||||
package com.dreamteam.timelapse
|
||||
|
||||
import android.os.Bundle
|
||||
import android.util.Log
|
||||
import androidx.fragment.app.Fragment
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.ListView
|
||||
import androidx.navigation.fragment.findNavController
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout
|
||||
import com.dreamteam.timelapse.data.ProjectRepository
|
||||
import com.dreamteam.timelapse.databinding.FragmentProjetsBinding
|
||||
import com.dreamteam.timelapse.databinding.FragmentVideosBinding
|
||||
import kotlinx.coroutines.delay
|
||||
import com.dreamteam.timelapse.data.ApiService
|
||||
import retrofit2.Retrofit
|
||||
import retrofit2.converter.gson.GsonConverterFactory
|
||||
|
||||
/**
|
||||
* A simple [Fragment] subclass as the default destination in the navigation.
|
||||
*/
|
||||
|
||||
class ProjetsFrag : Fragment() {
|
||||
|
||||
private lateinit var projectRepository: ProjectRepository
|
||||
//private lateinit var listView: ListView
|
||||
private lateinit var recyclerView: RecyclerView
|
||||
private lateinit var projectAdapter: ProjectAdapter
|
||||
private var _binding: FragmentProjetsBinding? = null
|
||||
private val binding get() = _binding!!
|
||||
|
||||
private lateinit var apiService: ApiService // Déclare l'apiService
|
||||
private var projects: List<Project> = emptyList() // Déclare une liste de projets vide
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
|
||||
// Initialiser apiService ici, par exemple, en utilisant Retrofit
|
||||
val retrofit = Retrofit.Builder()
|
||||
.baseUrl("https://timelapse.kerboul.me/api/")
|
||||
.addConverterFactory(GsonConverterFactory.create())
|
||||
.build()
|
||||
|
||||
apiService = retrofit.create(ApiService::class.java) // Crée une instance d'ApiService
|
||||
}
|
||||
|
||||
override fun onCreateView(
|
||||
inflater: LayoutInflater, container: ViewGroup?,
|
||||
savedInstanceState: Bundle?
|
||||
): View? {
|
||||
Log.d("ProjetsFrag", "Fragment Projets créé")
|
||||
_binding = FragmentProjetsBinding.inflate(inflater, container, false)
|
||||
|
||||
projectRepository = ProjectRepository(apiService) // Tu initialises ton repository
|
||||
fetchProjects()
|
||||
|
||||
return _binding?.root
|
||||
}
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
|
||||
val swipeRefreshLayout = binding.swipeRefreshLayout
|
||||
|
||||
swipeRefreshLayout.setOnRefreshListener {
|
||||
fetchProjects()
|
||||
Log.d("ProjetsFrag", "Actualisation des projets")
|
||||
}
|
||||
|
||||
recyclerView = binding.recyclerView // view.findViewById(R.id.recyclerView)
|
||||
recyclerView.layoutManager = LinearLayoutManager(context)
|
||||
|
||||
|
||||
}
|
||||
|
||||
private fun fetchProjects() {
|
||||
// Simulez l'appel API
|
||||
binding.swipeRefreshLayout.isRefreshing = true
|
||||
|
||||
Log.d("ProjetsFrag", "User has refreshed the projects list")
|
||||
projectRepository.fetchProjects(
|
||||
onSuccess = { projects ->
|
||||
Log.d("ProjetsFrag", "Projets reçus : $projects")
|
||||
this.projects = projects
|
||||
this.projectAdapter = ProjectAdapter(this.projects) //TODO : Potentiel problème pour les refresh ici (update de l'adapter ou un truc du genre à voir)
|
||||
this.recyclerView.adapter = this.projectAdapter
|
||||
// Mettre à jour le RecyclerView ou autre traitement
|
||||
},
|
||||
onError = { errorMessage ->
|
||||
Log.e("ProjetsFrag", errorMessage)
|
||||
}
|
||||
)
|
||||
binding.swipeRefreshLayout.isRefreshing = false
|
||||
}
|
||||
|
||||
// override fun onDestroyView() {
|
||||
// super.onDestroyView()
|
||||
// _binding = null
|
||||
// }
|
||||
}
|
||||
18
app/src/main/java/com/dreamteam/timelapse/RetrofitClient.kt
Normal file
18
app/src/main/java/com/dreamteam/timelapse/RetrofitClient.kt
Normal file
@@ -0,0 +1,18 @@
|
||||
package com.dreamteam.timelapse
|
||||
|
||||
import com.dreamteam.timelapse.data.ApiService
|
||||
import retrofit2.Retrofit
|
||||
import retrofit2.converter.gson.GsonConverterFactory
|
||||
|
||||
object RetrofitClient {
|
||||
private const val BASE_URL = "https://timelapse.kerbou.me/api/" // Remplace par l'URL de base de ton API
|
||||
|
||||
val instance: ApiService by lazy {
|
||||
val retrofit = Retrofit.Builder()
|
||||
.baseUrl(BASE_URL)
|
||||
.addConverterFactory(GsonConverterFactory.create())
|
||||
.build()
|
||||
|
||||
retrofit.create(ApiService::class.java)
|
||||
}
|
||||
}
|
||||
20
app/src/main/java/com/dreamteam/timelapse/TabsAdapter.kt
Normal file
20
app/src/main/java/com/dreamteam/timelapse/TabsAdapter.kt
Normal file
@@ -0,0 +1,20 @@
|
||||
package com.dreamteam.timelapse
|
||||
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.fragment.app.FragmentActivity
|
||||
import androidx.viewpager2.adapter.FragmentStateAdapter
|
||||
|
||||
class TabsAdapter(activity: FragmentActivity) : FragmentStateAdapter(activity) {
|
||||
|
||||
override fun getItemCount(): Int {
|
||||
return 2 // Nombre total d'onglets
|
||||
}
|
||||
|
||||
override fun createFragment(position: Int): Fragment {
|
||||
return when (position) {
|
||||
0 -> ProjetsFrag() // Premier fragment
|
||||
1 -> VideoFrag() // Second fragment
|
||||
else -> ProjetsFrag() // Par défaut
|
||||
}
|
||||
}
|
||||
}
|
||||
44
app/src/main/java/com/dreamteam/timelapse/VideoFrag.kt
Normal file
44
app/src/main/java/com/dreamteam/timelapse/VideoFrag.kt
Normal file
@@ -0,0 +1,44 @@
|
||||
package com.dreamteam.timelapse
|
||||
|
||||
import android.os.Bundle
|
||||
import androidx.fragment.app.Fragment
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.navigation.fragment.findNavController
|
||||
import com.dreamteam.timelapse.databinding.FragmentVideosBinding
|
||||
|
||||
/**
|
||||
* A simple [Fragment] subclass as the second destination in the navigation.
|
||||
*/
|
||||
class VideoFrag : Fragment() {
|
||||
|
||||
private var _binding: FragmentVideosBinding? = null
|
||||
|
||||
// This property is only valid between onCreateView and
|
||||
// onDestroyView.
|
||||
private val binding get() = _binding!!
|
||||
|
||||
override fun onCreateView(
|
||||
inflater: LayoutInflater, container: ViewGroup?,
|
||||
savedInstanceState: Bundle?
|
||||
): View {
|
||||
|
||||
_binding = FragmentVideosBinding.inflate(inflater, container, false)
|
||||
return binding.root
|
||||
|
||||
}
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
|
||||
binding.buttonSecond.setOnClickListener {
|
||||
findNavController().navigate(R.id.action_SecondFragment_to_FirstFragment)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onDestroyView() {
|
||||
super.onDestroyView()
|
||||
_binding = null
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.dreamteam.timelapse.data
|
||||
import com.dreamteam.timelapse.Project
|
||||
import retrofit2.Call
|
||||
import retrofit2.http.GET
|
||||
|
||||
interface ApiService {
|
||||
@GET("itemsdb") // Remplace par l'endpoint de ton API
|
||||
fun getProjets(): Call<List<Project>>
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package com.dreamteam.timelapse.data
|
||||
|
||||
import com.dreamteam.timelapse.Project
|
||||
import retrofit2.Call
|
||||
import retrofit2.Callback
|
||||
import retrofit2.Response
|
||||
|
||||
class ProjectRepository(private val apiService: ApiService) {
|
||||
|
||||
fun fetchProjects(onSuccess: (List<Project>) -> Unit, onError: (String) -> Unit) {
|
||||
val call = apiService.getProjets()
|
||||
call.enqueue(object : Callback<List<Project>> {
|
||||
override fun onResponse(call: Call<List<Project>>, response: Response<List<Project>>) {
|
||||
if (response.isSuccessful) {
|
||||
val projects = response.body()
|
||||
projects?.let {
|
||||
onSuccess(it)
|
||||
} ?: onError("Aucun projet trouvé")
|
||||
} else {
|
||||
onError("Erreur : ${response.code()}")
|
||||
}
|
||||
}
|
||||
|
||||
override fun onFailure(call: Call<List<Project>>, t: Throwable) {
|
||||
onError("Échec de l'appel API : ${t.message}")
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
45
app/src/main/res/layout/activity_main.xml
Normal file
45
app/src/main/res/layout/activity_main.xml
Normal file
@@ -0,0 +1,45 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:fitsSystemWindows="true"
|
||||
tools:context=".MainActivity">
|
||||
|
||||
<com.google.android.material.appbar.AppBarLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:fitsSystemWindows="true">
|
||||
|
||||
<com.google.android.material.tabs.TabLayout
|
||||
android:id="@+id/tabLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="top"
|
||||
android:contentDescription="@string/onglets_de_navigation"
|
||||
/>
|
||||
|
||||
</com.google.android.material.appbar.AppBarLayout>
|
||||
|
||||
<!-- useless now <include layout="@layout/content_main" />-->
|
||||
|
||||
<!-- <com.google.android.material.floatingactionbutton.FloatingActionButton
|
||||
android:id="@+id/fab"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom|end"
|
||||
android:layout_marginEnd="@dimen/fab_margin"
|
||||
android:layout_marginBottom="16dp"
|
||||
app:srcCompat="@android:drawable/ic_dialog_email" /> -->
|
||||
|
||||
|
||||
<!-- marge pour le appBar layout -->
|
||||
<androidx.viewpager2.widget.ViewPager2
|
||||
android:id="@+id/viewPager"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_below="@id/tabLayout"
|
||||
android:layout_marginTop="50dp"
|
||||
/>
|
||||
|
||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
||||
57
app/src/main/res/layout/fragment_projets.xml
Normal file
57
app/src/main/res/layout/fragment_projets.xml
Normal file
@@ -0,0 +1,57 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--<androidx.core.widget.NestedScrollView 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"
|
||||
tools:context=".ProjetsFrag">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:padding="16dp">
|
||||
|
||||
<Button
|
||||
android:id="@+id/button_first"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/next"
|
||||
app:layout_constraintBottom_toTopOf="@id/textview_first"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textview_first"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="16dp"
|
||||
android:text="@string/lorem_ipsum"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/button_first" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
-->
|
||||
<!--<androidx.swiperefreshlayout.widget.SwipeRefreshLayout-->
|
||||
<com.dreamteam.timelapse.CustomSwipeRefreshLayout
|
||||
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"
|
||||
tools:context=".ProjetsFrag"
|
||||
android:id="@+id/swipeRefreshLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/recyclerView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"/>
|
||||
<!--<ListView
|
||||
android:id="@+id/listView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />-->
|
||||
|
||||
</com.dreamteam.timelapse.CustomSwipeRefreshLayout>
|
||||
|
||||
<!--</androidx.core.widget.NestedScrollView> -->
|
||||
35
app/src/main/res/layout/fragment_videos.xml
Normal file
35
app/src/main/res/layout/fragment_videos.xml
Normal file
@@ -0,0 +1,35 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.core.widget.NestedScrollView 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"
|
||||
tools:context=".VideoFrag">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:padding="16dp">
|
||||
|
||||
<Button
|
||||
android:id="@+id/button_second"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/previous"
|
||||
app:layout_constraintBottom_toTopOf="@id/textview_second"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textview_second"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="16dp"
|
||||
android:text="@string/lorem_ipsum"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/button_second" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</androidx.core.widget.NestedScrollView>
|
||||
33
app/src/main/res/layout/item_project_card.xml
Normal file
33
app/src/main/res/layout/item_project_card.xml
Normal file
@@ -0,0 +1,33 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<androidx.cardview.widget.CardView
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="8dp"
|
||||
tools:ignore="MissingConstraints">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:padding="16dp">
|
||||
|
||||
<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"/>
|
||||
<!-- Ajouter d'autres vues comme une image ou une description -->
|
||||
</LinearLayout>
|
||||
|
||||
</androidx.cardview.widget.CardView>
|
||||
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
28
app/src/main/res/navigation/nav_graph.xml
Normal file
28
app/src/main/res/navigation/nav_graph.xml
Normal file
@@ -0,0 +1,28 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<navigation 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:id="@+id/nav_graph"
|
||||
app:startDestination="@id/FirstFragment">
|
||||
|
||||
<fragment
|
||||
android:id="@+id/FirstFragment"
|
||||
android:name="com.dreamteam.timelapse.ProjetsFrag"
|
||||
android:label="@string/first_fragment_label"
|
||||
tools:layout="@layout/fragment_projets">
|
||||
|
||||
<action
|
||||
android:id="@+id/action_FirstFragment_to_SecondFragment"
|
||||
app:destination="@id/SecondFragment" />
|
||||
</fragment>
|
||||
<fragment
|
||||
android:id="@+id/SecondFragment"
|
||||
android:name="com.dreamteam.timelapse.VideoFrag"
|
||||
android:label="@string/second_fragment_label"
|
||||
tools:layout="@layout/fragment_videos">
|
||||
|
||||
<action
|
||||
android:id="@+id/action_SecondFragment_to_FirstFragment"
|
||||
app:destination="@id/FirstFragment" />
|
||||
</fragment>
|
||||
</navigation>
|
||||
3
app/src/main/res/values-land/dimens.xml
Normal file
3
app/src/main/res/values-land/dimens.xml
Normal file
@@ -0,0 +1,3 @@
|
||||
<resources>
|
||||
<dimen name="fab_margin">48dp</dimen>
|
||||
</resources>
|
||||
7
app/src/main/res/values-night/themes.xml
Normal file
7
app/src/main/res/values-night/themes.xml
Normal file
@@ -0,0 +1,7 @@
|
||||
<resources xmlns:tools="http://schemas.android.com/tools">
|
||||
<!-- Base application theme. -->
|
||||
<style name="Base.Theme.Timelapse" parent="Theme.Material3.DayNight.NoActionBar">
|
||||
<!-- Customize your dark theme here. -->
|
||||
<!-- <item name="colorPrimary">@color/my_dark_primary</item> -->
|
||||
</style>
|
||||
</resources>
|
||||
9
app/src/main/res/values-v23/themes.xml
Normal file
9
app/src/main/res/values-v23/themes.xml
Normal file
@@ -0,0 +1,9 @@
|
||||
<resources xmlns:tools="http://schemas.android.com/tools">
|
||||
|
||||
<style name="Theme.Timelapse" parent="Base.Theme.Timelapse">
|
||||
<!-- Transparent system bars for edge-to-edge. -->
|
||||
<item name="android:navigationBarColor">@android:color/transparent</item>
|
||||
<item name="android:statusBarColor">@android:color/transparent</item>
|
||||
<item name="android:windowLightStatusBar">?attr/isLightTheme</item>
|
||||
</style>
|
||||
</resources>
|
||||
3
app/src/main/res/values-w1240dp/dimens.xml
Normal file
3
app/src/main/res/values-w1240dp/dimens.xml
Normal file
@@ -0,0 +1,3 @@
|
||||
<resources>
|
||||
<dimen name="fab_margin">200dp</dimen>
|
||||
</resources>
|
||||
3
app/src/main/res/values-w600dp/dimens.xml
Normal file
3
app/src/main/res/values-w600dp/dimens.xml
Normal file
@@ -0,0 +1,3 @@
|
||||
<resources>
|
||||
<dimen name="fab_margin">48dp</dimen>
|
||||
</resources>
|
||||
3
app/src/main/res/values/dimens.xml
Normal file
3
app/src/main/res/values/dimens.xml
Normal file
@@ -0,0 +1,3 @@
|
||||
<resources>
|
||||
<dimen name="fab_margin">16dp</dimen>
|
||||
</resources>
|
||||
@@ -1,3 +1,46 @@
|
||||
<resources>
|
||||
<string name="app_name">Timelapse</string>
|
||||
<!-- Strings used for fragments for navigation -->
|
||||
<string name="first_fragment_label">First Fragment</string>
|
||||
<string name="second_fragment_label">Second Fragment</string>
|
||||
<string name="next">Next</string>
|
||||
<string name="previous">Previous</string>
|
||||
|
||||
<string name="lorem_ipsum">
|
||||
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam in scelerisque sem. Mauris
|
||||
volutpat, dolor id interdum ullamcorper, risus dolor egestas lectus, sit amet mattis purus
|
||||
dui nec risus. Maecenas non sodales nisi, vel dictum dolor. Class aptent taciti sociosqu ad
|
||||
litora torquent per conubia nostra, per inceptos himenaeos. Suspendisse blandit eleifend
|
||||
diam, vel rutrum tellus vulputate quis. Aliquam eget libero aliquet, imperdiet nisl a,
|
||||
ornare ex. Sed rhoncus est ut libero porta lobortis. Fusce in dictum tellus.\n\n
|
||||
Suspendisse interdum ornare ante. Aliquam nec cursus lorem. Morbi id magna felis. Vivamus
|
||||
egestas, est a condimentum egestas, turpis nisl iaculis ipsum, in dictum tellus dolor sed
|
||||
neque. Morbi tellus erat, dapibus ut sem a, iaculis tincidunt dui. Interdum et malesuada
|
||||
fames ac ante ipsum primis in faucibus. Curabitur et eros porttitor, ultricies urna vitae,
|
||||
molestie nibh. Phasellus at commodo eros, non aliquet metus. Sed maximus nisl nec dolor
|
||||
bibendum, vel congue leo egestas.\n\n
|
||||
Sed interdum tortor nibh, in sagittis risus mollis quis. Curabitur mi odio, condimentum sit
|
||||
amet auctor at, mollis non turpis. Nullam pretium libero vestibulum, finibus orci vel,
|
||||
molestie quam. Fusce blandit tincidunt nulla, quis sollicitudin libero facilisis et. Integer
|
||||
interdum nunc ligula, et fermentum metus hendrerit id. Vestibulum lectus felis, dictum at
|
||||
lacinia sit amet, tristique id quam. Cras eu consequat dui. Suspendisse sodales nunc ligula,
|
||||
in lobortis sem porta sed. Integer id ultrices magna, in luctus elit. Sed a pellentesque
|
||||
est.\n\n
|
||||
Aenean nunc velit, lacinia sed dolor sed, ultrices viverra nulla. Etiam a venenatis nibh.
|
||||
Morbi laoreet, tortor sed facilisis varius, nibh orci rhoncus nulla, id elementum leo dui
|
||||
non lorem. Nam mollis ipsum quis auctor varius. Quisque elementum eu libero sed commodo. In
|
||||
eros nisl, imperdiet vel imperdiet et, scelerisque a mauris. Pellentesque varius ex nunc,
|
||||
quis imperdiet eros placerat ac. Duis finibus orci et est auctor tincidunt. Sed non viverra
|
||||
ipsum. Nunc quis augue egestas, cursus lorem at, molestie sem. Morbi a consectetur ipsum, a
|
||||
placerat diam. Etiam vulputate dignissim convallis. Integer faucibus mauris sit amet finibus
|
||||
convallis.\n\n
|
||||
Phasellus in aliquet mi. Pellentesque habitant morbi tristique senectus et netus et
|
||||
malesuada fames ac turpis egestas. In volutpat arcu ut felis sagittis, in finibus massa
|
||||
gravida. Pellentesque id tellus orci. Integer dictum, lorem sed efficitur ullamcorper,
|
||||
libero justo consectetur ipsum, in mollis nisl ex sed nisl. Donec maximus ullamcorper
|
||||
sodales. Praesent bibendum rhoncus tellus nec feugiat. In a ornare nulla. Donec rhoncus
|
||||
libero vel nunc consequat, quis tincidunt nisl eleifend. Cras bibendum enim a justo luctus
|
||||
vestibulum. Fusce dictum libero quis erat maximus, vitae volutpat diam dignissim.
|
||||
</string>
|
||||
<string name="onglets_de_navigation">Onglets de navigation</string>
|
||||
</resources>
|
||||
@@ -2,4 +2,9 @@
|
||||
<resources>
|
||||
|
||||
<style name="Theme.Timelapse" parent="android:Theme.Material.Light.NoActionBar" />
|
||||
<!-- Base application theme. -->
|
||||
<style name="Base.Theme.Timelapse" parent="Theme.Material3.DayNight.NoActionBar">
|
||||
<!-- Customize your light theme here. -->
|
||||
<!-- <item name="colorPrimary">@color/my_light_primary</item> -->
|
||||
</style>
|
||||
</resources>
|
||||
@@ -8,6 +8,11 @@ espressoCore = "3.5.1"
|
||||
lifecycleRuntimeKtx = "2.6.1"
|
||||
activityCompose = "1.8.0"
|
||||
composeBom = "2023.08.00"
|
||||
material = "1.10.0"
|
||||
appcompat = "1.6.1"
|
||||
constraintlayout = "2.1.4"
|
||||
navigationFragmentKtx = "2.6.0"
|
||||
navigationUiKtx = "2.6.0"
|
||||
|
||||
[libraries]
|
||||
androidx-core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "coreKtx" }
|
||||
@@ -24,6 +29,11 @@ androidx-ui-tooling-preview = { group = "androidx.compose.ui", name = "ui-toolin
|
||||
androidx-ui-test-manifest = { group = "androidx.compose.ui", name = "ui-test-manifest" }
|
||||
androidx-ui-test-junit4 = { group = "androidx.compose.ui", name = "ui-test-junit4" }
|
||||
androidx-material3 = { group = "androidx.compose.material3", name = "material3" }
|
||||
material = { group = "com.google.android.material", name = "material", version.ref = "material" }
|
||||
androidx-appcompat = { group = "androidx.appcompat", name = "appcompat", version.ref = "appcompat" }
|
||||
androidx-constraintlayout = { group = "androidx.constraintlayout", name = "constraintlayout", version.ref = "constraintlayout" }
|
||||
androidx-navigation-fragment-ktx = { group = "androidx.navigation", name = "navigation-fragment-ktx", version.ref = "navigationFragmentKtx" }
|
||||
androidx-navigation-ui-ktx = { group = "androidx.navigation", name = "navigation-ui-ktx", version.ref = "navigationUiKtx" }
|
||||
|
||||
[plugins]
|
||||
android-application = { id = "com.android.application", version.ref = "agp" }
|
||||
|
||||
Reference in New Issue
Block a user