bgabriel998/SoftwareDevProject

View on GitHub
app/src/main/res/layout/fragment_camera.xml

Summary

Maintainability
Test Coverage
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout 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:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".fragments.CameraFragment"
    android:id="@+id/cameraFragmentLayout">

    <!-- Camera-preview -->
    <androidx.camera.view.PreviewView
        android:id="@+id/cameraPreviewFragment"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />

    <!-- Black rectangle that is displayed when a picture is taken to simulate a flash-->
    <View
        android:id="@+id/take_picture_flash"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@drawable/rectangle"
        android:visibility="gone"/>

    <LinearLayout
        android:id="@+id/permissionRequestLayout"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical"
        android:gravity="center"
        android:background="@color/BackgroundGrey"
        android:visibility="gone">

        <TextView
            android:id="@+id/permissionRequest"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/permission_rationale_message"
            android:layout_marginStart="20dp"
            android:layout_marginEnd="20dp"
            android:textColor="@color/White"/>

        <ImageButton
            android:id="@+id/openSettingsButton"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:background="@color/Transparent"
            android:paddingTop="5dp"
            app:srcCompat="@drawable/ic_settings" />

    </LinearLayout>

    <!-- Compass View-->
    <ch.epfl.sdp.peakar.camera.CameraUiView
        android:id="@+id/compass"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="bottom"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintRight_toRightOf="parent" />

    <!-- Image button to take a picture, ratio of the button image is 1.3 -->
    <ImageButton
        android:id="@+id/takePicture"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:background="@drawable/ic_take_picture_button"
        android:layout_marginBottom="10dp"
        app:layout_constraintBottom_toBottomOf="@+id/compass"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        android:contentDescription="@string/button_used_to_take_a_picture" />

    <!-- Image button to switch between the different possibilities to display the POIs -->
    <ImageButton
        android:id="@+id/switchDisplayPOIs"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:contentDescription="@string/buttonChangeDisplayModePOI"
        android:background="@drawable/ic_circle_background"
        app:layout_constraintStart_toEndOf="@+id/takePicture"
        app:layout_constraintTop_toTopOf="@+id/takePicture"
        app:layout_constraintBottom_toBottomOf="@+id/takePicture"
        app:srcCompat="@drawable/ic_binoculars" />


    <!--TextView indicates the horizontal heading of the user-->
    <TextView
        android:id="@+id/textDisplayPOImode"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:gravity="center"
        android:textColor="@color/White"
        android:textSize="11sp"
        app:layout_constraintLeft_toLeftOf="@+id/switchDisplayPOIs"
        app:layout_constraintRight_toRightOf="@+id/switchDisplayPOIs"
        app:layout_constraintBottom_toBottomOf="@+id/switchDisplayPOIs"
        android:text=""
        android:layout_marginBottom="5dp" />

    <!-- Image button to switch between the different possibilities to display the POIs -->
    <ImageButton
        android:id="@+id/compassMiniature"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:contentDescription="@string/buttonChangeDisplayModePOI"
        android:background="@drawable/ic_circle_background"
        app:layout_constraintEnd_toStartOf="@+id/takePicture"
        app:layout_constraintTop_toTopOf="@+id/takePicture"
        app:layout_constraintBottom_toBottomOf="@+id/takePicture"
        app:srcCompat="@drawable/ic_compass_ring" />

    <!-- layout to display the arrow and heading inside the compass-->
    <LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:orientation="vertical"

        app:layout_constraintLeft_toLeftOf="@+id/compassMiniature"
        app:layout_constraintRight_toRightOf="@+id/compassMiniature"
        app:layout_constraintTop_toTopOf="@+id/compassMiniature"
        app:layout_constraintBottom_toBottomOf="@+id/compassMiniature">

        <ImageView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:contentDescription="@string/buttonChangeDisplayModePOI"
            android:layout_gravity="center"
            android:layout_marginTop="-2dp"
            app:srcCompat="@drawable/ic_compass_arrow" />

        <!--TextView indicates the horizontal heading of the user-->
        <TextView
            android:id="@+id/headingCompass"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:gravity="center"
            android:textColor="@color/White"
            android:textSize="11sp"
            android:text=""
            android:layout_marginTop="-4dp" />
    </LinearLayout>

    <!--TextView indicates the horizontal heading of the user-->
    <TextView
        android:id="@+id/headingHorizontal"
        android:visibility="gone"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="40dp"
        android:gravity="top"
        android:textColor="@color/White"
        android:background="@drawable/rectangle"
        android:text=""
        android:layout_marginEnd="5dp"
        app:layout_constraintTop_toTopOf="parent"
        app:layout_constraintEnd_toEndOf="parent"/>

    <!--TextView indicates the vertical heading of the user-->
    <TextView
        android:id="@+id/headingVertical"
        android:visibility="gone"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignStart="@+id/headingHorizontal"
        android:layout_below="@+id/headingHorizontal"
        android:gravity="top"
        android:textColor="@color/White"
        android:background="@drawable/rectangle"
        android:text=""
        app:layout_constraintEnd_toEndOf="@+id/headingHorizontal"
        app:layout_constraintTop_toBottomOf="@+id/headingHorizontal" />

    <!--TextView indicates the horizontal and vertical fov in degrees-->
    <TextView
        android:id="@+id/fovHorVer"
        android:visibility="gone"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignStart="@+id/headingVertical"
        android:layout_below="@+id/headingVertical"
        android:gravity="top"
        android:textColor="@color/White"
        android:background="@drawable/rectangle"
        android:text=""
        app:layout_constraintEnd_toEndOf="@+id/headingHorizontal"
        app:layout_constraintTop_toBottomOf="@+id/headingVertical" />


    <!--TextView indicates the user location-->
    <TextView
        android:id="@+id/userLocation"
        android:visibility="gone"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignStart="@+id/fovHorVer"
        android:layout_below="@+id/fovHorVer"
        android:gravity="top"
        android:textColor="@color/White"
        android:background="@drawable/rectangle"
        android:text=""
        app:layout_constraintEnd_toEndOf="@+id/headingHorizontal"
        app:layout_constraintTop_toBottomOf="@+id/fovHorVer" />

    <!--TextView indicates the altitude of the user-->
    <TextView
        android:id="@+id/userAltitude"
        android:visibility="gone"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignStart="@+id/fovHorVer"
        android:layout_below="@+id/fovHorVer"
        android:gravity="top"
        android:textColor="@color/White"
        android:background="@drawable/rectangle"
        android:text=""
        app:layout_constraintEnd_toEndOf="@+id/headingHorizontal"
        app:layout_constraintTop_toBottomOf="@+id/userLocation" />

</androidx.constraintlayout.widget.ConstraintLayout>