TP07byMathieu + boutDeControleBlanc
This commit is contained in:
3
TP05/.idea/.gitignore
generated
vendored
Normal file
3
TP05/.idea/.gitignore
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
9
TP05/.idea/TP05.iml
generated
Normal file
9
TP05/.idea/TP05.iml
generated
Normal file
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$" />
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
6
TP05/.idea/misc.xml
generated
Normal file
6
TP05/.idea/misc.xml
generated
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_21" project-jdk-name="Android API 34, extension level 7 Platform" project-jdk-type="Android SDK">
|
||||
<output url="file://$PROJECT_DIR$/out" />
|
||||
</component>
|
||||
</project>
|
8
TP05/.idea/modules.xml
generated
Normal file
8
TP05/.idea/modules.xml
generated
Normal file
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/.idea/TP05.iml" filepath="$PROJECT_DIR$/.idea/TP05.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
6
TP05/.idea/vcs.xml
generated
Normal file
6
TP05/.idea/vcs.xml
generated
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$/.." vcs="Git" />
|
||||
</component>
|
||||
</project>
|
10
TP05/EX01_Reticule/.idea/deploymentTargetDropDown.xml
generated
Normal file
10
TP05/EX01_Reticule/.idea/deploymentTargetDropDown.xml
generated
Normal file
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="deploymentTargetDropDown">
|
||||
<value>
|
||||
<entry key="app">
|
||||
<State />
|
||||
</entry>
|
||||
</value>
|
||||
</component>
|
||||
</project>
|
4
TP05/EX01_Reticule/.idea/gradle.xml
generated
4
TP05/EX01_Reticule/.idea/gradle.xml
generated
@@ -4,15 +4,15 @@
|
||||
<component name="GradleSettings">
|
||||
<option name="linkedExternalProjectsSettings">
|
||||
<GradleProjectSettings>
|
||||
<option name="testRunner" value="GRADLE" />
|
||||
<option name="distributionType" value="DEFAULT_WRAPPED" />
|
||||
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
||||
<option name="gradleJvm" value="jbr-17" />
|
||||
<option name="modules">
|
||||
<set>
|
||||
<option value="$PROJECT_DIR$" />
|
||||
<option value="$PROJECT_DIR$/app" />
|
||||
</set>
|
||||
</option>
|
||||
<option name="resolveExternalAnnotations" value="false" />
|
||||
</GradleProjectSettings>
|
||||
</option>
|
||||
</component>
|
||||
|
10
TP05/EX01_Reticule/.idea/migrations.xml
generated
Normal file
10
TP05/EX01_Reticule/.idea/migrations.xml
generated
Normal file
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectMigrations">
|
||||
<option name="MigrateToGradleLocalJavaHome">
|
||||
<set>
|
||||
<option value="$PROJECT_DIR$" />
|
||||
</set>
|
||||
</option>
|
||||
</component>
|
||||
</project>
|
3
TP05/EX01_Reticule/.idea/misc.xml
generated
3
TP05/EX01_Reticule/.idea/misc.xml
generated
@@ -1,6 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" project-jdk-name="jbr-17" project-jdk-type="JavaSDK">
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="jbr-17" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/build/classes" />
|
||||
</component>
|
||||
<component name="ProjectType">
|
||||
|
42
TP05/EX01_Reticule/app/build.gradle.kts
Normal file
42
TP05/EX01_Reticule/app/build.gradle.kts
Normal file
@@ -0,0 +1,42 @@
|
||||
plugins {
|
||||
id("com.android.application")
|
||||
}
|
||||
|
||||
android {
|
||||
namespace = "fr.iutfbleau.dev45.wamster.tp05ex01_reticule"
|
||||
compileSdk = 34
|
||||
|
||||
defaultConfig {
|
||||
applicationId = "fr.iutfbleau.dev45.wamster.tp05ex01_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("androidx.appcompat:appcompat:1.6.1")
|
||||
implementation("com.google.android.material:material:1.11.0")
|
||||
implementation("androidx.constraintlayout:constraintlayout:2.1.4")
|
||||
testImplementation("junit:junit:4.13.2")
|
||||
androidTestImplementation("androidx.test.ext:junit:1.1.5")
|
||||
androidTestImplementation("androidx.test.espresso:espresso-core:3.5.1")
|
||||
}
|
@@ -0,0 +1,26 @@
|
||||
package fr.iutfbleau.dev45.wamster.tp05ex01_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 <a href="http://d.android.com/tools/testing">Testing documentation</a>
|
||||
*/
|
||||
@RunWith(AndroidJUnit4.class)
|
||||
public class ExampleInstrumentedTest {
|
||||
@Test
|
||||
public void useAppContext() {
|
||||
// Context of the app under test.
|
||||
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
|
||||
assertEquals("fr.iutfbleau.dev45.wamster.tp05ex01_reticule", appContext.getPackageName());
|
||||
}
|
||||
}
|
@@ -0,0 +1,53 @@
|
||||
package fr.iutfbleau.dev45.wamster.tp05ex01_reticule;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Paint;
|
||||
import android.graphics.Path;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.View;
|
||||
|
||||
public class Dessin extends View {
|
||||
private float rayon;
|
||||
private float x;
|
||||
private float y;
|
||||
private final Paint pinceau;
|
||||
public Dessin(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
this.pinceau = new Paint();
|
||||
this.pinceau.setStyle(Paint.Style.STROKE);
|
||||
this.pinceau.setStrokeWidth(20.0f);
|
||||
this.pinceau.setColor(0xfffc6600);
|
||||
this.rayon = 100f;
|
||||
this.x = -1;
|
||||
this.y = -1;
|
||||
}
|
||||
|
||||
public void setCoordonnee(float x, float y){
|
||||
this.x = x;
|
||||
this.y =y;
|
||||
this.invalidate();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDraw(Canvas canvas){
|
||||
if (this.x < 0){
|
||||
this.x = getWidth()/2f;
|
||||
}
|
||||
if (this.y < 0){
|
||||
this.y = getHeight()/2f;
|
||||
}
|
||||
canvas.drawCircle(this.x, this.y, this.rayon, this.pinceau);
|
||||
Path trait1 = new Path();
|
||||
trait1.moveTo(this.x,this.y-(1.5f*this.rayon));
|
||||
trait1.lineTo(this.x, this.y+(1.5f*this.rayon));
|
||||
trait1.close();
|
||||
canvas.drawPath(trait1, this.pinceau);
|
||||
|
||||
Path trait2 = new Path();
|
||||
trait2.moveTo(this.x-(1.5f*this.rayon),this.y);
|
||||
trait2.lineTo(this.x+(1.5f*this.rayon), this.y);
|
||||
trait2.close();
|
||||
canvas.drawPath(trait2, this.pinceau);
|
||||
}
|
||||
}
|
@@ -0,0 +1,55 @@
|
||||
package fr.iutfbleau.dev45.wamster.tp05ex01_reticule;
|
||||
|
||||
import android.util.Log;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
|
||||
public class Evenement implements View.OnTouchListener{
|
||||
|
||||
private Dessin dessin;
|
||||
private boolean mouvementEnCours;
|
||||
private float distance = 50f;
|
||||
|
||||
public Evenement(Dessin dessin){
|
||||
this.dessin = dessin;
|
||||
this.mouvementEnCours = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onTouch(View v, MotionEvent event) {
|
||||
int action = event.getActionMasked();
|
||||
int index = event.getActionIndex();
|
||||
int id = event.getPointerId(index);
|
||||
Log.v("test1", id+"");
|
||||
float x,y;
|
||||
|
||||
switch (action) {
|
||||
case MotionEvent.ACTION_DOWN:
|
||||
this.mouvementEnCours = true;
|
||||
break;
|
||||
|
||||
case MotionEvent.ACTION_POINTER_DOWN:
|
||||
this.mouvementEnCours = false;
|
||||
break;
|
||||
|
||||
case MotionEvent.ACTION_MOVE:
|
||||
if (this.mouvementEnCours){
|
||||
this.dessin.setCoordonnee(event.getX(), event.getY());
|
||||
}
|
||||
break;
|
||||
|
||||
case MotionEvent.ACTION_UP:
|
||||
this.mouvementEnCours = false;
|
||||
break;
|
||||
case MotionEvent.ACTION_CANCEL:
|
||||
this.mouvementEnCours = false;
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public float isDistancePetite(float x1, float y1){
|
||||
float x2 = this.dessin.getX();
|
||||
float y2 = this.dessin.getX();
|
||||
}
|
||||
}
|
@@ -0,0 +1,18 @@
|
||||
package fr.iutfbleau.dev45.wamster.tp05ex01_reticule;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import android.os.Bundle;
|
||||
|
||||
public class MainActivity extends AppCompatActivity {
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_main);
|
||||
|
||||
Dessin dessin = findViewById(R.id.zoneDeDessin);
|
||||
Evenement ecouteurDoigt = new Evenement(dessin);
|
||||
dessin.setOnTouchListener(ecouteurDoigt);
|
||||
}
|
||||
}
|
@@ -0,0 +1,17 @@
|
||||
package fr.iutfbleau.dev45.wamster.tp05ex01_reticule;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* Example local unit test, which will execute on the development machine (host).
|
||||
*
|
||||
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
|
||||
*/
|
||||
public class ExampleUnitTest {
|
||||
@Test
|
||||
public void addition_isCorrect() {
|
||||
assertEquals(4, 2 + 2);
|
||||
}
|
||||
}
|
4
TP05/EX01_Reticule/build.gradle.kts
Normal file
4
TP05/EX01_Reticule/build.gradle.kts
Normal file
@@ -0,0 +1,4 @@
|
||||
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||
plugins {
|
||||
id("com.android.application") version "8.2.1" apply false
|
||||
}
|
18
TP05/EX01_Reticule/settings.gradle.kts
Normal file
18
TP05/EX01_Reticule/settings.gradle.kts
Normal file
@@ -0,0 +1,18 @@
|
||||
pluginManagement {
|
||||
repositories {
|
||||
google()
|
||||
mavenCentral()
|
||||
gradlePluginPortal()
|
||||
}
|
||||
}
|
||||
dependencyResolutionManagement {
|
||||
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
|
||||
repositories {
|
||||
google()
|
||||
mavenCentral()
|
||||
}
|
||||
}
|
||||
|
||||
rootProject.name = "TP05EX01_Reticule"
|
||||
include(":app")
|
||||
|
34
TP05/EX02_ArcEnCiel/.idea/deploymentTargetDropDown.xml
generated
Normal file
34
TP05/EX02_ArcEnCiel/.idea/deploymentTargetDropDown.xml
generated
Normal file
@@ -0,0 +1,34 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="deploymentTargetDropDown">
|
||||
<value>
|
||||
<entry key="app">
|
||||
<State>
|
||||
<targetSelectedWithDropDown>
|
||||
<Target>
|
||||
<type value="QUICK_BOOT_TARGET" />
|
||||
<deviceKey>
|
||||
<Key>
|
||||
<type value="VIRTUAL_DEVICE_PATH" />
|
||||
<value value="C:\Users\nerol\.android\avd\Pixel_3a_API_34_extension_level_7_x86_64.avd" />
|
||||
</Key>
|
||||
</deviceKey>
|
||||
</Target>
|
||||
</targetSelectedWithDropDown>
|
||||
<timeTargetWasSelectedWithDropDown value="2024-03-08T18:22:46.628450700Z" />
|
||||
<targetsSelectedWithDialog>
|
||||
<Target>
|
||||
<type value="QUICK_BOOT_TARGET" />
|
||||
<deviceKey>
|
||||
<Key>
|
||||
<type value="VIRTUAL_DEVICE_PATH" />
|
||||
<value value="C:\Users\nerol\.android\avd\Pixel_3a_API_34_extension_level_7_x86_64.avd" />
|
||||
</Key>
|
||||
</deviceKey>
|
||||
</Target>
|
||||
</targetsSelectedWithDialog>
|
||||
</State>
|
||||
</entry>
|
||||
</value>
|
||||
</component>
|
||||
</project>
|
4
TP05/EX02_ArcEnCiel/.idea/gradle.xml
generated
4
TP05/EX02_ArcEnCiel/.idea/gradle.xml
generated
@@ -4,15 +4,15 @@
|
||||
<component name="GradleSettings">
|
||||
<option name="linkedExternalProjectsSettings">
|
||||
<GradleProjectSettings>
|
||||
<option name="testRunner" value="GRADLE" />
|
||||
<option name="distributionType" value="DEFAULT_WRAPPED" />
|
||||
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
||||
<option name="gradleJvm" value="#GRADLE_LOCAL_JAVA_HOME" />
|
||||
<option name="modules">
|
||||
<set>
|
||||
<option value="$PROJECT_DIR$" />
|
||||
<option value="$PROJECT_DIR$/app" />
|
||||
</set>
|
||||
</option>
|
||||
<option name="resolveExternalAnnotations" value="false" />
|
||||
</GradleProjectSettings>
|
||||
</option>
|
||||
</component>
|
||||
|
10
TP05/EX02_ArcEnCiel/.idea/migrations.xml
generated
Normal file
10
TP05/EX02_ArcEnCiel/.idea/migrations.xml
generated
Normal file
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectMigrations">
|
||||
<option name="MigrateToGradleLocalJavaHome">
|
||||
<set>
|
||||
<option value="$PROJECT_DIR$" />
|
||||
</set>
|
||||
</option>
|
||||
</component>
|
||||
</project>
|
2
TP05/EX02_ArcEnCiel/.idea/misc.xml
generated
2
TP05/EX02_ArcEnCiel/.idea/misc.xml
generated
@@ -1,6 +1,6 @@
|
||||
<project version="4">
|
||||
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" project-jdk-name="jbr-17" project-jdk-type="JavaSDK">
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="jbr-17" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/build/classes" />
|
||||
</component>
|
||||
<component name="ProjectType">
|
||||
|
Reference in New Issue
Block a user