Compare commits
1 commit
| Author | SHA1 | Date | |
|---|---|---|---|
| b7f77e157f |
29 changed files with 354 additions and 1003 deletions
|
|
@ -4,7 +4,7 @@
|
||||||
<selectionStates>
|
<selectionStates>
|
||||||
<SelectionState runConfigName="app">
|
<SelectionState runConfigName="app">
|
||||||
<option name="selectionMode" value="DROPDOWN" />
|
<option name="selectionMode" value="DROPDOWN" />
|
||||||
<DropdownSelection timestamp="2026-02-05T11:33:42.096254600Z">
|
<DropdownSelection timestamp="2026-02-03T14:43:08.366675Z">
|
||||||
<Target type="DEFAULT_BOOT">
|
<Target type="DEFAULT_BOOT">
|
||||||
<handle>
|
<handle>
|
||||||
<DeviceId pluginId="PhysicalDevice" identifier="serial=QGP7K78LKBMVZTRC" />
|
<DeviceId pluginId="PhysicalDevice" identifier="serial=QGP7K78LKBMVZTRC" />
|
||||||
|
|
@ -27,28 +27,7 @@
|
||||||
</DialogSelection>
|
</DialogSelection>
|
||||||
</SelectionState>
|
</SelectionState>
|
||||||
<SelectionState runConfigName="testCalculIMG()">
|
<SelectionState runConfigName="testCalculIMG()">
|
||||||
<option name="selectionMode" value="DIALOG" />
|
<option name="selectionMode" value="DROPDOWN" />
|
||||||
<DropdownSelection timestamp="2026-02-04T16:57:48.611512800Z">
|
|
||||||
<Target type="DEFAULT_BOOT">
|
|
||||||
<handle>
|
|
||||||
<DeviceId pluginId="PhysicalDevice" identifier="serial=QGP7K78LKBMVZTRC" />
|
|
||||||
</handle>
|
|
||||||
</Target>
|
|
||||||
</DropdownSelection>
|
|
||||||
<DialogSelection>
|
|
||||||
<targets>
|
|
||||||
<Target type="DEFAULT_BOOT">
|
|
||||||
<handle>
|
|
||||||
<DeviceId pluginId="PhysicalDevice" identifier="serial=QGP7K78LKBMVZTRC" />
|
|
||||||
</handle>
|
|
||||||
</Target>
|
|
||||||
<Target type="DEFAULT_BOOT">
|
|
||||||
<handle>
|
|
||||||
<DeviceId pluginId="LocalEmulator" identifier="path=C:\Users\erwan\.android\avd\Medium_Phone.avd" />
|
|
||||||
</handle>
|
|
||||||
</Target>
|
|
||||||
</targets>
|
|
||||||
</DialogSelection>
|
|
||||||
</SelectionState>
|
</SelectionState>
|
||||||
</selectionStates>
|
</selectionStates>
|
||||||
</component>
|
</component>
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ android {
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
applicationId "com.example.coach"
|
applicationId "com.example.coach"
|
||||||
minSdk 21
|
minSdk 16
|
||||||
targetSdk 36
|
targetSdk 36
|
||||||
versionCode 1
|
versionCode 1
|
||||||
versionName "1.0"
|
versionName "1.0"
|
||||||
|
|
@ -34,11 +34,8 @@ dependencies {
|
||||||
implementation libs.material
|
implementation libs.material
|
||||||
implementation libs.activity
|
implementation libs.activity
|
||||||
implementation libs.constraintlayout
|
implementation libs.constraintlayout
|
||||||
implementation libs.recyclerview
|
|
||||||
testImplementation libs.junit
|
testImplementation libs.junit
|
||||||
androidTestImplementation libs.ext.junit
|
androidTestImplementation libs.ext.junit
|
||||||
androidTestImplementation libs.espresso.core
|
androidTestImplementation libs.espresso.core
|
||||||
implementation 'com.google.code.gson:gson:2.11.0'
|
implementation 'com.google.code.gson:gson:2.11.0'
|
||||||
implementation 'com.squareup.retrofit2:retrofit:2.11.0'
|
|
||||||
implementation 'com.squareup.retrofit2:converter-gson:2.11.0'
|
|
||||||
}
|
}
|
||||||
|
|
@ -12,14 +12,15 @@ import static androidx.test.espresso.action.ViewActions.click;
|
||||||
import static androidx.test.espresso.action.ViewActions.typeText;
|
import static androidx.test.espresso.action.ViewActions.typeText;
|
||||||
import static androidx.test.espresso.action.ViewActions.closeSoftKeyboard;
|
import static androidx.test.espresso.action.ViewActions.closeSoftKeyboard;
|
||||||
import static androidx.test.espresso.matcher.ViewMatchers.withId;
|
import static androidx.test.espresso.matcher.ViewMatchers.withId;
|
||||||
|
import static androidx.test.espresso.assertion.ViewAssertions.matches;
|
||||||
import static androidx.test.espresso.matcher.ViewMatchers.withText;
|
import static androidx.test.espresso.matcher.ViewMatchers.withText;
|
||||||
|
|
||||||
import com.example.coach.R;
|
import com.example.coach.R;
|
||||||
|
|
||||||
@RunWith(AndroidJUnit4.class)
|
@RunWith(AndroidJUnit4.class)
|
||||||
public class CalculActivityTest {
|
public class MainActivityTest {
|
||||||
@Rule
|
@Rule
|
||||||
public ActivityScenarioRule activityRule = new ActivityScenarioRule<>(CalculActivity.class);
|
public ActivityScenarioRule activityRule = new ActivityScenarioRule<>(MainActivity.class);
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testCalculIMG(){
|
public void testCalculIMG(){
|
||||||
|
|
@ -2,8 +2,6 @@
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:tools="http://schemas.android.com/tools">
|
xmlns:tools="http://schemas.android.com/tools">
|
||||||
|
|
||||||
<uses-permission android:name="android.permission.INTERNET" />
|
|
||||||
|
|
||||||
<application
|
<application
|
||||||
android:allowBackup="true"
|
android:allowBackup="true"
|
||||||
android:dataExtractionRules="@xml/data_extraction_rules"
|
android:dataExtractionRules="@xml/data_extraction_rules"
|
||||||
|
|
@ -12,26 +10,16 @@
|
||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
android:roundIcon="@mipmap/ic_launcher_round"
|
android:roundIcon="@mipmap/ic_launcher_round"
|
||||||
android:supportsRtl="true"
|
android:supportsRtl="true"
|
||||||
android:theme="@style/Theme.Coach"
|
android:theme="@style/Theme.Coach">
|
||||||
android:usesCleartextTraffic="true">
|
|
||||||
<activity
|
|
||||||
android:name=".view.HistoActivity"
|
|
||||||
android:parentActivityName=".view.MainActivity"
|
|
||||||
android:exported="false" />
|
|
||||||
<activity
|
<activity
|
||||||
android:name=".view.MainActivity"
|
android:name=".view.MainActivity"
|
||||||
android:exported="true"
|
android:exported="true">
|
||||||
android:launchMode="singleTop">
|
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.MAIN" />
|
<action android:name="android.intent.action.MAIN" />
|
||||||
|
|
||||||
<category android:name="android.intent.category.LAUNCHER" />
|
<category android:name="android.intent.category.LAUNCHER" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</activity>
|
</activity>
|
||||||
<activity
|
|
||||||
android:name=".view.CalculActivity"
|
|
||||||
android:exported="false"
|
|
||||||
android:parentActivityName=".view.MainActivity"></activity>
|
|
||||||
</application>
|
</application>
|
||||||
|
|
||||||
</manifest>
|
</manifest>
|
||||||
|
|
@ -1,30 +0,0 @@
|
||||||
package com.example.coach.api;
|
|
||||||
|
|
||||||
import com.google.gson.Gson;
|
|
||||||
import com.google.gson.GsonBuilder;
|
|
||||||
|
|
||||||
import retrofit2.Retrofit;
|
|
||||||
import retrofit2.converter.gson.GsonConverterFactory;
|
|
||||||
|
|
||||||
public class CoachApi {
|
|
||||||
private static final String API_URL = "http://10.0.2.2/rest_coach/";
|
|
||||||
private static Retrofit retrofit = null;
|
|
||||||
private static Gson gson = new GsonBuilder()
|
|
||||||
.setDateFormat("yyyy-MM-dd HH:mm:ss")
|
|
||||||
.create();
|
|
||||||
|
|
||||||
public static Retrofit getRetrofit()
|
|
||||||
{
|
|
||||||
if(retrofit == null){
|
|
||||||
retrofit = new Retrofit.Builder()
|
|
||||||
.baseUrl(API_URL)
|
|
||||||
.addConverterFactory(GsonConverterFactory.create(gson))
|
|
||||||
.build();
|
|
||||||
}
|
|
||||||
return retrofit;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Gson getGson() {
|
|
||||||
return gson;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,45 +0,0 @@
|
||||||
package com.example.coach.api;
|
|
||||||
|
|
||||||
import android.util.Log;
|
|
||||||
|
|
||||||
import com.example.coach.model.Profil;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import retrofit2.Call;
|
|
||||||
import retrofit2.Callback;
|
|
||||||
import retrofit2.Response;
|
|
||||||
|
|
||||||
public class HelperApi {
|
|
||||||
private static final IRequestApi api = CoachApi.getRetrofit().create(IRequestApi.class);
|
|
||||||
|
|
||||||
public static IRequestApi getApi()
|
|
||||||
{
|
|
||||||
return api;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static <T> void call(Call<ResponseApi<T>> call, ICallbackApi<T> callback)
|
|
||||||
{
|
|
||||||
call.enqueue(new Callback<ResponseApi<T>>() {
|
|
||||||
@Override
|
|
||||||
public void onResponse(Call<ResponseApi<T>> call, Response<ResponseApi<T>> response) {
|
|
||||||
Log.d("API", "code : " + response.body().getCode() +
|
|
||||||
" message : " + response.body().getMessage() +
|
|
||||||
" result : " + response.body().getResult()
|
|
||||||
);
|
|
||||||
if (response.isSuccessful() && response.body() != null) {
|
|
||||||
callback.onSuccess(response.body().getResult());
|
|
||||||
} else {
|
|
||||||
callback.onError();
|
|
||||||
Log.e("API", "Erreur API: " + response.code());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onFailure(Call<ResponseApi<T>> call, Throwable throwable) {
|
|
||||||
callback.onError();
|
|
||||||
Log.e("API", "Erreur API", throwable);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,6 +0,0 @@
|
||||||
package com.example.coach.api;
|
|
||||||
|
|
||||||
public interface ICallbackApi<T> {
|
|
||||||
void onSuccess(T result);
|
|
||||||
void onError();
|
|
||||||
}
|
|
||||||
|
|
@ -1,25 +0,0 @@
|
||||||
package com.example.coach.api;
|
|
||||||
|
|
||||||
import com.example.coach.model.Profil;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import retrofit2.Call;
|
|
||||||
import retrofit2.http.DELETE;
|
|
||||||
import retrofit2.http.Field;
|
|
||||||
import retrofit2.http.FormUrlEncoded;
|
|
||||||
import retrofit2.http.GET;
|
|
||||||
import retrofit2.http.POST;
|
|
||||||
import retrofit2.http.Path;
|
|
||||||
|
|
||||||
public interface IRequestApi {
|
|
||||||
@GET("profil")
|
|
||||||
Call<ResponseApi<List<Profil>>> getProfils();
|
|
||||||
|
|
||||||
@FormUrlEncoded
|
|
||||||
@POST("profil")
|
|
||||||
Call<ResponseApi<Integer>> creerProfil(@Field("champs") String profilJson);
|
|
||||||
|
|
||||||
@DELETE("profil/{champs}")
|
|
||||||
Call<ResponseApi<Integer>> supprProfil(@Path(value = "champs", encoded = true) String profilJson);
|
|
||||||
}
|
|
||||||
|
|
@ -1,31 +0,0 @@
|
||||||
package com.example.coach.api;
|
|
||||||
|
|
||||||
public class ResponseApi<T> {
|
|
||||||
private int code;
|
|
||||||
private String message;
|
|
||||||
private T result;
|
|
||||||
|
|
||||||
public int getCode() {
|
|
||||||
return code;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCode(int code) {
|
|
||||||
this.code = code;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getMessage() {
|
|
||||||
return message;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setMessage(String message) {
|
|
||||||
this.message = message;
|
|
||||||
}
|
|
||||||
|
|
||||||
public T getResult() {
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setResult(T result) {
|
|
||||||
this.result = result;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,5 +0,0 @@
|
||||||
package com.example.coach.contract;
|
|
||||||
|
|
||||||
public interface IAllView {
|
|
||||||
void afficherMessage(String message);
|
|
||||||
}
|
|
||||||
|
|
@ -3,7 +3,7 @@ package com.example.coach.contract;
|
||||||
/**
|
/**
|
||||||
* Contrat pour que le CalculPresenter puisse envoyer des infos à la vue
|
* Contrat pour que le CalculPresenter puisse envoyer des infos à la vue
|
||||||
*/
|
*/
|
||||||
public interface ICalculView extends IAllView{
|
public interface ICalculView {
|
||||||
/**
|
/**
|
||||||
* Méthode permettant le transfert des résultats vers la vue
|
* Méthode permettant le transfert des résultats vers la vue
|
||||||
* @param image nom du fichier du smiley
|
* @param image nom du fichier du smiley
|
||||||
|
|
|
||||||
|
|
@ -1,10 +0,0 @@
|
||||||
package com.example.coach.contract;
|
|
||||||
|
|
||||||
import com.example.coach.model.Profil;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public interface IHistoView extends IAllView {
|
|
||||||
void afficherListe(List profils);
|
|
||||||
void transfertProfil(Profil profil);
|
|
||||||
}
|
|
||||||
90
app/src/main/java/com/example/coach/data/ProfilDAO.java
Normal file
90
app/src/main/java/com/example/coach/data/ProfilDAO.java
Normal file
|
|
@ -0,0 +1,90 @@
|
||||||
|
package com.example.coach.data;
|
||||||
|
|
||||||
|
import android.content.ContentValues;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.database.Cursor;
|
||||||
|
import android.database.sqlite.SQLiteDatabase;
|
||||||
|
import android.database.sqlite.SQLiteOpenHelper;
|
||||||
|
|
||||||
|
import com.example.coach.model.Profil;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
public class ProfilDAO extends SQLiteOpenHelper {
|
||||||
|
|
||||||
|
private static final String DATABASE_NAME = "coach.db";
|
||||||
|
private static final int DATABASE_VERSION = 1;
|
||||||
|
private static final String TABLE_PROFIL = "profil";
|
||||||
|
private static final String COL_POIDS = "poids";
|
||||||
|
private static final String COL_TAILLE = "taille";
|
||||||
|
private static final String COL_AGE = "age";
|
||||||
|
private static final String COL_SEXE = "sexe";
|
||||||
|
private static final String COL_DATEMESURE = "dateMesure";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param db The database.
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void onCreate(SQLiteDatabase db) {
|
||||||
|
String createTable = "CREATE TABLE " + TABLE_PROFIL + " (" +
|
||||||
|
COL_DATEMESURE + " INTEGER PRIMARY KEY, "+
|
||||||
|
COL_POIDS + " INTEGER, "+
|
||||||
|
COL_TAILLE + " INTEGER, "+
|
||||||
|
COL_AGE + " INTEGER, "+
|
||||||
|
COL_SEXE + " INTEGER)";
|
||||||
|
db.execSQL(createTable);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param db The database.
|
||||||
|
* @param oldVersion The old database version.
|
||||||
|
* @param newVersion The new database version.
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
|
||||||
|
db.execSQL("DROP TABLE IF EXISTS " + TABLE_PROFIL);
|
||||||
|
onCreate(db);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ProfilDAO(Context context)
|
||||||
|
{
|
||||||
|
super(context, DATABASE_NAME, null, DATABASE_VERSION);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void insertProfil(Profil profil)
|
||||||
|
{
|
||||||
|
SQLiteDatabase db = this.getWritableDatabase();
|
||||||
|
ContentValues values = new ContentValues();
|
||||||
|
|
||||||
|
values.put(COL_POIDS, profil.getPoids());
|
||||||
|
values.put(COL_AGE, profil.getAge());
|
||||||
|
values.put(COL_TAILLE, profil.getTaille());
|
||||||
|
values.put(COL_SEXE, profil.getSexe());
|
||||||
|
values.put(COL_DATEMESURE, profil.getDateMesure().getTime());
|
||||||
|
|
||||||
|
db.insert(TABLE_PROFIL, null, values);
|
||||||
|
db.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Profil getLastProfil()
|
||||||
|
{
|
||||||
|
SQLiteDatabase db = this.getReadableDatabase();
|
||||||
|
Profil profil = null;
|
||||||
|
String query = "SELECT * FROM " + TABLE_PROFIL + " ORDER BY " + COL_DATEMESURE + " DESC LIMIT 1";
|
||||||
|
Cursor cursor = db.rawQuery(query, null);
|
||||||
|
|
||||||
|
if(cursor.moveToFirst()){
|
||||||
|
int poids = cursor.getInt(cursor.getColumnIndexOrThrow(COL_POIDS));
|
||||||
|
int taille = cursor.getInt(cursor.getColumnIndexOrThrow(COL_TAILLE));
|
||||||
|
int age = cursor.getInt(cursor.getColumnIndexOrThrow(COL_AGE));
|
||||||
|
int sexe = cursor.getInt(cursor.getColumnIndexOrThrow(COL_SEXE));
|
||||||
|
long date = cursor.getLong(cursor.getColumnIndexOrThrow(COL_DATEMESURE));
|
||||||
|
|
||||||
|
profil = new Profil(poids, taille, age, sexe, new Date(date));
|
||||||
|
}
|
||||||
|
cursor.close();
|
||||||
|
db.close();
|
||||||
|
|
||||||
|
return profil;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,12 +1,11 @@
|
||||||
package com.example.coach.model;
|
package com.example.coach.model;
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Classe métier contenant les informations d'un profil
|
* Classe métier contenant les informations d'un profil
|
||||||
*/
|
*/
|
||||||
public class Profil implements Serializable {
|
public class Profil {
|
||||||
private static final int MIN_FEMME = 25;
|
private static final int MIN_FEMME = 25;
|
||||||
private static final int MAX_FEMME = 30;
|
private static final int MAX_FEMME = 30;
|
||||||
private static final int MIN_HOMME = 15;
|
private static final int MIN_HOMME = 15;
|
||||||
|
|
@ -19,8 +18,8 @@ public class Profil implements Serializable {
|
||||||
private Integer taille;
|
private Integer taille;
|
||||||
private Integer age;
|
private Integer age;
|
||||||
private Integer sexe;
|
private Integer sexe;
|
||||||
private transient double img;
|
private double img;
|
||||||
private transient int indice;
|
private int indice;
|
||||||
private Date dateMesure;
|
private Date dateMesure;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -84,7 +83,7 @@ public class Profil implements Serializable {
|
||||||
* @return Valeur de l'img
|
* @return Valeur de l'img
|
||||||
*/
|
*/
|
||||||
public double getImg(){
|
public double getImg(){
|
||||||
return calculImg();
|
return this.img;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -1,37 +1,27 @@
|
||||||
package com.example.coach.presenter;
|
package com.example.coach.presenter;
|
||||||
|
|
||||||
import android.util.Log;
|
import android.content.Context;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
|
|
||||||
import com.example.coach.api.CoachApi;
|
|
||||||
import com.example.coach.api.HelperApi;
|
|
||||||
import com.example.coach.api.ICallbackApi;
|
|
||||||
import com.example.coach.api.IRequestApi;
|
|
||||||
import com.example.coach.api.ResponseApi;
|
|
||||||
import com.example.coach.contract.ICalculView;
|
import com.example.coach.contract.ICalculView;
|
||||||
|
import com.example.coach.data.ProfilDAO;
|
||||||
import com.example.coach.model.Profil;
|
import com.example.coach.model.Profil;
|
||||||
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import retrofit2.Call;
|
|
||||||
import retrofit2.Callback;
|
|
||||||
import retrofit2.Response;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 'presenter' dédié à la vue affichant le calcul de l'img
|
* 'presenter' dédié à la vue affichant le calcul de l'img
|
||||||
*/
|
*/
|
||||||
public class CalculPresenter {
|
public class CalculPresenter {
|
||||||
private ICalculView vue;
|
private ICalculView vue;
|
||||||
|
private ProfilDAO profilDAO;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructeur : valorise la propriété permettant d'accéder à la vue
|
* Constructeur : valorise la propriété permettant d'accéder à la vue
|
||||||
* @param vue
|
* @param vue
|
||||||
*/
|
*/
|
||||||
public CalculPresenter(ICalculView vue) {
|
public CalculPresenter(ICalculView vue, Context context) {
|
||||||
this.vue = vue;
|
this.vue = vue;
|
||||||
|
this.profilDAO = new ProfilDAO(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -45,52 +35,16 @@ public class CalculPresenter {
|
||||||
public void creerProfil(Integer sexe, Integer poids, Integer taille, Integer age)
|
public void creerProfil(Integer sexe, Integer poids, Integer taille, Integer age)
|
||||||
{
|
{
|
||||||
Profil profil = new Profil(poids, taille, age, sexe, new Date());
|
Profil profil = new Profil(poids, taille, age, sexe, new Date());
|
||||||
|
profilDAO.insertProfil(profil);
|
||||||
vue.AfficherResultat(profil.getImage(), profil.getImg(), profil.getMessage(), profil.normal());
|
vue.AfficherResultat(profil.getImage(), profil.getImg(), profil.getMessage(), profil.normal());
|
||||||
String profilJson = CoachApi.getGson().toJson(profil);
|
|
||||||
HelperApi.call(HelperApi.getApi().creerProfil(profilJson), new ICallbackApi<Integer>() {
|
|
||||||
@Override
|
|
||||||
public void onSuccess(Integer result) {
|
|
||||||
if (result == 1) {
|
|
||||||
vue.afficherMessage("profil enregistré");
|
|
||||||
}else{
|
|
||||||
vue.afficherMessage("échec enregistrement profil");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onError() {
|
|
||||||
vue.afficherMessage("échec enregistrement profil");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void chargerDernierProfil()
|
public void chargerDernierProfil()
|
||||||
{
|
{
|
||||||
IRequestApi api = HelperApi.getApi();
|
Profil profil = profilDAO.getLastProfil();
|
||||||
HelperApi.call(api.getProfils(), new ICallbackApi<List<Profil>>() {
|
if(profil != null)
|
||||||
@Override
|
{
|
||||||
public void onSuccess(List<Profil> result) {
|
vue.remplirChamps(profil.getPoids(), profil.getTaille(), profil.getAge(), profil.getSexe());
|
||||||
if(result != null){
|
|
||||||
List<Profil> profils = result;
|
|
||||||
if (profils != null && !profils.isEmpty()) {
|
|
||||||
// récupérer le plus récent
|
|
||||||
Profil dernier = Collections.max(profils,
|
|
||||||
(p1, p2) -> p1.getDateMesure().compareTo(p2.getDateMesure())
|
|
||||||
);
|
|
||||||
vue.remplirChamps(dernier.getPoids(), dernier.getTaille(),
|
|
||||||
dernier.getAge(), dernier.getSexe());
|
|
||||||
}else{
|
|
||||||
vue.afficherMessage("échec récupération dernier profil");
|
|
||||||
}
|
}
|
||||||
}else{
|
|
||||||
vue.afficherMessage("échec récupération dernier profil");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onError() {
|
|
||||||
vue.afficherMessage("échec récupération dernier profil");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,74 +0,0 @@
|
||||||
package com.example.coach.presenter;
|
|
||||||
|
|
||||||
import android.util.Log;
|
|
||||||
|
|
||||||
import com.example.coach.api.CoachApi;
|
|
||||||
import com.example.coach.api.HelperApi;
|
|
||||||
import com.example.coach.api.ICallbackApi;
|
|
||||||
import com.example.coach.api.IRequestApi;
|
|
||||||
import com.example.coach.api.ResponseApi;
|
|
||||||
import com.example.coach.contract.IHistoView;
|
|
||||||
import com.example.coach.model.Profil;
|
|
||||||
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import retrofit2.Call;
|
|
||||||
import retrofit2.Callback;
|
|
||||||
import retrofit2.Response;
|
|
||||||
|
|
||||||
public class HistoPresenter {
|
|
||||||
private IHistoView vue;
|
|
||||||
|
|
||||||
public HistoPresenter(IHistoView vue)
|
|
||||||
{
|
|
||||||
this.vue = vue;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void chargerProfils()
|
|
||||||
{
|
|
||||||
HelperApi.call(HelperApi.getApi().getProfils(), new ICallbackApi<List<Profil>>() {
|
|
||||||
@Override
|
|
||||||
public void onSuccess(List<Profil> result) {
|
|
||||||
if(result != null){
|
|
||||||
List<Profil> profils = result;
|
|
||||||
Collections.sort(profils, (p1, p2) -> p2.getDateMesure().compareTo(p1.getDateMesure()));
|
|
||||||
vue.afficherListe(profils);
|
|
||||||
}else{
|
|
||||||
vue.afficherMessage("échec récupération des derniers profils");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onError() {
|
|
||||||
vue.afficherMessage("échec récupération des derniers profils");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public void supprProfil(Profil profil, ICallbackApi<Void> callback)
|
|
||||||
{
|
|
||||||
String profilJson = CoachApi.getGson().toJson(profil);
|
|
||||||
HelperApi.call(HelperApi.getApi().supprProfil(profilJson), new ICallbackApi<Integer>() {
|
|
||||||
@Override
|
|
||||||
public void onSuccess(Integer result) {
|
|
||||||
if (result == 1) {
|
|
||||||
vue.afficherMessage("profil supprimé");
|
|
||||||
callback.onSuccess(null);
|
|
||||||
}else{
|
|
||||||
vue.afficherMessage("échec suppression profil");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onError() {
|
|
||||||
vue.afficherMessage("échec suppression profil");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public void transfertProfil(Profil profil)
|
|
||||||
{
|
|
||||||
vue.transfertProfil(profil);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,167 +0,0 @@
|
||||||
package com.example.coach.view;
|
|
||||||
|
|
||||||
import android.graphics.Color;
|
|
||||||
import android.os.Bundle;
|
|
||||||
import android.widget.Button;
|
|
||||||
import android.widget.EditText;
|
|
||||||
import android.widget.ImageView;
|
|
||||||
import android.widget.RadioButton;
|
|
||||||
import android.widget.TextView;
|
|
||||||
import android.widget.Toast;
|
|
||||||
|
|
||||||
import androidx.activity.EdgeToEdge;
|
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
|
||||||
import androidx.core.graphics.Insets;
|
|
||||||
import androidx.core.view.ViewCompat;
|
|
||||||
import androidx.core.view.WindowInsetsCompat;
|
|
||||||
|
|
||||||
import com.example.coach.R;
|
|
||||||
import com.example.coach.contract.ICalculView;
|
|
||||||
import com.example.coach.model.Profil;
|
|
||||||
import com.example.coach.presenter.CalculPresenter;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Activity qui permet le calcul de l'img
|
|
||||||
*/
|
|
||||||
public class CalculActivity extends AppCompatActivity implements ICalculView {
|
|
||||||
|
|
||||||
private EditText txtPoids;
|
|
||||||
private EditText txtTaille;
|
|
||||||
private EditText txtAge;
|
|
||||||
private RadioButton rdHomme;
|
|
||||||
private RadioButton rdFemme;
|
|
||||||
private TextView lblIMG;
|
|
||||||
private ImageView imgSmiley;
|
|
||||||
private Button btnCalc;
|
|
||||||
|
|
||||||
private CalculPresenter presenter;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
|
||||||
super.onCreate(savedInstanceState);
|
|
||||||
EdgeToEdge.enable(this);
|
|
||||||
setContentView(R.layout.activity_calcul);
|
|
||||||
ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main), (v, insets) -> {
|
|
||||||
Insets systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars());
|
|
||||||
v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom);
|
|
||||||
return insets;
|
|
||||||
});
|
|
||||||
init();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Méthode permettant l'affichage du résultat du calcul de l'img
|
|
||||||
* @param image nom du fichier drawable pour le smiley
|
|
||||||
* @param img valeur de l'img
|
|
||||||
* @param message message à afficher
|
|
||||||
* @param normal faux si l'img n'est pas normal, vrai dans le cas inverse
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void AfficherResultat(String image, double img, String message, boolean normal) {
|
|
||||||
int iamgeId = getResources().getIdentifier(image, "drawable", getPackageName());
|
|
||||||
String texte = String.format("%.01f", img) + " : IMG " + message;
|
|
||||||
|
|
||||||
if(iamgeId == 0){
|
|
||||||
imgSmiley.setImageResource(R.drawable.normal);
|
|
||||||
}else{
|
|
||||||
imgSmiley.setImageResource(iamgeId);
|
|
||||||
}
|
|
||||||
lblIMG.setText(texte);
|
|
||||||
if(!normal){
|
|
||||||
lblIMG.setTextColor(Color.RED);
|
|
||||||
}else{
|
|
||||||
lblIMG.setTextColor(Color.GREEN);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param poids poids stocké
|
|
||||||
* @param taille taille stockée
|
|
||||||
* @param age âge stocké
|
|
||||||
* @param sexe sexe stocké
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void remplirChamps(Integer poids, Integer taille, Integer age, Integer sexe) {
|
|
||||||
txtPoids.setText(poids.toString());
|
|
||||||
txtTaille.setText(taille.toString());
|
|
||||||
txtAge.setText(age.toString());
|
|
||||||
|
|
||||||
if(sexe == 1){
|
|
||||||
rdHomme.setChecked(true);
|
|
||||||
}else{
|
|
||||||
rdFemme.setChecked(true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Traitements à réaliser lors du lancement de l'application
|
|
||||||
*/
|
|
||||||
private void init()
|
|
||||||
{
|
|
||||||
chargeObjetsGraphiques();
|
|
||||||
presenter = new CalculPresenter(this);
|
|
||||||
btnCalc.setOnClickListener(v -> btnCalcClic());
|
|
||||||
recupProfil();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Récupère les objets graphiques
|
|
||||||
*/
|
|
||||||
private void chargeObjetsGraphiques()
|
|
||||||
{
|
|
||||||
txtPoids = (EditText) findViewById(R.id.txtPoids);
|
|
||||||
txtTaille = (EditText) findViewById(R.id.txtTaille);
|
|
||||||
txtAge = (EditText) findViewById(R.id.txtAge);
|
|
||||||
|
|
||||||
rdHomme = (RadioButton) findViewById(R.id.rdHomme);
|
|
||||||
rdFemme = (RadioButton) findViewById(R.id.rdFemme);
|
|
||||||
|
|
||||||
lblIMG = (TextView) findViewById(R.id.lblResultat);
|
|
||||||
|
|
||||||
imgSmiley = (ImageView) findViewById(R.id.imgSmiley);
|
|
||||||
|
|
||||||
btnCalc = (Button) findViewById(R.id.btnCalc);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Traitements à réaliser lors du clic sur le bouton
|
|
||||||
*/
|
|
||||||
private void btnCalcClic()
|
|
||||||
{
|
|
||||||
int poids = 0, taille = 0, age = 0, sexe = 0;
|
|
||||||
|
|
||||||
try {
|
|
||||||
poids = Integer.parseInt(txtPoids.getText().toString());
|
|
||||||
taille = Integer.parseInt(txtTaille.getText().toString());
|
|
||||||
age = Integer.parseInt(txtAge.getText().toString());
|
|
||||||
}catch (Exception ignored){}
|
|
||||||
|
|
||||||
if(rdHomme.isChecked()){
|
|
||||||
sexe = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(poids == 0 || taille == 0 || age == 0){
|
|
||||||
Toast.makeText(this, "Veuillez remplir tous les champs", Toast.LENGTH_SHORT).show();
|
|
||||||
}else{
|
|
||||||
presenter.creerProfil(sexe, poids, taille, age);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param message
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void afficherMessage(String message) {
|
|
||||||
Toast.makeText(this, message, Toast.LENGTH_SHORT).show();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void recupProfil()
|
|
||||||
{
|
|
||||||
Profil profil = (Profil) getIntent().getSerializableExtra("profil");
|
|
||||||
if(profil != null){
|
|
||||||
remplirChamps(profil.getPoids(), profil.getTaille(), profil.getAge(), profil.getSexe());
|
|
||||||
}else{
|
|
||||||
presenter.chargerDernierProfil();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,74 +0,0 @@
|
||||||
package com.example.coach.view;
|
|
||||||
|
|
||||||
import android.content.Intent;
|
|
||||||
import android.os.Bundle;
|
|
||||||
import android.widget.Toast;
|
|
||||||
|
|
||||||
import androidx.activity.EdgeToEdge;
|
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
|
||||||
import androidx.core.graphics.Insets;
|
|
||||||
import androidx.core.view.ViewCompat;
|
|
||||||
import androidx.core.view.WindowInsetsCompat;
|
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
|
||||||
|
|
||||||
import com.example.coach.R;
|
|
||||||
import com.example.coach.contract.IHistoView;
|
|
||||||
import com.example.coach.model.Profil;
|
|
||||||
import com.example.coach.presenter.HistoPresenter;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class HistoActivity extends AppCompatActivity implements IHistoView {
|
|
||||||
HistoPresenter presenter;
|
|
||||||
|
|
||||||
private void init()
|
|
||||||
{
|
|
||||||
presenter = new HistoPresenter(this);
|
|
||||||
presenter.chargerProfils();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
|
||||||
super.onCreate(savedInstanceState);
|
|
||||||
EdgeToEdge.enable(this);
|
|
||||||
setContentView(R.layout.activity_histo);
|
|
||||||
ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main), (v, insets) -> {
|
|
||||||
Insets systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars());
|
|
||||||
v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom);
|
|
||||||
init();
|
|
||||||
return insets;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param profils
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void afficherListe(List profils) {
|
|
||||||
if(profils != null){
|
|
||||||
RecyclerView lstHisto = (RecyclerView) findViewById(R.id.lstHisto);
|
|
||||||
HistoListAdapter adapter = new HistoListAdapter(profils, HistoActivity.this);
|
|
||||||
lstHisto.setAdapter(adapter);
|
|
||||||
lstHisto.setLayoutManager(new LinearLayoutManager(HistoActivity.this));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param profil
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void transfertProfil(Profil profil) {
|
|
||||||
Intent intent = new Intent(HistoActivity.this, CalculActivity.class);
|
|
||||||
intent.putExtra("profil", profil);
|
|
||||||
startActivity(intent);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param message
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void afficherMessage(String message) {
|
|
||||||
Toast.makeText(this, message, Toast.LENGTH_SHORT).show();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,128 +0,0 @@
|
||||||
package com.example.coach.view;
|
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
import android.view.LayoutInflater;
|
|
||||||
import android.view.View;
|
|
||||||
import android.view.ViewGroup;
|
|
||||||
import android.widget.ImageButton;
|
|
||||||
import android.widget.ImageView;
|
|
||||||
import android.widget.TextView;
|
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
|
||||||
|
|
||||||
import com.example.coach.R;
|
|
||||||
import com.example.coach.api.ICallbackApi;
|
|
||||||
import com.example.coach.contract.IHistoView;
|
|
||||||
import com.example.coach.model.Profil;
|
|
||||||
import com.example.coach.presenter.HistoPresenter;
|
|
||||||
|
|
||||||
import java.text.SimpleDateFormat;
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Locale;
|
|
||||||
|
|
||||||
public class HistoListAdapter extends RecyclerView.Adapter<HistoListAdapter.ViewHolder> {
|
|
||||||
|
|
||||||
private List<Profil> profils;
|
|
||||||
private IHistoView vue;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Retourne une ligne de la liste
|
|
||||||
* @param parent The ViewGroup into which the new View will be added after it is bound to
|
|
||||||
* an adapter position.
|
|
||||||
* @param viewType The view type of the new View.
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@NonNull
|
|
||||||
@Override
|
|
||||||
public HistoListAdapter.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
|
||||||
Context parentContext = parent.getContext();
|
|
||||||
LayoutInflater layout = LayoutInflater.from(parentContext);
|
|
||||||
View view = layout.inflate(R.layout.layout_list_histo, parent, false);
|
|
||||||
|
|
||||||
return new HistoListAdapter.ViewHolder(view);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Rempli une ligne
|
|
||||||
* @param holder The ViewHolder which should be updated to represent the contents of the
|
|
||||||
* item at the given position in the data set.
|
|
||||||
* @param position The position of the item within the adapter's data set.
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void onBindViewHolder(@NonNull HistoListAdapter.ViewHolder holder, int position) {
|
|
||||||
Double img = profils.get(position).getImg();
|
|
||||||
String img1desimal = String.format("%.01f", img);
|
|
||||||
holder.txtListIMG.setText(img1desimal);
|
|
||||||
|
|
||||||
Date dateMesure = profils.get(position).getDateMesure();
|
|
||||||
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss", Locale.getDefault());
|
|
||||||
String dateFormatee = sdf.format(dateMesure);
|
|
||||||
holder.txtListDate.setText(dateFormatee);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Compte le nombre de lignes
|
|
||||||
* @return int
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public int getItemCount() {
|
|
||||||
return profils.size();
|
|
||||||
}
|
|
||||||
|
|
||||||
public HistoListAdapter(List<Profil> profils, IHistoView vue)
|
|
||||||
{
|
|
||||||
this.profils = profils;
|
|
||||||
this.vue = vue;
|
|
||||||
}
|
|
||||||
|
|
||||||
public class ViewHolder extends RecyclerView.ViewHolder{
|
|
||||||
final TextView txtListDate;
|
|
||||||
final TextView txtListIMG;
|
|
||||||
final ImageButton btnListSuppr;
|
|
||||||
|
|
||||||
HistoPresenter presenter;
|
|
||||||
public ViewHolder(@NonNull View itemView) {
|
|
||||||
super(itemView);
|
|
||||||
|
|
||||||
txtListDate = (TextView) itemView.findViewById(R.id.txtListDate);
|
|
||||||
txtListIMG = (TextView) itemView.findViewById(R.id.txtListIMG);
|
|
||||||
btnListSuppr = (ImageButton) itemView.findViewById(R.id.btnListSuppr);
|
|
||||||
init();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void btnListSuppr_clic()
|
|
||||||
{
|
|
||||||
int position = getBindingAdapterPosition();
|
|
||||||
presenter.supprProfil(profils.get(position), new ICallbackApi<Void>() {
|
|
||||||
@Override
|
|
||||||
public void onSuccess(Void result) {
|
|
||||||
profils.remove(position);
|
|
||||||
notifyItemRemoved(position);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onError() {
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
private void init()
|
|
||||||
{
|
|
||||||
btnListSuppr.setOnClickListener(v -> btnListSuppr_clic());
|
|
||||||
txtListDate.setOnClickListener(v -> txtListDateOrImg_clic());
|
|
||||||
txtListIMG.setOnClickListener(v -> txtListDateOrImg_clic());
|
|
||||||
presenter = new HistoPresenter(vue);
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private void txtListDateOrImg_clic()
|
|
||||||
{
|
|
||||||
int position = getBindingAdapterPosition();
|
|
||||||
presenter.transfertProfil(profils.get(position));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,8 +1,13 @@
|
||||||
package com.example.coach.view;
|
package com.example.coach.view;
|
||||||
|
|
||||||
import android.content.Intent;
|
import android.graphics.Color;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.widget.ImageButton;
|
import android.widget.Button;
|
||||||
|
import android.widget.EditText;
|
||||||
|
import android.widget.ImageView;
|
||||||
|
import android.widget.RadioButton;
|
||||||
|
import android.widget.TextView;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
import androidx.activity.EdgeToEdge;
|
import androidx.activity.EdgeToEdge;
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
|
@ -11,11 +16,24 @@ import androidx.core.view.ViewCompat;
|
||||||
import androidx.core.view.WindowInsetsCompat;
|
import androidx.core.view.WindowInsetsCompat;
|
||||||
|
|
||||||
import com.example.coach.R;
|
import com.example.coach.R;
|
||||||
|
import com.example.coach.contract.ICalculView;
|
||||||
|
import com.example.coach.presenter.CalculPresenter;
|
||||||
|
|
||||||
public class MainActivity extends AppCompatActivity {
|
/**
|
||||||
|
* Activity qui permet le calcul de l'img
|
||||||
|
*/
|
||||||
|
public class MainActivity extends AppCompatActivity implements ICalculView {
|
||||||
|
|
||||||
private ImageButton btnMonIMG;
|
private EditText txtPoids;
|
||||||
private ImageButton btnMonHistorique;
|
private EditText txtTaille;
|
||||||
|
private EditText txtAge;
|
||||||
|
private RadioButton rdHomme;
|
||||||
|
private RadioButton rdFemme;
|
||||||
|
private TextView lblIMG;
|
||||||
|
private ImageView imgSmiley;
|
||||||
|
private Button btnCalc;
|
||||||
|
|
||||||
|
private CalculPresenter presenter;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
|
@ -25,32 +43,106 @@ public class MainActivity extends AppCompatActivity {
|
||||||
ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main), (v, insets) -> {
|
ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main), (v, insets) -> {
|
||||||
Insets systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars());
|
Insets systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars());
|
||||||
v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom);
|
v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom);
|
||||||
init();
|
|
||||||
return insets;
|
return insets;
|
||||||
});
|
});
|
||||||
|
init();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Méthode permettant l'affichage du résultat du calcul de l'img
|
||||||
|
* @param image nom du fichier drawable pour le smiley
|
||||||
|
* @param img valeur de l'img
|
||||||
|
* @param message message à afficher
|
||||||
|
* @param normal faux si l'img n'est pas normal, vrai dans le cas inverse
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void AfficherResultat(String image, double img, String message, boolean normal) {
|
||||||
|
int iamgeId = getResources().getIdentifier(image, "drawable", getPackageName());
|
||||||
|
String texte = String.format("%.01f", img) + " : IMG " + message;
|
||||||
|
|
||||||
|
if(iamgeId == 0){
|
||||||
|
imgSmiley.setImageResource(R.drawable.normal);
|
||||||
|
}else{
|
||||||
|
imgSmiley.setImageResource(iamgeId);
|
||||||
|
}
|
||||||
|
lblIMG.setText(texte);
|
||||||
|
if(!normal){
|
||||||
|
lblIMG.setTextColor(Color.RED);
|
||||||
|
}else{
|
||||||
|
lblIMG.setTextColor(Color.GREEN);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param poids poids stocké
|
||||||
|
* @param taille taille stockée
|
||||||
|
* @param age âge stocké
|
||||||
|
* @param sexe sexe stocké
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void remplirChamps(Integer poids, Integer taille, Integer age, Integer sexe) {
|
||||||
|
txtPoids.setText(poids.toString());
|
||||||
|
txtTaille.setText(taille.toString());
|
||||||
|
txtAge.setText(age.toString());
|
||||||
|
|
||||||
|
if(sexe == 1){
|
||||||
|
rdHomme.setChecked(true);
|
||||||
|
}else{
|
||||||
|
rdFemme.setChecked(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Traitements à réaliser lors du lancement de l'application
|
||||||
|
*/
|
||||||
private void init()
|
private void init()
|
||||||
{
|
{
|
||||||
chargeObjetsGraphiques();
|
chargeObjetsGraphiques();
|
||||||
creerMenu();
|
presenter = new CalculPresenter(this, this);
|
||||||
|
btnCalc.setOnClickListener(v -> btnCalcClic());
|
||||||
|
presenter.chargerDernierProfil();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Récupère les objets graphiques
|
||||||
|
*/
|
||||||
private void chargeObjetsGraphiques()
|
private void chargeObjetsGraphiques()
|
||||||
{
|
{
|
||||||
btnMonIMG = (ImageButton) findViewById(R.id.btnMonIMG);
|
txtPoids = (EditText) findViewById(R.id.txtPoids);
|
||||||
btnMonHistorique = (ImageButton) findViewById(R.id.btnMonHistorique);
|
txtTaille = (EditText) findViewById(R.id.txtTaille);
|
||||||
|
txtAge = (EditText) findViewById(R.id.txtAge);
|
||||||
|
|
||||||
|
rdHomme = (RadioButton) findViewById(R.id.rdHomme);
|
||||||
|
rdFemme = (RadioButton) findViewById(R.id.rdFemme);
|
||||||
|
|
||||||
|
lblIMG = (TextView) findViewById(R.id.lblResultat);
|
||||||
|
|
||||||
|
imgSmiley = (ImageView) findViewById(R.id.imgSmiley);
|
||||||
|
|
||||||
|
btnCalc = (Button) findViewById(R.id.btnCalc);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ecouteMenu(Class classe)
|
/**
|
||||||
|
* Traitements à réaliser lors du clic sur le bouton
|
||||||
|
*/
|
||||||
|
private void btnCalcClic()
|
||||||
{
|
{
|
||||||
Intent intent = new Intent(MainActivity.this, classe);
|
int poids = 0, taille = 0, age = 0, sexe = 0;
|
||||||
startActivity(intent);
|
|
||||||
|
try {
|
||||||
|
poids = Integer.parseInt(txtPoids.getText().toString());
|
||||||
|
taille = Integer.parseInt(txtTaille.getText().toString());
|
||||||
|
age = Integer.parseInt(txtAge.getText().toString());
|
||||||
|
}catch (Exception ignored){}
|
||||||
|
|
||||||
|
if(rdHomme.isChecked()){
|
||||||
|
sexe = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void creerMenu()
|
if(poids == 0 || taille == 0 || age == 0){
|
||||||
{
|
Toast.makeText(this, "Veuillez remplir tous les champs", Toast.LENGTH_SHORT).show();
|
||||||
btnMonIMG.setOnClickListener(v -> ecouteMenu(CalculActivity.class));
|
}else{
|
||||||
btnMonHistorique.setOnClickListener(v -> ecouteMenu(HistoActivity.class));
|
presenter.creerProfil(sexe, poids, taille, age);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 21 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 5.2 KiB |
|
|
@ -1,173 +0,0 @@
|
||||||
<?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:id="@+id/main"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
tools:context=".view.CalculActivity">
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:orientation="vertical"
|
|
||||||
tools:layout_editor_absoluteX="1dp"
|
|
||||||
tools:layout_editor_absoluteY="1dp">
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:layout_gravity="center_horizontal"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:orientation="horizontal">
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:layout_gravity="center_horizontal"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:gravity="center_horizontal|center_vertical"
|
|
||||||
android:orientation="vertical">
|
|
||||||
|
|
||||||
<RadioGroup
|
|
||||||
android:id="@+id/grpRadioSexe"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent">
|
|
||||||
|
|
||||||
<RadioButton
|
|
||||||
android:id="@+id/rdHomme"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="0dp"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:checked="true"
|
|
||||||
android:text="Homme" />
|
|
||||||
|
|
||||||
<RadioButton
|
|
||||||
android:id="@+id/rdFemme"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="0dp"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:text="Femme" />
|
|
||||||
</RadioGroup>
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:layout_gravity="center_horizontal"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:orientation="vertical">
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:layout_gravity="center_horizontal"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:gravity="center_horizontal|center_vertical"
|
|
||||||
android:orientation="horizontal">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/textView"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:text="Poids :" />
|
|
||||||
|
|
||||||
<EditText
|
|
||||||
android:id="@+id/txtPoids"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:ems="10"
|
|
||||||
android:inputType="number" />
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:layout_gravity="center_horizontal"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:gravity="center_horizontal|center_vertical"
|
|
||||||
android:orientation="horizontal">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/textView2"
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:text="Taille :" />
|
|
||||||
|
|
||||||
<EditText
|
|
||||||
android:id="@+id/txtTaille"
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:ems="10"
|
|
||||||
android:inputType="number" />
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:layout_gravity="center_horizontal"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:gravity="center_horizontal|center_vertical"
|
|
||||||
android:orientation="horizontal">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/textView3"
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:text="Age :" />
|
|
||||||
|
|
||||||
<EditText
|
|
||||||
android:id="@+id/txtAge"
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:ems="10"
|
|
||||||
android:inputType="number" />
|
|
||||||
</LinearLayout>
|
|
||||||
</LinearLayout>
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_gravity="center_horizontal"
|
|
||||||
android:layout_weight="0"
|
|
||||||
android:gravity="center_horizontal|center_vertical"
|
|
||||||
android:orientation="horizontal">
|
|
||||||
|
|
||||||
<Button
|
|
||||||
android:id="@+id/btnCalc"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:text="Calculer" />
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:layout_gravity="center_horizontal"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:gravity="center_horizontal|center_vertical"
|
|
||||||
android:orientation="horizontal">
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/imgSmiley"
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_weight="1"
|
|
||||||
app:srcCompat="@drawable/normal" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/lblResultat"
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_weight="1" />
|
|
||||||
</LinearLayout>
|
|
||||||
</LinearLayout>
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
||||||
|
|
@ -1,22 +0,0 @@
|
||||||
<?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:id="@+id/main"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
tools:context=".view.HistoActivity">
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:orientation="vertical">
|
|
||||||
|
|
||||||
<androidx.recyclerview.widget.RecyclerView
|
|
||||||
android:id="@+id/lstHisto"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:layout_marginTop="?attr/actionBarSize"
|
|
||||||
android:scrollbars="vertical" />
|
|
||||||
</LinearLayout>
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
||||||
|
|
@ -10,64 +10,164 @@
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical"
|
||||||
|
tools:layout_editor_absoluteX="1dp"
|
||||||
|
tools:layout_editor_absoluteY="1dp">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
|
android:layout_gravity="center_horizontal"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_gravity="center_horizontal"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:gravity="center_horizontal|center_vertical"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<RadioGroup
|
||||||
|
android:id="@+id/grpRadioSexe"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
|
<RadioButton
|
||||||
|
android:id="@+id/rdHomme"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:checked="true"
|
||||||
|
android:text="Homme" />
|
||||||
|
|
||||||
|
<RadioButton
|
||||||
|
android:id="@+id/rdFemme"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:text="Femme" />
|
||||||
|
</RadioGroup>
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_gravity="center_horizontal"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
|
android:layout_gravity="center_horizontal"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:orientation="vertical"></LinearLayout>
|
android:gravity="center_horizontal|center_vertical"
|
||||||
|
android:orientation="horizontal">
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:orientation="vertical">
|
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/textView4"
|
android:id="@+id/textView"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:gravity="center_horizontal"
|
android:layout_weight="1"
|
||||||
android:text="mon IMG"
|
android:text="Poids :" />
|
||||||
android:textSize="34sp" />
|
|
||||||
|
|
||||||
<ImageButton
|
<EditText
|
||||||
android:id="@+id/btnMonIMG"
|
android:id="@+id/txtPoids"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:ems="10"
|
||||||
|
android:inputType="number" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_gravity="center_horizontal"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:gravity="center_horizontal|center_vertical"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/textView2"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:text="Taille :" />
|
||||||
|
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/txtTaille"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:ems="10"
|
||||||
|
android:inputType="number" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_gravity="center_horizontal"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:gravity="center_horizontal|center_vertical"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/textView3"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:text="Age :" />
|
||||||
|
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/txtAge"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:ems="10"
|
||||||
|
android:inputType="number" />
|
||||||
|
</LinearLayout>
|
||||||
|
</LinearLayout>
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="center_horizontal"
|
android:layout_gravity="center_horizontal"
|
||||||
|
android:layout_weight="0"
|
||||||
|
android:gravity="center_horizontal|center_vertical"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/btnCalc"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:text="Calculer" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_gravity="center_horizontal"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:gravity="center_horizontal|center_vertical"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/imgSmiley"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
app:srcCompat="@drawable/normal" />
|
app:srcCompat="@drawable/normal" />
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:orientation="vertical">
|
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/textView5"
|
android:id="@+id/lblResultat"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:gravity="center_horizontal"
|
android:layout_weight="1" />
|
||||||
android:text="mon historique"
|
|
||||||
android:textSize="34sp" />
|
|
||||||
|
|
||||||
<ImageButton
|
|
||||||
android:id="@+id/btnMonHistorique"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_gravity="center_horizontal"
|
|
||||||
app:srcCompat="@drawable/historique" />
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
@ -1,57 +0,0 @@
|
||||||
<?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="wrap_content">
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:orientation="horizontal">
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:layout_weight="0"
|
|
||||||
android:gravity="clip_vertical"
|
|
||||||
android:orientation="vertical">
|
|
||||||
|
|
||||||
<ImageButton
|
|
||||||
android:id="@+id/btnListSuppr"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
app:srcCompat="@drawable/suppr" />
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:gravity="clip_vertical"
|
|
||||||
android:orientation="vertical">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/txtListDate"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="TextView" />
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:gravity="clip_vertical"
|
|
||||||
android:orientation="vertical">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/txtListIMG"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:gravity="end"
|
|
||||||
android:text="TextView"
|
|
||||||
android:textSize="24sp"
|
|
||||||
android:textStyle="bold" />
|
|
||||||
</LinearLayout>
|
|
||||||
</LinearLayout>
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
<resources xmlns:tools="http://schemas.android.com/tools">
|
<resources xmlns:tools="http://schemas.android.com/tools">
|
||||||
<!-- Base application theme. -->
|
<!-- Base application theme. -->
|
||||||
<style name="Base.Theme.Coach" parent="Theme.AppCompat.DayNight.DarkActionBar">
|
<style name="Base.Theme.Coach" parent="Theme.Material3.DayNight.NoActionBar">
|
||||||
<!-- Customize your dark theme here. -->
|
<!-- Customize your dark theme here. -->
|
||||||
<!-- <item name="colorPrimary">@color/my_dark_primary</item> -->
|
<!-- <item name="colorPrimary">@color/my_dark_primary</item> -->
|
||||||
</style>
|
</style>
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
<resources xmlns:tools="http://schemas.android.com/tools">
|
<resources xmlns:tools="http://schemas.android.com/tools">
|
||||||
<!-- Base application theme. -->
|
<!-- Base application theme. -->
|
||||||
<style name="Base.Theme.Coach" parent="Theme.AppCompat.DayNight">
|
<style name="Base.Theme.Coach" parent="Theme.Material3.DayNight.NoActionBar">
|
||||||
<!-- Customize your light theme here. -->
|
<!-- Customize your light theme here. -->
|
||||||
<!-- <item name="colorPrimary">@color/my_light_primary</item> -->
|
<!-- <item name="colorPrimary">@color/my_light_primary</item> -->
|
||||||
</style>
|
</style>
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,6 @@ appcompat = "1.6.1"
|
||||||
material = "1.10.0"
|
material = "1.10.0"
|
||||||
activity = "1.8.0"
|
activity = "1.8.0"
|
||||||
constraintlayout = "2.1.4"
|
constraintlayout = "2.1.4"
|
||||||
recyclerview = "1.4.0"
|
|
||||||
|
|
||||||
[libraries]
|
[libraries]
|
||||||
junit = { group = "junit", name = "junit", version.ref = "junit" }
|
junit = { group = "junit", name = "junit", version.ref = "junit" }
|
||||||
|
|
@ -17,7 +16,6 @@ appcompat = { group = "androidx.appcompat", name = "appcompat", version.ref = "a
|
||||||
material = { group = "com.google.android.material", name = "material", version.ref = "material" }
|
material = { group = "com.google.android.material", name = "material", version.ref = "material" }
|
||||||
activity = { group = "androidx.activity", name = "activity", version.ref = "activity" }
|
activity = { group = "androidx.activity", name = "activity", version.ref = "activity" }
|
||||||
constraintlayout = { group = "androidx.constraintlayout", name = "constraintlayout", version.ref = "constraintlayout" }
|
constraintlayout = { group = "androidx.constraintlayout", name = "constraintlayout", version.ref = "constraintlayout" }
|
||||||
recyclerview = { group = "androidx.recyclerview", name = "recyclerview", version.ref = "recyclerview" }
|
|
||||||
|
|
||||||
[plugins]
|
[plugins]
|
||||||
android-application = { id = "com.android.application", version.ref = "agp" }
|
android-application = { id = "com.android.application", version.ref = "agp" }
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue