Disclaimer dialog is updated.

This commit is contained in:
Onuray Sahin 2020-07-09 15:17:17 +03:00
parent f5284e8447
commit c1f1620624
4 changed files with 83 additions and 49 deletions

View File

@ -17,6 +17,7 @@
package im.vector.riotx.features.disclaimer package im.vector.riotx.features.disclaimer
import android.app.Activity import android.app.Activity
import android.content.DialogInterface
import androidx.preference.PreferenceManager import androidx.preference.PreferenceManager
import android.view.ViewGroup import android.view.ViewGroup
import android.widget.TextView import android.widget.TextView
@ -24,11 +25,15 @@ import androidx.appcompat.app.AlertDialog
import androidx.core.content.edit import androidx.core.content.edit
import im.vector.riotx.BuildConfig import im.vector.riotx.BuildConfig
import im.vector.riotx.R import im.vector.riotx.R
import im.vector.riotx.core.dialogs.withColoredButton
import im.vector.riotx.core.extensions.setTextWithColoredPart import im.vector.riotx.core.extensions.setTextWithColoredPart
import im.vector.riotx.core.utils.displayInWebView
import im.vector.riotx.core.utils.openPlayStore import im.vector.riotx.core.utils.openPlayStore
import im.vector.riotx.features.settings.VectorSettingsUrls
import im.vector.riotx.features.themes.ThemeUtils
// Increase this value to show again the disclaimer dialog after an upgrade of the application // Increase this value to show again the disclaimer dialog after an upgrade of the application
private const val CURRENT_DISCLAIMER_VALUE = 1 private const val CURRENT_DISCLAIMER_VALUE = 2
private const val SHARED_PREF_KEY = "LAST_DISCLAIMER_VERSION_VALUE" private const val SHARED_PREF_KEY = "LAST_DISCLAIMER_VERSION_VALUE"
@ -42,22 +47,13 @@ fun showDisclaimerDialog(activity: Activity) {
val dialogLayout = activity.layoutInflater.inflate(R.layout.dialog_disclaimer_content, null) val dialogLayout = activity.layoutInflater.inflate(R.layout.dialog_disclaimer_content, null)
val textView = (dialogLayout as ViewGroup).findViewById<TextView>(R.id.dialogDisclaimerContentLine2)
@Suppress("ConstantConditionIf")
if (BuildConfig.FLAVOR == "gplay") {
textView.setTextWithColoredPart(R.string.alpha_disclaimer_content_line_2_gplay, R.string.alpha_disclaimer_content_line_2_gplay_colored_part)
textView.setOnClickListener {
openPlayStore(activity)
}
} else {
textView.setText(R.string.alpha_disclaimer_content_line_2_fdroid)
}
AlertDialog.Builder(activity) AlertDialog.Builder(activity)
.setView(dialogLayout) .setView(dialogLayout)
.setCancelable(false) .setCancelable(false)
.setPositiveButton(R.string._continue, null) .setNegativeButton(R.string.element_disclaimer_negative_button, null)
.setPositiveButton(R.string.element_disclaimer_positive_button) { _, _ ->
activity.displayInWebView(VectorSettingsUrls.DISCLAIMER_URL)
}
.show() .show()
} }
} }

View File

@ -0,0 +1,26 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="50dp"
android:height="61dp"
android:viewportWidth="50"
android:viewportHeight="61">
<path
android:pathData="M18.3955,17.8083V26.3699L27.1656,26.3609C27.277,26.3609 27.3786,26.3579 27.4797,26.3515C29.7857,26.2008 31.5882,24.3266 31.5882,22.0849C31.5882,19.7263 29.6086,17.8083 27.1744,17.8083H18.3955ZM9.7219,60.0954C4.9319,60.0954 1.0483,56.3331 1.0483,51.6915V35.6749C1.017,35.3844 1,35.0891 1,34.7902C0.9995,34.4859 1.0159,34.1855 1.0483,33.8891V9.4044C1.0483,4.7629 4.9319,1 9.7219,1H27.1744C39.1737,1 48.9359,10.4586 48.9359,22.0849C48.9359,33.1388 40.0252,42.3786 28.6499,43.1205C28.1664,43.1529 27.6681,43.1693 27.1744,43.1693L18.3955,43.1777V51.6915C18.3955,56.3331 14.5124,60.0954 9.7219,60.0954Z"
android:fillColor="#A2DDEF"
android:fillType="evenOdd"/>
<path
android:pathData="M18.3954,17.8083V26.3699L27.1655,26.3609C27.2768,26.3609 27.3785,26.3579 27.4796,26.3515C29.7855,26.2008 31.588,24.3266 31.588,22.0849C31.588,19.7263 29.6085,17.8083 27.1742,17.8083H18.3954ZM9.7217,60.0954C4.9317,60.0954 1.0481,56.3331 1.0481,51.6915V9.4044C1.0481,4.7629 4.9317,1 9.7217,1H27.1742C39.1736,1 48.9358,10.4586 48.9358,22.0849C48.9358,33.1388 40.025,42.3786 28.6497,43.1205C28.1663,43.1529 27.6679,43.1693 27.1742,43.1693L18.3954,43.1777V51.6915C18.3954,56.3331 14.5122,60.0954 9.7217,60.0954Z"
android:strokeWidth="1.51616"
android:fillColor="#00000000"
android:fillType="evenOdd"
android:strokeColor="#368BD6"/>
<path
android:pathData="M9.7219,51.6914V9.4043H27.1744C34.4022,9.4043 40.2618,15.0817 40.2618,22.0848C40.2618,28.7975 34.8785,34.2918 28.0674,34.7359C27.7718,34.7553 27.4746,34.7652 27.1744,34.7652C20.3726,34.7718 15.2712,34.7768 11.8703,34.78C11.3929,34.7805 10.6767,34.7812 9.7219,34.7821"
android:strokeWidth="1.51616"
android:fillColor="#00000000"
android:strokeColor="#368BD6"
android:strokeLineCap="round"/>
<path
android:pathData="M16.8692,4.5845C18.1989,6.4229 18.7096,8.6537 18.3072,10.8631C17.9044,13.074 16.6367,14.9999 14.7377,16.2873C10.8171,18.9453 5.3938,18.0198 2.6485,14.2242C1.3187,12.3857 0.8081,10.1555 1.211,7.9451C1.6133,5.7347 2.881,3.8083 4.7805,2.5213C8.7011,-0.1366 14.1239,0.7888 16.8692,4.5845ZM40.3333,60.0907C37.5998,60.0907 34.9105,58.8425 33.2225,56.5088L20.9639,39.5588C18.215,35.7576 19.1671,30.5169 23.0897,27.854C27.0123,25.1891 32.4213,26.112 35.1702,29.9132L47.4287,46.8632C50.1781,50.6644 49.2261,55.9051 45.3034,58.568C43.7884,59.5969 42.0521,60.0907 40.3333,60.0907Z"
android:fillColor="#368BD6"
android:fillType="evenOdd"/>
</vector>

View File

@ -1,58 +1,65 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <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" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent">
android:orientation="vertical">
<FrameLayout <LinearLayout
android:layout_width="match_parent" android:id="@+id/disclaimerIconsLayout"
android:layout_height="140dp" android:layout_width="0dp"
android:background="#27303A"> android:layout_height="wrap_content"
android:gravity="center"
android:orientation="horizontal"
android:padding="32dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<ImageView <ImageView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="23dp" android:src="@drawable/ic_riot_icon" />
android:layout_marginLeft="23dp"
android:layout_marginTop="15dp"
android:src="@drawable/disclaimer_top_banner_foreground" />
<TextView <ImageView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="24dp" android:layout_margin="32dp"
android:layout_marginLeft="24dp" android:src="@drawable/ic_arrow_right"
android:layout_marginTop="92dp" android:tint="?riotx_text_secondary" />
android:fontFamily="sans-serif"
android:lineSpacingExtra="8sp"
android:text="@string/alpha_disclaimer_title"
android:textColor="@color/white"
android:textSize="24sp"
android:textStyle="normal" />
</FrameLayout> <ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/element_logo_green" />
</LinearLayout>
<TextView <TextView
android:layout_width="match_parent" android:id="@+id/disclaimerTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="24dp" android:text="@string/element_disclaimer_title"
android:layout_marginTop="21dp"
android:layout_marginEnd="24dp"
android:text="@string/element_alpha_disclaimer_content_line_1"
android:textColor="?riotx_text_primary" android:textColor="?riotx_text_primary"
android:textSize="16sp" /> android:textSize="20sp"
android:textStyle="bold"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/disclaimerIconsLayout" />
<TextView <TextView
android:id="@+id/dialogDisclaimerContentLine2" android:layout_width="0dp"
android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="24dp" android:layout_marginStart="24dp"
android:layout_marginTop="21dp" android:layout_marginTop="32dp"
android:layout_marginEnd="24dp" android:layout_marginEnd="24dp"
android:layout_marginBottom="21dp" android:gravity="center"
android:textColor="?riotx_text_primary" android:paddingBottom="32dp"
android:text="@string/element_disclaimer_content"
android:textColor="?riotx_text_secondary"
android:textSize="16sp" android:textSize="16sp"
tools:text="@string/alpha_disclaimer_content_line_2_gplay" /> app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/disclaimerTextView" />
</LinearLayout> </androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -2527,4 +2527,9 @@ Not all features in Riot are implemented in RiotX yet. Main missing (and coming
<string name="element_identity_server_error_outdated_identity_server">This identity server is outdated. Element support only API V2.</string> <string name="element_identity_server_error_outdated_identity_server">This identity server is outdated. Element support only API V2.</string>
<string name="element_identity_server_error_bulk_sha256_not_supported">For your privacy, Element only supports sending hashed user emails and phone number.</string> <string name="element_identity_server_error_bulk_sha256_not_supported">For your privacy, Element only supports sending hashed user emails and phone number.</string>
<string name="element_disclaimer_title">Riot is now Element!</string>
<string name="element_disclaimer_content">Were excited to announce weve changed name! Your app is up to date and youre signed in to your account.</string>
<string name="element_disclaimer_negative_button">GOT IT</string>
<string name="element_disclaimer_positive_button">LEARN MORE</string>
</resources> </resources>