| <?xml version="1.0" encoding="utf-8"?> |
| <!-- |
| ~ Copyright 2017, The Android Open Source Project |
| ~ |
| ~ Licensed under the Apache License, Version 2.0 (the "License"); |
| ~ you may not use this file except in compliance with the License. |
| ~ You may obtain a copy of the License at |
| ~ |
| ~ http://www.apache.org/licenses/LICENSE-2.0 |
| ~ |
| ~ Unless required by applicable law or agreed to in writing, software |
| ~ distributed under the License is distributed on an "AS IS" BASIS, |
| ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| ~ See the License for the specific language governing permissions and |
| ~ limitations under the License. |
| --> |
| |
| <layout xmlns:android="http://schemas.android.com/apk/res/android" |
| xmlns:app="http://schemas.android.com/apk/res-auto"> |
| <data> |
| <variable name="product" |
| type="com.example.android.persistence.model.Product"/> |
| <variable name="callback" |
| type="com.example.android.persistence.ui.ProductClickCallback"/> |
| </data> |
| |
| <android.support.v7.widget.CardView |
| android:layout_width="match_parent" |
| android:layout_height="wrap_content" |
| android:minHeight="@dimen/product_item_min_height" |
| android:onClick="@{() -> callback.onClick(product)}" |
| android:orientation="horizontal" |
| android:layout_marginStart="@dimen/item_horizontal_margin" |
| android:layout_marginEnd="@dimen/item_horizontal_margin" |
| app:cardUseCompatPadding="true"> |
| |
| <RelativeLayout |
| android:layout_marginStart="@dimen/item_horizontal_margin" |
| android:layout_marginEnd="@dimen/item_horizontal_margin" |
| android:layout_width="match_parent" |
| android:layout_height="wrap_content"> |
| |
| <TextView |
| android:id="@+id/name" |
| android:layout_width="wrap_content" |
| android:layout_height="wrap_content" |
| android:contentDescription="@string/cd_product_name" |
| android:text="@{product.name}"/> |
| |
| <TextView |
| android:layout_width="wrap_content" |
| android:layout_height="wrap_content" |
| android:layout_alignParentEnd="true" |
| android:layout_marginEnd="5dp" |
| android:text="@{@string/product_price(product.price)}"/> |
| |
| <TextView |
| android:layout_width="match_parent" |
| android:layout_height="wrap_content" |
| android:layout_below="@id/name" |
| android:text="@{product.description}"/> |
| </RelativeLayout> |
| |
| </android.support.v7.widget.CardView> |
| </layout> |