Skip to content
GitLab
Explorer
Connexion
S'inscrire
Navigation principale
Rechercher ou aller à…
Projet
L
LEPL1509-Projet
Gestion
Activité
Membres
Labels
Programmation
Tickets
Tableaux des tickets
Jalons
Wiki
Code
Requêtes de fusion
Dépôt
Branches
Validations
Étiquettes
Graphe du dépôt
Comparer les révisions
Extraits de code
Compilation
Pipelines
Jobs
Planifications de pipeline
Artéfacts
Déploiement
Releases
Registre de paquets
Registre de conteneur
Registre de modèles
Opération
Environnements
Modules Terraform
Surveillance
Incidents
Analyse
Données d'analyse des chaînes de valeur
Analyse des contributeurs
Données d'analyse CI/CD
Données d'analyse du dépôt
Expériences du modèle
Aide
Aide
Support
Documentation de GitLab
Comparer les forfaits GitLab
Forum de la communauté
Contribuer à GitLab
Donner votre avis
Conditions générales et politique de confidentialité
Raccourcis clavier
?
Extraits de code
Groupes
Projets
Afficher davantage de fils d'Ariane
Arthur Schamroth
LEPL1509-Projet
Validations
0025194f
Valider
0025194f
rédigé
2 years ago
par
Kilian Sonna
Parcourir les fichiers
Options
Téléchargements
Correctifs
Plain Diff
lauch custom program
parent
b5bfc35f
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
Modifications
1
Masquer les modifications d'espaces
En ligne
Côte à côte
Affichage de
1 fichier modifié
app/src/main/java/be/lepl1509group13/workoutwarrior/WorkoutActivity.java
+90
-2
90 ajouts, 2 suppressions
...va/be/lepl1509group13/workoutwarrior/WorkoutActivity.java
avec
90 ajouts
et
2 suppressions
app/src/main/java/be/lepl1509group13/workoutwarrior/WorkoutActivity.java
+
90
−
2
Voir le fichier @
0025194f
...
@@ -22,6 +22,7 @@ import com.google.firebase.database.DatabaseReference;
...
@@ -22,6 +22,7 @@ import com.google.firebase.database.DatabaseReference;
import
com.google.firebase.database.FirebaseDatabase
;
import
com.google.firebase.database.FirebaseDatabase
;
import
com.google.firebase.database.ValueEventListener
;
import
com.google.firebase.database.ValueEventListener
;
import
java.util.Arrays
;
import
java.util.Objects
;
import
java.util.Objects
;
public
class
WorkoutActivity
extends
AppCompatActivity
{
public
class
WorkoutActivity
extends
AppCompatActivity
{
...
@@ -45,7 +46,7 @@ public class WorkoutActivity extends AppCompatActivity {
...
@@ -45,7 +46,7 @@ public class WorkoutActivity extends AppCompatActivity {
private
boolean
workout_timer_started
=
false
;
// vrai si le timer de l'exo a déjà été démarré (qu'il soit sur pause ou non)
private
boolean
workout_timer_started
=
false
;
// vrai si le timer de l'exo a déjà été démarré (qu'il soit sur pause ou non)
private
long
timeLeftInMillis
;
// temps restant sur le timer du workout
private
long
timeLeftInMillis
;
// temps restant sur le timer du workout
Button
next_btn
;
Button
next_btn
;
int
exerciseIndexToDisplay
=
0
;
@Override
@Override
...
@@ -64,6 +65,10 @@ public class WorkoutActivity extends AppCompatActivity {
...
@@ -64,6 +65,10 @@ public class WorkoutActivity extends AppCompatActivity {
if
(
id
==
0
){
if
(
id
==
0
){
String
[][]
exercisesData
=
(
String
[][])
intent
.
getSerializableExtra
(
"exercisesData"
);
String
[][]
exercisesData
=
(
String
[][])
intent
.
getSerializableExtra
(
"exercisesData"
);
//todo pour Killian
//todo pour Killian
System
.
out
.
println
(
"custom : "
+
Arrays
.
deepToString
(
exercisesData
));
next_btn
.
setOnClickListener
(
v
->
onNextClickCustomProgram
(
exercisesData
));
displayCustomExercise
(
exercisesData
);
}
else
{
}
else
{
//it's a program from the database
//it's a program from the database
db
=
firebaseDb
.
getReference
(
"Programs"
);
db
=
firebaseDb
.
getReference
(
"Programs"
);
...
@@ -93,6 +98,89 @@ public class WorkoutActivity extends AppCompatActivity {
...
@@ -93,6 +98,89 @@ public class WorkoutActivity extends AppCompatActivity {
timeLeftInMillis
=
timer
;
timeLeftInMillis
=
timer
;
}
}
// Lauch custom program
void
onNextClickCustomProgram
(
String
[][]
exercises
)
{
exerciseIndexToDisplay
++;
System
.
out
.
println
(
"index : "
+
exerciseIndexToDisplay
);
System
.
out
.
println
(
"len : "
+
exercises
.
length
);
if
(
exerciseIndexToDisplay
>=
exercises
.
length
)
{
System
.
out
.
println
(
"on finish"
);
finish
();
}
else
{
TextView
name
=
findViewById
(
R
.
id
.
workout_todo
);
TextView
description
=
findViewById
(
R
.
id
.
workout_detail
);
ImageView
image
=
findViewById
(
R
.
id
.
workout_image
);
Button
launch_timer
=
findViewById
(
R
.
id
.
launch_timer
);
launch_timer
.
setVisibility
(
View
.
INVISIBLE
);
name
.
setText
(
exercises
[
exerciseIndexToDisplay
][
0
]);
name
.
setVisibility
(
View
.
INVISIBLE
);
description
.
setText
(
exercises
[
exerciseIndexToDisplay
][
1
]);
description
.
setVisibility
(
View
.
INVISIBLE
);
int
resourceId
=
getResources
().
getIdentifier
(
exercises
[
exerciseIndexToDisplay
][
2
],
"drawable"
,
getPackageName
());
image
.
setImageResource
(
resourceId
);
image
.
setVisibility
(
View
.
INVISIBLE
);
TextView
timer_break
=
findViewById
(
R
.
id
.
timer_break
);
CountDownTimer
countDownBreak
=
new
CountDownTimer
(
3000
,
1000
)
{
@Override
public
void
onTick
(
long
l
)
{
timer_break
.
setText
(
""
);
name
.
setText
(
""
);
description
.
setText
(
""
);
image
.
setVisibility
(
View
.
INVISIBLE
);
timer_break
.
setText
(
""
+
l
/
1000
);
//btn_next.setVisibility(View.INVISIBLE);
set_break_timer_text
.
setText
(
"Il est temps de prendre une pause..."
);
set_break_btn
.
setVisibility
(
View
.
INVISIBLE
);
}
@Override
public
void
onFinish
()
{
set_break_timer_text
.
setText
(
""
);
timer_break
.
setText
(
""
);
next_btn
.
setVisibility
(
View
.
VISIBLE
);
set_break_btn
.
setVisibility
(
View
.
VISIBLE
);
displayCustomExercise
(
exercises
);
}
};
countDownBreak
.
start
();
next_btn
.
setText
(
"Passer"
);
next_btn
.
setOnClickListener
(
v
->
{
countDownBreak
.
cancel
();
countDownBreak
.
onFinish
();
next_btn
.
setText
(
"Suivant"
);
//next_btn.setOnClickListener(v1 -> displayCustomExercise(exercises));
});
}
}
void
displayCustomExercise
(
String
[][]
exercises
)
{
if
(
exerciseIndexToDisplay
>=
exercises
.
length
)
finish
();
next_btn
.
setOnClickListener
(
v1
->
onNextClickCustomProgram
(
exercises
));
TextView
name
=
findViewById
(
R
.
id
.
workout_todo
);
name
.
setText
(
exercises
[
exerciseIndexToDisplay
][
0
]);
name
.
setVisibility
(
View
.
VISIBLE
);
TextView
description
=
findViewById
(
R
.
id
.
workout_detail
);
description
.
setText
(
exercises
[
exerciseIndexToDisplay
][
1
]);
description
.
setVisibility
(
View
.
VISIBLE
);
ImageView
image
=
findViewById
(
R
.
id
.
workout_image
);
int
resourceId
=
getResources
().
getIdentifier
(
exercises
[
exerciseIndexToDisplay
][
2
],
"drawable"
,
getPackageName
());
image
.
setImageResource
(
resourceId
);
image
.
setVisibility
(
View
.
VISIBLE
);
}
// Timer entre les séries
// Timer entre les séries
CountDownTimer
workout_break_timer
()
{
CountDownTimer
workout_break_timer
()
{
CountDownTimer
timer
=
new
CountDownTimer
(
set_break_timer
,
1000
)
{
CountDownTimer
timer
=
new
CountDownTimer
(
set_break_timer
,
1000
)
{
...
@@ -258,7 +346,7 @@ public class WorkoutActivity extends AppCompatActivity {
...
@@ -258,7 +346,7 @@ public class WorkoutActivity extends AppCompatActivity {
else
if
(!
Objects
.
equals
(
numberOfWorkouts
,
step
)){
else
if
(!
Objects
.
equals
(
numberOfWorkouts
,
step
)){
TextView
timer_break
=
findViewById
(
R
.
id
.
timer_break
);
TextView
timer_break
=
findViewById
(
R
.
id
.
timer_break
);
CountDownTimer
countDownBreak
=
new
CountDownTimer
(
10
000
,
1000
)
{
CountDownTimer
countDownBreak
=
new
CountDownTimer
(
3
000
,
1000
)
{
@Override
@Override
public
void
onTick
(
long
l
)
{
public
void
onTick
(
long
l
)
{
timer_break
.
setText
(
""
);
timer_break
.
setText
(
""
);
...
...
Ce diff est replié.
Cliquez pour l'agrandir.
Aperçu
0%
Chargement en cours
Veuillez réessayer
ou
joindre un nouveau fichier
.
Annuler
You are about to add
0
people
to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Enregistrer le commentaire
Annuler
Veuillez vous
inscrire
ou vous
se connecter
pour commenter