procrastinot-team/procrastinot

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

Summary

Maintainability
Test Coverage
<?xml version="1.0" encoding="utf-8"?>
<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/profileActivity"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">

    <androidx.appcompat.widget.Toolbar
        android:id="@+id/toolbar"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="@color/top_bar_background"
        android:minHeight="?attr/actionBarSize">

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:gravity="center"
            android:text="@string/profile"
            android:textColor="@color/dark_text"
            android:textSize="20sp" />
    </androidx.appcompat.widget.Toolbar>

    <androidx.core.widget.NestedScrollView
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:orientation="vertical">

            <androidx.cardview.widget.CardView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginLeft="16dp"
                android:layout_marginTop="16dp"
                android:layout_marginRight="16dp"
                app:cardCornerRadius="10dp"
                app:cardElevation="3dp">

                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:background="@color/card_background_dark"
                    android:orientation="horizontal"
                    android:paddingTop="24dp"
                    android:paddingBottom="24dp"
                    android:weightSum="8">

                    <androidx.constraintlayout.widget.ConstraintLayout
                        android:layout_width="0dp"
                        android:layout_height="wrap_content"
                        android:layout_weight="2"
                        android:gravity="center">

                        <com.google.android.material.imageview.ShapeableImageView
                            android:id="@+id/profileImage"
                            android:layout_width="0dp"
                            android:layout_height="0dp"
                            android:layout_marginStart="4dp"
                            android:layout_marginEnd="4dp"
                            app:layout_constraintDimensionRatio="H,1:1"
                            app:layout_constraintRight_toRightOf="parent"
                            app:layout_constraintLeft_toLeftOf="parent"
                            app:layout_constraintTop_toTopOf="parent"
                            android:scaleType="fitXY"
                            android:src="@mipmap/ic_launcher"
                            app:shapeAppearanceOverlay="@style/roundedImageViewRounded" />
                    </androidx.constraintlayout.widget.ConstraintLayout>

                    <LinearLayout
                        android:layout_width="0dp"
                        android:layout_height="wrap_content"
                        android:layout_weight="5"
                        android:orientation="vertical">

                        <EditText
                            android:id="@+id/nameEditText"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:autofillHints="@string/user_name_editable"
                            android:ems="10"
                            android:hint="@string/user_name_editable"
                            android:inputType="textPersonName"
                            android:textSize="14sp" />

                        <EditText
                            android:id="@+id/emailEditText"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:autofillHints="@string/user_email_editable"
                            android:ems="10"
                            android:hint="@string/user_email_editable"
                            android:inputType="textEmailAddress"
                            android:textSize="14sp" />

                        <TextView
                            android:id="@+id/nameTextView"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_gravity="start"
                            android:gravity="start"
                            android:layout_margin="4dp"
                            android:text="@string/user_name"
                            android:textColor="@color/dark_text"
                            android:textSize="18sp" />

                        <TextView
                            android:id="@+id/emailTextView"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_gravity="start"
                            android:gravity="start"
                            android:layout_margin="4dp"
                            android:text="@string/user_email"
                            android:textColor="@color/dark_text"
                            android:textSize="18sp" />

                        <TextView
                            android:id="@+id/usernameTextView"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_gravity="start"
                            android:gravity="start"
                            android:layout_margin="4dp"
                            android:text="@string/user_username"
                            android:textColor="@color/dark_text"
                            android:textSize="18sp" />

                        <Button
                            android:id="@+id/changeUsernameButton"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:text="@string/change_username_button_text"
                            android:textColor="@color/white" />

                        <LinearLayout
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content"
                            android:gravity="center"
                            android:orientation="horizontal"
                            android:weightSum="2">

                            <TextView
                                android:id="@+id/habitCountText"
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
                                android:layout_weight="1"
                                android:text="@string/loading" />

                            <TextView
                                android:id="@+id/avgPerWeekText"
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
                                android:layout_weight="1"
                                android:text="@string/loading" />
                        </LinearLayout>

                        <LinearLayout
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content"
                            android:gravity="center"
                            android:orientation="horizontal"
                            android:weightSum="2">

                            <TextView
                                android:id="@+id/earliestTextView"
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
                                android:layout_weight="1"
                                android:text="@string/loading" />

                            <TextView
                                android:id="@+id/latestTextView"
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
                                android:layout_weight="1"
                                android:text="@string/loading" />
                        </LinearLayout>

                        <LinearLayout
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content"
                            android:gravity="center"
                            android:orientation="horizontal"
                            android:weightSum="2">

                            <TextView
                                android:id="@+id/followersTextView"
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
                                android:layout_weight="1"
                                android:text="@string/loading" />

                            <TextView
                                android:id="@+id/followingTextView"
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
                                android:layout_weight="1"
                                android:text="@string/loading" />
                        </LinearLayout>
                    </LinearLayout>

                    <LinearLayout
                        android:layout_width="0dp"
                        android:layout_height="wrap_content"
                        android:layout_gravity="end"
                        android:layout_marginEnd="4dp"
                        android:layout_weight="1"
                        android:orientation="vertical">

                        <ImageButton
                            android:id="@+id/btnEdit"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:contentDescription="@string/edit_icon"
                            app:srcCompat="@android:drawable/ic_menu_edit" />

                        <ImageButton
                            android:id="@+id/btnSave"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:contentDescription="@string/save_icon"
                            app:srcCompat="@android:drawable/ic_menu_save" />

                        <ImageButton
                            android:id="@+id/btnFollow"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:contentDescription="@string/edit_icon"
                            app:srcCompat="@drawable/ic_follow" />

                        <ImageButton
                            android:id="@+id/btnUnfollow"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:contentDescription="@string/edit_icon"
                            app:srcCompat="@drawable/ic_unfollow" />

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

            <com.github.mateo762.myapplication.coach_rating.CoachRatingView
                android:id="@+id/coachRatingView"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginStart="16dp"
                android:layout_marginTop="16dp"
                android:layout_marginEnd="16dp" />

            <TextView
                android:id="@+id/habitsTitle"
                style="@style/title"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginLeft="16dp"
                android:layout_marginTop="16dp"
                android:layout_marginRight="16dp"
                android:layout_marginBottom="8dp"
                android:text="@string/profile_habits_title" />

            <androidx.recyclerview.widget.RecyclerView
                android:id="@+id/habitsRecyclerView"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:orientation="vertical"
                android:overScrollMode="never"
                app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
                tools:listitem="@layout/item_profile_habit" />

            <TextView
                android:id="@+id/profileGalleryTitle"
                style="@style/title"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginLeft="16dp"
                android:layout_marginTop="16dp"
                android:layout_marginRight="16dp"
                android:layout_marginBottom="8dp"
                android:text="@string/profile_progress_gallery_title" />

            <androidx.recyclerview.widget.RecyclerView
                android:id="@+id/galleryRecyclerView"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:orientation="vertical"
                android:overScrollMode="never"
                app:layoutManager="androidx.recyclerview.widget.GridLayoutManager"
                app:spanCount="2"
                tools:listitem="@layout/item_profile_gallery" />
        </LinearLayout>
    </androidx.core.widget.NestedScrollView>
</LinearLayout>