Completion of Fragment Start and beginning of Fragment Detail
continuous-integration/drone/push Build is passing Details

Gyroscope
Emre KARTAL 2 years ago
parent 6a449a5c13
commit 14ebcb8554

@ -326,7 +326,7 @@ class StubData : DataManager() {
1,
"Paris Saint-Germain FC",
"PSG",
"https://crests.football-data.org/524.svg",
"https://www.psg.fr/img/DefaultOpenGraphImage.jpg?20230329",
"24 Rue du Commandant Guilbaud, 75016 Paris, France",
"https://www.psg.fr/",
"1970",
@ -343,7 +343,7 @@ class StubData : DataManager() {
2,
"FC Barcelona",
"BAR",
"https://crests.football-data.org/81.svg",
"https://upload.wikimedia.org/wikipedia/fr/thumb/a/a1/Logo_FC_Barcelona.svg/1200px-Logo_FC_Barcelona.svg.png",
"Carrer d'Aristides Maillol, s/n, 08028 Barcelona, Spain",
"https://www.fcbarcelona.com/",
"1899",
@ -360,7 +360,7 @@ class StubData : DataManager() {
3,
"Liverpool FC",
"LIV",
"https://crests.football-data.org/64.svg",
"https://upload.wikimedia.org/wikipedia/fr/thumb/5/54/Logo_FC_Liverpool.svg/1200px-Logo_FC_Liverpool.svg.png",
"Anfield Road, Liverpool L4 0TH, United Kingdom",
"https://www.liverpoolfc.com/",
"1892",
@ -384,7 +384,13 @@ class StubData : DataManager() {
"BSA",
"LEAGUE",
"https://crests.football-data.org/764.svg",
Season(1557, Calendar.getInstance().apply { set(2023, Calendar.MARCH, 15) }, Calendar.getInstance().apply { set(2022, Calendar.DECEMBER, 3) },1, null),
Season(
1557,
Calendar.getInstance().apply { set(2023, Calendar.MARCH, 15) },
Calendar.getInstance().apply { set(2022, Calendar.DECEMBER, 3) },
1,
null
),
areaList[2],
)
)
@ -395,7 +401,13 @@ class StubData : DataManager() {
"ELC",
"LEAGUE",
"https://crests.football-data.org/PL.png",
Season(1557, Calendar.getInstance().apply { set(2023, Calendar.MARCH, 15) }, Calendar.getInstance().apply { set(2022, Calendar.DECEMBER, 3) },1, null),
Season(
1557,
Calendar.getInstance().apply { set(2023, Calendar.MARCH, 15) },
Calendar.getInstance().apply { set(2022, Calendar.DECEMBER, 3) },
1,
null
),
areaList[2],
)
)

@ -0,0 +1,33 @@
package uca.iut.clermont.view
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.ImageButton
import androidx.fragment.app.Fragment
import uca.iut.clermont.R
class DetailFragment : Fragment() {
private var isLiked = false
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
val view = inflater.inflate(R.layout.fragment_detail, container, false)
val button = view.findViewById<ImageButton>(R.id.buttonLike)
button.setOnClickListener {
isLiked = !isLiked
button.setImageResource(if (isLiked) R.drawable.full_like else R.drawable.empty_like)
}
return view;
}
}

@ -16,7 +16,7 @@ import uca.iut.clermont.model.Match
import uca.iut.clermont.view.adapter.FavoritesAdapter
import uca.iut.clermont.view.adapter.MatchesAdapter
class FavoriteFragment: Fragment() {
class FavoriteFragment : Fragment() {
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,

@ -45,5 +45,4 @@ class HomeFragment : Fragment() {
}
}

@ -10,8 +10,10 @@ import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.ImageButton
import android.widget.ImageView
import androidx.fragment.app.Fragment
import androidx.navigation.fragment.findNavController
import uca.iut.clermont.R
@ -39,6 +41,11 @@ class StartFragment : Fragment(), SensorEventListener {
accelerometer = sensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER)
sensorManager.registerListener(this, accelerometer, SensorManager.SENSOR_DELAY_NORMAL)
val buttonFavorite = view.findViewById<ImageButton>(R.id.nextButton)
buttonFavorite.setOnClickListener {
findNavController().navigate(R.id.detailFragment)
}
return view
}
@ -53,12 +60,10 @@ class StartFragment : Fragment(), SensorEventListener {
val angleY = y / 9.81f
if (Math.abs(angleX) > 0.1) {
// Déplacer la balle à droite ou à gauche en fonction de la direction du mouvement
val deltaX = angleX * 20f // La vitesse de déplacement est de 20 pixels par seconde
val deltaX = angleX * 20f * if (angleX > 0) 1 else -1
ObjectAnimator.ofFloat(ball, View.TRANSLATION_X, ball.x + deltaX).start()
// Faire tourner la balle pendant qu'elle se déplace
ObjectAnimator.ofFloat(ball, View.ROTATION, -angleX * 70f).start()
ObjectAnimator.ofFloat(ball, View.ROTATION, angleX * 3400f).start()
}
lastX = x

@ -8,7 +8,8 @@ import uca.iut.clermont.R
import uca.iut.clermont.model.Competition
import uca.iut.clermont.view.viewHolder.FavoriteHolder
class FavoritesAdapter(private val favoriteCompetition: Array<Competition> ) : RecyclerView.Adapter<FavoriteHolder>() {
class FavoritesAdapter(private val favoriteCompetition: Array<Competition>) :
RecyclerView.Adapter<FavoriteHolder>() {
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): FavoriteHolder {
return FavoriteHolder(
LayoutInflater.from(parent.context).inflate(R.layout.cellule_favorite, parent, false)

@ -3,11 +3,13 @@ package uca.iut.clermont.view.adapter
import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
import com.bumptech.glide.Glide
import uca.iut.clermont.R
import uca.iut.clermont.model.Match
import uca.iut.clermont.view.viewHolder.MatchHolder
class MatchesAdapter(private val recentMatches: Array<Match>) : RecyclerView.Adapter<MatchHolder>() {
class MatchesAdapter(private val recentMatches: Array<Match>) :
RecyclerView.Adapter<MatchHolder>() {
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): MatchHolder {
return MatchHolder(
LayoutInflater.from(parent.context).inflate(R.layout.cellule_match, parent, false)
@ -19,6 +21,16 @@ class MatchesAdapter(private val recentMatches: Array<Match>) : RecyclerView.Ada
holder.titleSecondTeam.text = recentMatches[position].awayTeam.name
holder.scoreHomeTeam.text = recentMatches[position].score.home.toString()
holder.scoreAwayTeam.text = recentMatches[position].score.away.toString()
Glide.with(holder.itemView.context)
.load(recentMatches[position].homeTeam.crest)
.error(R.drawable.imagenotfound)
.into(holder.imageHomeTeam)
Glide.with(holder.itemView.context)
.load(recentMatches[position].awayTeam.crest)
.error(R.drawable.imagenotfound)
.into(holder.imageAwayTeam)
}
override fun getItemCount() = recentMatches.size

@ -1,6 +1,7 @@
package uca.iut.clermont.view.viewHolder
import android.view.View
import android.widget.ImageView
import android.widget.TextView
import androidx.recyclerview.widget.RecyclerView
import uca.iut.clermont.R
@ -10,12 +11,16 @@ class MatchHolder(view: View) : RecyclerView.ViewHolder(view) {
val titleSecondTeam: TextView
val scoreHomeTeam: TextView
val scoreAwayTeam: TextView
val imageHomeTeam: ImageView
val imageAwayTeam: ImageView
init {
titleFirstTeam = view.findViewById(R.id.TitleFirstTeam)
titleSecondTeam = view.findViewById(R.id.TitleSecondTeam)
scoreHomeTeam = view.findViewById(R.id.ScoreHomeTeam)
scoreAwayTeam = view.findViewById(R.id.ScoreAwayTeam)
imageHomeTeam = view.findViewById(R.id.ImageFirstTeam)
imageAwayTeam = view.findViewById(R.id.ImageSecondTeam)
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 565 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 421 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 607 B

@ -11,13 +11,12 @@
android:name="androidx.navigation.fragment.NavHostFragment"
android:layout_width="0dp"
android:layout_height="0dp"
app:defaultNavHost="true"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:defaultNavHost="true"
app:navGraph="@navigation/my_nav" />
</androidx.constraintlayout.widget.ConstraintLayout>

@ -31,8 +31,6 @@
android:textColor="@color/black"
android:textSize="18dp" />
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

@ -1,6 +1,30 @@
<?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="match_parent"
android:layout_height="match_parent">
android:layout_height="match_parent"
tools:context=".view.DetailFragment">
<ImageView
android:id="@+id/imageDetail"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginTop="0dp"
android:scaleType="centerCrop"
android:src="@drawable/ic_launcher_background"
app:layout_constraintHeight_percent="0.2"
app:layout_constraintTop_toTopOf="parent" />
<ImageButton
android:id="@+id/buttonLike"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:layout_marginRight="15dp"
android:background="@android:color/transparent"
android:src="@drawable/empty_like"
app:layout_constraintEnd_toEndOf="@+id/imageDetail"
app:layout_constraintTop_toTopOf="@+id/imageDetail" />
</androidx.constraintlayout.widget.ConstraintLayout>

@ -31,9 +31,9 @@
android:background="@android:color/transparent"
android:fontFamily="@font/mulish_bold"
android:text="Exit"
android:textAllCaps="false"
android:textColor="@color/title"
android:textSize="26dp"
android:textAllCaps="false" />
android:textSize="26dp" />
</LinearLayout>

@ -98,9 +98,10 @@
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/listRecentsMatches"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_height="500dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textViewRecentMatches" />
app:layout_constraintTop_toBottomOf="@+id/textViewRecentMatches"
tools:itemCount="100" />
</androidx.constraintlayout.widget.ConstraintLayout>

@ -1,18 +1,57 @@
<?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"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto">
android:layout_height="match_parent">
<ImageView
android:id="@+id/ball"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:src="@drawable/ball"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ImageView
android:id="@+id/shadow"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:src="@drawable/shadow"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/ball" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="70dp"
android:gravity="center_vertical"
android:orientation="horizontal"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"/>
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/shadow">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="@font/mulish_black"
android:text="Continuer"
android:textColor="@color/title"
android:textSize="32sp" />
<ImageButton
android:id="@+id/nextButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:background="@android:color/transparent"
android:src="@drawable/button_next" />
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

@ -7,10 +7,10 @@
<fragment
android:id="@+id/startFragment"
android:name="uca.iut.clermont.view.StartFragment"
android:label="StartFragment" >
android:label="StartFragment">
<action
android:id="@+id/action_startFragment_to_homeFragment2"
app:destination="@id/homeFragment" />
android:id="@+id/action_startFragment_to_detailFragment"
app:destination="@id/detailFragment" />
</fragment>
<fragment
@ -30,5 +30,9 @@
android:id="@+id/action_favoriteFragment_to_homeFragment"
app:destination="@id/homeFragment" />
</fragment>
<fragment
android:id="@+id/detailFragment"
android:name="uca.iut.clermont.view.DetailFragment"
android:label="DetailFragment" />
</navigation>
Loading…
Cancel
Save