Skip to content
Snippets Groups Projects
Commit d1fc628e authored by PFEFFER Melvil's avatar PFEFFER Melvil
Browse files

Merge branch 'main' into 'update-pages'

# Conflicts:
#   app/src/main/res/values/strings.xml - solved
parents 5f4047c3 af0e68ed
No related branches found
No related tags found
1 merge request!8Update pages (Night mode done)
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
xmlns:tools="http://schemas.android.com/tools"
package="com.example.myapplication">
<uses-feature
android:name="android.hardware.camera"
......
package com.example.myapplication;
import android.app.Activity;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.Spinner;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.DialogFragment;
public class OverlayDialogFragmentForm extends DialogFragment {
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
// Inflate the layout for this dialog fragment
View view = inflater.inflate(R.layout.fragment_form, container, false);
return inflater.inflate(R.layout.fragment_form, container, false);
}
@Override
public void onStart() {
super.onStart();
if (getDialog() != null && getDialog().getWindow() != null) {
getDialog().getWindow().setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
getDialog().getWindow().setBackgroundDrawableResource(android.R.color.transparent); // Transparent background
}
Button goBackButton=(Button) this.getView().findViewById(R.id.submit_form_button);
View.OnClickListener listenerGoBackButton=new View.OnClickListener() {
@Override
public void onClick(View view) {
goBack();
}
};
goBackButton.setOnClickListener(listenerGoBackButton);
}
private void goBack() {
this.getDialog().dismiss();
}
}
......@@ -8,6 +8,7 @@ import android.graphics.Bitmap;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import com.example.myapplication.R;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
......@@ -21,7 +22,9 @@ import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.Spinner;
import android.widget.TextView;
import java.io.IOException;
......@@ -34,6 +37,8 @@ public class PhotoPage extends Fragment {
Button cameraButton, folderButton;
TextView textPredictionOutput, textProbabilityOutput;
ImageView imageView;
FrameLayout formLayout;
int imageSize = 256;
......@@ -41,7 +46,6 @@ public class PhotoPage extends Fragment {
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_photo_page, container, false);
// Initialize UI elements
cameraButton = view.findViewById(R.id.camera_button);
folderButton = view.findViewById(R.id.folder_button);
......@@ -50,6 +54,8 @@ public class PhotoPage extends Fragment {
imageView = view.findViewById(R.id.main_image_display);
Button seeTutoButton = view.findViewById(R.id.see_tuto);
// Set up button click listeners
cameraButton.setOnClickListener(new View.OnClickListener() {
@RequiresApi(api = Build.VERSION_CODES.M)
......@@ -69,6 +75,7 @@ public class PhotoPage extends Fragment {
public void onClick(View v) {
Intent folderIntent = new Intent(Intent.ACTION_PICK, MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
startActivityForResult(folderIntent, GALLERY_REQUEST_CODE);
}
});
......@@ -114,6 +121,7 @@ public class PhotoPage extends Fragment {
ContentResolver resolver = getContext().getContentResolver();
Bitmap galleryImage = MediaStore.Images.Media.getBitmap(resolver, selectedImageUri);
imageView.setImageBitmap(galleryImage);
processImage(galleryImage); // Pass the image for further processing
} catch (IOException e) {
e.printStackTrace();
......@@ -122,6 +130,7 @@ public class PhotoPage extends Fragment {
}
break;
}
showOverlayForm();
}
private void processImage(Bitmap bitmap) {
......@@ -162,5 +171,10 @@ public class PhotoPage extends Fragment {
textPredictionOutput.setText("Camera permission denied. Please allow it to use this feature.");
}
}
}
public void showOverlayForm() {
OverlayDialogFragmentForm overlayDialogForm = new OverlayDialogFragmentForm();
overlayDialogForm.show(getParentFragmentManager(), "overlayDialogForm");
}
}
<LinearLayout 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/form_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="@drawable/shape"
android:padding="20dp"
tools:context=".PhotoPage">
<!-- Title for the form -->
<TextView
android:id="@+id/form_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Saisissez les détails du localisation"
android:textSize="18sp"
android:textColor="#333333"
android:textStyle="bold"
android:layout_gravity="center_horizontal"
android:layout_marginTop="20dp" />
<!-- Location Input -->
<EditText
android:id="@+id/location_input"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:hint="Localisation (qu'est ce que vous voyez?)"
android:padding="20dp"
android:textColor="#000000" />
<TextView
android:id="@+id/form_zonage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Saisissez la zone correspondante"
android:textSize="18sp"
android:textColor="#333333"
android:textStyle="bold"
android:layout_gravity="center_horizontal"
android:layout_marginTop="20dp" />
<EditText
android:id="@+id/zone_input"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:hint="Dans quelle zone vous situez"
android:padding="20dp"
android:textColor="#000000" />
<Button
android:id="@+id/form_zoneInfo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Plus d'info sur les zones"
android:textSize="12sp"
android:textColor="#4B0076"
android:layout_gravity="right"
android:backgroundTint="#FFFFFF"
android:layout_marginTop="5dp" />
<!-- Date Picker (Optional) -->
<!-- Submit Button -->
<TextView
android:id="@+id/form_date"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Saisissez la date de la prise de la photo"
android:textSize="18sp"
android:textColor="#333333"
android:textStyle="bold"
android:layout_gravity="center_horizontal"
android:layout_marginTop="5dp" />
<DatePicker
android:id="@+id/date_picker"
android:layout_width="wrap_content"
android:layout_height="250dp"
android:layout_gravity="center_horizontal"
android:layout_marginTop="20dp" />
<Button
android:id="@+id/submit_form_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="30dp"
android:text="Envoyer"
android:textColor="#FFFFFF"
android:backgroundTint="#517293"
style="@style/ButtonAppearance" />
</LinearLayout>
......@@ -79,4 +79,10 @@
<string name="personal_data">Traitement des données personnelles</string>
<string name="download">Télécharger</string>
<string name="mode_sombre">Mode sombre</string>
<string-array name="zone_array">
<item>Zone 1</item>
<item>Zone 2</item>
<item>Zone 3</item>
<item>Zone 4</item>
</string-array>
</resources>
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment