Add RTL support to remaining layouts

This commit is contained in:
Torsten Grote
2018-09-11 18:09:45 -03:00
parent 53edcaf3e9
commit 6557d564c9
16 changed files with 59 additions and 70 deletions

View File

@@ -65,7 +65,7 @@ public class TestDataActivity extends BriarActivity {
@Override @Override
public void onProgressChanged(SeekBar seekBar, public void onProgressChanged(SeekBar seekBar,
int progress, boolean fromUser) { int progress, boolean fromUser) {
contactsTextView.setText(String.valueOf(progress + 1)); contactsTextView.setText(String.valueOf(progress));
} }
@Override @Override
@@ -151,7 +151,7 @@ public class TestDataActivity extends BriarActivity {
} }
private void createTestData() { private void createTestData() {
testDataCreator.createTestData(contactsSeekBar.getProgress() + 1, testDataCreator.createTestData(contactsSeekBar.getProgress(),
messagesSeekBar.getProgress(), blogPostsSeekBar.getProgress(), messagesSeekBar.getProgress(), blogPostsSeekBar.getProgress(),
forumsSeekBar.getProgress(), forumPostsSeekBar.getProgress()); forumsSeekBar.getProgress(), forumPostsSeekBar.getProgress());
Intent intent = new Intent(this, NavDrawerActivity.class); Intent intent = new Intent(this, NavDrawerActivity.class);

View File

@@ -19,8 +19,7 @@ public class QrCodeView extends FrameLayout {
private boolean fullscreen = false; private boolean fullscreen = false;
private FullscreenListener listener; private FullscreenListener listener;
public QrCodeView(@NonNull Context context, public QrCodeView(@NonNull Context context, @Nullable AttributeSet attrs) {
@Nullable AttributeSet attrs) {
super(context, attrs); super(context, attrs);
LayoutInflater inflater = (LayoutInflater) context LayoutInflater inflater = (LayoutInflater) context
.getSystemService(Context.LAYOUT_INFLATER_SERVICE); .getSystemService(Context.LAYOUT_INFLATER_SERVICE);

View File

@@ -3,7 +3,6 @@ package org.briarproject.briar.android.view;
import android.content.Context; import android.content.Context;
import android.graphics.Color; import android.graphics.Color;
import android.graphics.drawable.ColorDrawable; import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import android.support.annotation.UiThread; import android.support.annotation.UiThread;
import android.support.v7.widget.AppCompatTextView; import android.support.v7.widget.AppCompatTextView;
import android.util.AttributeSet; import android.util.AttributeSet;
@@ -11,13 +10,11 @@ import android.view.LayoutInflater;
import android.widget.FrameLayout; import android.widget.FrameLayout;
import android.widget.TextView; import android.widget.TextView;
import org.briarproject.bramble.api.identity.Author;
import org.briarproject.briar.R; import org.briarproject.briar.R;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import de.hdodenhof.circleimageview.CircleImageView; import de.hdodenhof.circleimageview.CircleImageView;
import im.delight.android.identicons.IdenticonDrawable;
@UiThread @UiThread
public class TextAvatarView extends FrameLayout { public class TextAvatarView extends FrameLayout {
@@ -35,7 +32,6 @@ public class TextAvatarView extends FrameLayout {
character = findViewById(R.id.textAvatarView); character = findViewById(R.id.textAvatarView);
background = findViewById(R.id.avatarBackground); background = findViewById(R.id.avatarBackground);
badge = findViewById(R.id.unreadCountView); badge = findViewById(R.id.unreadCountView);
badge.setVisibility(INVISIBLE);
} }
public TextAvatarView(Context context) { public TextAvatarView(Context context) {
@@ -72,10 +68,4 @@ public class TextAvatarView extends FrameLayout {
} }
} }
public void setAuthorAvatar(Author author) {
Drawable drawable = new IdenticonDrawable(author.getId().getBytes());
background.setImageDrawable(drawable);
character.setVisibility(GONE);
}
} }

View File

@@ -49,7 +49,7 @@ public class UnreadMessageButton extends FrameLayout {
setDirection(direction); setDirection(direction);
attributes.recycle(); attributes.recycle();
setUnreadCount(0); if (!isInEditMode()) setUnreadCount(0);
} }
private void setDirection(int direction) { private void setDirection(int direction) {
@@ -64,11 +64,11 @@ public class UnreadMessageButton extends FrameLayout {
public void setUnreadCount(int count) { public void setUnreadCount(int count) {
if (count == 0) { if (count == 0) {
setVisibility(INVISIBLE); fab.hide();
unread.setVisibility(INVISIBLE);
} else { } else {
// FIXME: Use animations when upgrading to support library 24.2.0 fab.show();
// https://code.google.com/p/android/issues/detail?id=216469 unread.setVisibility(VISIBLE);
setVisibility(VISIBLE);
unread.setText(String.valueOf(count)); unread.setText(String.valueOf(count));
} }
} }

View File

@@ -1,6 +1,7 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android" <vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp" android:width="24dp"
android:height="24dp" android:height="24dp"
android:autoMirrored="true"
android:viewportHeight="24.0" android:viewportHeight="24.0"
android:viewportWidth="24.0"> android:viewportWidth="24.0">
<path <path

View File

@@ -26,7 +26,8 @@
app:layout_constraintBottom_toBottomOf="@id/explanationText" app:layout_constraintBottom_toBottomOf="@id/explanationText"
app:layout_constraintEnd_toStartOf="@id/explanationText" app:layout_constraintEnd_toStartOf="@id/explanationText"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"/> app:layout_constraintTop_toTopOf="parent"
tools:ignore="ContentDescription"/>
<ImageView <ImageView
android:id="@+id/explanationImage" android:id="@+id/explanationImage"
@@ -34,8 +35,8 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1" android:layout_weight="1"
android:adjustViewBounds="true" android:adjustViewBounds="true"
android:paddingLeft="@dimen/margin_large" android:paddingEnd="@dimen/margin_large"
android:paddingRight="@dimen/margin_large" android:paddingStart="@dimen/margin_large"
android:paddingTop="@dimen/margin_large" android:paddingTop="@dimen/margin_large"
android:scaleType="fitCenter" android:scaleType="fitCenter"
android:src="@drawable/qr_code_explanation" android:src="@drawable/qr_code_explanation"

View File

@@ -10,9 +10,10 @@
<ImageView <ImageView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="bottom" android:layout_gravity="bottom|start"
android:layout_marginBottom="@dimen/margin_medium" android:layout_marginBottom="@dimen/margin_medium"
android:layout_marginLeft="@dimen/margin_medium" android:layout_marginEnd="@dimen/margin_medium"
android:layout_marginStart="@dimen/margin_medium"
android:contentDescription="@string/app_name" android:contentDescription="@string/app_name"
android:src="@drawable/navigation_drawer_header"/> android:src="@drawable/navigation_drawer_header"/>

View File

@@ -11,9 +11,9 @@
android:id="@+id/textView" android:id="@+id/textView"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="8dp" android:layout_marginEnd="@dimen/margin_large"
android:paddingLeft="@dimen/margin_large" android:layout_marginStart="@dimen/margin_large"
android:paddingRight="@dimen/margin_large" android:layout_marginTop="@dimen/margin_medium"
android:textSize="@dimen/text_size_medium" android:textSize="@dimen/text_size_medium"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
@@ -24,7 +24,7 @@
android:id="@+id/checkImage" android:id="@+id/checkImage"
android:layout_width="24dp" android:layout_width="24dp"
android:layout_height="24dp" android:layout_height="24dp"
android:layout_margin="8dp" android:layout_margin="@dimen/margin_medium"
android:src="@drawable/ic_check_white" android:src="@drawable/ic_check_white"
android:visibility="invisible" android:visibility="invisible"
app:layout_constraintBottom_toBottomOf="@+id/button" app:layout_constraintBottom_toBottomOf="@+id/button"
@@ -38,7 +38,7 @@
style="@style/BriarButton" style="@style/BriarButton"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_margin="8dp" android:layout_margin="@dimen/margin_medium"
app:layout_constraintEnd_toStartOf="@+id/helpButton" app:layout_constraintEnd_toStartOf="@+id/helpButton"
app:layout_constraintStart_toEndOf="@+id/checkImage" app:layout_constraintStart_toEndOf="@+id/checkImage"
app:layout_constraintTop_toBottomOf="@+id/textView" app:layout_constraintTop_toBottomOf="@+id/textView"
@@ -49,7 +49,7 @@
style="@style/BriarButtonFlat.Positive" style="@style/BriarButtonFlat.Positive"
android:layout_width="24dp" android:layout_width="24dp"
android:layout_height="24dp" android:layout_height="24dp"
android:layout_margin="8dp" android:layout_margin="@dimen/margin_medium"
android:contentDescription="@string/help" android:contentDescription="@string/help"
android:src="@drawable/ic_help_outline_white" android:src="@drawable/ic_help_outline_white"
android:tint="@color/briar_button_text_positive" android:tint="@color/briar_button_text_positive"

View File

@@ -10,4 +10,4 @@
android:textColor="@color/briar_accent" android:textColor="@color/briar_accent"
android:textSize="14sp" android:textSize="14sp"
android:textStyle="bold" android:textStyle="bold"
tools:text="This is a category"/> tools:text="@string/security_settings_title"/>

View File

@@ -1,7 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<merge <merge
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
tools:showIn="@layout/fragment_keyagreement_qr"> tools:showIn="@layout/fragment_keyagreement_qr">
@@ -11,29 +10,22 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center"/> android:layout_gravity="center"/>
<android.support.constraint.ConstraintLayout <ImageView
android:id="@+id/qr_code"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent"
android:contentDescription="@string/qr_code"
android:scaleType="fitCenter"/>
<ImageView <ImageView
android:id="@+id/qr_code" android:id="@+id/fullscreen_button"
android:layout_width="match_parent" android:layout_width="wrap_content"
android:layout_height="match_parent" android:layout_height="wrap_content"
android:contentDescription="@string/qr_code" android:layout_gravity="bottom|end|right"
android:scaleType="fitCenter"/> android:layout_margin="@dimen/margin_small"
android:alpha="0.54"
android:background="?attr/selectableItemBackground"
android:contentDescription="@string/show_qr_code_fullscreen"
android:src="@drawable/ic_fullscreen_black_48dp"/>
<ImageView
android:id="@+id/fullscreen_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="@dimen/margin_small"
android:alpha="0.54"
android:background="?selectableItemBackground"
android:contentDescription="@string/show_qr_code_fullscreen"
android:src="@drawable/ic_fullscreen_black_48dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintRight_toRightOf="parent"/>
</android.support.constraint.ConstraintLayout>
</merge> </merge>

View File

@@ -5,11 +5,11 @@
android:layout_height="match_parent"> android:layout_height="match_parent">
<ImageView <ImageView
android:src="@drawable/splash_screen"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center" android:layout_gravity="center"
android:layout_margin="@dimen/margin_xxlarge" android:layout_margin="@dimen/margin_xxlarge"
android:contentDescription="@string/app_name"/> android:contentDescription="@string/app_name"
android:src="@drawable/splash_screen"/>
</FrameLayout> </FrameLayout>

View File

@@ -9,8 +9,8 @@
style="@style/BriarAvatar" style="@style/BriarAvatar"
android:layout_width="@dimen/avatar_forum_size" android:layout_width="@dimen/avatar_forum_size"
android:layout_height="@dimen/avatar_forum_size" android:layout_height="@dimen/avatar_forum_size"
android:layout_gravity="bottom|left" android:layout_gravity="bottom|left|start"
android:src="@color/briar_button_text_positive"/> tools:src="@color/briar_button_text_positive"/>
<android.support.v7.widget.AppCompatTextView <android.support.v7.widget.AppCompatTextView
android:id="@+id/textAvatarView" android:id="@+id/textAvatarView"
@@ -32,13 +32,15 @@
android:id="@+id/unreadCountView" android:id="@+id/unreadCountView"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="@dimen/unread_bubble_size" android:layout_height="@dimen/unread_bubble_size"
android:layout_gravity="right|top" android:layout_gravity="right|end|top"
android:background="@drawable/bubble" android:background="@drawable/bubble"
android:gravity="center" android:gravity="center"
android:minWidth="@dimen/unread_bubble_size" android:minWidth="@dimen/unread_bubble_size"
android:textColor="@color/briar_text_primary_inverse" android:textColor="@color/briar_text_primary_inverse"
android:textSize="@dimen/unread_bubble_text_size" android:textSize="@dimen/unread_bubble_text_size"
android:textStyle="bold" android:textStyle="bold"
tools:text="12"/> android:visibility="invisible"
tools:text="12"
tools:visibility="visible"/>
</merge> </merge>

View File

@@ -22,9 +22,9 @@
android:layout_height="@dimen/text_input_height" android:layout_height="@dimen/text_input_height"
android:layout_gravity="bottom" android:layout_gravity="bottom"
android:background="?attr/selectableItemBackground" android:background="?attr/selectableItemBackground"
android:src="@drawable/ic_emoji_toggle"
android:padding="@dimen/margin_small" android:padding="@dimen/margin_small"
android:scaleType="center" android:scaleType="center"
android:src="@drawable/ic_emoji_toggle"
app:tint="?attr/colorControlNormal"/> app:tint="?attr/colorControlNormal"/>
<com.vanniktech.emoji.EmojiEditText <com.vanniktech.emoji.EmojiEditText
@@ -37,8 +37,10 @@
android:maxLines="4" android:maxLines="4"
android:minHeight="@dimen/text_input_height" android:minHeight="@dimen/text_input_height"
android:paddingLeft="2dp" android:paddingLeft="2dp"
android:paddingStart="2dp"
android:textColor="?android:attr/textColorPrimary" android:textColor="?android:attr/textColorPrimary"
tools:ignore="RtlSymmetry"/> tools:ignore="RtlSymmetry"
tools:text="Line 1\nLine 2\nLine 3"/>
<android.support.v7.widget.AppCompatImageButton <android.support.v7.widget.AppCompatImageButton
android:id="@+id/btn_send" android:id="@+id/btn_send"

View File

@@ -12,8 +12,6 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/margin_medium" android:layout_marginEnd="@dimen/margin_medium"
android:layout_marginLeft="@dimen/margin_medium"
android:layout_marginRight="@dimen/margin_medium"
android:layout_marginStart="@dimen/margin_medium" android:layout_marginStart="@dimen/margin_medium"
android:layout_marginTop="@dimen/margin_medium" android:layout_marginTop="@dimen/margin_medium"
android:elevation="@dimen/cardview_default_elevation" android:elevation="@dimen/cardview_default_elevation"
@@ -33,9 +31,9 @@
android:layout_height="@dimen/text_input_height" android:layout_height="@dimen/text_input_height"
android:layout_gravity="bottom" android:layout_gravity="bottom"
android:background="?attr/selectableItemBackground" android:background="?attr/selectableItemBackground"
android:src="@drawable/ic_emoji_toggle"
android:padding="@dimen/margin_small" android:padding="@dimen/margin_small"
android:scaleType="center" android:scaleType="center"
android:src="@drawable/ic_emoji_toggle"
app:tint="?attr/colorControlNormal"/> app:tint="?attr/colorControlNormal"/>
<com.vanniktech.emoji.EmojiEditText <com.vanniktech.emoji.EmojiEditText
@@ -43,15 +41,15 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@android:color/transparent" android:background="@android:color/transparent"
android:gravity="bottom"
android:inputType="textMultiLine|textLongMessage|textCapSentences|textAutoCorrect" android:inputType="textMultiLine|textLongMessage|textCapSentences|textAutoCorrect"
android:minHeight="@dimen/text_input_height" android:minHeight="@dimen/text_input_height"
android:paddingBottom="10dp" android:paddingBottom="@dimen/margin_small"
android:paddingEnd="@dimen/margin_small" android:paddingEnd="@dimen/margin_small"
android:paddingRight="@dimen/margin_small" android:paddingRight="@dimen/margin_small"
android:paddingTop="@dimen/margin_small" android:paddingTop="@dimen/margin_small"
android:textColor="?android:attr/textColorPrimary" android:textColor="?android:attr/textColorPrimary"
tools:ignore="RtlSymmetry"/> tools:ignore="RtlSymmetry"
tools:text="Line 1\nLine 2\nLine 3"/>
</LinearLayout> </LinearLayout>

View File

@@ -1,8 +1,10 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.AppBarLayout <android.support.design.widget.AppBarLayout
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content"> android:layout_height="wrap_content"
tools:context="org.briarproject.briar.android.navdrawer.NavDrawerActivity">
<android.support.v7.widget.Toolbar <android.support.v7.widget.Toolbar
android:id="@+id/toolbar" android:id="@+id/toolbar"

View File

@@ -16,7 +16,8 @@
android:id="@+id/unreadCountView" android:id="@+id/unreadCountView"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="@dimen/unread_bubble_size" android:layout_height="@dimen/unread_bubble_size"
android:layout_gravity="right|top" android:layout_gravity="right|end|top"
android:layout_marginEnd="5dp"
android:layout_marginRight="5dp" android:layout_marginRight="5dp"
android:layout_marginTop="10dp" android:layout_marginTop="10dp"
android:background="@drawable/bubble" android:background="@drawable/bubble"