Skip to content
This repository was archived by the owner on Aug 22, 2024. It is now read-only.

Commit a227476

Browse files
committed
[UPDATE] [#102] Refined the list item UI with most of the info.
1 parent 428be51 commit a227476

File tree

3 files changed

+40
-10
lines changed

3 files changed

+40
-10
lines changed

app/src/main/res/layout/activity_learning_resource.xml

-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
xmlns:tools="http://schemas.android.com/tools">
2020

2121
<androidx.constraintlayout.widget.ConstraintLayout
22-
android:layout_margin="8dp"
2322
android:layout_width="match_parent"
2423
android:layout_height="match_parent"
2524
tools:context="com.hossainkhan.android.demo.ui.resource.LearningResourceActivity">

app/src/main/res/layout/list_item_resource_tech_talk.xml

+34-9
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@
2222
<androidx.cardview.widget.CardView
2323
android:layout_width="match_parent"
2424
android:layout_height="wrap_content"
25-
android:layout_marginStart="8dp"
26-
android:layout_marginTop="8dp"
27-
android:layout_marginEnd="8dp"
25+
android:layout_marginStart="@dimen/material_horizontal_margin"
26+
android:layout_marginTop="@dimen/material_vertical_margin"
27+
android:layout_marginEnd="@dimen/material_horizontal_margin"
2828
app:cardCornerRadius="6dp"
2929
app:cardElevation="6dp">
3030

@@ -36,7 +36,7 @@
3636
<ImageButton
3737
android:id="@+id/action_play"
3838
style="@style/Widget.AppCompat.Button.Borderless"
39-
android:layout_width="wrap_content"
39+
android:layout_width="64dp"
4040
android:layout_height="wrap_content"
4141
android:tint="@color/md_red_500"
4242
app:layout_constraintBottom_toBottomOf="@+id/resource_summary"
@@ -46,32 +46,57 @@
4646

4747
<TextView
4848
android:id="@+id/resource_summary"
49-
style="@style/TextAppearance.AppCompat.Small"
49+
style="@style/TextAppearance.AppCompat.Caption"
5050
android:layout_width="0dp"
5151
android:layout_height="wrap_content"
52+
android:layout_marginTop="@dimen/material_content_distance_small"
5253
android:text="In this session you will learn best practices of using ConstraintLayout on Android, particularly covering tips and tricks in the Layout Editor and new features introduced in the 2.0 version. We will go over how to take advantage of those to create UI more efficiently."
5354
app:layout_constraintEnd_toStartOf="@+id/action_play"
54-
app:layout_constraintStart_toStartOf="parent"
55-
app:layout_constraintTop_toBottomOf="@+id/resource_title" />
55+
app:layout_constraintStart_toStartOf="@+id/guideline_vertical_start"
56+
app:layout_constraintTop_toBottomOf="@+id/resource_author" />
5657

5758
<TextView
5859
android:id="@+id/resource_date"
5960
android:layout_width="wrap_content"
6061
android:layout_height="wrap_content"
62+
android:layout_marginTop="@dimen/material_content_distance_small"
63+
android:layout_marginBottom="@dimen/material_vertical_margin"
6164
android:text="December 2, 2018"
62-
app:layout_constraintStart_toStartOf="parent"
65+
app:layout_constraintBottom_toBottomOf="parent"
66+
app:layout_constraintStart_toStartOf="@+id/guideline_vertical_start"
6367
app:layout_constraintTop_toBottomOf="@+id/resource_summary" />
6468

6569
<TextView
6670
android:id="@+id/resource_title"
6771
style="@style/TextAppearance.AppCompat.Title"
6872
android:layout_width="0dp"
6973
android:layout_height="wrap_content"
74+
android:layout_marginTop="@dimen/material_vertical_margin"
7075
android:text="This is the title of the talk."
7176
app:layout_constraintEnd_toStartOf="@+id/action_play"
72-
app:layout_constraintStart_toStartOf="parent"
77+
app:layout_constraintStart_toStartOf="@+id/guideline_vertical_start"
7378
app:layout_constraintTop_toTopOf="parent" />
7479

80+
81+
<TextView
82+
android:id="@+id/resource_author"
83+
style="@style/TextAppearance.AppCompat.Body2"
84+
android:layout_width="0dp"
85+
android:layout_height="wrap_content"
86+
android:layout_marginTop="@dimen/material_content_distance_small"
87+
android:gravity="end"
88+
android:text="by Author of the talk."
89+
app:layout_constraintEnd_toStartOf="@+id/action_play"
90+
app:layout_constraintStart_toStartOf="@+id/guideline_vertical_start"
91+
app:layout_constraintTop_toBottomOf="@+id/resource_title" />
92+
93+
<androidx.constraintlayout.widget.Guideline
94+
android:id="@+id/guideline_vertical_start"
95+
android:layout_width="0dp"
96+
android:layout_height="0dp"
97+
android:orientation="vertical"
98+
app:layout_constraintGuide_begin="16dp" />
99+
75100
</androidx.constraintlayout.widget.ConstraintLayout>
76101
</androidx.cardview.widget.CardView>
77102

app/src/main/res/values/dimens.xml

+6
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,10 @@
3131
<dimen name="ted_talk_thumbnail_height">220dp</dimen>
3232

3333
<item name="grid_column_count" type="integer">1</item>
34+
35+
<!-- Default screen margins, per the Android Design guidelines. -->
36+
<dimen name="material_horizontal_margin">16dp</dimen>
37+
<dimen name="material_vertical_margin">16dp</dimen>
38+
<dimen name="material_content_distance_medium">8dp</dimen>
39+
<dimen name="material_content_distance_small">4dp</dimen>
3440
</resources>

0 commit comments

Comments
 (0)