From 98c91c772cf918f8f628603895ed5baf555b57b7 Mon Sep 17 00:00:00 2001 From: Vavassor Date: Wed, 12 Jul 2017 02:09:07 -0400 Subject: [PATCH] Improves right-to-left layouts in the most basic fashion. --- .../keylesspalace/tusky/ComposeActivity.java | 18 ++++++------- app/src/main/res/layout/activity_about.xml | 4 +-- app/src/main/res/layout/activity_account.xml | 3 +++ app/src/main/res/layout/activity_compose.xml | 8 +++++- .../main/res/layout/activity_edit_profile.xml | 3 +++ app/src/main/res/layout/activity_main.xml | 3 +++ .../res/layout/fragment_compose_options.xml | 12 +++++++++ app/src/main/res/layout/item_account.xml | 2 ++ app/src/main/res/layout/item_autocomplete.xml | 2 ++ app/src/main/res/layout/item_blocked_user.xml | 11 ++++++-- app/src/main/res/layout/item_follow.xml | 10 ++++++- app/src/main/res/layout/item_muted_user.xml | 6 +++++ app/src/main/res/layout/item_saved_toot.xml | 2 +- app/src/main/res/layout/item_status.xml | 26 ++++++++++++++++++- .../res/layout/item_status_notification.xml | 12 ++++++--- 15 files changed, 102 insertions(+), 20 deletions(-) diff --git a/app/src/main/java/com/keylesspalace/tusky/ComposeActivity.java b/app/src/main/java/com/keylesspalace/tusky/ComposeActivity.java index 92a28015..01835cd1 100644 --- a/app/src/main/java/com/keylesspalace/tusky/ComposeActivity.java +++ b/app/src/main/java/com/keylesspalace/tusky/ComposeActivity.java @@ -546,15 +546,6 @@ public class ComposeActivity extends BaseActivity implements ComposeOptionsFragm floatingBtn.setEnabled(true); } - private void addLockToSendButton() { - floatingBtn.setText(R.string.action_send); - Drawable lock = AppCompatResources.getDrawable(this, R.drawable.send_private); - if (lock != null) { - lock.setBounds(0, 0, lock.getIntrinsicWidth(), lock.getIntrinsicHeight()); - floatingBtn.setCompoundDrawables(null, null, lock, null); - } - } - private static boolean copyToFile(ContentResolver contentResolver, Uri uri, File file) { InputStream from; FileOutputStream to; @@ -709,6 +700,15 @@ public class ComposeActivity extends BaseActivity implements ComposeOptionsFragm return true; } + private void addLockToSendButton() { + floatingBtn.setText(R.string.action_send); + Drawable lock = AppCompatResources.getDrawable(this, R.drawable.send_private); + if (lock != null) { + lock.setBounds(0, 0, lock.getIntrinsicWidth(), lock.getIntrinsicHeight()); + floatingBtn.setCompoundDrawables(null, null, lock, null); + } + } + private void setStatusVisibility(String visibility) { statusVisibility = visibility; switch (visibility) { diff --git a/app/src/main/res/layout/activity_about.xml b/app/src/main/res/layout/activity_about.xml index 3a595f1d..c1659b80 100644 --- a/app/src/main/res/layout/activity_about.xml +++ b/app/src/main/res/layout/activity_about.xml @@ -1,6 +1,6 @@ - @@ -66,8 +67,10 @@ diff --git a/app/src/main/res/layout/activity_compose.xml b/app/src/main/res/layout/activity_compose.xml index 2cbd4bbf..63d5b3cf 100644 --- a/app/src/main/res/layout/activity_compose.xml +++ b/app/src/main/res/layout/activity_compose.xml @@ -81,6 +81,7 @@ + @@ -115,6 +117,7 @@ style="?attr/image_button_style" android:layout_width="32dp" android:layout_height="32dp" + android:layout_marginEnd="8dp" android:layout_marginRight="8dp" app:srcCompat="@drawable/ic_attach_file_24dp" android:contentDescription="@string/action_photo_pick" /> @@ -124,6 +127,7 @@ style="?attr/image_button_style" android:layout_width="32dp" android:layout_height="32dp" + android:layout_marginEnd="8dp" android:layout_marginRight="8dp" app:srcCompat="@drawable/ic_public_24dp" android:contentDescription="@string/action_compose_options" /> @@ -156,11 +160,13 @@ android:background="@drawable/compose_button_colors" android:layout_width="80dp" android:layout_height="35dp" + android:layout_marginStart="10dp" android:layout_marginLeft="10dp" android:text="@string/action_send" android:textColor="@android:color/white" /> + - + \ No newline at end of file diff --git a/app/src/main/res/layout/activity_edit_profile.xml b/app/src/main/res/layout/activity_edit_profile.xml index 97049018..94534b9a 100644 --- a/app/src/main/res/layout/activity_edit_profile.xml +++ b/app/src/main/res/layout/activity_edit_profile.xml @@ -53,7 +53,10 @@ diff --git a/app/src/main/res/layout/item_account.xml b/app/src/main/res/layout/item_account.xml index afe79fb0..4df215b9 100644 --- a/app/src/main/res/layout/item_account.xml +++ b/app/src/main/res/layout/item_account.xml @@ -12,6 +12,7 @@ android:layout_height="48dp" android:layout_centerVertical="true" android:id="@+id/account_avatar" + android:layout_marginEnd="24dp" android:layout_marginRight="24dp" /> diff --git a/app/src/main/res/layout/item_blocked_user.xml b/app/src/main/res/layout/item_blocked_user.xml index 057748f0..592164dc 100644 --- a/app/src/main/res/layout/item_blocked_user.xml +++ b/app/src/main/res/layout/item_blocked_user.xml @@ -11,7 +11,9 @@ android:layout_width="48dp" android:layout_height="48dp" android:id="@+id/blocked_user_avatar" + android:layout_alignParentStart="true" android:layout_alignParentLeft="true" + android:layout_marginEnd="24dp" android:layout_marginRight="24dp" android:layout_centerVertical="true" android:contentDescription="@string/action_view_profile" /> @@ -23,7 +25,9 @@ android:id="@+id/blocked_user_unblock" android:layout_gravity="center_vertical" style="?attr/image_button_style" + android:layout_alignParentEnd="true" android:layout_alignParentRight="true" + android:layout_marginStart="16dp" android:layout_marginLeft="16dp" android:layout_centerVertical="true" android:contentDescription="@string/action_unblock" /> @@ -33,8 +37,10 @@ android:layout_height="match_parent" android:gravity="center_vertical" android:orientation="vertical" - android:layout_toRightOf="@id/blocked_user_avatar" - android:layout_toLeftOf="@id/blocked_user_unblock"> + android:layout_toStartOf="@id/blocked_user_unblock" + android:layout_toLeftOf="@id/blocked_user_unblock" + android:layout_toEndOf="@id/blocked_user_avatar" + android:layout_toRightOf="@id/blocked_user_avatar"> + \ No newline at end of file diff --git a/app/src/main/res/layout/item_follow.xml b/app/src/main/res/layout/item_follow.xml index e4366a20..7347012f 100644 --- a/app/src/main/res/layout/item_follow.xml +++ b/app/src/main/res/layout/item_follow.xml @@ -22,8 +22,10 @@ android:layout_height="wrap_content" android:id="@+id/follow_icon" app:srcCompat="@drawable/ic_person_add_24dp" - android:paddingRight="10dp" + android:paddingStart="24dp" android:paddingLeft="24dp" + android:paddingEnd="10dp" + android:paddingRight="10dp" android:tint="?attr/colorAccent" android:contentDescription="@null" /> @@ -35,6 +37,7 @@ android:layout_centerVertical="true" android:maxLines="1" android:ellipsize="end" + android:layout_toEndOf="@id/follow_icon" android:layout_toRightOf="@id/follow_icon" /> @@ -49,8 +52,11 @@ android:layout_height="40dp" android:id="@+id/notification_avatar" android:scaleType="fitCenter" + android:layout_marginStart="8dp" android:layout_marginLeft="8dp" + android:layout_marginEnd="10dp" android:layout_marginRight="10dp" + android:layout_alignParentStart="true" android:layout_alignParentLeft="true" android:contentDescription="@string/action_view_profile" /> @@ -58,6 +64,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="vertical" + android:layout_toEndOf="@id/notification_avatar" android:layout_toRightOf="@id/notification_avatar"> + diff --git a/app/src/main/res/layout/item_muted_user.xml b/app/src/main/res/layout/item_muted_user.xml index 34cce394..446ee07b 100644 --- a/app/src/main/res/layout/item_muted_user.xml +++ b/app/src/main/res/layout/item_muted_user.xml @@ -11,7 +11,9 @@ android:layout_width="48dp" android:layout_height="48dp" android:id="@+id/muted_user_avatar" + android:layout_alignParentStart="true" android:layout_alignParentLeft="true" + android:layout_marginEnd="24dp" android:layout_marginRight="24dp" android:layout_centerVertical="true" android:contentDescription="@string/action_view_profile" /> @@ -23,7 +25,9 @@ android:id="@+id/muted_user_unmute" android:layout_gravity="center_vertical" style="?attr/image_button_style" + android:layout_alignParentEnd="true" android:layout_alignParentRight="true" + android:layout_marginStart="16dp" android:layout_marginLeft="16dp" android:layout_centerVertical="true" android:contentDescription="@string/action_unmute" /> @@ -33,7 +37,9 @@ android:layout_height="match_parent" android:gravity="center_vertical" android:orientation="vertical" + android:layout_toEndOf="@id/muted_user_avatar" android:layout_toRightOf="@id/muted_user_avatar" + android:layout_toStartOf="@id/muted_user_unmute" android:layout_toLeftOf="@id/muted_user_unmute"> + \ No newline at end of file diff --git a/app/src/main/res/layout/item_status.xml b/app/src/main/res/layout/item_status.xml index f87ce8d5..183d3fec 100644 --- a/app/src/main/res/layout/item_status.xml +++ b/app/src/main/res/layout/item_status.xml @@ -12,6 +12,7 @@ android:layout_height="wrap_content" android:id="@+id/status_reblogged_bar" android:layout_alignParentTop="true" + android:layout_alignParentStart="true" android:layout_alignParentLeft="true" android:layout_marginTop="@dimen/status_reblogged_bar_top_padding"> @@ -20,8 +21,12 @@ android:layout_height="wrap_content" app:srcCompat="@drawable/ic_repeat_24dp" android:id="@+id/status_reblogged_icon" - android:paddingRight="10dp" + android:paddingStart="24dp" android:paddingLeft="24dp" + android:paddingEnd="10dp" + android:paddingRight="10dp" + android:layout_alignParentStart="true" + android:layout_alignParentLeft="true" android:tint="?android:textColorTertiary" android:contentDescription="@null" /> @@ -31,6 +36,7 @@ android:id="@+id/status_reblogged" android:textColor="?android:textColorTertiary" android:layout_centerVertical="true" + android:layout_toEndOf="@id/status_reblogged_icon" android:layout_toRightOf="@id/status_reblogged_icon" /> @@ -42,6 +48,7 @@ android:id="@+id/status_avatar" android:layout_below="@+id/status_reblogged_bar" android:layout_marginTop="11dp" + android:layout_marginEnd="10dp" android:layout_marginRight="10dp" android:contentDescription="@string/action_view_profile" /> @@ -59,6 +66,7 @@ android:id="@+id/status_since_created" android:layout_width="wrap_content" android:layout_height="wrap_content" + android:layout_alignParentEnd="true" android:layout_alignParentRight="true" android:text="20m" android:textColor="?android:textColorSecondary" /> @@ -67,7 +75,9 @@ android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="wrap_content" + android:layout_alignParentStart="true" android:layout_alignParentLeft="true" + android:layout_toStartOf="@id/status_since_created" android:layout_toLeftOf="@id/status_since_created"> @@ -145,6 +163,7 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_below="@+id/status_content" + android:layout_toEndOf="@+id/status_avatar" android:layout_toRightOf="@+id/status_avatar"> @@ -199,6 +221,7 @@ android:id="@+id/status_media_preview_3" android:layout_width="wrap_content" android:layout_height="@dimen/status_media_preview_height" + android:layout_marginStart="2dp" android:layout_marginLeft="2dp" android:layout_weight="1" android:scaleType="centerCrop" @@ -267,6 +290,7 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_below="@id/status_media_preview_container" + android:layout_toEndOf="@+id/status_avatar" android:layout_toRightOf="@+id/status_avatar" android:clipChildren="false" android:clipToPadding="false" diff --git a/app/src/main/res/layout/item_status_notification.xml b/app/src/main/res/layout/item_status_notification.xml index d646b6cf..4dcebd5a 100644 --- a/app/src/main/res/layout/item_status_notification.xml +++ b/app/src/main/res/layout/item_status_notification.xml @@ -19,8 +19,10 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/notification_icon" - android:paddingRight="10dp" + android:paddingStart="24dp" android:paddingLeft="24dp" + android:paddingEnd="10dp" + android:paddingRight="10dp" app:srcCompat="@drawable/ic_repeat_24dp" android:contentDescription="@null" /> @@ -33,6 +35,7 @@ android:maxLines="1" android:ellipsize="end" android:text="Someone favourited your status" + android:layout_toEndOf="@id/notification_icon" android:layout_toRightOf="@id/notification_icon" /> @@ -41,9 +44,12 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:id="@+id/notification_content" + android:paddingStart="58dp" android:paddingLeft="58dp" + android:paddingEnd="0dp" + android:paddingRight="0dp" + android:paddingBottom="10dp" android:text="Example status here" - android:textColor="?android:textColorTertiary" - android:paddingBottom="10dp" /> + android:textColor="?android:textColorTertiary" /> \ No newline at end of file