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

Commit 848275a

Browse files
authored
Merge pull request #111 from amardeshbd/add-support-for-blog-resource
[UPDATE] Added different icon for technical article.
2 parents 0057edb + b10fada commit 848275a

File tree

5 files changed

+32
-196
lines changed

5 files changed

+32
-196
lines changed

.idea/assetWizardSettings.xml

Lines changed: 0 additions & 187 deletions
This file was deleted.

app/src/main/java/com/hossainkhan/android/demo/data/ResourceInfo.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ data class ResourceInfo(
4141
var url: String = "",
4242
var publish_date: Timestamp? = null,
4343
/**
44-
* Possible values
45-
* "blog", "techtalk"
44+
* Possible values:
45+
* "techarticle", "techtalk"
4646
*/
4747
var type: String = "techtalk"
4848
) {

app/src/main/java/com/hossainkhan/android/demo/ui/resource/ResourceListAdapter.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ class ResourceListAdapter(
4545
parent, false
4646
)
4747

48-
binding.actionPlay.setOnClickListener {
48+
binding.actionPreviewResource.setOnClickListener {
4949
binding.data?.let {
5050
itemClickCallback?.invoke(it)
5151
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<!--
2+
~ Copyright (c) 2019 Hossain Khan
3+
~
4+
~ Licensed under the Apache License, Version 2.0 (the "License");
5+
~ you may not use this file except in compliance with the License.
6+
~ You may obtain a copy of the License at
7+
~
8+
~ http://www.apache.org/licenses/LICENSE-2.0
9+
~
10+
~ Unless required by applicable law or agreed to in writing, software
11+
~ distributed under the License is distributed on an "AS IS" BASIS,
12+
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
~ See the License for the specific language governing permissions and
14+
~ limitations under the License.
15+
-->
16+
17+
<vector android:height="42dp" android:viewportHeight="24.0"
18+
android:viewportWidth="24.0" android:width="42dp" xmlns:android="http://schemas.android.com/apk/res/android">
19+
<path android:fillColor="#FF000000" android:pathData="M4,6L2,6v14c0,1.1 0.9,2 2,2h14v-2L4,20L4,6zM20,2L8,2c-1.1,0 -2,0.9 -2,2v12c0,1.1 0.9,2 2,2h12c1.1,0 2,-0.9 2,-2L22,4c0,-1.1 -0.9,-2 -2,-2zM19,11L9,11L9,9h10v2zM15,15L9,15v-2h6v2zM19,7L9,7L9,5h10v2z"/>
20+
</vector>

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

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,17 @@
3434
tools:background="#ccc">
3535

3636
<ImageButton
37-
android:id="@+id/action_play"
37+
android:id="@+id/action_preview_resource"
3838
style="@style/Widget.AppCompat.Button.Borderless"
3939
android:layout_width="64dp"
4040
android:layout_height="wrap_content"
41-
android:tint="@color/md_red_500"
41+
android:src="@{safeUnbox(data.youTubeUrl)? @drawable/ic_play_circle_filled_black_42dp : @drawable/ic_library_books_black_42dp}"
42+
android:tint="@{safeUnbox(data.youTubeUrl)? @color/md_red_500 : @color/md_cyan_800}"
4243
app:layout_constraintStart_toStartOf="@+id/guideline_vertical_start"
4344
app:layout_constraintTop_toTopOf="@+id/resource_title"
44-
app:srcCompat="@drawable/ic_play_circle_filled_black_42dp" />
45+
tools:ignore="ContentDescription"
46+
tools:src="@drawable/ic_play_circle_filled_black_42dp"
47+
tools:tint="@color/md_red_500" />
4548

4649
<TextView
4750
android:id="@+id/resource_summary"
@@ -71,12 +74,12 @@
7174
android:id="@+id/resource_title"
7275
style="@style/TextAppearance.AppCompat.Title"
7376
android:layout_width="0dp"
74-
android:gravity="end"
7577
android:layout_height="wrap_content"
7678
android:layout_marginTop="@dimen/material_vertical_margin"
79+
android:gravity="end"
7780
android:text="@{data.title}"
7881
app:layout_constraintEnd_toEndOf="@id/guideline_vertical_end"
79-
app:layout_constraintStart_toEndOf="@id/action_play"
82+
app:layout_constraintStart_toEndOf="@id/action_preview_resource"
8083
app:layout_constraintTop_toTopOf="parent"
8184
tools:text="This is the title of the talk. This can become multi line" />
8285

@@ -90,7 +93,7 @@
9093
android:gravity="end"
9194
android:text="@{@string/tech_talk_author_and_venue(data.author, data.event)}"
9295
app:layout_constraintEnd_toEndOf="@id/guideline_vertical_end"
93-
app:layout_constraintStart_toEndOf="@+id/action_play"
96+
app:layout_constraintStart_toEndOf="@+id/action_preview_resource"
9497
app:layout_constraintTop_toBottomOf="@+id/resource_title"
9598
tools:text="by Author of the talk." />
9699

0 commit comments

Comments
 (0)