HumanLearning2021/HumanLearningApp

View on GitHub
app/src/main/res/layout/fragment_learning.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"
    android:animateLayoutChanges="true"
    tools:context=".view.learning.LearningFragment">

    <!-- Sadly this file contains a lot of copy pasted things (The CardViews with ImageView inside)
        But I don't know how to avoid this for the time being. Maybe a fragment?
        <include layout="..."> didn't compile
        (said there were duplicate ids, but in reality not).
    -->
    <androidx.cardview.widget.CardView
        android:id="@+id/cardView_to_sort"
        android:layout_width="@dimen/learning_image_size"
        android:layout_height="@dimen/learning_image_size"
        app:cardCornerRadius="@dimen/learning_image_corner_radius"

        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintHorizontal_bias="0.5"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@id/learning_guideline1">

        <ImageView
            android:id="@+id/imageView_to_sort"
            android:contentDescription="@string/learning_im_to_sort_contentDescription"
            android:layout_width="match_parent"
            android:scaleType="centerCrop"
            android:layout_height="match_parent"
            android:padding="@dimen/learning_image_border_width"
            app:srcCompat="@drawable/default_representative_picture" />
    </androidx.cardview.widget.CardView>

    <androidx.constraintlayout.widget.ConstraintLayout
        android:id="@+id/constraintLayout"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        app:layout_constraintBottom_toTopOf="@id/learning_guideline1"
        app:layout_constraintTop_toTopOf="parent">

        <androidx.cardview.widget.CardView
            android:id="@+id/cardView_cat_0"
            android:layout_width="@dimen/learning_image_size"
            android:layout_height="@dimen/learning_image_size"
            app:cardBackgroundColor="@color/white"
            app:cardCornerRadius="@dimen/learning_image_corner_radius"

            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintEnd_toStartOf="@+id/cardView_cat_1"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toTopOf="parent">

            <ImageView
                android:id="@+id/imageView_cat_0"
                android:contentDescription="@string/Learning_cat_0_contentDescription"
                android:layout_width="match_parent"
                android:scaleType="centerCrop"
                android:layout_height="match_parent"
                android:padding="@dimen/learning_image_border_width"
                app:srcCompat="@drawable/default_representative_picture" />
        </androidx.cardview.widget.CardView>

        <androidx.cardview.widget.CardView
            android:id="@+id/cardView_cat_1"
            android:layout_width="@dimen/learning_image_size"
            android:layout_height="@dimen/learning_image_size"
            app:cardBackgroundColor="@color/white"
            app:cardCornerRadius="@dimen/learning_image_corner_radius"

            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintEnd_toStartOf="@+id/cardView_cat_2"
            app:layout_constraintStart_toEndOf="@+id/cardView_cat_0"
            app:layout_constraintTop_toTopOf="parent">

            <ImageView
                android:id="@+id/imageView_cat_1"
                android:contentDescription="@string/Learning_cat_1_contentDescription"
                android:layout_width="match_parent"
                android:scaleType="centerCrop"
                android:layout_height="match_parent"
                android:padding="@dimen/learning_image_border_width"
                app:srcCompat="@drawable/default_representative_picture" />
        </androidx.cardview.widget.CardView>

        <androidx.cardview.widget.CardView
            android:id="@+id/cardView_cat_2"
            android:layout_width="@dimen/learning_image_size"
            android:layout_height="@dimen/learning_image_size"
            app:cardBackgroundColor="@color/white"
            app:cardCornerRadius="@dimen/learning_image_corner_radius"

            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toEndOf="@+id/cardView_cat_1"
            app:layout_constraintTop_toTopOf="parent">

            <ImageView
                android:id="@+id/imageView_cat_2"
                android:contentDescription="@string/Learning_cat_2_contentDescription"
                android:layout_width="match_parent"
                android:scaleType="centerCrop"
                android:layout_height="match_parent"
                android:padding="@dimen/learning_image_border_width"
                app:srcCompat="@drawable/default_representative_picture" />
        </androidx.cardview.widget.CardView>

    </androidx.constraintlayout.widget.ConstraintLayout>

    <androidx.constraintlayout.widget.Guideline
        android:id="@+id/learning_guideline1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
        app:layout_constraintGuide_percent="0.7" />
</androidx.constraintlayout.widget.ConstraintLayout>