Skip to content
This repository was archived by the owner on Feb 17, 2020. It is now read-only.

Commit 242c9c2

Browse files
committed
Merge branch 'develop' into conf/droidcon-turin-2018
# Conflicts: # app/build.gradle
2 parents c697001 + 713b4db commit 242c9c2

4 files changed

Lines changed: 41 additions & 34 deletions

File tree

app/src/main/java/net/squanchy/schedule/view/OtherEventItemView.kt

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package net.squanchy.schedule.view
33
import android.content.Context
44
import android.support.annotation.DrawableRes
55
import android.util.AttributeSet
6+
import androidx.view.isVisible
67
import kotlinx.android.synthetic.main.item_schedule_event_other.view.*
78
import net.squanchy.R
89
import net.squanchy.schedule.domain.view.Event
@@ -19,7 +20,14 @@ class OtherEventItemView @JvmOverloads constructor(
1920

2021
timestamp.text = startTimeAsFormattedString(event)
2122
title.text = event.title
22-
illustration.setImageResource(illustrationFor(event.type))
23+
24+
if (event.type != Event.Type.OTHER) {
25+
illustration.isVisible = true
26+
illustration.setImageResource(illustrationFor(event.type))
27+
} else {
28+
illustration.isVisible = false
29+
illustration.setImageDrawable(null)
30+
}
2331
}
2432

2533
private fun Event.Type.ensureSupported() {
@@ -47,12 +55,7 @@ class OtherEventItemView @JvmOverloads constructor(
4755
Event.Type.COFFEE_BREAK -> R.drawable.coffee_break
4856
Event.Type.LUNCH -> R.drawable.lunch
4957
Event.Type.REGISTRATION -> R.drawable.registration
50-
Event.Type.OTHER -> NO_DRAWABLE
5158
Event.Type.SOCIAL -> R.drawable.social
5259
else -> throw IllegalArgumentException("Type not supported: ${type.name}")
5360
}
54-
55-
companion object {
56-
private const val NO_DRAWABLE = 0
57-
}
5861
}

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

Lines changed: 30 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
<!-- We do only want the padding on the start side -->
33
<net.squanchy.schedule.view.OtherEventItemView
44
xmlns:android="http://schemas.android.com/apk/res/android"
5+
xmlns:app="http://schemas.android.com/apk/res-auto"
56
xmlns:tools="http://schemas.android.com/tools"
67
android:layout_width="match_parent"
78
android:layout_height="wrap_content"
@@ -11,42 +12,45 @@
1112
tools:layout_margin="16dp"
1213
tools:ignore="RtlSymmetry">
1314

14-
<LinearLayout
15+
<android.support.constraint.ConstraintLayout
16+
android:id="@+id/linearLayout"
1517
android:layout_width="match_parent"
16-
android:layout_height="wrap_content"
17-
android:orientation="horizontal">
18+
android:layout_height="wrap_content">
1819

19-
<LinearLayout
20-
android:layout_width="0dp"
20+
<TextView
21+
android:id="@+id/title"
22+
style="@style/Schedule.Card.Title"
23+
android:layout_width="@dimen/match_constraint"
2124
android:layout_height="wrap_content"
22-
android:layout_weight="1"
23-
android:layout_gravity="center_vertical"
24-
android:orientation="vertical">
25-
26-
<TextView
27-
android:id="@+id/title"
28-
style="@style/Schedule.Card.Title"
29-
android:layout_width="match_parent"
30-
android:layout_height="wrap_content"
31-
tools:text="Designing for an Android future" />
32-
33-
<TextView
34-
android:id="@+id/timestamp"
35-
style="@style/Schedule.Card.Timestamp"
36-
android:layout_width="wrap_content"
37-
android:layout_height="wrap_content"
38-
android:layout_marginTop="@dimen/card_timestamp_margin_top"
39-
tools:text="12:00" />
40-
41-
</LinearLayout>
25+
app:layout_constraintStart_toStartOf="parent"
26+
app:layout_constraintTop_toTopOf="@+id/illustration"
27+
app:layout_constraintEnd_toStartOf="@+id/illustration"
28+
app:layout_constraintBottom_toTopOf="@+id/timestamp"
29+
app:layout_constraintVertical_chainStyle="packed"
30+
app:layout_goneMarginEnd="@dimen/card_padding_horizontal"
31+
tools:text="Designing for an Android future" />
32+
33+
<TextView
34+
android:id="@+id/timestamp"
35+
style="@style/Schedule.Card.Timestamp"
36+
android:layout_width="wrap_content"
37+
android:layout_height="wrap_content"
38+
android:layout_marginTop="@dimen/card_timestamp_margin_top"
39+
app:layout_constraintStart_toStartOf="@+id/title"
40+
app:layout_constraintTop_toBottomOf="@+id/title"
41+
app:layout_constraintBottom_toBottomOf="@+id/illustration"
42+
tools:text="12:00" />
4243

4344
<ImageView
4445
android:id="@+id/illustration"
4546
android:layout_width="@dimen/card_other_illustration_width"
4647
android:layout_height="@dimen/card_other_illustration_height"
4748
android:scaleType="centerInside"
49+
app:layout_constraintTop_toTopOf="parent"
50+
app:layout_constraintEnd_toEndOf="parent"
51+
app:layout_constraintBottom_toBottomOf="parent"
4852
tools:src="@drawable/lunch" />
4953

50-
</LinearLayout>
54+
</android.support.constraint.ConstraintLayout>
5155

5256
</net.squanchy.schedule.view.OtherEventItemView>

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@
8787
android:id="@+id/favoriteIcon"
8888
android:layout_width="@dimen/card_favourite_size"
8989
android:layout_height="@dimen/card_favourite_size"
90-
android:src="@drawable/ic_favorite_filled"
90+
android:src="@drawable/ic_favorite_settings"
9191
android:tint="?colorPrimary"
9292
android:visibility="gone"
9393
app:layout_constraintTop_toTopOf="@+id/timestamp"

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
<dimen name="card_pressed_z_translation">2dp</dimen>
1818
<dimen name="card_padding_horizontal">16dp</dimen>
1919
<dimen name="card_padding_top">12dp</dimen>
20-
<dimen name="card_padding_bottom">8dp</dimen>
20+
<dimen name="card_padding_bottom">12dp</dimen>
2121
<dimen name="card_timestamp">14sp</dimen>
2222
<dimen name="card_timestamp_margin_top">4dp</dimen>
2323
<dimen name="card_favourite_size">20dp</dimen>

0 commit comments

Comments
 (0)