Merge branch '356-make-it-clearer-who-will-be-introduced' into 'master'

Make it clearer who will be introduced

Show contact names under avatars before sending introduction to make it clearer who will be introduced.

![device-2016-07-08-121836](/uploads/de13f6e75b9a573e561e9c810bbdb08b/device-2016-07-08-121836.png)

Closes #356

See merge request !242
This commit is contained in:
Ernir Erlingsson
2016-07-13 18:47:09 +00:00
2 changed files with 73 additions and 31 deletions

View File

@@ -1,38 +1,51 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.NestedScrollView <android.support.v4.widget.NestedScrollView
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"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:fillViewport="true"> android:fillViewport="true">
<LinearLayout <LinearLayout
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"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:padding="@dimen/margin_activity_horizontal" android:orientation="vertical"
android:orientation="vertical"> android:padding="@dimen/margin_activity_horizontal">
<RelativeLayout <RelativeLayout
android:id="@+id/introductionHeader"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content">
android:padding="@dimen/margin_medium">
<de.hdodenhof.circleimageview.CircleImageView <LinearLayout
android:id="@+id/avatarContact1" android:id="@+id/layoutContact1"
style="@style/BriarAvatar" android:layout_width="wrap_content"
android:layout_width="@dimen/listitem_picture_size" android:layout_height="wrap_content"
android:layout_height="@dimen/listitem_picture_size"
android:layout_centerHorizontal="true"
android:layout_marginEnd="@dimen/listitem_horizontal_margin"
android:layout_marginRight="@dimen/listitem_horizontal_margin"
android:layout_toLeftOf="@+id/introductionIcon" android:layout_toLeftOf="@+id/introductionIcon"
android:layout_toStartOf="@+id/introductionIcon" android:gravity="top|center_horizontal"
tools:src="@drawable/ic_launcher"/> android:orientation="vertical">
<de.hdodenhof.circleimageview.CircleImageView
android:id="@+id/avatarContact1"
style="@style/BriarAvatar"
android:layout_width="@dimen/listitem_picture_size"
android:layout_height="@dimen/listitem_picture_size"
android:layout_marginEnd="@dimen/listitem_horizontal_margin"
android:layout_marginLeft="@dimen/listitem_horizontal_margin"
android:layout_marginRight="@dimen/listitem_horizontal_margin"
android:layout_marginStart="@dimen/listitem_horizontal_margin"
tools:src="@drawable/ic_launcher"/>
<TextView
android:id="@+id/nameContact1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/margin_small"
android:gravity="center"
android:textColor="@color/briar_text_primary"
android:textSize="@dimen/text_size_tiny"
tools:text="Contact 1"/>
</LinearLayout>
<ImageView <ImageView
android:id="@+id/introductionIcon" android:id="@+id/introductionIcon"
@@ -42,18 +55,38 @@
android:src="@drawable/ic_contact_introduction" android:src="@drawable/ic_contact_introduction"
tools:ignore="ContentDescription"/> tools:ignore="ContentDescription"/>
<de.hdodenhof.circleimageview.CircleImageView <LinearLayout
android:id="@+id/avatarContact2" android:id="@+id/layoutContact2"
style="@style/BriarAvatar" android:layout_width="wrap_content"
android:layout_width="@dimen/listitem_picture_size" android:layout_height="wrap_content"
android:layout_height="@dimen/listitem_picture_size"
android:layout_centerHorizontal="true"
android:layout_marginLeft="@dimen/listitem_horizontal_margin"
android:layout_marginStart="@dimen/listitem_horizontal_margin"
android:layout_toEndOf="@+id/introductionIcon" android:layout_toEndOf="@+id/introductionIcon"
android:layout_toRightOf="@+id/introductionIcon" android:layout_toRightOf="@+id/introductionIcon"
android:transitionName="avatar" android:gravity="top|center_horizontal"
tools:src="@drawable/ic_launcher"/> android:orientation="vertical">
<de.hdodenhof.circleimageview.CircleImageView
android:id="@+id/avatarContact2"
style="@style/BriarAvatar"
android:layout_width="@dimen/listitem_picture_size"
android:layout_height="@dimen/listitem_picture_size"
android:layout_marginEnd="@dimen/listitem_horizontal_margin"
android:layout_marginLeft="@dimen/listitem_horizontal_margin"
android:layout_marginRight="@dimen/listitem_horizontal_margin"
android:layout_marginStart="@dimen/listitem_horizontal_margin"
android:transitionName="avatar"
tools:src="@drawable/ic_launcher"/>
<TextView
android:id="@+id/nameContact2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/margin_small"
android:gravity="center"
android:textColor="@color/briar_text_primary"
android:textSize="@dimen/text_size_tiny"
tools:text="Contact 2"/>
</LinearLayout>
</RelativeLayout> </RelativeLayout>
@@ -72,8 +105,8 @@
android:layout_marginTop="@dimen/margin_medium" android:layout_marginTop="@dimen/margin_medium"
android:layout_weight="1" android:layout_weight="1"
android:gravity="top" android:gravity="top"
android:textColor="@color/briar_text_secondary"
android:textSize="@dimen/text_size_medium" android:textSize="@dimen/text_size_medium"
android:textColor="@color/briar_text_primary"
tools:text="@string/introduction_message_text"/> tools:text="@string/introduction_message_text"/>
<EditText <EditText
@@ -83,7 +116,9 @@
android:layout_marginTop="@dimen/margin_medium" android:layout_marginTop="@dimen/margin_medium"
android:gravity="bottom" android:gravity="bottom"
android:hint="@string/introduction_message_hint" android:hint="@string/introduction_message_hint"
android:inputType="text|textMultiLine|textCapSentences"/> android:inputType="text|textMultiLine|textCapSentences"
android:textColor="@color/briar_text_primary"
android:textColorHint="@color/briar_text_tertiary"/>
<Button <Button
android:id="@+id/makeIntroductionButton" android:id="@+id/makeIntroductionButton"

View File

@@ -150,6 +150,10 @@ public class IntroductionMessageFragment extends BaseFragment {
ui.avatar2.setImageDrawable(new IdenticonDrawable( ui.avatar2.setImageDrawable(new IdenticonDrawable(
c2.getAuthor().getId().getBytes())); c2.getAuthor().getId().getBytes()));
// set contact names
ui.contactName1.setText(c1.getAuthor().getName());
ui.contactName2.setText(c2.getAuthor().getName());
// set introduction text // set introduction text
ui.text.setText(String.format( ui.text.setText(String.format(
getString(R.string.introduction_message_text), getString(R.string.introduction_message_text),
@@ -217,6 +221,7 @@ public class IntroductionMessageFragment extends BaseFragment {
private final ProgressBar progressBar; private final ProgressBar progressBar;
private final CircleImageView avatar1, avatar2; private final CircleImageView avatar1, avatar2;
private final TextView contactName1, contactName2;
private final TextView text; private final TextView text;
private final EditText message; private final EditText message;
private final Button button; private final Button button;
@@ -225,6 +230,8 @@ public class IntroductionMessageFragment extends BaseFragment {
progressBar = (ProgressBar) v.findViewById(R.id.progressBar); progressBar = (ProgressBar) v.findViewById(R.id.progressBar);
avatar1 = (CircleImageView) v.findViewById(R.id.avatarContact1); avatar1 = (CircleImageView) v.findViewById(R.id.avatarContact1);
avatar2 = (CircleImageView) v.findViewById(R.id.avatarContact2); avatar2 = (CircleImageView) v.findViewById(R.id.avatarContact2);
contactName1 = (TextView) v.findViewById(R.id.nameContact1);
contactName2 = (TextView) v.findViewById(R.id.nameContact2);
text = (TextView) v.findViewById(R.id.introductionText); text = (TextView) v.findViewById(R.id.introductionText);
message = (EditText) v.findViewById(R.id.introductionMessageView); message = (EditText) v.findViewById(R.id.introductionMessageView);
button = (Button) v.findViewById(R.id.makeIntroductionButton); button = (Button) v.findViewById(R.id.makeIntroductionButton);