diff --git a/app/src/main/java/com/example/myapplication/PhotoPage.java b/app/src/main/java/com/example/myapplication/PhotoPage.java index 6baa6357614c4f5784f3f11f5a885dec963b8af4..bd4eb1dd791782ef4c3fef5c48498ceb5bd2766c 100644 --- a/app/src/main/java/com/example/myapplication/PhotoPage.java +++ b/app/src/main/java/com/example/myapplication/PhotoPage.java @@ -37,7 +37,7 @@ public class PhotoPage extends Fragment { private static String predictionOutput; - Button cameraButton, folderButton; + Button cameraButton, folderButton, identifiedSpeciesButton; TextView textPredictionOutput, textProbabilityOutput; ImageView imageView; FrameLayout formLayout; @@ -48,12 +48,14 @@ public class PhotoPage extends Fragment { @Nullable @Override public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { + predictionOutput = null; 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); + identifiedSpeciesButton = view.findViewById(R.id.identified_species_button); textPredictionOutput = view.findViewById(R.id.textPredictionOutput); - textProbabilityOutput = view.findViewById(R.id.textProbabilityOutput); + //textProbabilityOutput = view.findViewById(R.id.textProbabilityOutput); imageView = view.findViewById(R.id.main_image_display); Button seeTutoButton = view.findViewById(R.id.see_tuto); @@ -82,6 +84,17 @@ public class PhotoPage extends Fragment { } }); + identifiedSpeciesButton.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + if(predictionOutput == null){ + Toast.makeText(getContext(), "Veuillez prendre une photo ou charger une image depuis votre gallerie.", Toast.LENGTH_LONG).show(); + } + else Toast.makeText(getContext(), predictionOutput, Toast.LENGTH_LONG).show(); + + + } + }); View.OnClickListener lSeeTutoButton = new View.OnClickListener() { @Override public void onClick(View view) { @@ -90,6 +103,8 @@ public class PhotoPage extends Fragment { startActivity(intent); getActivity().finish(); } + + }; seeTutoButton.setOnClickListener(lSeeTutoButton); diff --git a/app/src/main/res/layout/fragment_photo_page.xml b/app/src/main/res/layout/fragment_photo_page.xml index 4742b7d49f2a483fa1c16f1c019d2fb7dd63a99a..a6148b99adaf2cb3b1f73b9347bc99d4537c5479 100644 --- a/app/src/main/res/layout/fragment_photo_page.xml +++ b/app/src/main/res/layout/fragment_photo_page.xml @@ -65,6 +65,7 @@ tools:srcCompat="@tools:sample/avatars" /> <Button + android:id="@+id/identified_species_button" style="@style/ButtonAppearance" android:layout_width="wrap_content" android:layout_height="wrap_content" @@ -72,11 +73,17 @@ android:layout_marginTop="20dp" android:fontFamily="@font/inter" android:paddingHorizontal="40dp" - android:text="@string/especes" + android:text="Voir espèce(s) identifiée(s)" android:textSize="15sp" /> </FrameLayout> <!-- Prediction Text --> + + <!-- Accuracy Text --> + + <!-- Prediction Label --> + + <TextView android:id="@+id/textPredictionOutput" android:layout_width="351dp" @@ -88,19 +95,7 @@ android:textSize="17sp" android:textStyle="bold" /> - <!-- Accuracy Text --> - <TextView - android:id="@+id/textProbabilityOutput" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_gravity="center_horizontal|bottom" - android:layout_marginBottom="106dp" - android:text="" - android:textColor="#F12B2B" - android:textSize="17sp" - android:textStyle="bold" /> - <!-- Prediction Label --> <TextView android:id="@+id/prediction_label" android:layout_width="wrap_content" @@ -121,4 +116,12 @@ android:paddingEnd="50dp" android:text="@string/photo" /> + <EditText + android:id="@+id/editTextTextMultiLine4" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:ems="10" + android:gravity="start|top" + android:inputType="textMultiLine" /> + </FrameLayout>