Improves right-to-left layouts in the most basic fashion.

This commit is contained in:
Vavassor 2017-07-12 02:09:07 -04:00
parent a1e007eb2a
commit e4dff388d2
15 changed files with 102 additions and 20 deletions

View file

@ -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) {

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
<android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"

View file

@ -59,6 +59,7 @@
android:id="@+id/account_avatar"
android:layout_width="80dp"
android:layout_height="80dp"
android:layout_marginEnd="10dp"
android:layout_marginRight="10dp"
android:src="@drawable/avatar_default"
app:shadow="true" />
@ -66,8 +67,10 @@
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_toEndOf="@id/account_avatar"
android:layout_toRightOf="@id/account_avatar"
android:orientation="vertical">

View file

@ -81,6 +81,7 @@
<!--This is filled at runtime with ImageView's for each preview in the upload queue.-->
</LinearLayout>
</HorizontalScrollView>
<ProgressBar
@ -106,6 +107,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_camera_24dp"
android:contentDescription="@string/action_photo_take" />
@ -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" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
</android.support.design.widget.CoordinatorLayout>

View file

@ -53,7 +53,10 @@
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingStart="16dp"
android:paddingLeft="16dp"
android:paddingEnd="0dp"
android:paddingRight="0dp"
android:layout_marginTop="-40dp">
<com.pkmmte.view.CircularImageView

View file

@ -20,6 +20,7 @@
app:layout_anchor="@id/pager"
app:layout_anchorGravity="top|left"
android:layout_alignParentTop="true"
android:layout_alignParentStart="true"
android:layout_alignParentLeft="true"
style="?attr/image_button_style"
android:background="?android:colorBackground"
@ -37,7 +38,9 @@
app:tabPaddingTop="4dp"
app:tabTextAppearance="@style/TabLayoutTextStyle"
android:layout_alignParentTop="true"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_toEndOf="@id/drawer_toggle"
android:layout_toRightOf="@id/drawer_toggle">
<android.support.design.widget.TabItem

View file

@ -19,7 +19,10 @@
android:layout_height="match_parent"
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" />
<RadioButton
@ -29,7 +32,10 @@
android:id="@+id/radio_unlisted"
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp"
android:paddingStart="10dp"
android:paddingLeft="10dp"
android:paddingEnd="0dp"
android:paddingRight="0dp"
android:layout_weight="1" />
<RadioButton
@ -39,7 +45,10 @@
android:id="@+id/radio_private"
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp"
android:paddingStart="10dp"
android:paddingLeft="10dp"
android:paddingEnd="0dp"
android:paddingRight="0dp"
android:layout_weight="1" />
<RadioButton
@ -48,7 +57,10 @@
android:layout_height="match_parent"
android:id="@+id/radio_direct"
android:layout_marginTop="5dp"
android:paddingStart="10dp"
android:paddingLeft="10dp"
android:paddingEnd="0dp"
android:paddingRight="0dp"
android:layout_weight="1" />
</RadioGroup>

View file

@ -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" />
<LinearLayout
@ -19,6 +20,7 @@
android:layout_height="match_parent"
android:orientation="vertical"
android:gravity="center_vertical"
android:layout_toEndOf="@id/account_avatar"
android:layout_toRightOf="@id/account_avatar">
<TextView

View file

@ -9,6 +9,7 @@
android:layout_width="42dp"
android:layout_height="42dp"
android:layout_centerVertical="true"
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp"
android:id="@+id/avatar"
android:src="@drawable/avatar_default"
@ -18,6 +19,7 @@
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:orientation="vertical"
android:layout_toEndOf="@id/avatar"
android:layout_toRightOf="@id/avatar"
android:gravity="center_vertical">

View file

@ -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">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
@ -54,6 +60,7 @@
android:textSize="14sp"
android:id="@+id/blocked_user_username"
android:textColor="?android:textColorSecondary" />
</LinearLayout>
</RelativeLayout>

View file

@ -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" />
</RelativeLayout>
@ -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">
<TextView
@ -72,6 +79,7 @@
android:layout_height="wrap_content"
android:id="@+id/notification_username"
android:textColor="?android:textColorSecondary" />
</LinearLayout>
</RelativeLayout>

View file

@ -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">
<TextView

View file

@ -20,7 +20,7 @@
android:layout_gravity="center_vertical"
android:padding="16dp"
android:layout_margin="16dp"
android:contentDescription="@string/action_unmute"
app:srcCompat="@drawable/ic_clear_24dp" />
</LinearLayout>

View file

@ -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" />
</RelativeLayout>
@ -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">
<TextView
@ -80,6 +90,9 @@
android:ellipsize="end"
android:maxLines="1"
android:text="Name"
android:paddingStart="0dp"
android:paddingLeft="0dp"
android:paddingEnd="@dimen/status_display_name_right_padding"
android:paddingRight="@dimen/status_display_name_right_padding" />
<TextView
@ -112,6 +125,9 @@
android:id="@+id/status_content_warning_description"
android:text="Hello world"
android:textColor="?android:textColorPrimary"
android:paddingStart="0dp"
android:paddingLeft="0dp"
android:paddingEnd="8dp"
android:paddingRight="8dp" />
<ToggleButton
@ -137,6 +153,8 @@
android:layout_marginBottom="4dp"
android:layout_toRightOf="@+id/status_avatar"
android:layout_toEndOf="@+id/status_avatar"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_below="@+id/status_content_warning_bar"
android:focusable="true" />
@ -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">
<LinearLayout
@ -163,6 +182,7 @@
android:layout_width="wrap_content"
android:layout_height="@dimen/status_media_preview_height"
android:layout_weight="1"
android:layout_marginEnd="2dp"
android:layout_marginRight="2dp"
android:scaleType="centerCrop"
android:layout_marginTop="@dimen/status_media_preview_top_margin"
@ -173,6 +193,7 @@
android:layout_width="wrap_content"
android:layout_height="@dimen/status_media_preview_height"
android:layout_weight="1"
android:layout_marginStart="2dp"
android:layout_marginLeft="2dp"
android:scaleType="centerCrop"
android:layout_marginTop="@dimen/status_media_preview_top_margin"
@ -191,6 +212,7 @@
android:layout_width="wrap_content"
android:layout_height="@dimen/status_media_preview_height"
android:layout_weight="1"
android:layout_marginEnd="2dp"
android:layout_marginRight="2dp"
android:scaleType="centerCrop"
android:contentDescription="@string/action_view_media" />
@ -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"

View file

@ -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" />
</RelativeLayout>
@ -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" />
</LinearLayout>