From 65509137b69a4533c573948aef62f8338a3eda0c Mon Sep 17 00:00:00 2001
From: Torsten Grote <t@grobox.de>
Date: Thu, 20 Oct 2022 14:23:00 -0300
Subject: [PATCH] Replace illustration for mailbox success

---
 .../artwork/ic_check_circle_dark.svg          |   4 +
 .../artwork/ic_check_circle_light.svg         |   4 +
 .../briar/android/fragment/FinalFragment.java |  19 ++-
 .../android/mailbox/MailboxActivity.java      |   3 +-
 .../src/main/res/drawable/ic_check_circle.xml |  13 ++
 .../src/main/res/layout/fragment_final.xml    | 119 +++++++++---------
 .../src/main/res/values-night/color.xml       |   1 +
 briar-android/src/main/res/values/color.xml   |   3 +
 8 files changed, 97 insertions(+), 69 deletions(-)
 create mode 100644 briar-android/artwork/ic_check_circle_dark.svg
 create mode 100644 briar-android/artwork/ic_check_circle_light.svg
 create mode 100644 briar-android/src/main/res/drawable/ic_check_circle.xml

diff --git a/briar-android/artwork/ic_check_circle_dark.svg b/briar-android/artwork/ic_check_circle_dark.svg
new file mode 100644
index 0000000000..de27d40e62
--- /dev/null
+++ b/briar-android/artwork/ic_check_circle_dark.svg
@@ -0,0 +1,4 @@
+<svg width="91" height="90" viewBox="0 0 91 90" fill="none" xmlns="http://www.w3.org/2000/svg">
+<path d="M62.5714 35.1634C63.214 34.5173 63.2111 33.4726 62.5649 32.83C61.9188 32.1874 60.8741 32.1903 60.2315 32.8365L39.5238 53.66L30.5714 44.6578C29.9288 44.0117 28.8841 44.0088 28.238 44.6514C27.5918 45.2939 27.5889 46.3387 28.2315 46.9848L39.5238 58.3399L62.5714 35.1634Z" fill="#A3E635"/>
+<path fill-rule="evenodd" clip-rule="evenodd" d="M89.4014 45C89.4014 69.3005 69.7019 89 45.4014 89C21.1008 89 1.40137 69.3005 1.40137 45C1.40137 20.6995 21.1008 1 45.4014 1C69.7019 1 89.4014 20.6995 89.4014 45ZM86.1014 45C86.1014 67.478 67.8794 85.7 45.4014 85.7C22.9234 85.7 4.70137 67.478 4.70137 45C4.70137 22.522 22.9234 4.3 45.4014 4.3C67.8794 4.3 86.1014 22.522 86.1014 45Z" fill="#A3E635"/>
+</svg>
diff --git a/briar-android/artwork/ic_check_circle_light.svg b/briar-android/artwork/ic_check_circle_light.svg
new file mode 100644
index 0000000000..75663aa42e
--- /dev/null
+++ b/briar-android/artwork/ic_check_circle_light.svg
@@ -0,0 +1,4 @@
+<svg width="91" height="90" viewBox="0 0 91 90" fill="none" xmlns="http://www.w3.org/2000/svg">
+<path d="M62.5714 35.1634C63.214 34.5173 63.2111 33.4726 62.5649 32.83C61.9188 32.1874 60.8741 32.1903 60.2315 32.8365L39.5238 53.66L30.5714 44.6578C29.9288 44.0117 28.8841 44.0088 28.238 44.6514C27.5918 45.2939 27.5889 46.3387 28.2315 46.9848L39.5238 58.3399L62.5714 35.1634Z" fill="#65A30D"/>
+<path fill-rule="evenodd" clip-rule="evenodd" d="M89.4014 45C89.4014 69.3005 69.7019 89 45.4014 89C21.1008 89 1.40137 69.3005 1.40137 45C1.40137 20.6995 21.1008 1 45.4014 1C69.7019 1 89.4014 20.6995 89.4014 45ZM86.1014 45C86.1014 67.478 67.8794 85.7 45.4014 85.7C22.9234 85.7 4.70137 67.478 4.70137 45C4.70137 22.522 22.9234 4.3 45.4014 4.3C67.8794 4.3 86.1014 22.522 86.1014 45Z" fill="#65A30D"/>
+</svg>
diff --git a/briar-android/src/main/java/org/briarproject/briar/android/fragment/FinalFragment.java b/briar-android/src/main/java/org/briarproject/briar/android/fragment/FinalFragment.java
index d6cacf4f8f..e7ce4af130 100644
--- a/briar-android/src/main/java/org/briarproject/briar/android/fragment/FinalFragment.java
+++ b/briar-android/src/main/java/org/briarproject/briar/android/fragment/FinalFragment.java
@@ -22,12 +22,11 @@ import androidx.annotation.Nullable;
 import androidx.annotation.StringRes;
 import androidx.appcompat.app.ActionBar;
 import androidx.appcompat.app.AppCompatActivity;
-import androidx.core.widget.ImageViewCompat;
-import androidx.core.widget.NestedScrollView;
 import androidx.fragment.app.Fragment;
 
-import static android.view.View.FOCUS_DOWN;
 import static android.view.View.GONE;
+import static androidx.core.widget.ImageViewCompat.setImageTintList;
+import static org.briarproject.briar.android.util.UiUtils.hideViewOnSmallScreen;
 
 /**
  * A fragment to be used at the end of a user flow
@@ -61,7 +60,6 @@ public class FinalFragment extends Fragment {
 		return f;
 	}
 
-	private NestedScrollView scrollView;
 	protected Button buttonView;
 	protected final OnBackPressedCallback onBackPressedCallback =
 			new OnBackPressedCallback(true) {
@@ -79,7 +77,6 @@ public class FinalFragment extends Fragment {
 		View v = inflater
 				.inflate(R.layout.fragment_final, container, false);
 
-		scrollView = (NestedScrollView) v;
 		ImageView iconView = v.findViewById(R.id.iconView);
 		TextView titleView = v.findViewById(R.id.titleView);
 		TextView textView = v.findViewById(R.id.textView);
@@ -88,9 +85,12 @@ public class FinalFragment extends Fragment {
 		Bundle args = requireArguments();
 		titleView.setText(args.getInt(ARG_TITLE));
 		iconView.setImageResource(args.getInt(ARG_ICON));
-		int color = getResources().getColor(args.getInt(ARG_ICON_TINT));
-		ColorStateList tint = ColorStateList.valueOf(color);
-		ImageViewCompat.setImageTintList(iconView, tint);
+		int tintRes = args.getInt(ARG_ICON_TINT);
+		if (tintRes != 0) {
+			int color = getResources().getColor(tintRes);
+			ColorStateList tint = ColorStateList.valueOf(color);
+			setImageTintList(iconView, tint);
+		}
 		int textRes = args.getInt(ARG_TEXT);
 		if (textRes == 0) {
 			textView.setVisibility(GONE);
@@ -122,8 +122,7 @@ public class FinalFragment extends Fragment {
 	@Override
 	public void onStart() {
 		super.onStart();
-		// Scroll down in case the screen is small, so the button is visible
-		scrollView.post(() -> scrollView.fullScroll(FOCUS_DOWN));
+		hideViewOnSmallScreen(requireView().findViewById(R.id.iconView));
 	}
 
 	@Override
diff --git a/briar-android/src/main/java/org/briarproject/briar/android/mailbox/MailboxActivity.java b/briar-android/src/main/java/org/briarproject/briar/android/mailbox/MailboxActivity.java
index c72993776c..48fdeb8649 100644
--- a/briar-android/src/main/java/org/briarproject/briar/android/mailbox/MailboxActivity.java
+++ b/briar-android/src/main/java/org/briarproject/briar/android/mailbox/MailboxActivity.java
@@ -186,8 +186,7 @@ public class MailboxActivity extends BriarActivity {
 			tag = ErrorFragment.TAG;
 		} else if (s instanceof MailboxPairingState.Paired) {
 			f = FinalFragment.newInstance(R.string.mailbox_setup_paired_title,
-					R.drawable.ic_check_circle_outline,
-					R.color.briar_brand_green,
+					R.drawable.ic_check_circle, 0,
 					R.string.mailbox_setup_paired_description);
 			tag = FinalFragment.TAG;
 		} else {
diff --git a/briar-android/src/main/res/drawable/ic_check_circle.xml b/briar-android/src/main/res/drawable/ic_check_circle.xml
new file mode 100644
index 0000000000..9acf3c6707
--- /dev/null
+++ b/briar-android/src/main/res/drawable/ic_check_circle.xml
@@ -0,0 +1,13 @@
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+	android:width="90dp"
+	android:height="90dp"
+	android:viewportWidth="91"
+	android:viewportHeight="90">
+	<path
+		android:fillColor="@color/il_lime"
+		android:pathData="M62.571,35.163C63.214,34.517 63.211,33.473 62.565,32.83C61.919,32.187 60.874,32.19 60.231,32.836L39.524,53.66L30.571,44.658C29.929,44.012 28.884,44.009 28.238,44.651C27.592,45.294 27.589,46.339 28.232,46.985L39.524,58.34L62.571,35.163Z" />
+	<path
+		android:fillColor="@color/il_lime"
+		android:fillType="evenOdd"
+		android:pathData="M89.401,45C89.401,69.3 69.702,89 45.401,89C21.101,89 1.401,69.3 1.401,45C1.401,20.699 21.101,1 45.401,1C69.702,1 89.401,20.699 89.401,45ZM86.101,45C86.101,67.478 67.879,85.7 45.401,85.7C22.923,85.7 4.701,67.478 4.701,45C4.701,22.522 22.923,4.3 45.401,4.3C67.879,4.3 86.101,22.522 86.101,45Z" />
+</vector>
diff --git a/briar-android/src/main/res/layout/fragment_final.xml b/briar-android/src/main/res/layout/fragment_final.xml
index 13123fe861..a75ac3d99c 100644
--- a/briar-android/src/main/res/layout/fragment_final.xml
+++ b/briar-android/src/main/res/layout/fragment_final.xml
@@ -1,70 +1,75 @@
 <?xml version="1.0" encoding="utf-8"?>
-<androidx.core.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
+<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_height="match_parent"
-	android:fillViewport="true">
+	android:orientation="vertical">
 
-	<androidx.constraintlayout.widget.ConstraintLayout
+	<ScrollView
 		android:layout_width="match_parent"
-		android:layout_height="wrap_content">
+		android:layout_height="0dp"
+		android:layout_weight="1">
 
-		<ImageView
-			android:id="@+id/iconView"
-			android:layout_width="@dimen/hero_square"
-			android:layout_height="@dimen/hero_square"
-			android:layout_marginHorizontal="@dimen/margin_xlarge"
-			android:layout_marginTop="@dimen/margin_xlarge"
-			app:layout_constraintBottom_toTopOf="@+id/titleView"
-			app:layout_constraintEnd_toEndOf="parent"
-			app:layout_constraintStart_toStartOf="parent"
-			app:layout_constraintTop_toTopOf="parent"
-			app:layout_constraintVertical_bias="0.25"
-			app:layout_constraintVertical_chainStyle="packed"
-			tools:ignore="ContentDescription"
-			tools:srcCompat="@drawable/alerts_and_states_error"
-			tools:tint="@color/briar_red_500" />
+		<androidx.constraintlayout.widget.ConstraintLayout
+			android:layout_width="match_parent"
+			android:layout_height="wrap_content">
 
-		<TextView
-			android:id="@+id/titleView"
-			android:layout_width="0dp"
-			android:layout_height="wrap_content"
-			android:layout_marginHorizontal="@dimen/margin_xlarge"
-			android:layout_marginTop="@dimen/margin_xlarge"
-			android:gravity="center"
-			android:textAppearance="@style/TextAppearance.MaterialComponents.Headline5"
-			app:layout_constraintBottom_toTopOf="@+id/textView"
-			app:layout_constraintEnd_toEndOf="parent"
-			app:layout_constraintStart_toStartOf="parent"
-			app:layout_constraintTop_toBottomOf="@+id/iconView"
-			tools:text="@string/removable_drive_error_send_title" />
+			<ImageView
+				android:id="@+id/iconView"
+				android:layout_width="@dimen/hero_square"
+				android:layout_height="@dimen/hero_square"
+				android:layout_marginHorizontal="@dimen/margin_xlarge"
+				android:layout_marginTop="@dimen/margin_xlarge"
+				app:layout_constraintBottom_toTopOf="@+id/titleView"
+				app:layout_constraintEnd_toEndOf="parent"
+				app:layout_constraintStart_toStartOf="parent"
+				app:layout_constraintTop_toTopOf="parent"
+				app:layout_constraintVertical_bias="0.25"
+				app:layout_constraintVertical_chainStyle="packed"
+				tools:ignore="ContentDescription"
+				tools:srcCompat="@drawable/alerts_and_states_error"
+				tools:tint="@color/briar_red_500" />
 
-		<TextView
-			android:id="@+id/textView"
-			android:layout_width="0dp"
-			android:layout_height="wrap_content"
-			android:layout_marginHorizontal="@dimen/margin_xlarge"
-			android:layout_marginTop="@dimen/margin_xlarge"
-			android:layout_marginBottom="@dimen/margin_large"
-			android:textAppearance="@style/TextAppearance.MaterialComponents.Body1"
-			app:layout_constraintBottom_toTopOf="@+id/button"
-			app:layout_constraintEnd_toEndOf="parent"
-			app:layout_constraintStart_toStartOf="parent"
-			app:layout_constraintTop_toBottomOf="@+id/titleView"
-			tools:text="@string/removable_drive_error_send_text" />
+			<TextView
+				android:id="@+id/titleView"
+				android:layout_width="0dp"
+				android:layout_height="wrap_content"
+				android:layout_marginHorizontal="@dimen/margin_xlarge"
+				android:layout_marginTop="@dimen/margin_xlarge"
+				android:gravity="center"
+				android:textAppearance="@style/TextAppearance.MaterialComponents.Headline5"
+				app:layout_constraintBottom_toTopOf="@+id/textView"
+				app:layout_constraintEnd_toEndOf="parent"
+				app:layout_constraintStart_toStartOf="parent"
+				app:layout_constraintTop_toBottomOf="@+id/iconView"
+				tools:text="@string/removable_drive_error_send_title" />
 
-		<Button
-			android:id="@+id/button"
-			style="@style/BriarButton"
-			android:layout_width="0dp"
-			android:layout_height="wrap_content"
-			android:layout_margin="@dimen/margin_large"
-			android:text="@string/finish"
-			app:layout_constraintBottom_toBottomOf="parent"
-			app:layout_constraintEnd_toEndOf="parent"
-			app:layout_constraintStart_toStartOf="parent" />
+			<TextView
+				android:id="@+id/textView"
+				android:layout_width="0dp"
+				android:layout_height="wrap_content"
+				android:layout_margin="@dimen/margin_large"
+				android:textAppearance="@style/TextAppearance.MaterialComponents.Body1"
+				app:layout_constraintBottom_toBottomOf="parent"
+				app:layout_constraintEnd_toEndOf="parent"
+				app:layout_constraintStart_toStartOf="parent"
+				app:layout_constraintTop_toBottomOf="@+id/titleView"
+				tools:text="@string/removable_drive_error_send_text" />
 
-	</androidx.constraintlayout.widget.ConstraintLayout>
+		</androidx.constraintlayout.widget.ConstraintLayout>
 
-</androidx.core.widget.NestedScrollView>
+	</ScrollView>
+
+	<Button
+		android:id="@+id/button"
+		style="@style/BriarButton"
+		android:layout_width="match_parent"
+		android:layout_height="wrap_content"
+		android:layout_marginHorizontal="@dimen/margin_large"
+		android:text="@string/finish"
+		app:layout_constraintBottom_toBottomOf="parent"
+		app:layout_constraintEnd_toEndOf="parent"
+		app:layout_constraintStart_toStartOf="parent" />
+
+</LinearLayout>
diff --git a/briar-android/src/main/res/values-night/color.xml b/briar-android/src/main/res/values-night/color.xml
index c04f0b1b96..f2dfe00b90 100644
--- a/briar-android/src/main/res/values-night/color.xml
+++ b/briar-android/src/main/res/values-night/color.xml
@@ -29,4 +29,5 @@
 
 	<color name="il_border">#64748B</color>
 	<color name="il_background">#334155</color>
+	<color name="il_lime">@color/briar_lime_400_new</color>
 </resources>
diff --git a/briar-android/src/main/res/values/color.xml b/briar-android/src/main/res/values/color.xml
index 5dca230335..2928f38681 100644
--- a/briar-android/src/main/res/values/color.xml
+++ b/briar-android/src/main/res/values/color.xml
@@ -1,7 +1,9 @@
 <?xml version="1.0" encoding="utf-8"?>
 <resources>
 	<color name="briar_lime_600">#67a60f</color>
+	<color name="briar_lime_600_new">#65A30D</color>
 	<color name="briar_lime_400">#82c91e</color>
+	<color name="briar_lime_400_new">#A3E635</color>
 
 	<color name="briar_blue_800">#134a81</color>
 	<color name="briar_blue_600">#1b69b6</color>
@@ -55,6 +57,7 @@
 
 	<color name="il_border">#9CA3AF</color>
 	<color name="il_background">#E5E7EB</color>
+	<color name="il_lime">@color/briar_lime_600_new</color>
 
 	<!-- text colors -->
 	<color name="briar_text_link">@color/briar_blue_400</color>
-- 
GitLab