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
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 {
Toast
.
makeText
(
ProgramCreationActivity
.
this
,
"Veuillez entrer un exercice avant de vouloir l'ajouter !"
,
Toast
.
LENGTH_SHORT
).
show
();
}
else
{
Dialog
dialog
=
new
Dialog
(
ProgramCreationActivity
.
this
);
dialog
.
setContentView
(
R
.
layout
.
modify_exercice_popup
);
dialog
.
show
();
// Ajouter un listener à chaque checkBox
cb_lundi
=
dialog
.
findViewById
(
R
.
id
.
checkbox_monday
);
cb_mardi
=
dialog
.
findViewById
(
R
.
id
.
checkbox_tuesday
);
cb_mercredi
=
dialog
.
findViewById
(
R
.
id
.
checkbox_wednesday
);
cb_jeudi
=
dialog
.
findViewById
(
R
.
id
.
checkbox_thursday
);
cb_vendredi
=
dialog
.
findViewById
(
R
.
id
.
checkbox_friday
);
cb_samedi
=
dialog
.
findViewById
(
R
.
id
.
checkbox_saturday
);
cb_dimanche
=
dialog
.
findViewById
(
R
.
id
.
checkbox_sunday
);
cb_list
.
add
(
cb_lundi
);
cb_list
.
add
(
cb_mardi
);
cb_list
.
add
(
cb_mercredi
);
cb_list
.
add
(
cb_jeudi
);
cb_list
.
add
(
cb_vendredi
);
cb_list
.
add
(
cb_samedi
);
cb_list
.
add
(
cb_dimanche
);
for
(
CheckBox
cb
:
cb_list
)
cb
.
setOnCheckedChangeListener
(
myCheckBoxListener
);
DatabaseReference
workoutsDb
=
firebaseDb
.
getReference
(
"Workouts"
);
Query
query
=
workoutsDb
.
orderByChild
(
"name"
).
equalTo
(
exercise_searched
);
query
.
addValueEventListener
(
new
ValueEventListener
()
{
@Override
public
void
onDataChange
(
DataSnapshot
dataSnapshot
)
{
for
(
DataSnapshot
snapshot
:
dataSnapshot
.
getChildren
())
{
Long
timer
=
(
snapshot
.
child
(
"timer"
).
getValue
(
Long
.
class
))/
1000
;
img_actual_exo
=
snapshot
.
child
(
"image_url"
).
getValue
(
String
.
class
);
break_time
=
(
snapshot
.
child
(
"break"
).
getValue
(
Long
.
class
))/
1000
;
String
description
=
snapshot
.
child
(
"description"
).
getValue
(
String
.
class
);
EditText
description_text
=
dialog
.
findViewById
(
R
.
id
.
exercise_description
);
EditText
timer_edit
=
dialog
.
findViewById
(
R
.
id
.
exercise_timer
);
TextView
timer_text
=
dialog
.
findViewById
(
R
.
id
.
timer_text
);
TextView
break_text
=
dialog
.
findViewById
(
R
.
id
.
exercice_break
);
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
();
if
(!
EXOS
.
contains
(
exercise_searched
)){
Toast
.
makeText
(
ProgramCreationActivity
.
this
,
"Cet exercice n'est pas connu dans notre système !"
,
Toast
.
LENGTH_SHORT
).
show
();
}
else
{
Dialog
dialog
=
new
Dialog
(
ProgramCreationActivity
.
this
);
dialog
.
setContentView
(
R
.
layout
.
modify_exercice_popup
);
dialog
.
show
();
// Ajouter un listener à chaque checkBox
cb_lundi
=
dialog
.
findViewById
(
R
.
id
.
checkbox_monday
);
cb_mardi
=
dialog
.
findViewById
(
R
.
id
.
checkbox_tuesday
);
cb_mercredi
=
dialog
.
findViewById
(
R
.
id
.
checkbox_wednesday
);
cb_jeudi
=
dialog
.
findViewById
(
R
.
id
.
checkbox_thursday
);
cb_vendredi
=
dialog
.
findViewById
(
R
.
id
.
checkbox_friday
);
cb_samedi
=
dialog
.
findViewById
(
R
.
id
.
checkbox_saturday
);
cb_dimanche
=
dialog
.
findViewById
(
R
.
id
.
checkbox_sunday
);
cb_list
.
add
(
cb_lundi
);
cb_list
.
add
(
cb_mardi
);
cb_list
.
add
(
cb_mercredi
);
cb_list
.
add
(
cb_jeudi
);
cb_list
.
add
(
cb_vendredi
);
cb_list
.
add
(
cb_samedi
);
cb_list
.
add
(
cb_dimanche
);
for
(
CheckBox
cb
:
cb_list
)
cb
.
setOnCheckedChangeListener
(
myCheckBoxListener
);
DatabaseReference
workoutsDb
=
firebaseDb
.
getReference
(
"Workouts"
);
Query
query
=
workoutsDb
.
orderByChild
(
"name"
).
equalTo
(
exercise_searched
);
query
.
addValueEventListener
(
new
ValueEventListener
()
{
@Override
public
void
onDataChange
(
DataSnapshot
dataSnapshot
)
{
for
(
DataSnapshot
snapshot
:
dataSnapshot
.
getChildren
())
{
Long
timer
=
(
snapshot
.
child
(
"timer"
).
getValue
(
Long
.
class
))/
1000
;
img_actual_exo
=
snapshot
.
child
(
"image_url"
).
getValue
(
String
.
class
);
break_time
=
(
snapshot
.
child
(
"break"
).
getValue
(
Long
.
class
))/
1000
;
String
description
=
snapshot
.
child
(
"description"
).
getValue
(
String
.
class
);
EditText
description_text
=
dialog
.
findViewById
(
R
.
id
.
exercise_description
);
EditText
timer_edit
=
dialog
.
findViewById
(
R
.
id
.
exercise_timer
);
TextView
timer_text
=
dialog
.
findViewById
(
R
.
id
.
timer_text
);
TextView
break_text
=
dialog
.
findViewById
(
R
.
id
.
exercice_break
);
TextView
text_break
=
dialog
.
findViewById
(
R
.
id
.
text_break
);
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
()
{
@Override
public
void
onFocusChange
(
View
v
,
boolean
hasFocus
)
{
if
(!
hasFocus
)
{
description_text
.
setInputType
(
InputType
.
TYPE_CLASS_TEXT
|
InputType
.
TYPE_TEXT_FLAG_CAP_SENTENCES
);
}
else
{
description_text
.
setInputType
(
InputType
.
TYPE_CLASS_TEXT
|
InputType
.
TYPE_TEXT_FLAG_MULTI_LINE
|
InputType
.
TYPE_TEXT_FLAG_CAP_SENTENCES
);
}
);
description_text
.
setOnFocusChangeListener
(
new
View
.
OnFocusChangeListener
()
{
@Override
public
void
onFocusChange
(
View
v
,
boolean
hasFocus
)
{
if
(!
hasFocus
)
{
description_text
.
setInputType
(
InputType
.
TYPE_CLASS_TEXT
|
InputType
.
TYPE_TEXT_FLAG_CAP_SENTENCES
);
}
else
{
description_text
.
setInputType
(
InputType
.
TYPE_CLASS_TEXT
|
InputType
.
TYPE_TEXT_FLAG_MULTI_LINE
|
InputType
.
TYPE_TEXT_FLAG_CAP_SENTENCES
);
}
}
}
});
});
if
(
description
!=
null
){
description_text
.
setText
(
description
);
}
if
(
timer
==
0
){
timer_edit
.
setVisibility
(
View
.
INVISIBLE
);
timer_edit
.
setEnabled
(
false
);
timer_text
.
setText
(
""
);
}
else
{
timer_edit
.
setText
(
timer
.
toString
());
}
if
(
break_time
!=
null
){
break_text
.
setText
(
break_time
.
toString
());
if
(
description
!=
null
){
description_text
.
setText
(
description
);
}
if
(
timer
==
0
){
timer_edit
.
setVisibility
(
View
.
INVISIBLE
);
timer_edit
.
setEnabled
(
false
);
timer_text
.
setText
(
""
);
}
else
{
timer_edit
.
setText
(
timer
.
toString
());
}
if
(
break_time
!=
null
){
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
public
void
onCancelled
(
@NonNull
DatabaseError
databaseError
)
{
System
.
out
.
println
(
databaseError
);
@Override
public
void
onCancelled
(
@NonNull
DatabaseError
databaseError
)
{
System
.
out
.
println
(
databaseError
);
}
});
...
...
@@ -312,33 +321,34 @@ public class ProgramCreationActivity extends AppCompatActivity {
Button
save_btn
=
dialog
.
findViewById
(
R
.
id
.
btn_save_modif
);
save_btn
.
setOnClickListener
(
w
->
{
if
(
nbre_day
>
0
){
EditText
description_text
=
dialog
.
findViewById
(
R
.
id
.
exercise_description
);
String
description_str
=
description_text
.
getText
().
toString
();
EditText
break_text
=
dialog
.
findViewById
(
R
.
id
.
exercice_break
);
String
string_break
=
break_text
.
getText
().
toString
();
Integer
break_time
=
Integer
.
parseInt
(
string_break
);
EditText
timer_edit
=
dialog
.
findViewById
(
R
.
id
.
exercise_timer
);
String
string_timer
=
timer_edit
.
getText
().
toString
();
String
img
=
"@drawable/"
+
img_actual_exo
;
if
(
string_timer
.
equals
(
""
)){
actual_exo
=
new
Exercise
(
exercise_searched
,
description_str
,
break_time
,
img
,
0
);
}
else
{
Integer
timer_int
=
Integer
.
parseInt
(
string_timer
);
actual_exo
=
new
Exercise
(
exercise_searched
,
description_str
,
break_time
,
img
,
timer_int
);
if
(
nbre_day
>
0
){
EditText
description_text
=
dialog
.
findViewById
(
R
.
id
.
exercise_description
);
String
description_str
=
description_text
.
getText
().
toString
();
EditText
break_text
=
dialog
.
findViewById
(
R
.
id
.
exercice_break
);
String
string_break
=
break_text
.
getText
().
toString
();
Integer
break_time
=
Integer
.
parseInt
(
string_break
);
EditText
timer_edit
=
dialog
.
findViewById
(
R
.
id
.
exercise_timer
);
String
string_timer
=
timer_edit
.
getText
().
toString
();
String
img
=
"@drawable/"
+
img_actual_exo
;
if
(
string_timer
.
equals
(
""
)){
actual_exo
=
new
Exercise
(
exercise_searched
,
description_str
,
break_time
,
img
,
0
);
}
else
{
Integer
timer_int
=
Integer
.
parseInt
(
string_timer
);
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
));
dialog
.
dismiss
();
// Effacer le champ de texte AutoCompleteTextView
input_exo
.
setText
(
""
);
}
else
{
Toast
.
makeText
(
ProgramCreationActivity
.
this
,
"Veuillez sélectionner au moins un jour !"
,
Toast
.
LENGTH_SHORT
).
show
();
}
});
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 {
/**
* Add the new exercise to the program
*/
System
.
out
.
println
(
exercise
.
description
);
System
.
out
.
println
(
exercise
.
timer
);
if
(
exoInProgram
(
exercise
))
{
Toast
.
makeText
(
this
,
"Exercice déjà dans le programme !"
,
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 @@
android:text=
""
/>
<TextView
android:id=
"@+id/text_break"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
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