From 38c7c8c71acfdd28c97b8a02e3c7210554dd6623 Mon Sep 17 00:00:00 2001 From: Ivan Kupalov Date: Sun, 6 Jan 2019 10:39:42 +0100 Subject: [PATCH] Rework status layouts with ConstraintLayout (#967) * Migrate item_status_detailed layout, minimum * Migrate item_status_detailed layout, buttons * Migrate item_status layout, minimum + buttons * Migrate status layouts, fix RTL, cleanup * Fix item_status layout * Fix item_status name layout, fix CW button * Simplify item_status, item_status_detailed layouts with chains * Apply statuses layout feedback --- .../adapter/StatusDetailedViewHolder.java | 4 - app/src/main/res/layout/item_status.xml | 354 +++++++++--------- .../main/res/layout/item_status_detailed.xml | 305 ++++++++------- app/src/main/res/values/dimens.xml | 1 - 4 files changed, 337 insertions(+), 327 deletions(-) diff --git a/app/src/main/java/com/keylesspalace/tusky/adapter/StatusDetailedViewHolder.java b/app/src/main/java/com/keylesspalace/tusky/adapter/StatusDetailedViewHolder.java index c60a56374..7f2a3dc97 100644 --- a/app/src/main/java/com/keylesspalace/tusky/adapter/StatusDetailedViewHolder.java +++ b/app/src/main/java/com/keylesspalace/tusky/adapter/StatusDetailedViewHolder.java @@ -43,7 +43,6 @@ class StatusDetailedViewHolder extends StatusBaseViewHolder { private TextView cardDescription; private TextView cardUrl; private View infoDivider; - private View favReblogInfoContainer; private NumberFormat numberFormat = NumberFormat.getNumberInstance(); @@ -58,7 +57,6 @@ class StatusDetailedViewHolder extends StatusBaseViewHolder { cardDescription = view.findViewById(R.id.card_description); cardUrl = view.findViewById(R.id.card_link); infoDivider = view.findViewById(R.id.status_info_divider); - favReblogInfoContainer = view.findViewById(R.id.status_reblog_fav_info); } @Override @@ -95,10 +93,8 @@ class StatusDetailedViewHolder extends StatusBaseViewHolder { if(reblogs.getVisibility() == View.GONE && favourites.getVisibility() == View.GONE) { infoDivider.setVisibility(View.GONE); - favReblogInfoContainer.setVisibility(View.GONE); } else { infoDivider.setVisibility(View.VISIBLE); - favReblogInfoContainer.setVisibility(View.VISIBLE); } reblogs.setOnClickListener( v -> { diff --git a/app/src/main/res/layout/item_status.xml b/app/src/main/res/layout/item_status.xml index 82f49affc..fcfeadd4b 100644 --- a/app/src/main/res/layout/item_status.xml +++ b/app/src/main/res/layout/item_status.xml @@ -1,5 +1,5 @@ - + app:layout_constraintLeft_toRightOf="parent" + app:layout_constraintRight_toLeftOf="parent" + app:layout_constraintTop_toTopOf="parent" + tools:ignore="RtlSymmetry" + tools:text="ConnyDuck boosted" + tools:visibility="visible" /> - + + + + + + + + - - - - - - - - - - - + android:textAllCaps="true" + android:textOff="@string/status_content_warning_show_more" + android:textOn="@string/status_content_warning_show_less" + android:textSize="?attr/status_text_medium" + android:visibility="gone" + app:layout_constraintStart_toStartOf="@id/status_content_warning_description" + app:layout_constraintTop_toBottomOf="@id/status_content_warning_description" + tools:visibility="visible" /> + android:id="@+id/button_toggle_content" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginTop="4dp" + android:layout_marginBottom="4dp" + android:background="?attr/content_warning_button" + android:minWidth="150dp" + android:minHeight="0dp" + android:paddingLeft="16dp" + android:paddingTop="4dp" + android:paddingRight="16dp" + android:paddingBottom="4dp" + android:textAllCaps="true" + android:textOff="@string/status_content_show_less" + android:textOn="@string/status_content_show_more" + android:textSize="?attr/status_text_medium" + android:visibility="gone" + app:layout_constraintStart_toStartOf="@id/status_content_warning_description" + app:layout_constraintTop_toBottomOf="@id/status_content" + tools:visibility="visible" /> + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="@id/status_content_warning_description" + app:layout_constraintTop_toBottomOf="@id/button_toggle_content" + tools:visibility="gone"> - + + + android:contentDescription="@string/action_reblog" + android:padding="4dp" + app:layout_constraintEnd_toStartOf="@id/status_favourite" + app:layout_constraintStart_toEndOf="@id/status_reply" + app:layout_constraintTop_toTopOf="@id/status_reply" + sparkbutton:activeImage="@drawable/reblog_active" + sparkbutton:iconSize="28dp" + sparkbutton:inactiveImage="?attr/status_reblog_inactive_drawable" + sparkbutton:primaryColor="@color/tusky_blue" + sparkbutton:secondaryColor="@color/tusky_blue_light" /> - + - + - - - - - - - - - - - - - + diff --git a/app/src/main/res/layout/item_status_detailed.xml b/app/src/main/res/layout/item_status_detailed.xml index 897943ac5..1dbc158fb 100644 --- a/app/src/main/res/layout/item_status_detailed.xml +++ b/app/src/main/res/layout/item_status_detailed.xml @@ -1,5 +1,5 @@ - - + android:layout_marginStart="14dp" + android:layout_marginTop="10dp" + android:layout_marginEnd="14dp" + android:ellipsize="end" + android:maxLines="1" + android:textColor="?android:textColorPrimary" + android:textSize="?attr/status_text_medium" + android:textStyle="normal|bold" + app:layout_constrainedWidth="true" + app:layout_constraintBottom_toTopOf="@id/status_username" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintHorizontal_bias="0" + app:layout_constraintRight_toRightOf="parent" + app:layout_constraintStart_toEndOf="@id/status_avatar" + app:layout_constraintTop_toTopOf="parent" + app:layout_constraintVertical_chainStyle="packed" + tools:text="Display Name" /> - - - - - + + android:textSize="?attr/status_text_large" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/status_content_warning_description" /> + android:orientation="vertical" + app:layout_constraintTop_toBottomOf="@+id/status_content" + tools:visibility="gone"> + android:layout_marginTop="12dp" + android:layout_marginBottom="4dp" + app:layout_constraintTop_toBottomOf="@id/card_view"> + android:textSize="?attr/status_text_medium" + app:layout_constraintLeft_toLeftOf="parent" + app:layout_constraintRight_toRightOf="parent" + app:layout_constraintTop_toBottomOf="@id/status_media_preview_container" + tools:text="21 Dec 2018 18:45" /> + android:paddingEnd="16dp" + app:layout_constraintTop_toBottomOf="@id/status_timestamp_info" /> - + android:layout_marginTop="6dp" + android:background="?attr/selectableItemBackground" + android:padding="4dp" + android:textSize="?attr/status_text_medium" + app:layout_constraintStart_toStartOf="@id/status_info_divider" + app:layout_constraintTop_toBottomOf="@id/status_info_divider" + tools:text="4 reblogs" + tools:visibility="visible" /> - + - - + + android:paddingEnd="16dp" + app:layout_constraintTop_toBottomOf="@id/status_counters_barrier" /> - + + + android:contentDescription="@string/action_reblog" + android:padding="4dp" + app:layout_constraintEnd_toStartOf="@id/status_favourite" + app:layout_constraintStart_toEndOf="@id/status_reply" + app:layout_constraintTop_toTopOf="@id/status_reply" + sparkbutton:activeImage="@drawable/reblog_active" + sparkbutton:iconSize="28dp" + sparkbutton:inactiveImage="?attr/status_reblog_inactive_drawable" + sparkbutton:primaryColor="@color/tusky_blue" + sparkbutton:secondaryColor="@color/tusky_blue_light" /> - + - + - - - - - - - - - - - - - \ No newline at end of file + \ No newline at end of file diff --git a/app/src/main/res/values/dimens.xml b/app/src/main/res/values/dimens.xml index 16691ec79..1384062f0 100644 --- a/app/src/main/res/values/dimens.xml +++ b/app/src/main/res/values/dimens.xml @@ -1,6 +1,5 @@ 4dp - 10dp 8dp 8dp 100dp