Commit a296c1ac authored by Thomas Markiewicz's avatar Thomas Markiewicz
Browse files

Added onboarding screen

parent f4d4f057
Pipeline #50468 passed with stages
in 14 minutes and 31 seconds
......@@ -20,6 +20,12 @@
android:supportsRtl="true"
android:theme="@style/TuskyTheme"
android:usesCleartextTraffic="false">
<activity android:name=".OnboardingActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
</intent-filter>
</activity>
<activity
android:name=".SplashActivity"
android:theme="@style/SplashTheme">
......@@ -35,7 +41,7 @@
</activity>
<activity
android:name=".SavedTootActivity"
android:configChanges="orientation|screenSize|keyboardHidden"/>
android:configChanges="orientation|screenSize|keyboardHidden" />
<activity
android:name=".LoginActivity"
android:windowSoftInputMode="adjustResize">
......@@ -96,7 +102,7 @@
<activity
android:name=".ComposeActivity"
android:theme="@style/TuskyDialogActivityTheme"
android:windowSoftInputMode="stateVisible|adjustResize"/>
android:windowSoftInputMode="stateVisible|adjustResize" />
<activity
android:name=".ViewThreadActivity"
android:configChanges="orientation|screenSize" />
......
......@@ -140,7 +140,7 @@ public abstract class BaseActivity extends AppCompatActivity implements Injectab
protected void redirectIfNotLoggedIn() {
AccountEntity account = accountManager.getActiveAccount();
if (account == null) {
Intent intent = new Intent(this, LoginActivity.class);
Intent intent = new Intent(this, OnboardingActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);
startActivityWithSlideInAnimation(intent);
finish();
......
......@@ -405,7 +405,6 @@ class LoginActivity : BaseActivity(), Injectable {
private const val DOMAIN = "domain"
private const val CLIENT_ID = "clientId"
private const val CLIENT_SECRET = "clientSecret"
private var _isFirstTime = true;
@JvmStatic
fun getIntent(context: Context, mode: Boolean): Intent {
......
......@@ -406,9 +406,9 @@ public final class MainActivity extends BottomSheetActivity implements ActionBut
listItems.add(new DividerDrawerItem());
listItems.add(new SecondaryDrawerItem().withIdentifier(DRAWER_ITEM_ACCOUNT_SETTINGS).withName(R.string.action_view_account_preferences).withSelectable(false).withIcon(R.drawable.ic_account_settings).withIconTintingEnabled(true));
listItems.add(new SecondaryDrawerItem().withIdentifier(DRAWER_ITEM_SETTINGS).withName(R.string.action_view_preferences).withSelectable(false).withIcon(GoogleMaterial.Icon.gmd_settings));
listItems.add(new SecondaryDrawerItem().withIdentifier(DRAWER_ITEM_SUPPORT).withName(R.string.support_title_activity).withSelectable(false).withIcon(GoogleMaterial.Icon.gmd_help));
listItems.add(new SecondaryDrawerItem().withIdentifier(DRAWER_ITEM_POLICY).withName(R.string.policy_title_activity).withSelectable(false).withIcon(GoogleMaterial.Icon.gmd_assignment));
listItems.add(new SecondaryDrawerItem().withIdentifier(DRAWER_ITEM_STAY_SAFE).withName(R.string.stay_safe_title_activity).withSelectable(false).withIcon(GoogleMaterial.Icon.gmd_do_not_disturb_on));
listItems.add(new SecondaryDrawerItem().withIdentifier(DRAWER_ITEM_SUPPORT).withName(R.string.support).withSelectable(false).withIcon(GoogleMaterial.Icon.gmd_help));
listItems.add(new SecondaryDrawerItem().withIdentifier(DRAWER_ITEM_POLICY).withName(R.string.policy).withSelectable(false).withIcon(GoogleMaterial.Icon.gmd_assignment));
listItems.add(new SecondaryDrawerItem().withIdentifier(DRAWER_ITEM_STAY_SAFE).withName(R.string.stay_safe).withSelectable(false).withIcon(GoogleMaterial.Icon.gmd_do_not_disturb_on));
listItems.add(new SecondaryDrawerItem().withIdentifier(DRAWER_ITEM_ABOUT).withName(R.string.about_title_activity).withSelectable(false).withIcon(GoogleMaterial.Icon.gmd_info));
// tom: add links here
listItems.add(new SecondaryDrawerItem().withIdentifier(DRAWER_ITEM_LOG_OUT).withName(R.string.action_logout).withSelectable(false).withIcon(R.drawable.ic_logout).withIconTintingEnabled(true));
......
package com.keylesspalace.tusky
import android.content.Context
import android.content.Intent
import android.os.Bundle
import android.webkit.WebView
import android.widget.Button
import androidx.appcompat.app.AlertDialog
import androidx.appcompat.app.AppCompatActivity
class OnboardingActivity : AppCompatActivity() {
companion object {
@JvmStatic
fun getIntent(context: Context): Intent {
val intent = Intent(context, OnboardingActivity::class.java)
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP or Intent.FLAG_ACTIVITY_NEW_TASK)
return intent
}
}
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_onboarding)
findViewById<Button>(R.id.buttonRegister).setOnClickListener {
displayInWebView(R.string.register_url)
}
findViewById<Button>(R.id.buttonSupport).setOnClickListener {
displayInWebView(R.string.support_url)
}
findViewById<Button>(R.id.buttonPolicy).setOnClickListener {
displayInWebView(R.string.policy_url)
}
findViewById<Button>(R.id.buttonPolicy).setOnClickListener {
displayInWebView(R.string.policy_url)
}
findViewById<Button>(R.id.buttonStaySafe).setOnClickListener {
displayInWebView(R.string.stay_safe_url)
}
findViewById<Button>(R.id.buttonLogin).setOnClickListener {
val intent = Intent(this, LoginActivity::class.java)
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP or Intent.FLAG_ACTIVITY_NEW_TASK)
startActivity(intent)
finish()
}
}
private fun displayInWebView(id: Int) {
val url = this.getString(id)
val wv = WebView(this)
wv.loadUrl(url)
AlertDialog.Builder(this)
.setView(wv)
.setPositiveButton(android.R.string.ok, null)
.show()
}
}
......@@ -36,13 +36,14 @@ class SplashActivity : AppCompatActivity(), Injectable {
NotificationHelper.deleteLegacyNotificationChannels(this, accountManager)
/** Determine whether the user is currently logged in, and if so go ahead and load the
* timeline. Otherwise, start the activity_login screen. */
* timeline. Otherwise, start the activity_onboarding screen. */
val intent = if (accountManager.activeAccount != null) {
Intent(this, MainActivity::class.java)
} else {
LoginActivity.getIntent(this, false)
OnboardingActivity.getIntent(this)
}
startActivity(intent)
finish()
}
......
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout 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"
tools:context="com.keylesspalace.tusky.OnboardingActivity">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toTopOf="parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="vertical"
android:padding="16dp">
<ImageView
android:layout_width="192dp"
android:layout_height="192dp"
android:layout_marginBottom="16dp"
android:contentDescription="@null"
app:srcCompat="@drawable/splash_with_name" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginStart="16dp"
android:layout_marginRight="16dp"
android:layout_marginEnd="16dp"
android:text="@string/onboarding_message" />
<Button
android:id="@+id/buttonRegister"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:layout_marginTop="16dp"
android:layout_marginLeft="16dp"
android:layout_marginStart="16dp"
android:layout_marginRight="16dp"
android:layout_marginEnd="16dp"
style="@style/Widget.MaterialComponents.Button.TextButton"
android:text="@string/register" />
<Button
android:id="@+id/buttonSupport"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:layout_marginLeft="16dp"
android:layout_marginStart="16dp"
android:layout_marginRight="16dp"
android:layout_marginEnd="16dp"
style="@style/Widget.MaterialComponents.Button.TextButton"
android:text="@string/support" />
<Button
android:id="@+id/buttonPolicy"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:layout_marginLeft="16dp"
android:layout_marginStart="16dp"
android:layout_marginRight="16dp"
android:layout_marginEnd="16dp"
style="@style/Widget.MaterialComponents.Button.TextButton"
android:text="@string/policy" />
<Button
android:id="@+id/buttonStaySafe"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginStart="16dp"
android:layout_marginRight="16dp"
android:layout_marginEnd="16dp"
android:layout_width="match_parent"
style="@style/Widget.MaterialComponents.Button.TextButton"
android:text="@string/stay_safe" />
<Button
android:id="@+id/buttonLogin"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginStart="16dp"
android:layout_marginRight="16dp"
android:layout_marginEnd="16dp"
android:layout_width="match_parent"
android:text="@string/action_login" />
</LinearLayout>
</ScrollView>
</androidx.constraintlayout.widget.ConstraintLayout>
......@@ -237,9 +237,9 @@
<string name="notification_summary_small">%1$s ja %2$s</string>
<string name="notification_title_summary">%d uutta kanssakäymistä</string>
<string name="description_account_locked">Lukittu tili</string>
<string name="support_title_activity">Tuki</string>
<string name="policy_title_activity">Toimintaperiaatteet</string>
<string name="stay_safe_title_activity">Pysy turvassa</string>
<string name="support">Tuki</string>
<string name="policy">Toimintaperiaatteet</string>
<string name="stay_safe">Pysy turvassa</string>
<string name="about_title_activity">Meistä</string>
<string name="about_tusky_version">Librem Social %s</string>
<string name="about_tusky_license">Librem Social is vapaa ja avoimen lähdekoodin sovellus.
......
......@@ -280,9 +280,10 @@
<string name="description_account_locked">Locked Account</string>
<string name="support_title_activity">Support</string>
<string name="policy_title_activity">Policy</string>
<string name="stay_safe_title_activity">Stay safe</string>
<string name="register">Register</string>
<string name="support">Support</string>
<string name="policy">Policy</string>
<string name="stay_safe">Stay safe</string>
<string name="about_title_activity">About</string>
<string name="about_tusky_version">Librem Social %s</string>
<string name="about_tusky_license">
......@@ -548,4 +549,8 @@
<string name="poll_new_choice_hint">Choice %d</string>
<string name="edit_poll">Edit</string>
<string name="onboarding_message">
"Librem Social is a public social media that respects your digital rights and protects your online safety.\n\nIt has millions of active users across hundreds of servers distributed across the world.\n\nPlease note that you are not reachable on Librem Social until you login at least once, even if you have already registered for the Libem One services."
</string>
</resources>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment