Implement rough onboarding redesign

This commit is contained in:
Niels Andriesse 2019-12-16 11:43:08 +01:00
parent 8569183ed8
commit e46e1b2dd9
22 changed files with 484 additions and 4 deletions

View File

@ -124,6 +124,20 @@
android:name="firebase_messaging_auto_init_enabled" android:name="firebase_messaging_auto_init_enabled"
android:value="false" /> android:value="false" />
<activity
android:name="org.thoughtcrime.securesms.loki.redesign.LandingActivity"
android:launchMode="singleTask" />
<activity
android:name="org.thoughtcrime.securesms.loki.redesign.RegisterActivity"
android:launchMode="singleTask" />
<activity
android:name="org.thoughtcrime.securesms.loki.redesign.DisplayNameActivity"
android:launchMode="singleTask"
android:windowSoftInputMode="adjustResize" />
<activity
android:name="org.thoughtcrime.securesms.loki.redesign.RestoreActivity"
android:launchMode="singleTask"
android:windowSoftInputMode="adjustResize" />
<activity android:name="org.thoughtcrime.securesms.loki.LinkedDevicesActivity" /> <activity android:name="org.thoughtcrime.securesms.loki.LinkedDevicesActivity" />
<activity <activity
android:name="org.thoughtcrime.securesms.WebRtcCallActivity" android:name="org.thoughtcrime.securesms.WebRtcCallActivity"

View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle" >
<gradient
android:angle="90"
android:startColor="#121212"
android:endColor="#171717"
android:type="linear" />
</shape>

View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@color/accent" />
<corners android:radius="24dp" />
<stroke android:width="@dimen/border_thickness" android:color="@color/accent" />
</shape>

View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@color/transparent" />
<corners android:radius="24dp" />
<stroke android:width="@dimen/border_thickness" android:color="@color/accent" />
</shape>

View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle" >
<stroke
android:color="@color/text"
android:width="@dimen/border_thickness" />
<corners android:radius="@dimen/text_view_corner_radius" />
</shape>

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android="http://schemas.android.com/apk/res/android" >
<size android:width="2dp" />
<solid android:color="@color/accent" />
</shape>

View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle" >
<stroke
android:color="@color/text"
android:width="@dimen/border_thickness" />
<corners android:radius="@dimen/text_view_corner_radius" />
</shape>

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,58 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/default_session_background"
android:orientation="vertical">
<View
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/very_large_spacing"
android:layout_marginRight="@dimen/very_large_spacing"
android:textSize="@dimen/very_large_font_size"
android:textStyle="bold"
android:textColor="@color/text"
android:text="Pick your display name" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/very_large_spacing"
android:layout_marginTop="@dimen/large_spacing"
android:layout_marginRight="@dimen/very_large_spacing"
android:textSize="@dimen/medium_font_size"
android:textColor="@color/text"
android:text="This is how others will be able to recognize you." />
<EditText
style="@style/SessionEditText"
android:id="@+id/displayNameEditText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/very_large_spacing"
android:layout_marginTop="@dimen/large_spacing"
android:layout_marginRight="@dimen/very_large_spacing"
android:hint="Enter a display name" />
<View
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"/>
<Button
style="@style/MediumProminentFilledButton"
android:layout_width="match_parent"
android:layout_height="@dimen/medium_button_height"
android:layout_marginLeft="@dimen/massive_spacing"
android:layout_marginRight="@dimen/massive_spacing"
android:layout_marginBottom="@dimen/medium_spacing"
android:text="Continue" />
</LinearLayout>

View File

@ -0,0 +1,55 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/default_session_background"
android:orientation="vertical">
<View
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/very_large_spacing"
android:layout_marginRight="@dimen/very_large_spacing"
android:textSize="@dimen/very_large_font_size"
android:textStyle="bold"
android:textColor="@color/text"
android:text="Your Session begins here..." />
<View
android:layout_width="match_parent"
android:layout_height="234dp"
android:layout_marginTop="@dimen/medium_spacing"
android:background="@color/red" />
<View
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"/>
<Button
style="@style/MediumProminentFilledButton"
android:id="@+id/registerButton"
android:layout_width="match_parent"
android:layout_height="@dimen/medium_button_height"
android:layout_marginLeft="@dimen/massive_spacing"
android:layout_marginRight="@dimen/massive_spacing"
android:text="Create Account" />
<Button
style="@style/MediumProminentOutlineButton"
android:id="@+id/restoreButton"
android:layout_width="match_parent"
android:layout_height="@dimen/medium_button_height"
android:layout_marginLeft="@dimen/massive_spacing"
android:layout_marginTop="@dimen/medium_spacing"
android:layout_marginRight="@dimen/massive_spacing"
android:layout_marginBottom="@dimen/onboarding_button_bottom_offset"
android:text="Continue Your Session" />
</LinearLayout>

View File

@ -0,0 +1,67 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/default_session_background"
android:orientation="vertical">
<View
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/very_large_spacing"
android:layout_marginRight="@dimen/very_large_spacing"
android:textSize="@dimen/very_large_font_size"
android:textStyle="bold"
android:textColor="@color/text"
android:text="Say hello to your Session ID" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/very_large_spacing"
android:layout_marginTop="@dimen/large_spacing"
android:layout_marginRight="@dimen/very_large_spacing"
android:textSize="@dimen/medium_font_size"
android:textColor="@color/text"
android:text="Your Session ID is the unique address that people can use to contact you on Session. With no connection to your real identity, your Session ID is totally anonymous and private by design." />
<TextView
style="@style/SessionIDTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/very_large_spacing"
android:layout_marginTop="@dimen/large_spacing"
android:layout_marginRight="@dimen/very_large_spacing"
android:text="05987d601943c267879be41830888066c6a024cbdc9a548d06813924bf3372ea78" />
<View
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"/>
<Button
android:id="@+id/registerButton"
style="@style/MediumProminentFilledButton"
android:layout_width="match_parent"
android:layout_height="@dimen/medium_button_height"
android:layout_marginLeft="@dimen/massive_spacing"
android:layout_marginRight="@dimen/massive_spacing"
android:text="Continue" />
<Button
style="@style/MediumProminentOutlineButton"
android:layout_width="match_parent"
android:layout_height="@dimen/medium_button_height"
android:layout_marginLeft="@dimen/massive_spacing"
android:layout_marginTop="@dimen/medium_spacing"
android:layout_marginRight="@dimen/massive_spacing"
android:layout_marginBottom="@dimen/onboarding_button_bottom_offset"
android:text="Copy" />
</LinearLayout>

View File

@ -0,0 +1,60 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/default_session_background"
android:orientation="vertical">
<View
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/very_large_spacing"
android:layout_marginTop="@dimen/medium_spacing"
android:layout_marginRight="@dimen/very_large_spacing"
android:textSize="@dimen/very_large_font_size"
android:textStyle="bold"
android:textColor="@color/text"
android:text="Restore your account using your seed" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/very_large_spacing"
android:layout_marginTop="@dimen/medium_spacing"
android:layout_marginRight="@dimen/very_large_spacing"
android:textSize="@dimen/medium_font_size"
android:textColor="@color/text"
android:text="Enter the seed that was given to you when you signed up to restore your account." />
<EditText
style="@style/SessionEditText"
android:id="@+id/mnemonicEditText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/very_large_spacing"
android:layout_marginTop="@dimen/medium_spacing"
android:layout_marginRight="@dimen/very_large_spacing"
android:hint="Enter your seed" />
<View
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"/>
<Button
style="@style/MediumProminentFilledButton"
android:layout_width="match_parent"
android:layout_height="@dimen/medium_button_height"
android:layout_marginLeft="@dimen/massive_spacing"
android:layout_marginTop="@dimen/medium_spacing"
android:layout_marginRight="@dimen/massive_spacing"
android:layout_marginBottom="@dimen/medium_spacing"
android:text="Continue" />
</LinearLayout>

View File

@ -1,5 +1,11 @@
<?xml version='1.0' encoding='UTF-8'?> <?xml version='1.0' encoding='UTF-8'?>
<resources> <resources>
<!-- Session -->
<color name="accent">#00F782</color>
<color name="text">#FFFFFF</color>
<!-- Session -->
<!-- Loki --> <!-- Loki -->
<color name="loki_green">#78be20</color> <color name="loki_green">#78be20</color>
<color name="loki_dark_green">#419B41</color> <color name="loki_dark_green">#419B41</color>

View File

@ -1,5 +1,30 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources> <resources>
<!-- Session -->
<!-- Font Sizes -->
<dimen name="very_small_font_size">10sp</dimen>
<dimen name="small_font_size">13sp</dimen>
<dimen name="medium_font_size">15sp</dimen>
<dimen name="large_font_size">20sp</dimen>
<dimen name="very_large_font_size">25sp</dimen>
<dimen name="massive_font_size">50sp</dimen>
<!-- Element Sizes -->
<dimen name="medium_button_height">48dp</dimen>
<dimen name="border_thickness">2dp</dimen>
<dimen name="text_view_corner_radius">8dp</dimen>
<!-- Distances -->
<dimen name="medium_spacing">16dp</dimen>
<dimen name="large_spacing">24dp</dimen>
<dimen name="very_large_spacing">35dp</dimen>
<dimen name="massive_spacing">64dp</dimen>
<dimen name="onboarding_button_bottom_offset">48dp</dimen>
<!-- Session -->
<dimen name="emoji_drawer_size">32sp</dimen> <dimen name="emoji_drawer_size">32sp</dimen>
<dimen name="min_keyboard_size">50dp</dimen> <dimen name="min_keyboard_size">50dp</dimen>
<dimen name="default_custom_keyboard_size">220dp</dimen> <dimen name="default_custom_keyboard_size">220dp</dimen>

View File

@ -1,5 +1,43 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources xmlns:tools="http://schemas.android.com/tools"> <resources xmlns:tools="http://schemas.android.com/tools">
<!-- Session -->
<style name="MediumProminentFilledButton">
<item name="android:background">@drawable/prominent_filled_button_medium_background</item>
<item name="android:textAllCaps">false</item>
<item name="android:textSize">@dimen/medium_font_size</item>
<item name="android:textStyle">bold</item>
</style>
<style name="MediumProminentOutlineButton">
<item name="android:background">@drawable/prominent_outline_button_medium_background</item>
<item name="android:textAllCaps">false</item>
<item name="android:textSize">@dimen/medium_font_size</item>
<item name="android:textStyle">bold</item>
<item name="android:textColor">@color/accent</item>
</style>
<style name="SessionIDTextView">
<item name="android:background">@drawable/session_id_text_view_background</item>
<item name="android:padding">@dimen/medium_spacing</item>
<item name="android:textSize">@dimen/large_font_size</item>
<item name="android:textColor">@color/text</item>
<item name="android:fontFamily">@font/space_mono_regular</item>
</style>
<style name="SessionEditText">
<item name="android:background">@drawable/session_id_text_view_background</item>
<item name="android:paddingLeft">@dimen/medium_spacing</item>
<item name="android:paddingTop">@dimen/very_large_spacing</item>
<item name="android:paddingRight">@dimen/medium_spacing</item>
<item name="android:paddingBottom">@dimen/very_large_spacing</item>
<item name="android:textSize">@dimen/small_font_size</item>
<item name="android:textColor">@color/text</item>
<item name="android:textCursorDrawable">@drawable/session_edit_text_cursor</item>
<item name="android:maxLines">1</item>
</style>
<!-- Session -->
<style name="NoAnimation.Theme.BlackScreen" parent="Theme.AppCompat.NoActionBar"> <style name="NoAnimation.Theme.BlackScreen" parent="Theme.AppCompat.NoActionBar">
<item name="android:windowAnimationStyle">@null</item> <item name="android:windowAnimationStyle">@null</item>
<item name="android:windowBackground">@android:color/black</item> <item name="android:windowBackground">@android:color/black</item>

View File

@ -603,7 +603,12 @@ public class ApplicationContext extends MultiDexApplication implements Dependenc
public void updatePublicChatProfileAvatarIfNeeded() { public void updatePublicChatProfileAvatarIfNeeded() {
AsyncTask.execute(() -> { AsyncTask.execute(() -> {
LokiPublicChatAPI publicChatAPI = getLokiPublicChatAPI(); LokiPublicChatAPI publicChatAPI = null;
try {
publicChatAPI = getLokiPublicChatAPI();
} catch (Exception e) {
// Do nothing
}
if (publicChatAPI != null) { if (publicChatAPI != null) {
byte[] profileKey = ProfileKeyUtil.getProfileKey(this); byte[] profileKey = ProfileKeyUtil.getProfileKey(this);
String url = TextSecurePreferences.getProfileAvatarUrl(this); String url = TextSecurePreferences.getProfileAvatarUrl(this);

View File

@ -5,7 +5,6 @@ import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.IntentFilter; import android.content.IntentFilter;
import android.os.Bundle; import android.os.Bundle;
import android.preference.PreferenceManager;
import android.support.annotation.IdRes; import android.support.annotation.IdRes;
import android.support.annotation.NonNull; import android.support.annotation.NonNull;
import android.support.annotation.Nullable; import android.support.annotation.Nullable;
@ -14,9 +13,9 @@ import android.support.v4.app.Fragment;
import org.thoughtcrime.securesms.crypto.MasterSecretUtil; import org.thoughtcrime.securesms.crypto.MasterSecretUtil;
import org.thoughtcrime.securesms.jobs.PushNotificationReceiveJob; import org.thoughtcrime.securesms.jobs.PushNotificationReceiveJob;
import org.thoughtcrime.securesms.logging.Log; import org.thoughtcrime.securesms.logging.Log;
import org.thoughtcrime.securesms.loki.redesign.LandingActivity;
import org.thoughtcrime.securesms.loki.SeedActivity; import org.thoughtcrime.securesms.loki.SeedActivity;
import org.thoughtcrime.securesms.push.SignalServiceNetworkAccess; import org.thoughtcrime.securesms.push.SignalServiceNetworkAccess;
import org.thoughtcrime.securesms.registration.WelcomeActivity;
import org.thoughtcrime.securesms.service.KeyCachingService; import org.thoughtcrime.securesms.service.KeyCachingService;
import org.thoughtcrime.securesms.util.TextSecurePreferences; import org.thoughtcrime.securesms.util.TextSecurePreferences;
@ -182,7 +181,7 @@ public abstract class PassphraseRequiredActionBarActivity extends BaseActionBarA
} }
private Intent getWelcomeIntent() { private Intent getWelcomeIntent() {
return getRoutedIntent(WelcomeActivity.class, getPushRegistrationIntent()); return getRoutedIntent(LandingActivity.class, getPushRegistrationIntent());
} }
private Intent getPushRegistrationIntent() { private Intent getPushRegistrationIntent() {

View File

@ -0,0 +1,19 @@
package org.thoughtcrime.securesms.loki.redesign
import android.os.Bundle
import kotlinx.android.synthetic.main.activity_display_name_v2.*
import network.loki.messenger.R
import org.thoughtcrime.securesms.BaseActionBarActivity
class DisplayNameActivity : BaseActionBarActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_display_name_v2)
}
override fun onResume() {
super.onResume()
displayNameEditText.requestFocus()
}
}

View File

@ -0,0 +1,27 @@
package org.thoughtcrime.securesms.loki.redesign
import android.content.Intent
import android.os.Bundle
import kotlinx.android.synthetic.main.activity_landing.*
import network.loki.messenger.R
import org.thoughtcrime.securesms.BaseActionBarActivity
class LandingActivity : BaseActionBarActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_landing)
registerButton.setOnClickListener { register() }
restoreButton.setOnClickListener { restore() }
}
private fun register() {
val intent = Intent(this, RegisterActivity::class.java)
startActivity(intent)
}
private fun restore() {
val intent = Intent(this, RestoreActivity::class.java)
startActivity(intent)
}
}

View File

@ -0,0 +1,21 @@
package org.thoughtcrime.securesms.loki.redesign
import android.content.Intent
import android.os.Bundle
import kotlinx.android.synthetic.main.activity_register.*
import network.loki.messenger.R
import org.thoughtcrime.securesms.BaseActionBarActivity
class RegisterActivity : BaseActionBarActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_register)
registerButton.setOnClickListener { register() }
}
private fun register() {
val intent = Intent(this, DisplayNameActivity::class.java)
startActivity(intent)
}
}

View File

@ -0,0 +1,19 @@
package org.thoughtcrime.securesms.loki.redesign
import android.os.Bundle
import kotlinx.android.synthetic.main.activity_restore.*
import network.loki.messenger.R
import org.thoughtcrime.securesms.BaseActionBarActivity
class RestoreActivity : BaseActionBarActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_restore)
}
override fun onResume() {
super.onResume()
mnemonicEditText.requestFocus()
}
}