Update repo and module item layout

This commit is contained in:
topjohnwu 2017-01-07 03:18:47 +08:00
parent a474eafe84
commit fa73b41fa7
3 changed files with 108 additions and 112 deletions

View File

@ -136,7 +136,6 @@ public class ReposAdapter extends RecyclerView.Adapter<ReposAdapter.ViewHolder>
@BindView(R.id.author) TextView author;
@BindView(R.id.expand_layout) LinearLayout expandLayout;
@BindView(R.id.update) ImageView updateImage;
@BindView(R.id.installed) ImageView installedImage;
@BindView(R.id.changeLog) ImageView changeLog;
@BindView(R.id.authorLink) ImageView authorLink;
@BindView(R.id.supportLink) ImageView supportLink;
@ -179,6 +178,11 @@ public class ReposAdapter extends RecyclerView.Adapter<ReposAdapter.ViewHolder>
layoutParams.height = expanded ? expandHeight : 0;
expandLayout.setLayoutParams(layoutParams);
expandLayout.setVisibility(expanded ? View.VISIBLE : View.GONE);
if (expanded) {
updateImage.setTranslationY(expandHeight / 2);
} else {
updateImage.setTranslationY(0);
}
}
private void expand() {

View File

@ -20,9 +20,7 @@
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:minHeight="?android:attr/listPreferredItemHeight"
android:padding="@dimen/card_layout_padding"
android:paddingEnd="@dimen/card_layout_padding"
android:paddingStart="@dimen/card_layout_padding">
android:padding="@dimen/card_layout_padding">
<TextView
android:id="@+id/title"

View File

@ -20,17 +20,28 @@
android:minHeight="?android:attr/listPreferredItemHeight"
android:padding="@dimen/card_layout_padding">
<RelativeLayout
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical">
android:layout_gravity="center_vertical"
android:id="@+id/info_layout">
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:orientation="vertical"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1">
<TextView
android:id="@+id/title"
android:layout_width="@dimen/card_textview_width"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_marginTop="0dp"
android:maxLines="1"
android:textAppearance="?android:attr/textAppearanceMedium"
@ -38,10 +49,8 @@
<TextView
android:id="@+id/version_name"
android:layout_width="@dimen/card_textview_width"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_below="@id/title"
android:text="@string/no_info_provided"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="@android:color/tertiary_text_dark"
@ -50,10 +59,8 @@
<TextView
android:id="@+id/author"
android:layout_width="@dimen/card_textview_width"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_below="@id/version_name"
android:text="@string/no_info_provided"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="@android:color/tertiary_text_dark"
@ -62,35 +69,35 @@
<TextView
android:id="@+id/description"
android:layout_width="wrap_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_below="@id/author"
android:layout_gravity="center_vertical"
android:text="@string/no_info_provided"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textIsSelectable="false"
android:layout_alignEnd="@+id/author" />
android:textIsSelectable="false" />
</LinearLayout>
<ImageView
android:id="@+id/update"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="@id/title"
android:layout_alignParentEnd="true"
android:layout_gravity="end"
android:layout_gravity="center_vertical"
android:background="@drawable/ic_file_download_black"
android:backgroundTint="@color/icon_grey"
android:focusable="false"
android:gravity="end"/>
android:gravity="end" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="@+id/expand_layout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_below="@id/description"
android:layout_below="@id/info_layout"
android:orientation="vertical">
<LinearLayout
@ -136,19 +143,6 @@
</LinearLayout>
</RelativeLayout>
<ImageView
android:id="@+id/installed"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/card_imageview_margin"
android:layout_marginStart="@dimen/card_imageview_margin"
android:focusable="false"
android:gravity="end"
android:visibility="gone"/>
</RelativeLayout>