android TP3 ex1

This commit is contained in:
Simon SAYE BABU 2024-02-08 15:05:11 +01:00
parent aeb0fbed18
commit de69e1d700
8 changed files with 51 additions and 11 deletions

View 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>

View File

@ -1,17 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="GradleMigrationSettings" migrationVersion="1" />
<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
DEV4.5/Fleche/.idea/migrations.xml generated Normal file
View 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>

View File

@ -1,7 +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">

6
DEV4.5/Fleche/.idea/vcs.xml generated Normal file
View 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>

View File

@ -1,17 +1,32 @@
package com.example.fleche;
import android.content.DialogInterface;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
public class FlecheListener implements View.OnClickListener {
FlecheListener(ImageView img) {
private ImageView imgFleche;
private Button ButtonG;
private Button ButtonD;
FlecheListener(ImageView img, Button bg, Button bd) {
super();
this.imgFleche = img;
this.ButtonG = bg;
this.ButtonD = bd;
}
@Override
public void onClick(View view) {
//if (view.getId()==)
if(view.getId()==ButtonD.getId()) {
this.imgFleche.setImageResource(R.drawable.fleche_droite);
Log.v("test","droite");
}
if (view.getId()==ButtonG.getId()) {
this.imgFleche.setImageResource(R.drawable.fleche_gauche);
Log.v("test","gauche");
}
}
}

View File

@ -16,6 +16,6 @@ public class MainActivity extends AppCompatActivity {
ImageView FlecheImg = (ImageView) findViewById(R.id.flecheImg);
Button btnFlecheG = (Button) findViewById(R.id.flecheGauche);
Button btnFlecheD = (Button) findViewById(R.id.flecheDroite);
btnFlecheG.setOnClickListener();
btnFlecheG.setOnClickListener(new FlecheListener(FlecheImg,btnFlecheG,btnFlecheD));
}
}

View File

@ -4,7 +4,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="16dp"
android:paddingRight="16dp" >
android:paddingRight="16dp">
<ImageView
android:layout_width="wrap_content"
@ -36,7 +36,5 @@
android:layout_toEndOf="@+id/filler"
android:text="→"></Button>
<com.example.fleche.Fleche
android:layout_width="wrap_content"
android:layout_height="wrap_content"></com.example.fleche.Fleche>
</RelativeLayout>