Factotum-sdp/Factotum

View on GitHub
app/src/main/res/layout/contact_with_details.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:id="@+id/contact_details_fragment"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:contentDescription="@string/all_contact_info"
    android:orientation="vertical">

        <androidx.cardview.widget.CardView
            android:id="@+id/cardView"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_margin="16dp"
            app:cardCornerRadius="8dp"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toTopOf="parent">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical"
            android:padding="16dp">

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="horizontal">

                <ImageView
                    android:id="@+id/contact_image"
                    android:layout_width="100dp"
                    android:layout_height="100dp"
                    android:contentDescription="@string/contact_image"
                    tools:srcCompat="@mipmap/ic_launcher_round" />

                <Space
                    android:layout_width="16dp"
                    android:layout_height="match_parent" />

                <LinearLayout
                    android:id="@+id/name_role_layout"
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_weight="1"
                    android:orientation="vertical">

                    <LinearLayout
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:orientation="horizontal">

                        <com.google.android.material.textview.MaterialTextView
                            android:id="@+id/contact_name"
                            style="@style/TextAppearance.MaterialComponents.Headline5"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:text="@string/contact_name" />

                        <Space
                            android:layout_width="4dp"
                            android:layout_height="match_parent" />

                        <com.google.android.material.textview.MaterialTextView
                            android:id="@+id/contact_surname"
                            style="@style/TextAppearance.MaterialComponents.Headline5"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:text="@string/contact_surname" />
                    </LinearLayout>

                    <com.google.android.material.textview.MaterialTextView
                        android:id="@+id/contact_username"
                        style="@style/TextAppearance.MaterialComponents.Caption"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:text="@string/contact_details_username" />

                    <com.google.android.material.textview.MaterialTextView
                        android:id="@+id/contact_role"
                        style="@style/TextAppearance.MaterialComponents.Body1"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_marginTop="5dp"
                        android:text="@string/contact_role" />

                    <LinearLayout
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:orientation="horizontal"
                        android:id="@+id/managing_client_shown"
                        android:visibility="gone">

                        <com.google.android.material.textview.MaterialTextView
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:text="@string/managing_client_text"
                            style="@style/TextAppearance.MaterialComponents.Caption"
                            android:textStyle="bold" />

                        <com.google.android.material.textview.MaterialTextView
                            android:id="@+id/managing_client_value"
                            android:layout_width="match_parent"
                            android:layout_height="match_parent"
                            style="@style/TextAppearance.MaterialComponents.Caption"
                            android:text="@string/managing_client" />

                    </LinearLayout>
                </LinearLayout>
            </LinearLayout>

            <LinearLayout
                android:id="@+id/details_layout"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginTop="32dp"
                android:orientation="vertical">

                <com.google.android.material.textview.MaterialTextView
                    android:id="@+id/contact_details_label"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="@string/contact_details_intro"
                    android:textSize="16sp"
                    android:textStyle="bold" />

                <LinearLayout
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:orientation="horizontal">

                    <com.google.android.material.textview.MaterialTextView
                        android:id="@+id/contact_address_value"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="@string/address_ex_layout" />

                    <Space
                        android:layout_width="4dp"
                        android:layout_height="match_parent" />

                    <com.google.android.material.textview.MaterialTextView
                        android:id="@+id/contact_address"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="@string/contact_address" />
                </LinearLayout>

                <LinearLayout
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:orientation="horizontal">

                    <com.google.android.material.textview.MaterialTextView
                        android:id="@+id/contact_phone_value"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="@string/phone_nb_ex_layout" />

                    <Space
                        android:layout_width="4dp"
                        android:layout_height="match_parent" />

                    <com.google.android.material.textview.MaterialTextView
                        android:id="@+id/contact_phone"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="@string/contact_phone"
                        android:autoLink="phone"/>
                </LinearLayout>


                <LinearLayout
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:orientation="horizontal">

                    <com.google.android.material.textview.MaterialTextView
                        android:id="@+id/details_description"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="@string/notes_ex_layout" />

                    <Space
                        android:layout_width="4dp"
                        android:layout_height="match_parent" />

                    <com.google.android.material.textview.MaterialTextView
                        android:id="@+id/contact_details"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="@string/contact_details" />
                </LinearLayout>
            </LinearLayout>


            <RelativeLayout
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:padding="8dp"
                android:layout_marginTop="8dp">

                <LinearLayout
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:orientation="vertical"
                    android:layout_centerVertical="true"
                    android:layout_alignParentEnd="true">

                    <com.google.android.material.button.MaterialButton
                        style="@style/Widget.Material3.Button.Icon"
                        android:id="@+id/show_all_button"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="@string/show_all"
                        app:icon="@drawable/ic_map"/>

                    <com.google.android.material.button.MaterialButton
                        style="@style/Widget.Material3.Button.Icon"
                        android:id="@+id/run_button"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="@string/run"
                        app:icon="@drawable/ic_map"/>
                </LinearLayout>
            </RelativeLayout>

        </LinearLayout>
    </androidx.cardview.widget.CardView>

    <com.google.android.material.button.MaterialButton
        android:id="@+id/button_delete_contact"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/delete_contact_button"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent"
        app:layout_constraintVertical_bias="0.915" />

    <com.google.android.material.button.MaterialButton
        android:id="@+id/button_modify_contact"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/button_modify_contact"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent"
        app:layout_constraintVertical_bias="0.815" />

    <com.google.android.material.textview.MaterialTextView
        android:id="@+id/contact_not_found_text"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/contact_not_found"
        android:visibility="gone"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>