blob: 3ed4e05f1c39362b03bed78b3dd6b9f554cc8387 [file] [log] [blame]
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (C) 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>
<import type="android.text.TextUtils"/>
<import type="com.android.sample.githubbrowser.R"/>
<variable name="user" type="com.android.sample.githubbrowser.data.PersonData"/>
<variable name="editCallback" type="com.android.sample.githubbrowser.view.PersonClickCallback"/>
</data>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/background"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/avatar"
android:layout_width="96dp"
android:layout_height="96dp"
android:background="#FAFAFA"
app:imageUrl="@{user.avatar_url}"/>
<TextView
android:id="@+id/name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_toRightOf="@id/avatar"
android:lines="1"
android:maxLines="1"
android:paddingLeft="8dp"
android:paddingRight="8dp"
android:paddingTop="4dp"
android:text="@{user.name}"
android:textColor="#222"
android:textSize="20sp"
app:visibleInvisible="@{!(user == null || TextUtils.isEmpty(user.name))}"/>
<TextView
android:id="@+id/login"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/name"
android:layout_toRightOf="@id/avatar"
android:lines="1"
android:maxLines="1"
android:paddingLeft="8dp"
android:paddingRight="8dp"
android:paddingTop="4dp"
android:text="@{user.login}"
android:textColor="#444"
android:textSize="18sp"/>
<TextView
android:id="@+id/created"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignBottom="@id/avatar"
android:layout_toRightOf="@id/avatar"
android:lines="1"
android:maxLines="1"
android:paddingBottom="2dp"
android:paddingLeft="8dp"
android:textColor="#444"
android:textSize="14sp"
app:visibleInvisible="@{!(user == null || TextUtils.isEmpty(user.created_at))}"
app:jsonDate="@{user.created_at}"
app:stringRes="@{R.string.joined}"/>
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingLeft="16dp"
android:paddingTop="8dp">
<TextView
android:id="@+id/company"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:drawableLeft="@drawable/ic_people_black_18dp"
android:drawablePadding="2dp"
android:lines="1"
android:maxLines="1"
android:text="@{user.company}"
android:textColor="#444"
android:textSize="14sp"
app:visibleGone="@{!(user == null || TextUtils.isEmpty(user.company))}"/>
<TextView
android:id="@+id/location"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:drawableLeft="@drawable/ic_location_on_black_18dp"
android:drawablePadding="2dp"
android:lines="1"
android:maxLines="1"
android:paddingLeft="16dp"
android:text="@{user.location}"
android:textColor="#444"
android:textSize="14sp"
app:visibleGone="@{!(user == null || TextUtils.isEmpty(user.location))}"/>
<View
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_weight="1"/>
<ImageButton
android:id="@+id/edit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="8dp"
android:background="@null"
android:clickable="true"
android:onClick="@{() -> editCallback.onClick(user)}"
android:src="@drawable/ic_mode_edit_black_24dp"
app:visibleGone="@{user != null}"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingLeft="16dp"
android:paddingTop="8dp">
<TextView
android:id="@+id/email"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:drawableLeft="@drawable/ic_email_black_18dp"
android:drawablePadding="2dp"
android:lines="1"
android:maxLines="1"
android:text="@{user.email}"
android:textColor="#444"
android:textSize="14sp"
app:visibleGone="@{!(user == null || TextUtils.isEmpty(user.email))}"/>
<TextView
android:id="@+id/blog"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:drawableLeft="@drawable/ic_link_black_18dp"
android:drawablePadding="2dp"
android:lines="1"
android:maxLines="1"
android:paddingLeft="16dp"
android:text="@{user.blog}"
android:textColor="#444"
android:textSize="14sp"
app:visibleGone="@{!(user == null || TextUtils.isEmpty(user.blog))}"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingLeft="16dp"
android:paddingTop="8dp">
<TextView
android:id="@+id/followers_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:lines="1"
android:maxLines="1"
android:paddingRight="4dp"
android:text="@string/followers"
android:textColor="#444"
android:textSize="14sp"
app:visibleGone="@{user != null}"/>
<TextView
android:id="@+id/followers"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#CCC"
android:lines="1"
android:maxLines="1"
android:paddingLeft="4dp"
android:paddingRight="4dp"
android:text="@{Integer.toString(user.followers)}"
android:textColor="#444"
android:textSize="14sp"
app:visibleGone="@{user != null}"/>
<TextView
android:id="@+id/following_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:lines="1"
android:maxLines="1"
android:paddingLeft="16dp"
android:paddingRight="4dp"
android:text="@string/following"
android:textColor="#444"
android:textSize="14sp"
app:visibleGone="@{user != null}"/>
<TextView
android:id="@+id/following"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#CCC"
android:lines="1"
android:maxLines="1"
android:paddingLeft="4dp"
android:paddingRight="4dp"
android:text="@{Integer.toString(user.following)}"
android:textColor="#444"
android:textSize="14sp"
app:visibleGone="@{user != null}"/>
</LinearLayout>
<TextView
android:id="@+id/repositories_header"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="4dp"
android:paddingLeft="12dp"
android:paddingTop="24dp"
android:text="@string/repositories"
android:textAppearance="@style/TextAppearance.AppCompat.Body2"
app:visibleGone="@{user != null}"/>
app:textAllCaps="true"/>
<android.support.v7.widget.RecyclerView
android:id="@+id/repositories"
android:layout_width="match_parent"
android:layout_height="0dip"
android:layout_weight="1"/>
</LinearLayout>
</layout>