Clean up basic onboarding flow

Stephen Paul Weber created

Use the labels and icons from JMP onboarding, don't ask users if they want to
create an account on their "own server".

Change summary

src/cheogram/AndroidManifest.xml                                 |   4 
src/cheogram/java/eu/siacs/conversations/ui/WelcomeActivity.java |  17 
src/cheogram/res/drawable/getjid.xml                             |  15 
src/cheogram/res/drawable/havejid.xml                            |  15 
src/cheogram/res/drawable/snikket.xml                            | 192 ++
src/cheogram/res/layout/activity_welcome.xml                     |  89 
src/cheogram/res/values/strings.xml                              |   6 
src/main/java/eu/siacs/conversations/ui/EditAccountActivity.java |   3 
8 files changed, 292 insertions(+), 49 deletions(-)

Detailed changes

src/cheogram/AndroidManifest.xml 🔗

@@ -26,11 +26,11 @@
             android:launchMode="singleTask" />
         <activity
             android:name=".ui.PickServerActivity"
-            android:label="@string/create_new_account"
+            android:label="@string/get_jabber_id"
             android:launchMode="singleTask" />
         <activity
             android:name=".ui.MagicCreateActivity"
-            android:label="@string/create_new_account"
+            android:label="@string/get_jabber_id"
             android:launchMode="singleTask" />
         <activity
             android:name=".ui.EasyOnboardingInviteActivity"

src/cheogram/java/eu/siacs/conversations/ui/WelcomeActivity.java 🔗

@@ -122,7 +122,7 @@ public class WelcomeActivity extends XmppActivity implements XmppConnectionServi
         setSupportActionBar(binding.toolbar);
         configureActionBar(getSupportActionBar(), false);
         binding.registerNewAccount.setOnClickListener(v -> {
-            final Intent intent = new Intent(this, PickServerActivity.class);
+            final Intent intent = new Intent(this, MagicCreateActivity.class);
             addInviteUri(intent);
             startActivity(intent);
         });
@@ -139,7 +139,20 @@ public class WelcomeActivity extends XmppActivity implements XmppConnectionServi
             addInviteUri(intent);
             startActivity(intent);
         });
-
+        binding.useSnikket.setOnClickListener(v -> {
+            final List<Account> accounts = xmppConnectionService.getAccounts();
+            Intent intent = new Intent(WelcomeActivity.this, EditAccountActivity.class);
+            intent.putExtra(EditAccountActivity.EXTRA_FORCE_REGISTER, false);
+            intent.putExtra("snikket", true);
+            if (accounts.size() == 1) {
+                intent.putExtra("jid", accounts.get(0).getJid().asBareJid().toString());
+                intent.putExtra("init", true);
+            } else if (accounts.size() >= 1) {
+                intent = new Intent(WelcomeActivity.this, ManageAccountActivity.class);
+            }
+            addInviteUri(intent);
+            startActivity(intent);
+        });
     }
 
     @Override

src/cheogram/res/drawable/getjid.xml 🔗

@@ -0,0 +1,55 @@
+<vector xmlns:android="http://schemas.android.com/apk/res/android" xmlns:aapt="http://schemas.android.com/aapt"
+    android:viewportWidth="54.67484"
+    android:viewportHeight="69.64137"
+    android:width="54.67484dp"
+    android:height="69.64137dp">
+    <path
+        android:pathData="M-69.123113 1078.1423Z"
+        android:fillColor="#000000"
+        android:strokeMiterLimit="10" />
+    <group
+        android:scaleX="0.02688812"
+        android:scaleY="-0.02688812"
+        android:translateX="-4.373626"
+        android:translateY="98.6128">
+        <path

src/cheogram/res/drawable/havejid.xml 🔗

@@ -0,0 +1,56 @@
+<vector xmlns:android="http://schemas.android.com/apk/res/android" xmlns:aapt="http://schemas.android.com/aapt"
+    android:viewportWidth="54.67484"
+    android:viewportHeight="69.64137"
+    android:width="54.67484dp"
+    android:height="69.64137dp">
+    <path
+        android:pathData="M-69.123113 1078.1423Z"
+        android:fillColor="#000000"
+        android:strokeMiterLimit="10" />
+    <group
+        android:scaleX="0.02688812"
+        android:scaleY="-0.02688812"
+        android:translateX="-4.373626"
+        android:translateY="98.6128">
+        <path

src/cheogram/res/drawable/snikket.xml 🔗

@@ -0,0 +1,192 @@
+<vector xmlns:android="http://schemas.android.com/apk/res/android" xmlns:aapt="http://schemas.android.com/aapt"
+    android:viewportWidth="22.88676"
+    android:viewportHeight="22.88458"
+    android:width="54.67484dp"
+    android:height="54.67484dp">
+    <group
+        android:translateX="-94.38996"
+        android:translateY="-137.3911">
+        <group
+            android:scaleX="0.05535021"
+            android:scaleY="0.05535021"
+            android:translateX="88.57376"
+            android:translateY="137.3911">
+            <group
+                android:translateX="-188.17"
+                android:translateY="-200">
+                <path
+                    android:pathData="M679 510.12c0 0.09 0 0.09 -0.19 0.19a0.91 0.91 0 0 0 0.09 -0.48 0.34 0.34 0 0 1 0.1 0.29z"
+                    android:fillColor="#2D2B70" />
+            </group>
+            <group
+                android:translateX="-188.17"
+                android:translateY="-200">
+                <path
+                    android:pathData="M678.89 509.83a0.91 0.91 0 0 1 -0.09 0.48c0.19 -0.1 0.19 -0.1 0.19 -0.19a0.34 0.34 0 0 0 -0.1 -0.29z"
+                    android:fillColor="#2D2B70" />
+            </group>
+            <group
+                android:translateX="-188.17"
+                android:translateY="-200">
+                <path
+                    android:pathData="M679 510.12c0 0.09 0 0.09 -0.19 0.19a0.91 0.91 0 0 0 0.09 -0.48 0.34 0.34 0 0 1 0.1 0.29z"
+                    android:fillColor="#2D2B70" />
+            </group>
+            <group
+                android:translateX="-188.17"
+                android:translateY="-200">
+                <path
+                    android:pathData="M679 510.12c0 0.09 0 0.09 -0.19 0.19a0.91 0.91 0 0 0 0.09 -0.48 0.34 0.34 0 0 1 0.1 0.29z"
+                    android:fillColor="#2D2B70" />
+            </group>
+            <group
+                android:translateX="-188.17"
+                android:translateY="-200">
+                <path
+                    android:pathData="M632.3 454.62A206.27 206.27 0 0 1 522.84 501.21 205.25 205.25 0 0 1 500 406.68 205.75 205.75 0 0 1 632.3 454.62Z">
+                    <aapt:attr
+                        name="android:fillColor">
+                        <gradient
+                            android:startX="566.13"
+                            android:startY="409.16"
+                            android:endX="566.13"
+                            android:endY="493.17"
+                            android:tileMode="clamp">
+                            <item
+                                android:color="#F58020"
+                                android:offset="0" />
+                            <item
+                                android:color="#FDEB01"
+                                android:offset="1" />
+                        </gradient>
+                    </aapt:attr>
+                </path>
+            </group>
+            <group
+                android:translateX="-188.17"
+                android:translateY="-200">
+                <path
+                    android:pathData="M699.18 351.28a206.32 206.32 0 0 0 -95.78 -123.53 206.49 206.49 0 0 0 -87 98.17 204.39 204.39 0 0 0 -16.4 80.76 207 207 0 0 1 178.89 103.15 0.34 0.34 0 0 1 0.1 0.29 206.7 206.7 0 0 0 20.19 -158.84z">
+                    <aapt:attr
+                        name="android:fillColor">
+                        <gradient
+                            android:startX="499.96"
+                            android:startY="368.93"
+                            android:endX="706.74"
+                            android:endY="368.93"
+                            android:tileMode="clamp">
+                            <item
+                                android:color="#FFC50D"
+                                android:offset="0" />
+                            <item
+                                android:color="#FDEB01"
+                                android:offset="1" />
+                        </gradient>
+                    </aapt:attr>
+                </path>
+            </group>
+            <group
+                android:translateX="-188.17"
+                android:translateY="-200">
+                <path
+                    android:pathData="M603.37 585.71A206.76 206.76 0 0 1 321 510.12c-3 -5.08 -5.65 -10.25 -8.13 -15.6 -0.77 -1.63 -1.25 -2.68 -1.34 -3l-0.1 -0.1a204.93 204.93 0 0 1 -17.89 -74.15 22.26 22.26 0 0 1 -0.1 -2.58v-0.1c-0.19 -2.58 -0.19 -5.26 -0.19 -7.94q0 -5.31 0.29 -10.62a203.13 203.13 0 0 1 7.27 -44.78C325 264 405 200 499.94 200a204.88 204.88 0 0 1 103.43 27.75 206.47 206.47 0 0 0 -87 98.17 206.57 206.57 0 0 0 87 259.79z">
+                    <aapt:attr
+                        name="android:fillColor">
+                        <gradient
+                            android:startX="448.32"
+                            android:startY="210.56"
+                            android:endX="448.32"
+                            android:endY="599.59"
+                            android:tileMode="clamp">
+                            <item
+                                android:color="#3FC6F1"
+                                android:offset="0" />
+                            <item
+                                android:color="#4063AE"
+                                android:offset="1" />
+                        </gradient>
+                    </aapt:attr>
+                </path>
+            </group>
+            <path
+                android:pathData="M294.16 106.76A46.56 46.56 0 0 1 201.04 106.76A46.56 46.56 0 0 1 294.16 106.76Z"
+                android:fillColor="#FFFFFF" />
+            <group
+                android:translateX="-188.17"
+                android:translateY="-200">
+                <path
+                    android:pathData="M435.81 277.84a28.92 28.92 0 1 0 28.84 28.92 11.83 11.83 0 0 0 -0.14 -2.22 16.92 16.92 0 0 1 -25.3 -14.65 16.66 16.66 0 0 1 4.14 -11 28.76 28.76 0 0 0 -7.54 -1.05z"
+                    android:fillColor="#231F20" />
+            </group>
+            <group
+                android:translateX="-188.17"
+                android:translateY="-200">
+                <path
+                    android:pathData="M678.89 508.68v1.15A207 207 0 0 0 500 406.68 204.38 204.38 0 0 1 516.45 325.92c63 12.35 115.21 50.71 142.38 102.1a172.75 172.75 0 0 1 20.06 80.66z">
+                    <aapt:attr
+                        name="android:fillColor">
+                        <gradient
+                            android:startX="692.72"
+                            android:startY="464.03"
+                            android:endX="515.73"
+                            android:endY="367.2"
+                            android:tileMode="clamp">
+                            <item
+                                android:color="#FFFFFF"
+                                android:offset="0" />
+                            <item
+                                android:color="#00FFFFFF"
+                                android:offset="1" />
+                        </gradient>
+                    </aapt:attr>
+                </path>
+            </group>
+            <group
+                android:translateX="-188.17"
+                android:translateY="-200">
+                <path
+                    android:pathData="M303.21 613.45c42.58 -37.22 16.36 -103.82 9.67 -118.93 2.48 5.35 5.16 10.52 8.13 15.6a205 205 0 0 0 63.53 68c-28.89 31.22 -81.33 35.33 -81.33 35.33z">
+                    <aapt:attr
+                        name="android:fillColor">
+                        <gradient
+                            android:startX="300.94"
+                            android:startY="599.45"
+                            android:endX="346.32"
+                            android:endY="539.48"
+                            android:tileMode="clamp">
+                            <item
+                                android:color="#3FC6F1"
+                                android:offset="0" />
+                            <item
+                                android:color="#4063AE"
+                                android:offset="1" />
+                        </gradient>
+                    </aapt:attr>
+                </path>
+            </group>
+            <group
+                android:translateX="-188.17"
+                android:translateY="-200">
+                <path
+                    android:pathData="M603.4 585.71A206.72 206.72 0 0 1 293.58 417.3a22.26 22.26 0 0 1 -0.1 -2.58v-0.1c-0.19 -2.58 -0.19 -5.26 -0.19 -7.94 0 -3.54 0.09 -7.08 0.29 -10.62a203.13 203.13 0 0 1 7.27 -44.78 196.79 196.79 0 0 0 13.87 36.26 206.88 206.88 0 0 0 185.28 114.92 200.23 200.23 0 0 0 22.87 -1.25 205.82 205.82 0 0 0 80.53 84.5z">
+                    <aapt:attr
+                        name="android:fillColor">
+                        <gradient
+                            android:startX="627.42"
+                            android:startY="554.45"
+                            android:endX="351.38"
+                            android:endY="472.28"
+                            android:tileMode="clamp">
+                            <item
+                                android:color="#FFFFFF"
+                                android:offset="0" />
+                            <item
+                                android:color="#00FFFFFF"
+                                android:offset="1" />
+                        </gradient>
+                    </aapt:attr>
+                </path>
+            </group>
+        </group>
+    </group>
+</vector>

src/cheogram/res/layout/activity_welcome.xml 🔗

@@ -15,77 +15,78 @@
             android:layout_height="match_parent"
             android:fillViewport="true">
 
-            <RelativeLayout
+            <LinearLayout
                 android:layout_width="match_parent"
                 android:layout_height="wrap_content"
+                android:weightSum="2"
+                android:orientation="vertical"
                 android:background="?attr/color_background_primary">
 
+                <RelativeLayout
+                    android:layout_width="match_parent"
+                    android:layout_height="wrap_content"
+                    android:layout_weight="1"
+                    android:layout_above="@+id/linearLayout"
+                    android:layout_alignParentStart="true"
+                    android:layout_alignParentLeft="true">
+
+                    <ImageView
+                        android:layout_width="wrap_content"
+                        android:layout_height="wrap_content"
+                        android:layout_centerHorizontal="true"
+                        android:layout_centerVertical="true"
+                        android:padding="8dp"
+                        android:src="@drawable/main_logo" />
+                </RelativeLayout>
+
                 <LinearLayout
                     android:id="@+id/linearLayout"
                     android:layout_width="match_parent"
                     android:layout_height="wrap_content"
-                    android:layout_alignParentStart="true"
-                    android:layout_alignParentLeft="true"
-                    android:layout_alignParentBottom="true"
-                    android:minHeight="256dp"
+                    android:layout_weight="1"
                     android:orientation="vertical"
                     android:paddingLeft="16dp"
                     android:paddingRight="16dp"
                     android:paddingBottom="10dp">
 
-                    <Space
-                        android:layout_width="match_parent"
-                        android:layout_height="0dp"
-                        android:layout_weight="1" />
-
-                    <TextView
-                        android:layout_width="wrap_content"
-                        android:layout_height="wrap_content"
-                        android:text="@string/welcome_header"
-                        android:textAppearance="@style/TextAppearance.Conversations.Title" />
-
-                    <TextView
-                        android:layout_width="wrap_content"
-                        android:layout_height="wrap_content"
-                        android:layout_marginTop="8dp"
-                        android:text="@string/do_you_have_an_account"
-                        android:textAppearance="@style/TextAppearance.Conversations.Body1" />
-
                     <Button
                         android:id="@+id/register_new_account"
                         style="@style/Widget.Conversations.Button.Borderless"
-                        android:layout_width="wrap_content"
+                        android:textAllCaps="false"
+                        android:textSize="?TextSizeTitle"
+                        android:layout_width="match_parent"
                         android:layout_height="wrap_content"
-                        android:layout_gravity="right"
+                        android:layout_gravity="center"
+                        android:drawableLeft="@drawable/getjid"
                         android:text="@string/create_new_account"
                         android:textColor="?colorAccent" />
 
                     <Button
                         android:id="@+id/use_existing"
                         style="@style/Widget.Conversations.Button.Borderless"
-                        android:layout_width="wrap_content"
+                        android:textAllCaps="false"
+                        android:textSize="?TextSizeTitle"
+                        android:layout_width="match_parent"
                         android:layout_height="wrap_content"
-                        android:layout_gravity="right"
+                        android:layout_gravity="center"
+                        android:drawableLeft="@drawable/havejid"
                         android:text="@string/i_already_have_an_account"
-                        android:textColor="?android:textColorSecondary" />
-                </LinearLayout>
+                        android:textColor="?colorAccent" />
 
-                <RelativeLayout
-                    android:layout_width="match_parent"
-                    android:layout_height="match_parent"
-                    android:layout_above="@+id/linearLayout"
-                    android:layout_alignParentStart="true"
-                    android:layout_alignParentLeft="true">
 
-                    <ImageView
-                        android:layout_width="wrap_content"
+                    <Button
+                        android:id="@+id/use_snikket"
+                        style="@style/Widget.Conversations.Button.Borderless"
+                        android:textAllCaps="false"
+                        android:textSize="?TextSizeTitle"
+                        android:layout_width="match_parent"
                         android:layout_height="wrap_content"
-                        android:layout_centerHorizontal="true"
-                        android:layout_centerVertical="true"
-                        android:padding="8dp"
-                        android:src="@drawable/main_logo" />
-                </RelativeLayout>
-            </RelativeLayout>
+                        android:layout_gravity="center"
+                        android:drawableLeft="@drawable/snikket"
+                        android:text="@string/i_am_snikket_user"
+                        android:textColor="?colorAccent" />
+                </LinearLayout>
+            </LinearLayout>
         </ScrollView>
     </LinearLayout>
-</layout>
+</layout>

src/cheogram/res/values/strings.xml 🔗

@@ -2,9 +2,13 @@
 <resources>
     <string name="pick_a_server">Pick your Jabber service</string>
     <string name="use_conversations.im">Use ChatterboxTown</string>
-    <string name="create_new_account">Create new account</string>
+    <string name="get_jabber_id">Get Jabber ID</string>
+    <string name="create_new_account">I need to sign up for a new Jabber ID</string>
+    <string name="i_already_have_an_account">I already have a Jabber ID</string>
+    <string name="i_am_snikket_user">I am a Snikket user</string>
     <string name="do_you_have_an_account">Do you already have a Jabber ID? This might be the case if you are already using a different Jabber client or have used Cheogram Android, Conversations, or Snikket before. If not you can create a new Jabber ID right now.</string>
     <string name="server_select_text">Jabber is a provider independent instant messaging network, powered by the XMPP protocol. You can use this client with whatever Jabber service you choose.</string>
+    <string name="magic_create_text">You will be able to communicate with users of other providers by giving them your full Jabber ID.</string>
     <string name="magic_create_text_on_x">You have been invited to %1$s. We will guide you through the process of creating an account.\nWhen picking %1$s as a provider you will be able to communicate with users of other providers by giving them your full Jabber ID.</string>
     <string name="magic_create_text_fixed">You have been invited to %1$s. A username has already been picked for you. We will guide you through the process of creating an account.\nYou will be able to communicate with users of other providers by giving them your full Jabber ID.</string>
     <string name="your_server_invitation">Your server invitation</string>

src/main/java/eu/siacs/conversations/ui/EditAccountActivity.java 🔗

@@ -743,6 +743,9 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
         if (mForceRegister != null) {
             this.binding.accountRegisterNew.setVisibility(View.GONE);
         }
+        if (intent.getBooleanExtra("snikket", false)) {
+            this.binding.accountJidLayout.setHint("Snikket Address");
+        }
     }
 
     private void displayVerificationWarningDialog(final XmppUri xmppUri) {