Skip to content

Commit

Permalink
adapt to new "instant onboarding" UX workflow (#3015)
Browse files Browse the repository at this point in the history
* rework onboarding

* implement default registration in InstantOnboardingActivity

* dismiss signInDialog after button is selected

* add footer options, implement "explore other options" button

* properly handly permissions results

* implement "scan QR" button

* fix linter warnings

* remove from observers in onDestroy()

* handle DCACCOUNT and DCLOGIN in InstantOnboardingActivity instead of WelcomeActivity

* fix identation in setProviderFromQr()

* rename DEF_CHATMAIL_HOST to DEFAULT_CHATMAIL_HOST

* Update src/org/thoughtcrime/securesms/InstantOnboardingActivity.java

Co-authored-by: bjoern <r10s@b44t.com>

* Update res/layout/instant_onboarding_activity.xml

Co-authored-by: bjoern <r10s@b44t.com>

* Update res/layout/instant_onboarding_activity.xml

Co-authored-by: bjoern <r10s@b44t.com>

* Update res/layout/instant_onboarding_activity.xml

Co-authored-by: bjoern <r10s@b44t.com>

---------

Co-authored-by: bjoern <r10s@b44t.com>
  • Loading branch information
adbenitez and r10s authored May 6, 2024
1 parent 8d7e5e7 commit 81b7df0
Show file tree
Hide file tree
Showing 11 changed files with 686 additions and 137 deletions.
39 changes: 22 additions & 17 deletions AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -227,23 +227,7 @@
<activity android:name=".WelcomeActivity"
android:launchMode="singleTask"
android:theme="@style/TextSecure.LightNoActionBar"
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.BROWSABLE"/>
<!-- Android's scheme matcher is case-sensitive, so include most likely variations -->
<data android:scheme="DCACCOUNT"
tools:ignore="AppLinkUrlError" />
<data android:scheme="dcaccount"
tools:ignore="AppLinkUrlError" />
<data android:scheme="DCLOGIN"
tools:ignore="AppLinkUrlError" />
<data android:scheme="dclogin"
tools:ignore="AppLinkUrlError" />
</intent-filter>
</activity>
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize"/>

<activity android:name=".RegistrationActivity"
android:launchMode="singleTask"
Expand Down Expand Up @@ -309,6 +293,27 @@

<activity android:name="com.soundcloud.android.crop.CropImageActivity" />

<activity android:name=".InstantOnboardingActivity"
android:theme="@style/TextSecure.LightTheme"
android:windowSoftInputMode="stateHidden|adjustResize"
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.BROWSABLE"/>
<!-- Android's scheme matcher is case-sensitive, so include most likely variations -->
<data android:scheme="DCACCOUNT"
tools:ignore="AppLinkUrlError" />
<data android:scheme="dcaccount"
tools:ignore="AppLinkUrlError" />
<data android:scheme="DCLOGIN"
tools:ignore="AppLinkUrlError" />
<data android:scheme="dclogin"
tools:ignore="AppLinkUrlError" />
</intent-filter>
</activity>

<activity android:name=".CreateProfileActivity"
android:theme="@style/TextSecure.LightTheme"
android:windowSoftInputMode="stateHidden|adjustResize"
Expand Down
Binary file modified res/drawable/intro1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
126 changes: 126 additions & 0 deletions res/layout/instant_onboarding_activity.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">

<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="20dp"
android:orientation="vertical">

<LinearLayout android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:orientation="horizontal">

<ImageView android:id="@+id/avatar"
android:layout_width="64dp"
android:layout_height="64dp"
android:contentDescription="@string/pref_profile_photo"
android:transitionName="avatar"/>

<com.google.android.material.textfield.TextInputLayout
android:id="@+id/name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp">

<org.thoughtcrime.securesms.components.emoji.EmojiEditText
android:id="@+id/name_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/pref_your_name"
android:inputType="textCapWords" />
</com.google.android.material.textfield.TextInputLayout>

</LinearLayout>

<TextView
android:id="@+id/information_label"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:layout_marginTop="16dp"
android:gravity="start"
android:text="@string/set_name_and_avatar_explain"
android:textColor="@color/gray50" />

<TextView
android:id="@+id/privacy_policy_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="start"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:layout_marginTop="16dp"
android:text="@string/instant_onboarding_agree_default"
android:textColor="@color/delta_accent"
android:textSize="16sp"/>

<Button
style="@style/ButtonPrimary"
android:id="@+id/signup_button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:layout_marginTop="20dp"
android:layout_marginBottom="16dp"
android:text="@string/instant_onboarding_create"/>

<androidx.legacy.widget.Space
android:layout_weight="2"
android:layout_width="match_parent"
android:layout_height="0dp"/>

<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">

<TextView
android:id="@+id/other_options_button"
android:layout_width="0dp"
android:layout_height="wrap_content"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toStartOf="@+id/separator"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
android:gravity="start"
android:padding="16dp"
android:text="@string/instant_onboarding_show_more_instances"
android:textColor="@color/gray50"/>

<androidx.legacy.widget.Space
android:id="@+id/separator"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintStart_toEndOf="@+id/other_options_button"
app:layout_constraintEnd_toStartOf="@+id/scan_qr_button"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
android:paddingLeft="16dp"
android:paddingRight="16dp" />

<TextView
android:id="@+id/scan_qr_button"
android:layout_width="0dp"
android:layout_height="wrap_content"
app:layout_constraintStart_toEndOf="@+id/separator"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
android:gravity="end"
android:padding="16dp"
android:text="@string/qrscan_title"
android:textColor="@color/gray50"/>
</androidx.constraintlayout.widget.ConstraintLayout>

</LinearLayout>

</FrameLayout>
49 changes: 49 additions & 0 deletions res/layout/login_options_view.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<?xml version="1.0" encoding="utf-8"?>
<ScrollView
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">

<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="16dp"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:layout_marginTop="16dp"
android:gravity="center_horizontal">

<Button
style="@style/ButtonSecondary"
android:id="@+id/add_as_second_device_button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="24dp"
android:paddingRight="24dp"
android:layout_marginBottom="16dp"
android:text="@string/multidevice_receiver_title"/>

<Button
style="@style/ButtonSecondary"
android:id="@+id/backup_button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="24dp"
android:paddingRight="24dp"
android:layout_marginBottom="16dp"
android:text="@string/import_backup_title"/>

<Button
style="@style/ButtonSecondary"
android:id="@+id/login_button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="24dp"
android:paddingRight="24dp"
android:text="@string/manual_account_setup_option"/>

</LinearLayout>

</ScrollView>
28 changes: 5 additions & 23 deletions res/layout/welcome_activity.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
android:id="@+id/welcome_icon"
android:layout_width="wrap_content"
android:layout_height="100dp"
android:layout_weight="14"
android:layout_weight="10"
android:gravity="bottom"
android:src="@drawable/intro1"
android:paddingLeft="32dp"
Expand All @@ -43,32 +43,24 @@

<Button
style="@style/ButtonPrimary"
android:id="@+id/login_button"
android:id="@+id/signup_button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="24dp"
android:paddingRight="24dp"
android:layout_marginBottom="16dp"
android:text="@string/login_header"/>
android:text="@string/onboarding_create_instant_account"/>

<Button
style="@style/ButtonSecondary"
android:id="@+id/add_as_second_device_button"
android:id="@+id/signin_button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="24dp"
android:paddingRight="24dp"
android:layout_marginBottom="16dp"
android:text="@string/multidevice_receiver_title"/>
android:text="@string/onboarding_alternative_logins"/>

<Button
style="@style/ButtonSecondary"
android:id="@+id/scan_qr_button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="24dp"
android:paddingRight="24dp"
android:text="@string/scan_invitation_code"/>

</LinearLayout>

Expand All @@ -77,15 +69,5 @@
android:layout_width="match_parent"
android:layout_height="0dp"/>

<TextView
android:id="@+id/backup_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="22dp"
android:gravity="center"
android:text="@string/import_backup_title"
android:textColor="?attr/secondary_button_fg"
android:textSize="15sp"/>

</LinearLayout>

Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ private void refresh() {
DcHelper.getNotificationCenter(this).removeAllNotifiations(accountId);
}
if (accountId != dcContext.getAccountId()) {
AccountManager.getInstance().switchAccountAndStartActivity(this, accountId, null);
AccountManager.getInstance().switchAccountAndStartActivity(this, accountId);
}

refreshAvatar();
Expand Down
Loading

0 comments on commit 81b7df0

Please sign in to comment.