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
2b3d9730
Valider
2b3d9730
rédigé
2 years ago
par
Arthur Schamroth
Parcourir les fichiers
Options
Téléchargements
Correctifs
Plain Diff
Fix bugs
parent
a73ab2c4
Aucune branche associée trouvée
Branches contenant la validation
Aucune étiquette associée trouvée
1 requête de fusion
!41
Arthur
Modifications
2
Masquer les modifications d'espaces
En ligne
Côte à côte
Affichage de
2 fichiers modifiés
app/src/main/java/be/lepl1509group13/workoutwarrior/ProgramCreationActivity.java
+111
-103
111 ajouts, 103 suppressions
...pl1509group13/workoutwarrior/ProgramCreationActivity.java
app/src/main/res/layout/modify_exercice_popup.xml
+1
-0
1 ajout, 0 suppression
app/src/main/res/layout/modify_exercice_popup.xml
avec
112 ajouts
et
103 suppressions
app/src/main/java/be/lepl1509group13/workoutwarrior/ProgramCreationActivity.java
+
111
−
103
Voir le fichier @
2b3d9730
...
@@ -220,87 +220,96 @@ public class ProgramCreationActivity extends AppCompatActivity {
...
@@ -220,87 +220,96 @@ public class ProgramCreationActivity extends AppCompatActivity {
Toast
.
makeText
(
ProgramCreationActivity
.
this
,
"Veuillez entrer un exercice avant de vouloir l'ajouter !"
,
Toast
.
makeText
(
ProgramCreationActivity
.
this
,
"Veuillez entrer un exercice avant de vouloir l'ajouter !"
,
Toast
.
LENGTH_SHORT
).
show
();
Toast
.
LENGTH_SHORT
).
show
();
}
else
{
}
else
{
Dialog
dialog
=
new
Dialog
(
ProgramCreationActivity
.
this
);
if
(!
EXOS
.
contains
(
exercise_searched
)){
dialog
.
setContentView
(
R
.
layout
.
modify_exercice_popup
);
Toast
.
makeText
(
ProgramCreationActivity
.
this
,
"Cet exercice n'est pas connu dans notre système !"
,
dialog
.
show
();
Toast
.
LENGTH_SHORT
).
show
();
// Ajouter un listener à chaque checkBox
}
cb_lundi
=
dialog
.
findViewById
(
R
.
id
.
checkbox_monday
);
else
{
cb_mardi
=
dialog
.
findViewById
(
R
.
id
.
checkbox_tuesday
);
Dialog
dialog
=
new
Dialog
(
ProgramCreationActivity
.
this
);
cb_mercredi
=
dialog
.
findViewById
(
R
.
id
.
checkbox_wednesday
);
dialog
.
setContentView
(
R
.
layout
.
modify_exercice_popup
);
cb_jeudi
=
dialog
.
findViewById
(
R
.
id
.
checkbox_thursday
);
dialog
.
show
();
cb_vendredi
=
dialog
.
findViewById
(
R
.
id
.
checkbox_friday
);
// Ajouter un listener à chaque checkBox
cb_samedi
=
dialog
.
findViewById
(
R
.
id
.
checkbox_saturday
);
cb_lundi
=
dialog
.
findViewById
(
R
.
id
.
checkbox_monday
);
cb_dimanche
=
dialog
.
findViewById
(
R
.
id
.
checkbox_sunday
);
cb_mardi
=
dialog
.
findViewById
(
R
.
id
.
checkbox_tuesday
);
cb_mercredi
=
dialog
.
findViewById
(
R
.
id
.
checkbox_wednesday
);
cb_list
.
add
(
cb_lundi
);
cb_jeudi
=
dialog
.
findViewById
(
R
.
id
.
checkbox_thursday
);
cb_list
.
add
(
cb_mardi
);
cb_vendredi
=
dialog
.
findViewById
(
R
.
id
.
checkbox_friday
);
cb_list
.
add
(
cb_mercredi
);
cb_samedi
=
dialog
.
findViewById
(
R
.
id
.
checkbox_saturday
);
cb_list
.
add
(
cb_jeudi
);
cb_dimanche
=
dialog
.
findViewById
(
R
.
id
.
checkbox_sunday
);
cb_list
.
add
(
cb_vendredi
);
cb_list
.
add
(
cb_samedi
);
cb_list
.
add
(
cb_lundi
);
cb_list
.
add
(
cb_dimanche
);
cb_list
.
add
(
cb_mardi
);
cb_list
.
add
(
cb_mercredi
);
for
(
CheckBox
cb
:
cb_list
)
cb
.
setOnCheckedChangeListener
(
myCheckBoxListener
);
cb_list
.
add
(
cb_jeudi
);
cb_list
.
add
(
cb_vendredi
);
DatabaseReference
workoutsDb
=
firebaseDb
.
getReference
(
"Workouts"
);
cb_list
.
add
(
cb_samedi
);
Query
query
=
workoutsDb
.
orderByChild
(
"name"
).
equalTo
(
exercise_searched
);
cb_list
.
add
(
cb_dimanche
);
query
.
addValueEventListener
(
new
ValueEventListener
()
{
@Override
for
(
CheckBox
cb
:
cb_list
)
cb
.
setOnCheckedChangeListener
(
myCheckBoxListener
);
public
void
onDataChange
(
DataSnapshot
dataSnapshot
)
{
for
(
DataSnapshot
snapshot
:
dataSnapshot
.
getChildren
())
{
DatabaseReference
workoutsDb
=
firebaseDb
.
getReference
(
"Workouts"
);
Long
timer
=
(
snapshot
.
child
(
"timer"
).
getValue
(
Long
.
class
))/
1000
;
Query
query
=
workoutsDb
.
orderByChild
(
"name"
).
equalTo
(
exercise_searched
);
img_actual_exo
=
snapshot
.
child
(
"image_url"
).
getValue
(
String
.
class
);
query
.
addValueEventListener
(
new
ValueEventListener
()
{
break_time
=
(
snapshot
.
child
(
"break"
).
getValue
(
Long
.
class
))/
1000
;
@Override
String
description
=
snapshot
.
child
(
"description"
).
getValue
(
String
.
class
);
public
void
onDataChange
(
DataSnapshot
dataSnapshot
)
{
for
(
DataSnapshot
snapshot
:
dataSnapshot
.
getChildren
())
{
EditText
description_text
=
dialog
.
findViewById
(
R
.
id
.
exercise_description
);
Long
timer
=
(
snapshot
.
child
(
"timer"
).
getValue
(
Long
.
class
))/
1000
;
EditText
timer_edit
=
dialog
.
findViewById
(
R
.
id
.
exercise_timer
);
img_actual_exo
=
snapshot
.
child
(
"image_url"
).
getValue
(
String
.
class
);
TextView
timer_text
=
dialog
.
findViewById
(
R
.
id
.
timer_text
);
break_time
=
(
snapshot
.
child
(
"break"
).
getValue
(
Long
.
class
))/
1000
;
TextView
break_text
=
dialog
.
findViewById
(
R
.
id
.
exercice_break
);
String
description
=
snapshot
.
child
(
"description"
).
getValue
(
String
.
class
);
ConstraintLayout
form_layout
=
dialog
.
findViewById
(
R
.
id
.
constraintLayout2
);
EditText
description_text
=
dialog
.
findViewById
(
R
.
id
.
exercise_description
);
form_layout
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
EditText
timer_edit
=
dialog
.
findViewById
(
R
.
id
.
exercise_timer
);
@Override
TextView
timer_text
=
dialog
.
findViewById
(
R
.
id
.
timer_text
);
public
void
onClick
(
View
v
)
{
TextView
break_text
=
dialog
.
findViewById
(
R
.
id
.
exercice_break
);
if
(
description_text
.
hasFocus
())
{
TextView
text_break
=
dialog
.
findViewById
(
R
.
id
.
text_break
);
description_text
.
clearFocus
();
break_text
.
setVisibility
(
View
.
INVISIBLE
);
text_break
.
setVisibility
(
View
.
INVISIBLE
);
ConstraintLayout
form_layout
=
dialog
.
findViewById
(
R
.
id
.
constraintLayout2
);
form_layout
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
v
)
{
if
(
description_text
.
hasFocus
())
{
description_text
.
clearFocus
();
}
}
}
}
}
);
});
description_text
.
setOnFocusChangeListener
(
new
View
.
OnFocusChangeListener
()
{
description_text
.
setOnFocusChangeListener
(
new
View
.
OnFocusChangeListener
()
{
@Override
@Override
public
void
onFocusChange
(
View
v
,
boolean
hasFocus
)
{
public
void
onFocusChange
(
View
v
,
boolean
hasFocus
)
{
if
(!
hasFocus
)
{
if
(!
hasFocus
)
{
description_text
.
setInputType
(
InputType
.
TYPE_CLASS_TEXT
|
InputType
.
TYPE_TEXT_FLAG_CAP_SENTENCES
);
description_text
.
setInputType
(
InputType
.
TYPE_CLASS_TEXT
|
InputType
.
TYPE_TEXT_FLAG_CAP_SENTENCES
);
}
else
{
}
else
{
description_text
.
setInputType
(
InputType
.
TYPE_CLASS_TEXT
|
InputType
.
TYPE_TEXT_FLAG_MULTI_LINE
|
InputType
.
TYPE_TEXT_FLAG_CAP_SENTENCES
);
description_text
.
setInputType
(
InputType
.
TYPE_CLASS_TEXT
|
InputType
.
TYPE_TEXT_FLAG_MULTI_LINE
|
InputType
.
TYPE_TEXT_FLAG_CAP_SENTENCES
);
}
}
}
}
});
});
if
(
description
!=
null
){
if
(
description
!=
null
){
description_text
.
setText
(
description
);
description_text
.
setText
(
description
);
}
}
if
(
timer
==
0
){
if
(
timer
==
0
){
timer_edit
.
setVisibility
(
View
.
INVISIBLE
);
timer_edit
.
setVisibility
(
View
.
INVISIBLE
);
timer_edit
.
setEnabled
(
false
);
timer_edit
.
setEnabled
(
false
);
timer_text
.
setText
(
""
);
timer_text
.
setText
(
""
);
}
else
{
}
else
{
timer_edit
.
setText
(
timer
.
toString
());
timer_edit
.
setText
(
timer
.
toString
());
}
}
if
(
break_time
!=
null
){
if
(
break_time
!=
null
){
break_text
.
setText
(
break_time
.
toString
());
break_text
.
setText
(
break_time
.
toString
());
}
int
resId
=
getResources
().
getIdentifier
(
img_actual_exo
,
"drawable"
,
getPackageName
());
ImageView
image
=
dialog
.
findViewById
(
R
.
id
.
exercice_to_modify_image
);
image
.
setImageResource
(
resId
);
}
}
int
resId
=
getResources
().
getIdentifier
(
img_actual_exo
,
"drawable"
,
getPackageName
());
ImageView
image
=
dialog
.
findViewById
(
R
.
id
.
exercice_to_modify_image
);
image
.
setImageResource
(
resId
);
}
}
}
@Override
@Override
public
void
onCancelled
(
@NonNull
DatabaseError
databaseError
)
{
public
void
onCancelled
(
@NonNull
DatabaseError
databaseError
)
{
System
.
out
.
println
(
databaseError
);
System
.
out
.
println
(
databaseError
);
}
}
});
});
...
@@ -312,33 +321,34 @@ public class ProgramCreationActivity extends AppCompatActivity {
...
@@ -312,33 +321,34 @@ public class ProgramCreationActivity extends AppCompatActivity {
Button
save_btn
=
dialog
.
findViewById
(
R
.
id
.
btn_save_modif
);
Button
save_btn
=
dialog
.
findViewById
(
R
.
id
.
btn_save_modif
);
save_btn
.
setOnClickListener
(
w
->
{
save_btn
.
setOnClickListener
(
w
->
{
if
(
nbre_day
>
0
){
if
(
nbre_day
>
0
){
EditText
description_text
=
dialog
.
findViewById
(
R
.
id
.
exercise_description
);
EditText
description_text
=
dialog
.
findViewById
(
R
.
id
.
exercise_description
);
String
description_str
=
description_text
.
getText
().
toString
();
String
description_str
=
description_text
.
getText
().
toString
();
EditText
break_text
=
dialog
.
findViewById
(
R
.
id
.
exercice_break
);
EditText
break_text
=
dialog
.
findViewById
(
R
.
id
.
exercice_break
);
String
string_break
=
break_text
.
getText
().
toString
();
String
string_break
=
break_text
.
getText
().
toString
();
Integer
break_time
=
Integer
.
parseInt
(
string_break
);
Integer
break_time
=
Integer
.
parseInt
(
string_break
);
EditText
timer_edit
=
dialog
.
findViewById
(
R
.
id
.
exercise_timer
);
EditText
timer_edit
=
dialog
.
findViewById
(
R
.
id
.
exercise_timer
);
String
string_timer
=
timer_edit
.
getText
().
toString
();
String
string_timer
=
timer_edit
.
getText
().
toString
();
String
img
=
"@drawable/"
+
img_actual_exo
;
String
img
=
"@drawable/"
+
img_actual_exo
;
if
(
string_timer
.
equals
(
""
)){
if
(
string_timer
.
equals
(
""
)){
actual_exo
=
new
Exercise
(
exercise_searched
,
description_str
,
break_time
,
img
,
0
);
actual_exo
=
new
Exercise
(
exercise_searched
,
description_str
,
break_time
,
img
,
0
);
}
else
{
}
else
{
Integer
timer_int
=
Integer
.
parseInt
(
string_timer
);
Integer
timer_int
=
Integer
.
parseInt
(
string_timer
);
actual_exo
=
new
Exercise
(
exercise_searched
,
description_str
,
break_time
,
img
,
timer_int
);
actual_exo
=
new
Exercise
(
exercise_searched
,
description_str
,
break_time
,
img
,
timer_int
);
}
addToProgram
(
actual_exo
,
new
ArrayList
<>(
current_days_checked
));
dialog
.
dismiss
();
// Effacer le champ de texte AutoCompleteTextView
input_exo
.
setText
(
""
);
}
}
addToProgram
(
actual_exo
,
new
ArrayList
<>(
current_days_checked
));
else
{
dialog
.
dismiss
();
Toast
.
makeText
(
ProgramCreationActivity
.
this
,
"Veuillez sélectionner au moins un jour !"
,
// Effacer le champ de texte AutoCompleteTextView
Toast
.
LENGTH_SHORT
).
show
();
input_exo
.
setText
(
""
);
}
}
});
else
{
}
Toast
.
makeText
(
ProgramCreationActivity
.
this
,
"Veuillez sélectionner au moins un jour !"
,
Toast
.
LENGTH_SHORT
).
show
();
}
});
}
}
});
});
}
}
...
@@ -437,8 +447,6 @@ public class ProgramCreationActivity extends AppCompatActivity {
...
@@ -437,8 +447,6 @@ public class ProgramCreationActivity extends AppCompatActivity {
/**
/**
* Add the new exercise to the program
* Add the new exercise to the program
*/
*/
System
.
out
.
println
(
exercise
.
description
);
System
.
out
.
println
(
exercise
.
timer
);
if
(
exoInProgram
(
exercise
))
{
if
(
exoInProgram
(
exercise
))
{
Toast
.
makeText
(
this
,
"Exercice déjà dans le programme !"
,
Toast
.
makeText
(
this
,
"Exercice déjà dans le programme !"
,
Toast
.
LENGTH_SHORT
).
show
();
Toast
.
LENGTH_SHORT
).
show
();
...
...
Ce diff est replié.
Cliquez pour l'agrandir.
app/src/main/res/layout/modify_exercice_popup.xml
+
1
−
0
Voir le fichier @
2b3d9730
...
@@ -170,6 +170,7 @@
...
@@ -170,6 +170,7 @@
android:text=
""
/>
android:text=
""
/>
<TextView
<TextView
android:id=
"@+id/text_break"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"Gérez votre temps de pause en secondes"
/>
android:text=
"Gérez votre temps de pause en secondes"
/>
...
...
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