debut page projet
This commit is contained in:
@@ -23,6 +23,17 @@
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".ProjectActivity"
|
||||
android:exported="true"
|
||||
android:label="@string/app_name"
|
||||
android:theme="@style/Theme.Timelapse">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" /> <!-- ???? -->
|
||||
|
||||
<!--<category android:name="android.intent.category.LAUNCHER" />-->
|
||||
</intent-filter>
|
||||
</activity>
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
@@ -1,4 +0,0 @@
|
||||
package com.dreamteam.timelapse;
|
||||
|
||||
public class ProjectActivity : AppCompatActivity() {
|
||||
}
|
||||
55
app/src/main/java/com/dreamteam/timelapse/ProjectActivity.kt
Normal file
55
app/src/main/java/com/dreamteam/timelapse/ProjectActivity.kt
Normal file
@@ -0,0 +1,55 @@
|
||||
package com.dreamteam.timelapse
|
||||
import android.os.Bundle
|
||||
import android.util.Log
|
||||
import android.view.View
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.navigation.ui.AppBarConfiguration
|
||||
import androidx.viewpager2.widget.ViewPager2
|
||||
import com.dreamteam.timelapse.databinding.ActivityMainBinding
|
||||
import com.google.android.material.tabs.TabLayout
|
||||
import com.dreamteam.timelapse.R as Rtmp
|
||||
|
||||
class ProjectActivity : AppCompatActivity() {
|
||||
|
||||
private lateinit var appBarConfiguration: AppBarConfiguration
|
||||
private lateinit var binding: ActivityMainBinding
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
// super.onCreate(savedInstanceState)
|
||||
//
|
||||
|
||||
Log.d("mainActivity", "La main activity est créée")
|
||||
|
||||
|
||||
// setSupportActionBar(binding.toolbar)
|
||||
//
|
||||
super.onCreate(savedInstanceState)
|
||||
//val navController = findNavController(R.id.nav_host_fragment_content_main)
|
||||
//appBarConfiguration = AppBarConfiguration(navController.graph)
|
||||
//setupActionBarWithNavController(navController, appBarConfiguration)
|
||||
|
||||
// R.layout contient :
|
||||
// - un TabLayout avec l'id tabLayout
|
||||
// - un ViewPager2 avec l'id viewPager
|
||||
// - un FloatingActionButton avec l'id fab
|
||||
|
||||
//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)
|
||||
|
||||
|
||||
// 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
|
||||
// }
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.dreamteam.timelapse
|
||||
|
||||
import android.content.Intent
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
@@ -43,7 +44,11 @@ class ProjectAdapter(private val projects: List<Project>) : RecyclerView.Adapter
|
||||
.load("https://timelapse.kerboul.me/api/smile") // L'URL de l'image
|
||||
.into(holder.projectImage)
|
||||
DrawableCompat.setTint(holder.projectBadge.background, ContextCompat.getColor(context, color))
|
||||
|
||||
holder.itemView.setOnClickListener {
|
||||
val intent = Intent(context, ProjectActivity::class.java)
|
||||
intent.putExtra("PROJECT_ID", project.id) // Passe les données nécessaires à l'activité cible
|
||||
context.startActivity(intent)
|
||||
}
|
||||
}
|
||||
|
||||
override fun getItemCount(): Int {
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginBottom="8dp"
|
||||
|
||||
android:foreground="?android:attr/selectableItemBackground"
|
||||
app:cardCornerRadius="10dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
tools:ignore="MissingConstraints"
|
||||
|
||||
Reference in New Issue
Block a user