From ecc189aeacac29066a38257ea2d50cc528319203 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Mon, 21 Sep 2020 14:29:44 +0200 Subject: [PATCH] Restore logo on login screens This reverts commit 4cc3e87d644d9ea4e38dcc7533dff6887e940a79. --- .../app/features/login/LoginActivity.kt | 10 +++++ .../signout/soft/SoftLogoutController.kt | 4 ++ .../signout/soft/epoxy/LoginHeaderItem.kt | 27 ++++++++++++ .../main/res/drawable/element_logotype.xml | 27 ++++++++++++ .../drawable/element_logotype_combined.xml | 43 ------------------- .../main/res/layout/activity_signed_out.xml | 5 +++ vector/src/main/res/layout/fragment_login.xml | 5 +++ .../res/layout/fragment_login_captcha.xml | 5 +++ ...fragment_login_generic_text_input_form.xml | 5 +++ .../layout/fragment_login_reset_password.xml | 5 +++ ...login_reset_password_mail_confirmation.xml | 5 +++ .../fragment_login_reset_password_success.xml | 5 +++ .../fragment_login_server_selection.xml | 5 +++ .../layout/fragment_login_server_url_form.xml | 5 +++ ...fragment_login_signup_signin_selection.xml | 5 +++ .../main/res/layout/fragment_login_splash.xml | 23 +++++++--- .../main/res/layout/fragment_login_terms.xml | 5 +++ .../layout/fragment_login_wait_for_email.xml | 5 +++ .../src/main/res/layout/item_login_header.xml | 9 ++++ .../src/main/res/values-land/styles_login.xml | 15 +++++++ vector/src/main/res/values/styles_login.xml | 21 ++++++++- 21 files changed, 188 insertions(+), 51 deletions(-) create mode 100644 vector/src/main/java/im/vector/app/features/signout/soft/epoxy/LoginHeaderItem.kt create mode 100644 vector/src/main/res/drawable/element_logotype.xml delete mode 100644 vector/src/main/res/drawable/element_logotype_combined.xml create mode 100644 vector/src/main/res/layout/item_login_header.xml diff --git a/vector/src/main/java/im/vector/app/features/login/LoginActivity.kt b/vector/src/main/java/im/vector/app/features/login/LoginActivity.kt index 735521fc3c..2a692c2d53 100644 --- a/vector/src/main/java/im/vector/app/features/login/LoginActivity.kt +++ b/vector/src/main/java/im/vector/app/features/login/LoginActivity.kt @@ -19,10 +19,12 @@ package im.vector.app.features.login import android.content.Context import android.content.Intent import android.view.View +import android.view.ViewGroup import androidx.annotation.CallSuper import androidx.appcompat.app.AlertDialog import androidx.appcompat.widget.Toolbar import androidx.core.view.ViewCompat +import androidx.core.view.children import androidx.core.view.isVisible import androidx.fragment.app.Fragment import androidx.fragment.app.FragmentManager @@ -72,6 +74,13 @@ open class LoginActivity : VectorBaseActivity(), ToolbarConfigurable, UnlockedAc get() = supportFragmentManager.findFragmentById(R.id.loginFragmentContainer) private val commonOption: (FragmentTransaction) -> Unit = { ft -> + // Find the loginLogo on the current Fragment, this should not return null + (topFragment?.view as? ViewGroup) + // Find findViewById does not work, I do not know why + // findViewById(R.id.loginLogo) + ?.children + ?.firstOrNull { it.id == R.id.loginLogo } + ?.let { ft.addSharedElement(it, ViewCompat.getTransitionName(it) ?: "") } ft.setCustomAnimations(enterAnim, exitAnim, popEnterAnim, popExitAnim) } @@ -136,6 +145,7 @@ open class LoginActivity : VectorBaseActivity(), ToolbarConfigurable, UnlockedAc addFragmentToBackstack(R.id.loginFragmentContainer, LoginServerSelectionFragment::class.java, option = { ft -> + findViewById(R.id.loginSplashLogo)?.let { ft.addSharedElement(it, ViewCompat.getTransitionName(it) ?: "") } findViewById(R.id.loginSplashTitle)?.let { ft.addSharedElement(it, ViewCompat.getTransitionName(it) ?: "") } findViewById(R.id.loginSplashSubmit)?.let { ft.addSharedElement(it, ViewCompat.getTransitionName(it) ?: "") } // TODO Disabled because it provokes a flickering diff --git a/vector/src/main/java/im/vector/app/features/signout/soft/SoftLogoutController.kt b/vector/src/main/java/im/vector/app/features/signout/soft/SoftLogoutController.kt index b6f4e13a91..989fc0aadb 100644 --- a/vector/src/main/java/im/vector/app/features/signout/soft/SoftLogoutController.kt +++ b/vector/src/main/java/im/vector/app/features/signout/soft/SoftLogoutController.kt @@ -28,6 +28,7 @@ import im.vector.app.core.resources.StringProvider import im.vector.app.features.login.LoginMode import im.vector.app.features.signout.soft.epoxy.loginCenterButtonItem import im.vector.app.features.signout.soft.epoxy.loginErrorWithRetryItem +import im.vector.app.features.signout.soft.epoxy.loginHeaderItem import im.vector.app.features.signout.soft.epoxy.loginPasswordFormItem import im.vector.app.features.signout.soft.epoxy.loginRedButtonItem import im.vector.app.features.signout.soft.epoxy.loginTextItem @@ -64,6 +65,9 @@ class SoftLogoutController @Inject constructor( } private fun buildHeader(state: SoftLogoutViewState) { + loginHeaderItem { + id("header") + } loginTitleItem { id("title") text(stringProvider.getString(R.string.soft_logout_title)) diff --git a/vector/src/main/java/im/vector/app/features/signout/soft/epoxy/LoginHeaderItem.kt b/vector/src/main/java/im/vector/app/features/signout/soft/epoxy/LoginHeaderItem.kt new file mode 100644 index 0000000000..0ce50b9cdb --- /dev/null +++ b/vector/src/main/java/im/vector/app/features/signout/soft/epoxy/LoginHeaderItem.kt @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2020 New Vector Ltd + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package im.vector.app.features.signout.soft.epoxy + +import com.airbnb.epoxy.EpoxyModelClass +import im.vector.app.R +import im.vector.app.core.epoxy.VectorEpoxyHolder +import im.vector.app.core.epoxy.VectorEpoxyModel + +@EpoxyModelClass(layout = R.layout.item_login_header) +abstract class LoginHeaderItem : VectorEpoxyModel() { + class Holder : VectorEpoxyHolder() +} diff --git a/vector/src/main/res/drawable/element_logotype.xml b/vector/src/main/res/drawable/element_logotype.xml new file mode 100644 index 0000000000..0419447b32 --- /dev/null +++ b/vector/src/main/res/drawable/element_logotype.xml @@ -0,0 +1,27 @@ + + + + + + + + + diff --git a/vector/src/main/res/drawable/element_logotype_combined.xml b/vector/src/main/res/drawable/element_logotype_combined.xml deleted file mode 100644 index 7516bd63e1..0000000000 --- a/vector/src/main/res/drawable/element_logotype_combined.xml +++ /dev/null @@ -1,43 +0,0 @@ - - - - - - - - - - - - - diff --git a/vector/src/main/res/layout/activity_signed_out.xml b/vector/src/main/res/layout/activity_signed_out.xml index 20b03a6a2c..cfe9316677 100644 --- a/vector/src/main/res/layout/activity_signed_out.xml +++ b/vector/src/main/res/layout/activity_signed_out.xml @@ -6,6 +6,11 @@ android:layout_height="match_parent" android:background="?riotx_background"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + diff --git a/vector/src/main/res/values-land/styles_login.xml b/vector/src/main/res/values-land/styles_login.xml index d781ec5f1e..29ddebedd2 100644 --- a/vector/src/main/res/values-land/styles_login.xml +++ b/vector/src/main/res/values-land/styles_login.xml @@ -1,4 +1,19 @@ + + diff --git a/vector/src/main/res/values/styles_login.xml b/vector/src/main/res/values/styles_login.xml index c5180384a8..d31503759a 100644 --- a/vector/src/main/res/values/styles_login.xml +++ b/vector/src/main/res/values/styles_login.xml @@ -8,9 +8,26 @@ 36dp + + + + +