diff --git a/app/src/main/java/com/keylesspalace/tusky/view/ConversationLineItemDecoration.java b/app/src/main/java/com/keylesspalace/tusky/view/ConversationLineItemDecoration.java deleted file mode 100644 index 0beb5632..00000000 --- a/app/src/main/java/com/keylesspalace/tusky/view/ConversationLineItemDecoration.java +++ /dev/null @@ -1,76 +0,0 @@ -/* Copyright 2017 Andrew Dawson - * - * This file is a part of Tusky. - * - * This program is free software; you can redistribute it and/or modify it under the terms of the - * GNU General Public License as published by the Free Software Foundation; either version 3 of the - * License, or (at your option) any later version. - * - * Tusky is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even - * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General - * Public License for more details. - * - * You should have received a copy of the GNU General Public License along with Tusky; if not, - * see . */ - -package com.keylesspalace.tusky.view; - -import android.content.Context; -import android.graphics.Canvas; -import android.graphics.drawable.Drawable; -import android.support.v7.widget.RecyclerView; -import android.view.View; - -import com.keylesspalace.tusky.R; -import com.keylesspalace.tusky.adapter.ThreadAdapter; -import com.keylesspalace.tusky.viewdata.StatusViewData; - -public class ConversationLineItemDecoration extends RecyclerView.ItemDecoration { - private final Context context; - private final Drawable divider; - - public ConversationLineItemDecoration(Context context, Drawable divider) { - this.context = context; - this.divider = divider; - } - - @Override - public void onDraw(Canvas c, RecyclerView parent, RecyclerView.State state) { - int dividerLeft = parent.getPaddingLeft() - + context.getResources().getDimensionPixelSize(R.dimen.status_left_line_margin); - int dividerRight = dividerLeft + divider.getIntrinsicWidth(); - - int childCount = parent.getChildCount(); - int avatarMargin = context.getResources() - .getDimensionPixelSize(R.dimen.account_avatar_margin); - - for (int i = 0; i < childCount; i++) { - View child = parent.getChildAt(i); - - int position = parent.getChildAdapterPosition(child); - ThreadAdapter adapter = (ThreadAdapter) parent.getAdapter(); - - StatusViewData.Concrete current = adapter.getItem(position); - int dividerTop, dividerBottom; - if (current != null) { - StatusViewData.Concrete above = adapter.getItem(position - 1); - if (above != null && above.getId().equals(current.getInReplyToId())) { - dividerTop = child.getTop(); - } else { - dividerTop = child.getTop() + avatarMargin; - } - StatusViewData.Concrete below = adapter.getItem(position + 1); - if (below != null && current.getId().equals(below.getInReplyToId()) && - adapter.getDetailedStatusPosition() != position) { - dividerBottom = child.getBottom(); - } else { - dividerBottom = child.getTop() + avatarMargin; - } - - divider.setBounds(dividerLeft, dividerTop, dividerRight, dividerBottom); - divider.draw(c); - - } - } - } -} diff --git a/app/src/main/java/com/keylesspalace/tusky/view/ConversationLineItemDecoration.kt b/app/src/main/java/com/keylesspalace/tusky/view/ConversationLineItemDecoration.kt new file mode 100644 index 00000000..dc310e19 --- /dev/null +++ b/app/src/main/java/com/keylesspalace/tusky/view/ConversationLineItemDecoration.kt @@ -0,0 +1,70 @@ +/* Copyright 2017 Andrew Dawson + * + * This file is a part of Tusky. + * + * This program is free software; you can redistribute it and/or modify it under the terms of the + * GNU General Public License as published by the Free Software Foundation; either version 3 of the + * License, or (at your option) any later version. + * + * Tusky is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even + * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General + * Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Tusky; if not, + * see . */ + +package com.keylesspalace.tusky.view + +import android.content.Context +import android.graphics.Canvas +import android.graphics.drawable.Drawable +import android.support.v7.widget.RecyclerView +import android.view.View + +import com.keylesspalace.tusky.R +import com.keylesspalace.tusky.adapter.ThreadAdapter + +class ConversationLineItemDecoration(private val context: Context, private val divider: Drawable) : RecyclerView.ItemDecoration() { + + override fun onDraw(canvas: Canvas, parent: RecyclerView, state: RecyclerView.State?) { + val dividerStart = parent.paddingStart + context.resources.getDimensionPixelSize(R.dimen.status_line_margin_start) + val dividerEnd = dividerStart + divider.intrinsicWidth + + val childCount = parent.childCount + val avatarMargin = context.resources.getDimensionPixelSize(R.dimen.account_avatar_margin) + + for (i in 0 until childCount) { + val child = parent.getChildAt(i) + + val position = parent.getChildAdapterPosition(child) + val adapter = parent.adapter as ThreadAdapter + + val current = adapter.getItem(position) + val dividerTop: Int + val dividerBottom: Int + if (current != null) { + val above = adapter.getItem(position - 1) + dividerTop = if (above != null && above.id == current.inReplyToId) { + child.top + } else { + child.top + avatarMargin + } + val below = adapter.getItem(position + 1) + dividerBottom = if (below != null && current.id == below.inReplyToId && + adapter.detailedStatusPosition != position) { + child.bottom + } else { + child.top + avatarMargin + } + + if (parent.layoutDirection == View.LAYOUT_DIRECTION_LTR) { + divider.setBounds(dividerStart, dividerTop, dividerEnd, dividerBottom) + } else { + divider.setBounds(canvas.width - dividerEnd, dividerTop, canvas.width - dividerStart, dividerBottom) + } + divider.draw(canvas) + + } + } + } +} diff --git a/app/src/main/res/layout/activity_about.xml b/app/src/main/res/layout/activity_about.xml index 1a52e5b1..f25eaaa4 100644 --- a/app/src/main/res/layout/activity_about.xml +++ b/app/src/main/res/layout/activity_about.xml @@ -26,7 +26,6 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_horizontal" - android:drawableLeft="@mipmap/ic_launcher" android:drawablePadding="16dp" android:drawableStart="@mipmap/ic_launcher" android:gravity="center_vertical" diff --git a/app/src/main/res/layout/activity_account.xml b/app/src/main/res/layout/activity_account.xml index 40bcc5b3..457ceac8 100644 --- a/app/src/main/res/layout/activity_account.xml +++ b/app/src/main/res/layout/activity_account.xml @@ -55,7 +55,6 @@ android:layout_width="80dp" android:layout_height="80dp" android:layout_marginEnd="10dp" - android:layout_marginRight="10dp" android:src="@drawable/avatar_default" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" @@ -75,7 +74,6 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginEnd="10dp" - android:layout_marginRight="10dp" android:text="@string/follows_you" android:textColor="?android:textColorPrimary" android:textSize="?attr/status_text_medium" @@ -109,7 +107,6 @@ android:id="@+id/account_locked" android:layout_width="16sp" android:layout_height="16sp" - android:layout_marginLeft="4dp" android:layout_marginStart="4dp" android:contentDescription="@string/description_account_locked" android:tint="?android:textColorSecondary" diff --git a/app/src/main/res/layout/activity_compose.xml b/app/src/main/res/layout/activity_compose.xml index 5167d83c..4d19f6b3 100644 --- a/app/src/main/res/layout/activity_compose.xml +++ b/app/src/main/res/layout/activity_compose.xml @@ -136,8 +136,6 @@ android:gravity="center_vertical" android:paddingBottom="8dp" android:paddingEnd="16dp" - android:paddingLeft="8dp" - android:paddingRight="16dp" android:paddingStart="8dp" android:paddingTop="4dp"> @@ -214,7 +212,6 @@ android:id="@+id/floating_btn" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_marginLeft="10dp" android:layout_marginStart="10dp" android:textSize="?attr/status_text_medium" android:background="@drawable/compose_button_colors" diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index 262f5e2e..d4b7b12c 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -16,7 +16,6 @@ style="?attr/image_button_style" android:layout_width="?attr/actionBarSize" android:layout_height="?attr/actionBarSize" - android:layout_alignParentLeft="true" android:layout_alignParentStart="true" android:layout_alignParentTop="true" android:background="?android:colorBackground" @@ -30,10 +29,8 @@ android:layout_width="wrap_content" android:layout_height="?attr/actionBarSize" android:layout_alignParentEnd="true" - android:layout_alignParentRight="true" android:layout_alignParentTop="true" android:layout_toEndOf="@id/drawer_toggle" - android:layout_toRightOf="@id/drawer_toggle" android:background="?android:colorBackground" app:tabGravity="fill" app:tabIndicatorHeight="3dp" @@ -88,7 +85,6 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_margin="16dp" - android:clickable="true" android:contentDescription="@string/action_compose" app:layout_anchor="@id/pager" app:layout_anchorGravity="bottom|end" diff --git a/app/src/main/res/layout/fragment_compose_options.xml b/app/src/main/res/layout/fragment_compose_options.xml index d9a48dfd..f1cdc132 100644 --- a/app/src/main/res/layout/fragment_compose_options.xml +++ b/app/src/main/res/layout/fragment_compose_options.xml @@ -20,9 +20,7 @@ android:id="@+id/radio_public" android:layout_marginBottom="5dp" android:paddingStart="10dp" - android:paddingLeft="10dp" android:paddingEnd="0dp" - android:paddingRight="0dp" android:layout_weight="1" /> diff --git a/app/src/main/res/layout/item_account.xml b/app/src/main/res/layout/item_account.xml index 775892a4..d3de75fd 100644 --- a/app/src/main/res/layout/item_account.xml +++ b/app/src/main/res/layout/item_account.xml @@ -13,14 +13,12 @@ android:layout_width="48dp" android:layout_height="48dp" android:layout_centerVertical="true" - android:layout_marginEnd="24dp" - android:layout_marginRight="24dp" /> + android:layout_marginEnd="24dp" /> diff --git a/app/src/main/res/layout/item_autocomplete.xml b/app/src/main/res/layout/item_autocomplete.xml index cf8e3d89..128dfc60 100644 --- a/app/src/main/res/layout/item_autocomplete.xml +++ b/app/src/main/res/layout/item_autocomplete.xml @@ -11,7 +11,6 @@ android:layout_height="42dp" android:layout_centerVertical="true" android:layout_marginEnd="8dp" - android:layout_marginRight="8dp" android:contentDescription="@null" android:src="@drawable/avatar_default" /> @@ -19,7 +18,6 @@ android:layout_width="wrap_content" android:layout_height="match_parent" android:layout_toEndOf="@id/avatar" - android:layout_toRightOf="@id/avatar" android:gravity="center_vertical" android:orientation="vertical"> diff --git a/app/src/main/res/layout/item_blocked_user.xml b/app/src/main/res/layout/item_blocked_user.xml index 81ba686c..1ef75c09 100644 --- a/app/src/main/res/layout/item_blocked_user.xml +++ b/app/src/main/res/layout/item_blocked_user.xml @@ -12,11 +12,9 @@ android:id="@+id/blocked_user_avatar" android:layout_width="48dp" android:layout_height="48dp" - android:layout_alignParentLeft="true" android:layout_alignParentStart="true" android:layout_centerVertical="true" android:layout_marginEnd="24dp" - android:layout_marginRight="24dp" android:contentDescription="@string/action_view_profile" /> diff --git a/app/src/main/res/layout/item_follow.xml b/app/src/main/res/layout/item_follow.xml index 2525c98b..dc8f695f 100644 --- a/app/src/main/res/layout/item_follow.xml +++ b/app/src/main/res/layout/item_follow.xml @@ -21,7 +21,6 @@ android:ellipsize="end" android:gravity="center_vertical" android:maxLines="1" - android:paddingLeft="28dp" android:paddingStart="28dp" android:textColor="?android:textColorTertiary" android:textSize="?attr/status_text_medium" @@ -31,12 +30,9 @@ android:id="@+id/notification_avatar" android:layout_width="40dp" android:layout_height="40dp" - android:layout_alignParentLeft="true" android:layout_alignParentStart="true" android:layout_below="@+id/notification_text" android:layout_marginEnd="14dp" - android:layout_marginLeft="8dp" - android:layout_marginRight="14dp" android:layout_marginStart="8dp" android:contentDescription="@string/action_view_profile" android:scaleType="fitCenter" @@ -48,7 +44,6 @@ android:layout_height="wrap_content" android:layout_below="@+id/notification_text" android:layout_toEndOf="@id/notification_avatar" - android:layout_toRightOf="@id/notification_avatar" android:ellipsize="end" android:maxLines="1" android:textColor="?android:textColorPrimary" @@ -62,7 +57,6 @@ android:layout_height="wrap_content" android:layout_below="@+id/notification_display_name" android:layout_toEndOf="@id/notification_avatar" - android:layout_toRightOf="@id/notification_avatar" android:ellipsize="end" android:maxLines="1" android:textColor="?android:textColorSecondary" diff --git a/app/src/main/res/layout/item_follow_request.xml b/app/src/main/res/layout/item_follow_request.xml index a91be264..15a8af0c 100644 --- a/app/src/main/res/layout/item_follow_request.xml +++ b/app/src/main/res/layout/item_follow_request.xml @@ -12,19 +12,15 @@ android:id="@+id/follow_request_avatar" android:layout_width="48dp" android:layout_height="48dp" - android:layout_alignParentLeft="true" android:layout_alignParentStart="true" android:layout_centerVertical="true" android:layout_marginEnd="24dp" - android:layout_marginRight="24dp" android:contentDescription="@string/action_view_profile" /> @@ -58,9 +54,7 @@ android:layout_width="32dp" android:layout_height="32dp" android:layout_centerVertical="true" - android:layout_marginLeft="12dp" android:layout_marginStart="12dp" - android:layout_toLeftOf="@+id/follow_request_reject" android:layout_toStartOf="@id/follow_request_reject" android:background="?attr/selectableItemBackgroundBorderless" android:contentDescription="@string/action_accept" @@ -68,14 +62,12 @@ app:srcCompat="@drawable/ic_check_24dp" /> diff --git a/app/src/main/res/layout/item_status.xml b/app/src/main/res/layout/item_status.xml index bc89e222..9006d9a5 100644 --- a/app/src/main/res/layout/item_status.xml +++ b/app/src/main/res/layout/item_status.xml @@ -12,10 +12,9 @@ android:id="@+id/status_reblogged" android:layout_width="match_parent" android:layout_height="wrap_content" - android:layout_marginTop="@dimen/status_reblogged_bar_top_padding" + android:layout_marginTop="@dimen/status_reblogged_bar_padding_top" android:drawablePadding="6dp" android:gravity="center_vertical" - android:paddingLeft="38dp" android:paddingStart="38dp" android:textColor="?android:textColorTertiary" android:textSize="?attr/status_text_medium" @@ -27,7 +26,6 @@ android:layout_height="48dp" android:layout_below="@+id/status_reblogged" android:layout_marginEnd="14dp" - android:layout_marginRight="14dp" android:layout_marginTop="14dp" android:contentDescription="@string/action_view_profile" android:scaleType="fitCenter" @@ -39,7 +37,6 @@ android:layout_height="24dp" android:layout_alignBottom="@+id/status_avatar" android:layout_alignEnd="@id/status_avatar" - android:layout_alignRight="@id/status_avatar" android:contentDescription="@null" android:visibility="gone" tools:src="@color/accent" @@ -51,7 +48,6 @@ android:layout_height="wrap_content" android:layout_below="@+id/status_reblogged" android:layout_toEndOf="@+id/status_avatar" - android:layout_toRightOf="@+id/status_avatar" android:paddingBottom="4dp" android:paddingTop="@dimen/status_avatar_padding"> @@ -59,13 +55,10 @@ android:id="@+id/status_display_name" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_alignParentLeft="true" android:layout_alignParentStart="true" android:ellipsize="end" android:maxLines="1" - android:paddingEnd="@dimen/status_display_name_right_padding" - android:paddingLeft="0dp" - android:paddingRight="@dimen/status_display_name_right_padding" + android:paddingEnd="@dimen/status_display_name_padding_end" android:paddingStart="0dp" android:textColor="?android:textColorPrimary" android:textSize="?attr/status_text_medium" @@ -77,8 +70,6 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_toEndOf="@id/status_display_name" - android:layout_toLeftOf="@+id/status_timestamp_info" - android:layout_toRightOf="@id/status_display_name" android:layout_toStartOf="@+id/status_timestamp_info" android:ellipsize="end" android:maxLines="1" @@ -91,8 +82,6 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentEnd="true" - android:layout_alignParentRight="true" - android:layout_marginLeft="4dp" android:layout_marginStart="4dp" android:textColor="?android:textColorSecondary" android:textSize="?attr/status_text_medium" @@ -107,7 +96,6 @@ android:layout_below="@+id/status_name_bar" android:layout_marginBottom="4dp" android:layout_toEndOf="@+id/status_avatar" - android:layout_toRightOf="@+id/status_avatar" android:focusable="true" android:visibility="gone" app:paddingHorizontal="4dp"> @@ -144,11 +132,9 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentEnd="true" - android:layout_alignParentRight="true" android:layout_below="@+id/status_content_warning_bar" android:layout_marginBottom="4dp" android:layout_toEndOf="@+id/status_avatar" - android:layout_toRightOf="@+id/status_avatar" android:focusable="true" android:lineSpacingMultiplier="1.1" android:textColor="?android:textColorPrimary" @@ -161,9 +147,8 @@ android:layout_height="wrap_content" android:layout_below="@+id/status_content" android:layout_marginBottom="4dp" - android:layout_marginTop="@dimen/status_media_preview_top_margin" - android:layout_toEndOf="@+id/status_avatar" - android:layout_toRightOf="@+id/status_avatar"> + android:layout_marginTop="@dimen/status_media_preview_margin_top" + android:layout_toEndOf="@+id/status_avatar"> @@ -167,7 +165,7 @@ android:layout_height="wrap_content" android:layout_below="@+id/card_view" android:layout_marginBottom="4dp" - android:layout_marginTop="@dimen/status_media_preview_top_margin"> + android:layout_marginTop="@dimen/status_media_preview_margin_top"> @@ -39,13 +37,10 @@ android:id="@+id/status_display_name" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_alignParentLeft="true" android:layout_alignParentStart="true" android:ellipsize="end" android:maxLines="1" - android:paddingEnd="@dimen/status_display_name_right_padding" - android:paddingLeft="0dp" - android:paddingRight="@dimen/status_display_name_right_padding" + android:paddingEnd="@dimen/status_display_name_padding_end" android:paddingStart="0dp" android:textAppearance="@android:style/TextAppearance.DeviceDefault.Small" android:textColor="?android:textColorTertiary" @@ -58,8 +53,6 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_toEndOf="@id/status_display_name" - android:layout_toLeftOf="@+id/status_timestamp_info" - android:layout_toRightOf="@id/status_display_name" android:layout_toStartOf="@+id/status_timestamp_info" android:ellipsize="end" android:maxLines="1" @@ -72,8 +65,6 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentEnd="true" - android:layout_alignParentRight="true" - android:layout_marginLeft="4dp" android:layout_marginStart="4dp" android:textColor="?android:textColorTertiary" android:textSize="?attr/status_text_medium" @@ -88,7 +79,6 @@ android:layout_below="@+id/status_name_bar" android:layout_marginBottom="4dp" android:layout_toEndOf="@+id/notification_status_avatar" - android:layout_toRightOf="@+id/notification_status_avatar" android:focusable="true" android:visibility="gone" app:paddingHorizontal="4dp" @@ -129,7 +119,6 @@ android:layout_height="wrap_content" android:layout_below="@id/notification_content_warning_bar" android:layout_toEndOf="@+id/notification_status_avatar" - android:layout_toRightOf="@+id/notification_status_avatar" android:lineSpacingMultiplier="1.1" android:paddingBottom="10dp" android:textColor="?android:textColorTertiary" @@ -157,7 +146,6 @@ android:layout_width="24dp" android:layout_height="24dp" android:layout_alignBottom="@+id/notification_status_avatar" - android:layout_alignEnd="@id/notification_status_avatar" - android:layout_alignRight="@id/notification_status_avatar" /> + android:layout_alignEnd="@id/notification_status_avatar" /> \ No newline at end of file diff --git a/app/src/main/res/values-w820dp/dimens.xml b/app/src/main/res/values-w820dp/dimens.xml deleted file mode 100644 index a013a735..00000000 --- a/app/src/main/res/values-w820dp/dimens.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - 0dp - diff --git a/app/src/main/res/values/dimens.xml b/app/src/main/res/values/dimens.xml index a4bc41cb..d4e1772e 100644 --- a/app/src/main/res/values/dimens.xml +++ b/app/src/main/res/values/dimens.xml @@ -1,25 +1,17 @@ - 4dp - 4dp + 4dp 10dp - 8dp - 40dp - 4dp + 8dp + 4dp 100dp 130dp - 8dp 8dp 0dp 120dp 8dp - 8dp - 40dp - 64dp - 40dp - 8dp 14dp 8dp - 36dp + 36dp 16dp 5dp