summaryrefslogtreecommitdiff
path: root/app/src/main/res/layout/repository_item.xml
blob: aac09357f95732f633652f633bdbb6ed6829e59d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
<?xml version="1.0" encoding="utf-8"?>
<layout>
    <data>
        <import type="java.text.NumberFormat"/>
        <variable
            name="repo"
            type="com.yodle.android.kotlindemo.model.Repository"/>
        <variable
            name="pushedDate"
            type="String"/>
    </data>

    <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:tools="http://schemas.android.com/tools"
        android:id="@+id/repositoryItemRootLayout"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="?attr/selectableItemBackground"
        android:clickable="true"
        android:paddingTop="@dimen/material_padding">

        <ImageView
            android:id="@+id/repositoryItemImage"
            android:layout_width="40dp"
            android:layout_height="40dp"
            android:layout_marginBottom="@dimen/material_padding"
            android:layout_marginLeft="@dimen/material_padding"
            tools:src="@mipmap/ic_launcher"/>

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginBottom="@dimen/material_padding"
            android:layout_marginLeft="@dimen/material_list_padding_left"
            android:layout_marginRight="@dimen/material_padding"
            android:orientation="vertical">

            <TextView
                android:id="@+id/repositoryItemTitle"
                android:text="@{repo.full_name}"
                style="@style/PrimaryTextStyle"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginBottom="@dimen/material_padding_quarter"
                android:layout_marginRight="@dimen/material_padding_double"
                android:ellipsize="end"
                android:lines="1"
                tools:text="JetBrains/kotlin"/>

            <TextView
                android:id="@+id/repositoryItemDescription"
                android:text="@{repo.description}"
                style="@style/SecondaryTextStyle"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginBottom="@dimen/material_padding_quarter"
                tools:text="The Kotlin Programming Language"/>

            <TextView
                android:id="@+id/repositoryItemLastUpdated"
                android:text='@{"Updated" + pushedDate}'
                style="@style/SecondaryTextStyle"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                tools:text="Updated 6 hours ago"/>
        </LinearLayout>

        <LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="right"
            android:gravity="center_vertical"
            android:orientation="horizontal"
            android:paddingRight="@dimen/material_padding">

            <TextView
                android:id="@+id/repositoryItemStarCount"
                android:text='@{NumberFormat.getInstance().format(repo.watchers_count)}'
                style="@style/SecondaryTextStyle"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginRight="@dimen/material_padding_quarter"
                android:textColor="@color/primary_text"
                tools:text="532"/>

            <ImageView
                android:layout_width="16dp"
                android:layout_height="16dp"
                android:adjustViewBounds="true"
                android:src="@drawable/ic_star"/>
        </LinearLayout>

        <View
            style="@style/HorizontalDividerStyle"
            android:layout_gravity="bottom"
            android:layout_marginLeft="@dimen/material_list_padding_left"/>
    </FrameLayout>
</layout>