diff --git a/DEV4.1/test/cinema2/cinema b/DEV4.1/test/cinema2/cinema new file mode 160000 index 0000000..a266118 --- /dev/null +++ b/DEV4.1/test/cinema2/cinema @@ -0,0 +1 @@ +Subproject commit a266118297ca4a1243b3748cde59de8ce282f51c diff --git a/DEV4.1/test/test/test.html b/DEV4.1/test/test/test.html deleted file mode 100644 index 05aa726..0000000 --- a/DEV4.1/test/test/test.html +++ /dev/null @@ -1,94 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/DEV4.1/test/test/test.js b/DEV4.1/test/test/test.js new file mode 100644 index 0000000..a605b65 --- /dev/null +++ b/DEV4.1/test/test/test.js @@ -0,0 +1,139 @@ +function apiManager() { + key = "92f0f56afffd55f39d43937ed6899e00"; + let URL = "https://api.themoviedb.org/3/"; + + let request = { search, searchMovie, searchTV, searchPerson, popMovie, trendMovie, topMovie, upcomingMovie, + getMovieCredits, popTV, todayTV, weekTV, topTV, findPeopleID, findPeopleID, findPeopleName, + getPeopleCreditsTV, getPeopleCreditsMovie + }; + + function search(input,page_index) { //multisearch + return fetch(URL + "search/multi?query="+ input +"&api_key=" + key + "&page=" + page_index + "&language=fr") + .then(response => response.json()) + .then(data => data); + console.log(response.json) + } + + function searchMovie(input,page_index) { + return fetch(URL + "search/movie?query="+ input +"&api_key=" + key + "&page=" + page_index + "&language=fr") + .then(response => response.json()) + .then(data => data); + console.log(response.json) + } + + function searchTV(input,page_index) { + return fetch(URL + "search/tv?query="+ input +"&api_key=" + key + "&page=" + page_index + "&language=fr") + .then(response => response.json()) + .then(data => data); + console.log(response.json) + } + + function searchPerson(input,page_index) { + return fetch(URL + "search/person?query="+ input +"&api_key=" + key + "&page=" + page_index + "&language=fr") + .then(response => response.json()) + .then(data => data); + console.log(response.json) + } + + //Movie + + function popMovie(page_index) { + return fetch(URL + "movie/popular?&api_key=" + key + "&page=" + page_index + "&language=fr") + .then(response => response.json()) + .then(data => data); + console.log(response.json) + } + + function trendMovie(page_index) { + return fetch(URL + "trending/movie/day?&api_key=" + key + "&page=" + page_index + "&language=fr") + .then(response => response.json()) + .then(data => data); + console.log(response.json) + } + + function topMovie(page_index) { + return fetch(URL + "movie/top_rated?&api_key=" + key + "&page=" + page_index + "&language=fr") + .then(response => response.json()) + .then(data => data); + console.log(response.json) + } + + function upcomingMovie(page_index) { + return fetch(URL + "movie/upcoming?&api_key=" + key + "&page=" + page_index + "&language=fr") + .then(response => response.json()) + .then(data => data); + console.log(response.json) + } + + function getMovieCredits(id) { + return fetch(URL + "movie/" + id + "/credits?&api_key=" + key + "&language=fr") + .then(response => response.json()) + .then(data => data); + console.log(response.json) + } + + //TV + + function popTV(page_index) { + return fetch(URL + "tv/popular?&api_key=" + key + "&page=" + page_index + "&language=fr") + .then(response => response.json()) + .then(data => data); + console.log(response.json) + } + + function todayTV(page_index) { + return fetch(URL + "tv/airing_today?&api_key=" + key + "&page=" + page_index + "&language=fr") + .then(response => response.json()) + .then(data => data); + console.log(response.json) + } + + function weekTV(page_index) { + return fetch(URL + "tv/on_the_air?&api_key=" + key + "&page=" + page_index + "&language=fr") + .then(response => response.json()) + .then(data => data); + console.log(response.json) + } + + function topTV(page_index) { + return fetch(URL + "tv/top_rated?&api_key=" + key + "&page=" + page_index + "&language=fr") + .then(response => response.json()) + .then(data => data); + console.log(response.json) + } + + //People + + function findPeopleID(id) { + return fetch(URL + "person/"+ id +"?&api_key=" + key + "&language=fr") + .then(response => response.json()) + .then(data => data); + console.log(response.json) + } + + function findPeopleName(name,page_index) { + return fetch(URL + "search/person?query="+ name +"?&api_key=" + key + "&page=" + page_index + "&language=fr") + .then(response => response.json()) + .then(data => data); + console.log(response.json) + } + + function getPeopleCreditsTV(id) { + return fetch(URL + "person/"+ id + "/tv_credits?&api_key=" + key + "&language=fr") + .then(response => response.json()) + .then(data => data); + console.log(response.json) + } + + function getPeopleCreditsMovie(id) { + return fetch(URL + "person/"+ id + "/movie_credits?&api_key=" + key + "&language=fr") + .then(response => response.json()) + .then(data => data); + console.log(response.json) + } + + // TAGGED IMAGES ?? + + return request; + +} \ No newline at end of file diff --git a/DEV4.5/Android b/DEV4.5/Android new file mode 160000 index 0000000..e2ecdea --- /dev/null +++ b/DEV4.5/Android @@ -0,0 +1 @@ +Subproject commit e2ecdea9e3aa6e130ca3a4ecd86058488e4dcd38 diff --git a/DEV4.5/ChatRelative/.idea/misc.xml b/DEV4.5/ChatRelative/.idea/misc.xml index 0ad17cb..8978d23 100644 --- a/DEV4.5/ChatRelative/.idea/misc.xml +++ b/DEV4.5/ChatRelative/.idea/misc.xml @@ -1,4 +1,3 @@ - diff --git a/DEV4.5/Couleurs/.gitignore b/DEV4.5/Couleurs/.gitignore new file mode 100644 index 0000000..c6cbe56 --- /dev/null +++ b/DEV4.5/Couleurs/.gitignore @@ -0,0 +1,8 @@ +*.iml +.gradle +/local.properties +/.idea/workspace.xml +/.idea/libraries +.DS_Store +/build +/captures diff --git a/DEV4.5/Couleurs/.idea/.gitignore b/DEV4.5/Couleurs/.idea/.gitignore new file mode 100644 index 0000000..26d3352 --- /dev/null +++ b/DEV4.5/Couleurs/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/DEV4.5/Couleurs/.idea/caches/build_file_checksums.ser b/DEV4.5/Couleurs/.idea/caches/build_file_checksums.ser new file mode 100644 index 0000000..49bc20a Binary files /dev/null and b/DEV4.5/Couleurs/.idea/caches/build_file_checksums.ser differ diff --git a/DEV4.5/Couleurs/.idea/codeStyles/Project.xml b/DEV4.5/Couleurs/.idea/codeStyles/Project.xml new file mode 100644 index 0000000..30aa626 --- /dev/null +++ b/DEV4.5/Couleurs/.idea/codeStyles/Project.xml @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/DEV4.5/Couleurs/.idea/compiler.xml b/DEV4.5/Couleurs/.idea/compiler.xml new file mode 100644 index 0000000..3cd2840 --- /dev/null +++ b/DEV4.5/Couleurs/.idea/compiler.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/DEV4.5/Couleurs/.idea/deploymentTargetDropDown.xml b/DEV4.5/Couleurs/.idea/deploymentTargetDropDown.xml new file mode 100644 index 0000000..0c0c338 --- /dev/null +++ b/DEV4.5/Couleurs/.idea/deploymentTargetDropDown.xml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/DEV4.5/Couleurs/.idea/encodings.xml b/DEV4.5/Couleurs/.idea/encodings.xml new file mode 100644 index 0000000..97626ba --- /dev/null +++ b/DEV4.5/Couleurs/.idea/encodings.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/DEV4.5/Couleurs/.idea/gradle.xml b/DEV4.5/Couleurs/.idea/gradle.xml new file mode 100644 index 0000000..b2302f7 --- /dev/null +++ b/DEV4.5/Couleurs/.idea/gradle.xml @@ -0,0 +1,20 @@ + + + + + + + \ No newline at end of file diff --git a/DEV4.5/Couleurs/.idea/jarRepositories.xml b/DEV4.5/Couleurs/.idea/jarRepositories.xml new file mode 100644 index 0000000..6d3ee29 --- /dev/null +++ b/DEV4.5/Couleurs/.idea/jarRepositories.xml @@ -0,0 +1,40 @@ + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/DEV4.5/Couleurs/.idea/migrations.xml b/DEV4.5/Couleurs/.idea/migrations.xml new file mode 100644 index 0000000..f8051a6 --- /dev/null +++ b/DEV4.5/Couleurs/.idea/migrations.xml @@ -0,0 +1,10 @@ + + + + + + \ No newline at end of file diff --git a/DEV4.5/Couleurs/.idea/misc.xml b/DEV4.5/Couleurs/.idea/misc.xml new file mode 100644 index 0000000..c3cebc7 --- /dev/null +++ b/DEV4.5/Couleurs/.idea/misc.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/DEV4.5/Couleurs/.idea/modules.xml b/DEV4.5/Couleurs/.idea/modules.xml new file mode 100644 index 0000000..33f8fea --- /dev/null +++ b/DEV4.5/Couleurs/.idea/modules.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/DEV4.5/Couleurs/.idea/vcs.xml b/DEV4.5/Couleurs/.idea/vcs.xml new file mode 100644 index 0000000..b2bdec2 --- /dev/null +++ b/DEV4.5/Couleurs/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/DEV4.5/Couleurs/app/.gitignore b/DEV4.5/Couleurs/app/.gitignore new file mode 100644 index 0000000..796b96d --- /dev/null +++ b/DEV4.5/Couleurs/app/.gitignore @@ -0,0 +1 @@ +/build diff --git a/DEV4.5/Couleurs/app/build.gradle b/DEV4.5/Couleurs/app/build.gradle new file mode 100644 index 0000000..0ad5c3b --- /dev/null +++ b/DEV4.5/Couleurs/app/build.gradle @@ -0,0 +1,25 @@ +apply plugin: 'com.android.application' + +android { + compileSdk 33 + buildToolsVersion '33.0.0' + + defaultConfig { + applicationId "fr.iut_fbleau.apl41.couleurs" + minSdkVersion 19 + targetSdk 33 + versionCode 1 + versionName "1.0" + } + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' + } + } +} + +dependencies { + implementation fileTree(dir: 'libs', include: ['*.jar']) + testImplementation 'junit:junit:4.12' +} diff --git a/DEV4.5/Couleurs/app/proguard-rules.pro b/DEV4.5/Couleurs/app/proguard-rules.pro new file mode 100644 index 0000000..45dc58a --- /dev/null +++ b/DEV4.5/Couleurs/app/proguard-rules.pro @@ -0,0 +1,17 @@ +# Add project specific ProGuard rules here. +# By default, the flags in this file are appended to flags specified +# in /opt/android-sdk/tools/proguard/proguard-android.txt +# You can edit the include path and order by changing the proguardFiles +# directive in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# Add any project specific keep options here: + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} diff --git a/DEV4.5/Couleurs/app/src/androidTest/java/fr/iut_fbleau/apl41/couleurs/ApplicationTest.java b/DEV4.5/Couleurs/app/src/androidTest/java/fr/iut_fbleau/apl41/couleurs/ApplicationTest.java new file mode 100644 index 0000000..d1165c3 --- /dev/null +++ b/DEV4.5/Couleurs/app/src/androidTest/java/fr/iut_fbleau/apl41/couleurs/ApplicationTest.java @@ -0,0 +1,13 @@ +package fr.iut_fbleau.apl41.couleurs; + +import android.app.Application; +import android.test.ApplicationTestCase; + +/** + * Testing Fundamentals + */ +public class ApplicationTest extends ApplicationTestCase { + public ApplicationTest() { + super(Application.class); + } +} \ No newline at end of file diff --git a/DEV4.5/Couleurs/app/src/main/AndroidManifest.xml b/DEV4.5/Couleurs/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000..8ea4cea --- /dev/null +++ b/DEV4.5/Couleurs/app/src/main/AndroidManifest.xml @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/DEV4.5/Couleurs/app/src/main/java/fr/iut_fbleau/apl41/couleurs/AccesBaseDeDonnees.java b/DEV4.5/Couleurs/app/src/main/java/fr/iut_fbleau/apl41/couleurs/AccesBaseDeDonnees.java new file mode 100644 index 0000000..98a118c --- /dev/null +++ b/DEV4.5/Couleurs/app/src/main/java/fr/iut_fbleau/apl41/couleurs/AccesBaseDeDonnees.java @@ -0,0 +1,45 @@ +package fr.iut_fbleau.apl41.couleurs; + +import android.content.ContentValues; +import android.content.Context; +import android.database.sqlite.SQLiteDatabase; +import android.database.sqlite.SQLiteOpenHelper; +import android.provider.BaseColumns; + +public class AccesBaseDeDonnees extends SQLiteOpenHelper { + public final static String NOM_BASE = "base_couleurs"; + public final static int VERSION_BASE = 3; + public final static String NOM_TABLE = "couleurs"; + public final static String CHAMP_NOM = "couleurs_nom"; + public final static String CHAMP_VALEUR = "couleurs_valeur"; + + public AccesBaseDeDonnees(Context context) { + super(context, AccesBaseDeDonnees.NOM_BASE, null, AccesBaseDeDonnees.VERSION_BASE); + } + + @Override + public void onCreate(SQLiteDatabase baseDeDonnees) { + baseDeDonnees.execSQL("create table " + AccesBaseDeDonnees.NOM_TABLE + "(" + + BaseColumns._ID + " integer primary key autoincrement, " + + AccesBaseDeDonnees.CHAMP_NOM + " text not null, " + + AccesBaseDeDonnees.CHAMP_VALEUR + " integer);"); + + ContentValues tuple = new ContentValues(); + + tuple.put(AccesBaseDeDonnees.CHAMP_NOM, "bleu Denim"); + tuple.put(AccesBaseDeDonnees.CHAMP_VALEUR, 0xFF4B0082); + baseDeDonnees.insert(AccesBaseDeDonnees.NOM_TABLE, null, tuple); + tuple.put(AccesBaseDeDonnees.CHAMP_NOM, "bleu électrique"); + tuple.put(AccesBaseDeDonnees.CHAMP_VALEUR, 0xFF1163E3); + baseDeDonnees.insert(AccesBaseDeDonnees.NOM_TABLE, null, tuple); + tuple.put(AccesBaseDeDonnees.CHAMP_NOM, "bleu vert"); + tuple.put(AccesBaseDeDonnees.CHAMP_VALEUR, 0xFF40E0D0); + baseDeDonnees.insert(AccesBaseDeDonnees.NOM_TABLE, null, tuple); + } + + @Override + public void onUpgrade(SQLiteDatabase baseDeDonnees, int vieux, int nouveau) { + baseDeDonnees.execSQL("drop table if exists " + AccesBaseDeDonnees.NOM_TABLE); + this.onCreate(baseDeDonnees); + } +} diff --git a/DEV4.5/Couleurs/app/src/main/java/fr/iut_fbleau/apl41/couleurs/ControleClic.java b/DEV4.5/Couleurs/app/src/main/java/fr/iut_fbleau/apl41/couleurs/ControleClic.java new file mode 100644 index 0000000..00298b8 --- /dev/null +++ b/DEV4.5/Couleurs/app/src/main/java/fr/iut_fbleau/apl41/couleurs/ControleClic.java @@ -0,0 +1,20 @@ +package fr.iut_fbleau.apl41.couleurs; + +import android.app.Activity; +import android.view.View; +import android.widget.AdapterView; +import android.widget.Toast; + +/** + * Created by hernand on 3/28/17. + */ +public class ControleClic implements AdapterView.OnItemClickListener { + private Activity parent; + public ControleClic(Activity a) { + this.parent = a; + } + @Override + public void onItemClick(AdapterView liste, View vue, int positionListe, long idBase) { + Toast.makeText(this.parent, "Clic sur ligne "+(positionListe+1), Toast.LENGTH_SHORT).show(); + } +} diff --git a/DEV4.5/Couleurs/app/src/main/java/fr/iut_fbleau/apl41/couleurs/Lieur.java b/DEV4.5/Couleurs/app/src/main/java/fr/iut_fbleau/apl41/couleurs/Lieur.java new file mode 100644 index 0000000..17a1718 --- /dev/null +++ b/DEV4.5/Couleurs/app/src/main/java/fr/iut_fbleau/apl41/couleurs/Lieur.java @@ -0,0 +1,16 @@ +package fr.iut_fbleau.apl41.couleurs; + +import android.database.Cursor; +import android.view.View; +import android.widget.SimpleCursorAdapter; + +public class Lieur implements SimpleCursorAdapter.ViewBinder { + @Override + public boolean setViewValue(View view, Cursor cursor, int columnIndex) { + if(view.getId() == R.id.couleur) { + view.setBackgroundColor(cursor.getInt(columnIndex)); + return true; + } + return false; + } +} diff --git a/DEV4.5/Couleurs/app/src/main/java/fr/iut_fbleau/apl41/couleurs/Liste.java b/DEV4.5/Couleurs/app/src/main/java/fr/iut_fbleau/apl41/couleurs/Liste.java new file mode 100644 index 0000000..c9d982c --- /dev/null +++ b/DEV4.5/Couleurs/app/src/main/java/fr/iut_fbleau/apl41/couleurs/Liste.java @@ -0,0 +1,59 @@ +package fr.iut_fbleau.apl41.couleurs; + +import android.app.Activity; +import android.database.Cursor; +import android.database.sqlite.SQLiteDatabase; +import android.os.Bundle; +import android.view.Menu; +import android.view.MenuItem; +import android.widget.ListView; +import android.widget.SimpleCursorAdapter; +import android.widget.Toast; + +public class Liste extends Activity { + private final static String[] CHAMPS = {AccesBaseDeDonnees.CHAMP_NOM, AccesBaseDeDonnees.CHAMP_VALEUR}; + private final static int[] VUES = {R.id.nom, R.id.couleur}; + private SimpleCursorAdapter adaptateur; + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + this.setContentView(R.layout.activity_liste); + + this.adaptateur = new SimpleCursorAdapter(this, R.layout.row_element, null, Liste.CHAMPS, Liste.VUES, 0); + this.adaptateur.setViewBinder(new Lieur()); + ListView elements = (ListView) this.findViewById(R.id.elements); + elements.setOnItemClickListener(new ControleClic(this)); + elements.setAdapter(this.adaptateur); + this.remplirListe(); + } + + public void remplirListe() { + AccesBaseDeDonnees acces = new AccesBaseDeDonnees(this); + SQLiteDatabase baseDeDonnees = acces.getReadableDatabase(); + + Cursor curseur = baseDeDonnees.query(AccesBaseDeDonnees.NOM_TABLE, null, null, null, null, null, null); + if (curseur != null) { + this.adaptateur.swapCursor(curseur); + } else { + Toast.makeText(this, "Erreur d'accès à la base de données", Toast.LENGTH_SHORT).show(); + } + } + + @Override + public boolean onCreateOptionsMenu(Menu menu) { + this.getMenuInflater().inflate(R.menu.menu_liste, menu); + return true; + } + + @Override + public boolean onOptionsItemSelected(MenuItem item) { + int id = item.getItemId(); + + if (id == R.id.action_ajouter) { + // TODO + return true; + } + + return super.onOptionsItemSelected(item); + } +} diff --git a/DEV4.5/Couleurs/app/src/main/res/layout/activity_liste.xml b/DEV4.5/Couleurs/app/src/main/res/layout/activity_liste.xml new file mode 100644 index 0000000..858d06b --- /dev/null +++ b/DEV4.5/Couleurs/app/src/main/res/layout/activity_liste.xml @@ -0,0 +1,18 @@ + + + diff --git a/DEV4.5/Couleurs/app/src/main/res/layout/row_element.xml b/DEV4.5/Couleurs/app/src/main/res/layout/row_element.xml new file mode 100644 index 0000000..0871fc0 --- /dev/null +++ b/DEV4.5/Couleurs/app/src/main/res/layout/row_element.xml @@ -0,0 +1,25 @@ + + + + + + + \ No newline at end of file diff --git a/DEV4.5/Couleurs/app/src/main/res/menu/menu_liste.xml b/DEV4.5/Couleurs/app/src/main/res/menu/menu_liste.xml new file mode 100644 index 0000000..847ca63 --- /dev/null +++ b/DEV4.5/Couleurs/app/src/main/res/menu/menu_liste.xml @@ -0,0 +1,13 @@ + + + diff --git a/DEV4.5/Couleurs/app/src/main/res/mipmap-hdpi/ic_launcher.png b/DEV4.5/Couleurs/app/src/main/res/mipmap-hdpi/ic_launcher.png new file mode 100644 index 0000000..cde69bc Binary files /dev/null and b/DEV4.5/Couleurs/app/src/main/res/mipmap-hdpi/ic_launcher.png differ diff --git a/DEV4.5/Couleurs/app/src/main/res/mipmap-mdpi/ic_launcher.png b/DEV4.5/Couleurs/app/src/main/res/mipmap-mdpi/ic_launcher.png new file mode 100644 index 0000000..c133a0c Binary files /dev/null and b/DEV4.5/Couleurs/app/src/main/res/mipmap-mdpi/ic_launcher.png differ diff --git a/DEV4.5/Couleurs/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/DEV4.5/Couleurs/app/src/main/res/mipmap-xhdpi/ic_launcher.png new file mode 100644 index 0000000..bfa42f0 Binary files /dev/null and b/DEV4.5/Couleurs/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/DEV4.5/Couleurs/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/DEV4.5/Couleurs/app/src/main/res/mipmap-xxhdpi/ic_launcher.png new file mode 100644 index 0000000..324e72c Binary files /dev/null and b/DEV4.5/Couleurs/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/DEV4.5/Couleurs/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/DEV4.5/Couleurs/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png new file mode 100644 index 0000000..aee44e1 Binary files /dev/null and b/DEV4.5/Couleurs/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ diff --git a/DEV4.5/Couleurs/app/src/main/res/values-w820dp/dimens.xml b/DEV4.5/Couleurs/app/src/main/res/values-w820dp/dimens.xml new file mode 100644 index 0000000..43758b3 --- /dev/null +++ b/DEV4.5/Couleurs/app/src/main/res/values-w820dp/dimens.xml @@ -0,0 +1,5 @@ + + + 64dp + + diff --git a/DEV4.5/Couleurs/app/src/main/res/values/dimens.xml b/DEV4.5/Couleurs/app/src/main/res/values/dimens.xml new file mode 100644 index 0000000..3fbe64e --- /dev/null +++ b/DEV4.5/Couleurs/app/src/main/res/values/dimens.xml @@ -0,0 +1,14 @@ + + + 16dp + + + 16dp + + + 32dp + + + 12dp + + diff --git a/DEV4.5/Couleurs/app/src/main/res/values/strings.xml b/DEV4.5/Couleurs/app/src/main/res/values/strings.xml new file mode 100644 index 0000000..c8d6132 --- /dev/null +++ b/DEV4.5/Couleurs/app/src/main/res/values/strings.xml @@ -0,0 +1,8 @@ + + + Couleurs + + + Ajouter + + diff --git a/DEV4.5/Couleurs/app/src/test/java/fr/iut_fbleau/apl41/couleurs/ExampleUnitTest.java b/DEV4.5/Couleurs/app/src/test/java/fr/iut_fbleau/apl41/couleurs/ExampleUnitTest.java new file mode 100644 index 0000000..89bf27e --- /dev/null +++ b/DEV4.5/Couleurs/app/src/test/java/fr/iut_fbleau/apl41/couleurs/ExampleUnitTest.java @@ -0,0 +1,15 @@ +package fr.iut_fbleau.apl41.couleurs; + +import org.junit.Test; + +import static org.junit.Assert.*; + +/** + * To work on unit tests, switch the Test Artifact in the Build Variants view. + */ +public class ExampleUnitTest { + @Test + public void addition_isCorrect() throws Exception { + assertEquals(4, 2 + 2); + } +} \ No newline at end of file diff --git a/DEV4.5/Couleurs/build.gradle b/DEV4.5/Couleurs/build.gradle new file mode 100644 index 0000000..d54ad67 --- /dev/null +++ b/DEV4.5/Couleurs/build.gradle @@ -0,0 +1,25 @@ +// Top-level build file where you can add configuration options common to all sub-projects/modules. + +buildscript { + repositories { + google() + jcenter() + } + dependencies { + classpath 'com.android.tools.build:gradle:7.2.2' + + // NOTE: Do not place your application dependencies here; they belong + // in the individual module build.gradle files + } +} + +allprojects { + repositories { + google() + jcenter() + } +} + +task clean(type: Delete) { + delete rootProject.buildDir +} diff --git a/DEV4.5/Couleurs/gradle.properties b/DEV4.5/Couleurs/gradle.properties new file mode 100644 index 0000000..1d3591c --- /dev/null +++ b/DEV4.5/Couleurs/gradle.properties @@ -0,0 +1,18 @@ +# Project-wide Gradle settings. + +# IDE (e.g. Android Studio) users: +# Gradle settings configured through the IDE *will override* +# any settings specified in this file. + +# For more details on how to configure your build environment visit +# http://www.gradle.org/docs/current/userguide/build_environment.html + +# Specifies the JVM arguments used for the daemon process. +# The setting is particularly useful for tweaking memory settings. +# Default value: -Xmx10248m -XX:MaxPermSize=256m +# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 + +# When configured, Gradle will run in incubating parallel mode. +# This option should only be used with decoupled projects. More details, visit +# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects +# org.gradle.parallel=true \ No newline at end of file diff --git a/DEV4.5/Couleurs/gradle/wrapper/gradle-wrapper.jar b/DEV4.5/Couleurs/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000..13372ae Binary files /dev/null and b/DEV4.5/Couleurs/gradle/wrapper/gradle-wrapper.jar differ diff --git a/DEV4.5/Couleurs/gradle/wrapper/gradle-wrapper.properties b/DEV4.5/Couleurs/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..8a9a5ad --- /dev/null +++ b/DEV4.5/Couleurs/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,6 @@ +#Wed Mar 23 13:29:16 CET 2022 +distributionBase=GRADLE_USER_HOME +distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip +distributionPath=wrapper/dists +zipStorePath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME diff --git a/DEV4.5/Couleurs/gradlew b/DEV4.5/Couleurs/gradlew new file mode 100644 index 0000000..9d82f78 --- /dev/null +++ b/DEV4.5/Couleurs/gradlew @@ -0,0 +1,160 @@ +#!/usr/bin/env bash + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS="" + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn ( ) { + echo "$*" +} + +die ( ) { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; +esac + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin, switch paths to Windows format before running java +if $cygwin ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + JAVACMD=`cygpath --unix "$JAVACMD"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=$((i+1)) + done + case $i in + (0) set -- ;; + (1) set -- "$args0" ;; + (2) set -- "$args0" "$args1" ;; + (3) set -- "$args0" "$args1" "$args2" ;; + (4) set -- "$args0" "$args1" "$args2" "$args3" ;; + (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules +function splitJvmOpts() { + JVM_OPTS=("$@") +} +eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS +JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" + +exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" diff --git a/DEV4.5/Couleurs/gradlew.bat b/DEV4.5/Couleurs/gradlew.bat new file mode 100644 index 0000000..8a0b282 --- /dev/null +++ b/DEV4.5/Couleurs/gradlew.bat @@ -0,0 +1,90 @@ +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS= + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windowz variants + +if not "%OS%" == "Windows_NT" goto win9xME_args +if "%@eval[2+2]" == "4" goto 4NT_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* +goto execute + +:4NT_args +@rem Get arguments from the 4NT Shell from JP Software +set CMD_LINE_ARGS=%$ + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/DEV4.5/Couleurs/settings.gradle b/DEV4.5/Couleurs/settings.gradle new file mode 100644 index 0000000..e7b4def --- /dev/null +++ b/DEV4.5/Couleurs/settings.gradle @@ -0,0 +1 @@ +include ':app' diff --git a/DEV4.5/Reticule/.gitignore b/DEV4.5/Reticule/.gitignore new file mode 100644 index 0000000..aa724b7 --- /dev/null +++ b/DEV4.5/Reticule/.gitignore @@ -0,0 +1,15 @@ +*.iml +.gradle +/local.properties +/.idea/caches +/.idea/libraries +/.idea/modules.xml +/.idea/workspace.xml +/.idea/navEditor.xml +/.idea/assetWizardSettings.xml +.DS_Store +/build +/captures +.externalNativeBuild +.cxx +local.properties diff --git a/DEV4.5/Reticule/.idea/.gitignore b/DEV4.5/Reticule/.idea/.gitignore new file mode 100644 index 0000000..26d3352 --- /dev/null +++ b/DEV4.5/Reticule/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/DEV4.5/Reticule/.idea/.name b/DEV4.5/Reticule/.idea/.name new file mode 100644 index 0000000..1319b83 --- /dev/null +++ b/DEV4.5/Reticule/.idea/.name @@ -0,0 +1 @@ +reticule \ No newline at end of file diff --git a/DEV4.5/Reticule/.idea/compiler.xml b/DEV4.5/Reticule/.idea/compiler.xml new file mode 100644 index 0000000..b589d56 --- /dev/null +++ b/DEV4.5/Reticule/.idea/compiler.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/DEV4.5/Reticule/.idea/deploymentTargetDropDown.xml b/DEV4.5/Reticule/.idea/deploymentTargetDropDown.xml new file mode 100644 index 0000000..0c0c338 --- /dev/null +++ b/DEV4.5/Reticule/.idea/deploymentTargetDropDown.xml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/DEV4.5/Reticule/.idea/gradle.xml b/DEV4.5/Reticule/.idea/gradle.xml new file mode 100644 index 0000000..32522c1 --- /dev/null +++ b/DEV4.5/Reticule/.idea/gradle.xml @@ -0,0 +1,18 @@ + + + + + + \ No newline at end of file diff --git a/DEV4.5/Reticule/.idea/migrations.xml b/DEV4.5/Reticule/.idea/migrations.xml new file mode 100644 index 0000000..f8051a6 --- /dev/null +++ b/DEV4.5/Reticule/.idea/migrations.xml @@ -0,0 +1,10 @@ + + + + + + \ No newline at end of file diff --git a/DEV4.5/Reticule/.idea/misc.xml b/DEV4.5/Reticule/.idea/misc.xml new file mode 100644 index 0000000..0ad17cb --- /dev/null +++ b/DEV4.5/Reticule/.idea/misc.xml @@ -0,0 +1,10 @@ + + + + + + + + + \ No newline at end of file diff --git a/DEV4.5/Reticule/.idea/vcs.xml b/DEV4.5/Reticule/.idea/vcs.xml new file mode 100644 index 0000000..b2bdec2 --- /dev/null +++ b/DEV4.5/Reticule/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/DEV4.5/Reticule/app/.gitignore b/DEV4.5/Reticule/app/.gitignore new file mode 100644 index 0000000..42afabf --- /dev/null +++ b/DEV4.5/Reticule/app/.gitignore @@ -0,0 +1 @@ +/build \ No newline at end of file diff --git a/DEV4.5/Reticule/app/build.gradle.kts b/DEV4.5/Reticule/app/build.gradle.kts new file mode 100644 index 0000000..db60226 --- /dev/null +++ b/DEV4.5/Reticule/app/build.gradle.kts @@ -0,0 +1,40 @@ +plugins { + alias(libs.plugins.androidApplication) +} + +android { + namespace = "fr.iutfbleau.but2.reticule" + compileSdk = 34 + + defaultConfig { + applicationId = "fr.iutfbleau.but2.reticule" + minSdk = 19 + targetSdk = 34 + versionCode = 1 + versionName = "1.0" + + testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" + } + + buildTypes { + release { + isMinifyEnabled = false + proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro") + } + } + compileOptions { + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 + } +} + +dependencies { + + implementation(libs.appcompat) + implementation(libs.material) + implementation(libs.activity) + implementation(libs.constraintlayout) + testImplementation(libs.junit) + androidTestImplementation(libs.ext.junit) + androidTestImplementation(libs.espresso.core) +} \ No newline at end of file diff --git a/DEV4.5/Reticule/app/proguard-rules.pro b/DEV4.5/Reticule/app/proguard-rules.pro new file mode 100644 index 0000000..481bb43 --- /dev/null +++ b/DEV4.5/Reticule/app/proguard-rules.pro @@ -0,0 +1,21 @@ +# Add project specific ProGuard rules here. +# You can control the set of applied configuration files using the +# proguardFiles setting in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile \ No newline at end of file diff --git a/DEV4.5/Reticule/app/src/androidTest/java/fr/iutfbleau/but2/reticule/ExampleInstrumentedTest.java b/DEV4.5/Reticule/app/src/androidTest/java/fr/iutfbleau/but2/reticule/ExampleInstrumentedTest.java new file mode 100644 index 0000000..42a9f6a --- /dev/null +++ b/DEV4.5/Reticule/app/src/androidTest/java/fr/iutfbleau/but2/reticule/ExampleInstrumentedTest.java @@ -0,0 +1,26 @@ +package fr.iutfbleau.but2.reticule; + +import android.content.Context; + +import androidx.test.platform.app.InstrumentationRegistry; +import androidx.test.ext.junit.runners.AndroidJUnit4; + +import org.junit.Test; +import org.junit.runner.RunWith; + +import static org.junit.Assert.*; + +/** + * Instrumented test, which will execute on an Android device. + * + * @see Testing documentation + */ +@RunWith(AndroidJUnit4.class) +public class ExampleInstrumentedTest { + @Test + public void useAppContext() { + // Context of the app under test. + Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); + assertEquals("fr.iutfbleau.but2.reticule", appContext.getPackageName()); + } +} \ No newline at end of file diff --git a/DEV4.5/Reticule/app/src/main/AndroidManifest.xml b/DEV4.5/Reticule/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000..5e5eeab --- /dev/null +++ b/DEV4.5/Reticule/app/src/main/AndroidManifest.xml @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/DEV4.5/Reticule/app/src/main/java/fr/iutfbleau/but2/reticule/MainActivity.java b/DEV4.5/Reticule/app/src/main/java/fr/iutfbleau/but2/reticule/MainActivity.java new file mode 100644 index 0000000..85bbbee --- /dev/null +++ b/DEV4.5/Reticule/app/src/main/java/fr/iutfbleau/but2/reticule/MainActivity.java @@ -0,0 +1,49 @@ +package fr.iutfbleau.but2.reticule; + +import android.os.Bundle; + +import androidx.activity.EdgeToEdge; +import androidx.appcompat.app.AppCompatActivity; +import androidx.core.graphics.Insets; +import androidx.core.view.ViewCompat; +import androidx.core.view.WindowInsetsCompat; + +public class MainActivity extends AppCompatActivity { + private static final String RETICULE_POSITION_KEY_X = "reticule_position_X"; + private static final String RETICULE_POSITION_KEY_Y = "reticule_position_Y"; + private float reticulePositionX = 0; + private float reticulePositionY = 0; + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_main); + + + + Reticule Ret = findViewById(R.id.reticule); + + ReticuleController RC; + if (savedInstanceState != null) { + reticulePositionX = savedInstanceState.getFloat(RETICULE_POSITION_KEY_X, 0); + reticulePositionY = savedInstanceState.getFloat(RETICULE_POSITION_KEY_Y, 0); + RC = new ReticuleController(reticulePositionX,reticulePositionY); + } + else { + RC = new ReticuleController(); + } + + event e = new event(RC,this); + Ret.setRL(e.listener); + Ret.setRC(RC); + Ret.setOnTouchListener(e); + + + } + + protected void onSaveInstanceState(Bundle outState) { + + outState.putFloat(RETICULE_POSITION_KEY_X, reticulePositionX); + outState.putFloat(RETICULE_POSITION_KEY_Y, reticulePositionY); + super.onSaveInstanceState(outState); + } +} \ No newline at end of file diff --git a/DEV4.5/Reticule/app/src/main/java/fr/iutfbleau/but2/reticule/Reticule.java b/DEV4.5/Reticule/app/src/main/java/fr/iutfbleau/but2/reticule/Reticule.java new file mode 100644 index 0000000..1285e95 --- /dev/null +++ b/DEV4.5/Reticule/app/src/main/java/fr/iutfbleau/but2/reticule/Reticule.java @@ -0,0 +1,40 @@ +package fr.iutfbleau.but2.reticule; + +import android.content.Context; +import android.graphics.Canvas; +import android.graphics.Color; +import android.graphics.Paint; +import android.util.AttributeSet; +import android.view.View; + +import androidx.annotation.Nullable; + +public class Reticule extends View { + + ReticuleController RC; + + ReticuleListener RL; + + public void setRC(ReticuleController RC) { + this.RC = RC; + } + + public void setRL(ReticuleListener RL) { + this.RL = RL; + } + + public Reticule(Context context, AttributeSet attrs) { + super(context, attrs); + } + + @Override + protected void onDraw(Canvas c){ + super.onDraw(c); + Paint p = new Paint(); + p.setColor(Color.YELLOW); + p.setStyle(Paint.Style.STROKE); + c.drawCircle(RC.x,RC.y,40,p); + c.drawLine(RC.x-40,RC.y,RC.x+40,RC.y,p); + c.drawLine(RC.x,RC.y-40,RC.x,RC.y+40,p); + } +} diff --git a/DEV4.5/Reticule/app/src/main/java/fr/iutfbleau/but2/reticule/ReticuleController.java b/DEV4.5/Reticule/app/src/main/java/fr/iutfbleau/but2/reticule/ReticuleController.java new file mode 100644 index 0000000..9854952 --- /dev/null +++ b/DEV4.5/Reticule/app/src/main/java/fr/iutfbleau/but2/reticule/ReticuleController.java @@ -0,0 +1,14 @@ +package fr.iutfbleau.but2.reticule; + +public class ReticuleController { + float x,y; + + public ReticuleController(){ + this.x = 0; + this.y = 0; + } + public ReticuleController(float x, float y){ + this.x = x; + this.y = y; + } +} diff --git a/DEV4.5/Reticule/app/src/main/java/fr/iutfbleau/but2/reticule/ReticuleListener.java b/DEV4.5/Reticule/app/src/main/java/fr/iutfbleau/but2/reticule/ReticuleListener.java new file mode 100644 index 0000000..d502722 --- /dev/null +++ b/DEV4.5/Reticule/app/src/main/java/fr/iutfbleau/but2/reticule/ReticuleListener.java @@ -0,0 +1,94 @@ +package fr.iutfbleau.but2.reticule; + +import android.content.Context; +import android.util.DisplayMetrics; +import android.util.Log; +import android.view.View; +import android.view.GestureDetector; +import android.view.MotionEvent; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; + +public class ReticuleListener extends GestureDetector.SimpleOnGestureListener { + + private ReticuleController RC; + private View v; + private Context c; + + public ReticuleListener(ReticuleController RC, Context c){ + super(); + this.c = c; + this.RC = RC; + } + + void setView(View v){ + this.v = v; + } + + @Override + public boolean onDown(@NonNull MotionEvent e) { return true; } + + @Override + public void onShowPress(@NonNull MotionEvent e) {} + + @Override + public boolean onSingleTapUp(@NonNull MotionEvent e) { return false; } + + @Override + public boolean onScroll(@Nullable MotionEvent e1, @NonNull MotionEvent e2, float distanceX, float distanceY) { return false; } + + @Override + public void onLongPress(@NonNull MotionEvent e) { + } + + @Override + public boolean onFling(@Nullable MotionEvent e1, @NonNull MotionEvent e2, float velocityX, float velocityY) { + float distanceX = e2.getX() - e1.getX(); + float distanceY = e2.getY() - e1.getY(); + + float distanceXdp = pxToDp(distanceX); + float distanceYdp = pxToDp(distanceY); + Log.d("test","X = " + distanceX + "dx = " + distanceXdp + ";Y = " + distanceY + "dy = " + distanceYdp ); + + if (Math.abs(distanceXdp) > 20 && Math.abs(distanceXdp)>(Math.abs(distanceYdp))) { + if (distanceXdp>0){ + RC.x += dpToPx(20); + } + else { + RC.x -= dpToPx(20); + } + } else if (Math.abs(distanceYdp) > 20 && Math.abs(distanceXdp)<(Math.abs(distanceYdp))) { + if (distanceYdp>0){ + RC.y += dpToPx(20); + } + else { + RC.y -= dpToPx(20); + } + } + v.invalidate(); + Log.d("test","Fling"); + return true; + } + + @Override + public boolean onSingleTapConfirmed(@NonNull MotionEvent e) { + return false; + } + + @Override + public boolean onDoubleTap(@NonNull MotionEvent e) { return false; } + + @Override + public boolean onDoubleTapEvent(@NonNull MotionEvent e) { + return false; + } + + private float pxToDp(float px) { + return px / c.getResources().getDisplayMetrics().density; + } + public int dpToPx(float dp) { + return Math.round(dp * (c.getResources().getDisplayMetrics().xdpi / DisplayMetrics.DENSITY_DEFAULT)); + } + +} diff --git a/DEV4.5/Reticule/app/src/main/java/fr/iutfbleau/but2/reticule/event.java b/DEV4.5/Reticule/app/src/main/java/fr/iutfbleau/but2/reticule/event.java new file mode 100644 index 0000000..303d348 --- /dev/null +++ b/DEV4.5/Reticule/app/src/main/java/fr/iutfbleau/but2/reticule/event.java @@ -0,0 +1,23 @@ +package fr.iutfbleau.but2.reticule; + +import android.content.Context; +import android.view.GestureDetector; +import android.view.MotionEvent; +import android.view.View; + +public class event implements View.OnTouchListener { + + private GestureDetector gestureDetector; + public ReticuleListener listener; + + public event(ReticuleController RC, Context c) { + this.listener = new ReticuleListener(RC,c); + gestureDetector = new GestureDetector(this.listener); + } + + @Override + public boolean onTouch(View v, MotionEvent event) { + this.listener.setView(v); + return gestureDetector.onTouchEvent(event); + } +} diff --git a/DEV4.5/Reticule/app/src/main/res/drawable-v24/ic_launcher_foreground.xml b/DEV4.5/Reticule/app/src/main/res/drawable-v24/ic_launcher_foreground.xml new file mode 100644 index 0000000..2b068d1 --- /dev/null +++ b/DEV4.5/Reticule/app/src/main/res/drawable-v24/ic_launcher_foreground.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/DEV4.5/Reticule/app/src/main/res/drawable/ic_launcher_background.xml b/DEV4.5/Reticule/app/src/main/res/drawable/ic_launcher_background.xml new file mode 100644 index 0000000..07d5da9 --- /dev/null +++ b/DEV4.5/Reticule/app/src/main/res/drawable/ic_launcher_background.xml @@ -0,0 +1,170 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/DEV4.5/Reticule/app/src/main/res/layout/activity_main.xml b/DEV4.5/Reticule/app/src/main/res/layout/activity_main.xml new file mode 100644 index 0000000..22d40c7 --- /dev/null +++ b/DEV4.5/Reticule/app/src/main/res/layout/activity_main.xml @@ -0,0 +1,16 @@ + + + + + + \ No newline at end of file diff --git a/DEV4.5/Reticule/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/DEV4.5/Reticule/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml new file mode 100644 index 0000000..6f3b755 --- /dev/null +++ b/DEV4.5/Reticule/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/DEV4.5/Reticule/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml b/DEV4.5/Reticule/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml new file mode 100644 index 0000000..6f3b755 --- /dev/null +++ b/DEV4.5/Reticule/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/DEV4.5/Reticule/app/src/main/res/mipmap-hdpi/ic_launcher.webp b/DEV4.5/Reticule/app/src/main/res/mipmap-hdpi/ic_launcher.webp new file mode 100644 index 0000000..c209e78 Binary files /dev/null and b/DEV4.5/Reticule/app/src/main/res/mipmap-hdpi/ic_launcher.webp differ diff --git a/DEV4.5/Reticule/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp b/DEV4.5/Reticule/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp new file mode 100644 index 0000000..b2dfe3d Binary files /dev/null and b/DEV4.5/Reticule/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp differ diff --git a/DEV4.5/Reticule/app/src/main/res/mipmap-mdpi/ic_launcher.webp b/DEV4.5/Reticule/app/src/main/res/mipmap-mdpi/ic_launcher.webp new file mode 100644 index 0000000..4f0f1d6 Binary files /dev/null and b/DEV4.5/Reticule/app/src/main/res/mipmap-mdpi/ic_launcher.webp differ diff --git a/DEV4.5/Reticule/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp b/DEV4.5/Reticule/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp new file mode 100644 index 0000000..62b611d Binary files /dev/null and b/DEV4.5/Reticule/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp differ diff --git a/DEV4.5/Reticule/app/src/main/res/mipmap-xhdpi/ic_launcher.webp b/DEV4.5/Reticule/app/src/main/res/mipmap-xhdpi/ic_launcher.webp new file mode 100644 index 0000000..948a307 Binary files /dev/null and b/DEV4.5/Reticule/app/src/main/res/mipmap-xhdpi/ic_launcher.webp differ diff --git a/DEV4.5/Reticule/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp b/DEV4.5/Reticule/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp new file mode 100644 index 0000000..1b9a695 Binary files /dev/null and b/DEV4.5/Reticule/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp differ diff --git a/DEV4.5/Reticule/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp b/DEV4.5/Reticule/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp new file mode 100644 index 0000000..28d4b77 Binary files /dev/null and b/DEV4.5/Reticule/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp differ diff --git a/DEV4.5/Reticule/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp b/DEV4.5/Reticule/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp new file mode 100644 index 0000000..9287f50 Binary files /dev/null and b/DEV4.5/Reticule/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp differ diff --git a/DEV4.5/Reticule/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp b/DEV4.5/Reticule/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp new file mode 100644 index 0000000..aa7d642 Binary files /dev/null and b/DEV4.5/Reticule/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp differ diff --git a/DEV4.5/Reticule/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp b/DEV4.5/Reticule/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp new file mode 100644 index 0000000..9126ae3 Binary files /dev/null and b/DEV4.5/Reticule/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp differ diff --git a/DEV4.5/Reticule/app/src/main/res/values-night/themes.xml b/DEV4.5/Reticule/app/src/main/res/values-night/themes.xml new file mode 100644 index 0000000..dd0adf3 --- /dev/null +++ b/DEV4.5/Reticule/app/src/main/res/values-night/themes.xml @@ -0,0 +1,7 @@ + + + + \ No newline at end of file diff --git a/DEV4.5/Reticule/app/src/main/res/values/colors.xml b/DEV4.5/Reticule/app/src/main/res/values/colors.xml new file mode 100644 index 0000000..c8524cd --- /dev/null +++ b/DEV4.5/Reticule/app/src/main/res/values/colors.xml @@ -0,0 +1,5 @@ + + + #FF000000 + #FFFFFFFF + \ No newline at end of file diff --git a/DEV4.5/Reticule/app/src/main/res/values/strings.xml b/DEV4.5/Reticule/app/src/main/res/values/strings.xml new file mode 100644 index 0000000..cb943c0 --- /dev/null +++ b/DEV4.5/Reticule/app/src/main/res/values/strings.xml @@ -0,0 +1,3 @@ + + reticule + \ No newline at end of file diff --git a/DEV4.5/Reticule/app/src/main/res/values/themes.xml b/DEV4.5/Reticule/app/src/main/res/values/themes.xml new file mode 100644 index 0000000..e55cc1f --- /dev/null +++ b/DEV4.5/Reticule/app/src/main/res/values/themes.xml @@ -0,0 +1,9 @@ + + + + +