Adds functional dashboard based on recycler view that picks the number of columns based on screen width.

This commit is contained in:
Tom Hicks
2021-07-05 00:01:37 -07:00
parent 26df28512c
commit 7b09098833
6 changed files with 667 additions and 500 deletions

View File

@@ -4,6 +4,7 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="@dimen/text_margin"
android:background="@drawable/rectangle_background">
<TextView

View File

@@ -1,145 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
<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=".ui.dashboard.DashboardFragment">
<LinearLayout
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/list"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="8dp"
android:orientation="vertical">
<GridLayout
android:id="@+id/monsterCards"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:columnCount="2">
<!-- <include-->
<!-- layout="@layout/card_monster"-->
<!-- android:layout_width="0dp"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:layout_columnWeight="1"-->
<!-- android:layout_marginVertical="8dp"/>-->
<!-- <include-->
<!-- layout="@layout/card_monster"-->
<!-- android:layout_width="0dp"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:layout_columnWeight="1"-->
<!-- android:layout_marginVertical="8dp"/>-->
<!-- <include-->
<!-- layout="@layout/card_monster"-->
<!-- android:layout_width="0dp"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:layout_columnWeight="1"-->
<!-- android:layout_marginVertical="8dp"/>-->
<!-- <include-->
<!-- layout="@layout/card_monster"-->
<!-- android:layout_width="0dp"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:layout_columnWeight="1"-->
<!-- android:layout_marginVertical="8dp"/>-->
</GridLayout>
<GridLayout
android:id="@+id/monsterShortCards"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:columnCount="2">
<!-- <include-->
<!-- layout="@layout/card_monster_short"-->
<!-- android:layout_width="0dp"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:layout_columnWeight="1"-->
<!-- android:layout_marginVertical="8dp"/>-->
<!-- <include-->
<!-- layout="@layout/card_monster_short"-->
<!-- android:layout_width="0dp"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:layout_columnWeight="1"-->
<!-- android:layout_marginVertical="8dp"/>-->
<!-- <include-->
<!-- layout="@layout/card_monster_short"-->
<!-- android:layout_width="0dp"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:layout_columnWeight="1"-->
<!-- android:layout_marginVertical="8dp"/>-->
<!-- <include-->
<!-- layout="@layout/card_monster_short"-->
<!-- android:layout_width="0dp"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:layout_columnWeight="1"-->
<!-- android:layout_marginVertical="8dp"/>-->
</GridLayout>
<GridLayout
android:id="@+id/monsterTiles"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:columnCount="2">
<!-- <include-->
<!-- layout="@layout/tile_monster"-->
<!-- android:layout_width="0dp"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:layout_columnWeight="1"-->
<!-- android:layout_marginVertical="8dp"/>-->
<!-- <include-->
<!-- layout="@layout/tile_monster"-->
<!-- android:layout_width="0dp"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:layout_columnWeight="1"-->
<!-- android:layout_marginVertical="8dp" />-->
<!-- <include-->
<!-- layout="@layout/tile_monster"-->
<!-- android:layout_width="0dp"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:layout_columnWeight="1"-->
<!-- android:layout_marginVertical="8dp"/>-->
<!-- <include-->
<!-- layout="@layout/tile_monster"-->
<!-- android:layout_width="0dp"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:layout_columnWeight="1"-->
<!-- android:layout_marginVertical="8dp" />-->
</GridLayout>
<GridLayout
android:id="@+id/monsterShortTiles"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:columnCount="2">
<!-- <include-->
<!-- layout="@layout/tile_monster_short"-->
<!-- android:layout_width="0dp"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:layout_columnWeight="1"-->
<!-- android:layout_marginVertical="8dp" />-->
<!-- <include-->
<!-- layout="@layout/tile_monster_short"-->
<!-- android:layout_width="0dp"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:layout_columnWeight="1"-->
<!-- android:layout_marginVertical="8dp" />-->
<!-- <include-->
<!-- layout="@layout/tile_monster_short"-->
<!-- android:layout_width="0dp"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:layout_columnWeight="1"-->
<!-- android:layout_marginVertical="8dp" />-->
<!-- <include-->
<!-- layout="@layout/tile_monster_short"-->
<!-- android:layout_width="0dp"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:layout_columnWeight="1"-->
<!-- android:layout_marginVertical="8dp" />-->
</GridLayout>
</LinearLayout>
</ScrollView>
android:layout_height="match_parent"
android:divider="?android:attr/dividerVertical"
android:dividerPadding="@dimen/text_margin"
app:layoutManager="LinearLayoutManager"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:listitem="@layout/card_monster" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -0,0 +1,42 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="@+id/content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="@dimen/text_margin"
android:textAppearance="?attr/textAppearanceListItem" />
<!-- <include-->
<!-- layout="@layout/card_monster"-->
<!-- android:layout_width="0dp"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:layout_columnWeight="1"-->
<!-- android:layout_marginVertical="8dp"/>-->
<!-- <include-->
<!-- layout="@layout/card_monster_short"-->
<!-- android:layout_width="0dp"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:layout_columnWeight="1"-->
<!-- android:layout_marginVertical="8dp"/>-->
<!-- <include-->
<!-- layout="@layout/tile_monster"-->
<!-- android:layout_width="0dp"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:layout_columnWeight="1"-->
<!-- android:layout_marginVertical="8dp"/>-->
<!-- <include-->
<!-- layout="@layout/tile_monster_short"-->
<!-- android:layout_width="0dp"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:layout_columnWeight="1"-->
<!-- android:layout_marginVertical="8dp" />-->
</LinearLayout>