feat:【光环助手】一键登录相关UI优化-UI https://jira.shanqu.cc/browse/GHZSCY-7445
This commit is contained in:
@ -2,9 +2,9 @@ package com.gh.base
|
||||
|
||||
import android.app.Activity
|
||||
import android.app.Application
|
||||
import android.content.res.Configuration
|
||||
import android.os.Bundle
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import com.therouter.TheRouter
|
||||
import com.gh.ad.AdDelegateHelper
|
||||
import com.gh.common.util.FloatingBackViewManager
|
||||
import com.gh.common.xapk.XapkInstaller
|
||||
@ -15,27 +15,45 @@ import com.gh.gamecenter.SplashAdActivity
|
||||
import com.gh.gamecenter.SplashScreenActivity
|
||||
import com.gh.gamecenter.authorization.AuthorizationActivity
|
||||
import com.gh.gamecenter.common.base.GlobalActivityManager
|
||||
import com.gh.gamecenter.common.constant.RouteConsts
|
||||
import com.gh.gamecenter.common.provider.IHelpAndFeedbackProvider
|
||||
import com.gh.gamecenter.common.utils.PackageFlavorHelper
|
||||
import com.gh.gamecenter.core.provider.IPushProvider
|
||||
import com.gh.gamecenter.login.utils.QuickLoginHelper
|
||||
import com.gh.gamecenter.login.view.LoginActivity
|
||||
import com.gh.gamecenter.va.VCore
|
||||
import com.gh.gamecenter.login.utils.QuickLoginHelper
|
||||
import com.gh.vspace.VHelper
|
||||
import com.halo.assistant.HaloApp
|
||||
import com.therouter.TheRouter
|
||||
|
||||
// TODO:移动到对应的模块
|
||||
class GlobalActivityLifecycleObserver : Application.ActivityLifecycleCallbacks {
|
||||
private var isFromBackgroundToForeground = false // 是否后台回到前台
|
||||
|
||||
override fun onActivityPreCreated(activity: Activity, savedInstanceState: Bundle?) {
|
||||
if (QuickLoginHelper.isLoginAuthPage(activity)) {
|
||||
try {
|
||||
val resources = activity.resources
|
||||
val config = Configuration(resources.configuration)
|
||||
config.fontScale = 1.0f
|
||||
|
||||
// 更新Resources配置
|
||||
val metrics = resources.displayMetrics
|
||||
metrics.scaledDensity = metrics.density
|
||||
resources.updateConfiguration(config, metrics)
|
||||
|
||||
} catch (e: Exception) {
|
||||
// 设置字体失败
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onActivityCreated(activity: Activity, savedInstanceState: Bundle?) {
|
||||
// do nothing
|
||||
}
|
||||
|
||||
override fun onActivityStarted(activity: Activity) {
|
||||
GlobalActivityManager.currentActivity = activity
|
||||
GlobalActivityManager.activityCount ++
|
||||
GlobalActivityManager.activityCount++
|
||||
if (GlobalActivityManager.activityCount == 1 && isFromBackgroundToForeground) {
|
||||
if (AdDelegateHelper.shouldShowStartUpAd(true)
|
||||
&& !HaloApp.getInstance().isDisableSplashAdTemporarily
|
||||
@ -111,7 +129,7 @@ class GlobalActivityLifecycleObserver : Application.ActivityLifecycleCallbacks {
|
||||
}
|
||||
|
||||
override fun onActivityStopped(activity: Activity) {
|
||||
GlobalActivityManager.activityCount --
|
||||
GlobalActivityManager.activityCount--
|
||||
isFromBackgroundToForeground = GlobalActivityManager.activityCount <= 0
|
||||
}
|
||||
|
||||
|
||||
@ -16,9 +16,7 @@ import androidx.core.view.WindowCompat
|
||||
import androidx.core.view.doOnAttach
|
||||
import cn.com.chinatelecom.account.api.CtAuth
|
||||
import cn.jiguang.verifysdk.api.*
|
||||
import com.therouter.TheRouter
|
||||
import com.gh.gamecenter.common.base.GlobalActivityManager.getCurrentPageEntity
|
||||
import com.gh.gamecenter.common.constant.RouteConsts
|
||||
import com.gh.gamecenter.common.databinding.SetWaitDialogBinding
|
||||
import com.gh.gamecenter.common.utils.*
|
||||
import com.gh.gamecenter.core.provider.ILoginProvider
|
||||
@ -26,6 +24,7 @@ import com.gh.gamecenter.core.runOnUiThread
|
||||
import com.gh.gamecenter.quicklogin.R
|
||||
import com.lightgame.utils.AppManager
|
||||
import com.lightgame.utils.Utils
|
||||
import com.therouter.TheRouter
|
||||
|
||||
@SuppressLint("StaticFieldLeak")
|
||||
object LoginHelper {
|
||||
@ -152,11 +151,21 @@ object LoginHelper {
|
||||
when (code) {
|
||||
LOGIN_AUTH_CODE_SUCCESS -> {
|
||||
loginToken = content
|
||||
getLoginProvider()?.startQuickLoginHelperPageFromQuickLogin(content, context, continuablePath, callback)
|
||||
getLoginProvider()?.startQuickLoginHelperPageFromQuickLogin(
|
||||
content,
|
||||
context,
|
||||
continuablePath,
|
||||
callback
|
||||
)
|
||||
}
|
||||
|
||||
LOGIN_AUTH_CODE_FAILURE -> {
|
||||
getLoginProvider()?.startCodeLoginPageFromQuickLogin(openAuthPageSuccess, context, continuablePath, callback)
|
||||
getLoginProvider()?.startCodeLoginPageFromQuickLogin(
|
||||
openAuthPageSuccess,
|
||||
context,
|
||||
continuablePath,
|
||||
callback
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -172,7 +181,14 @@ object LoginHelper {
|
||||
backgroundView = getLoginProvider()?.createQuickLoginBackgroundView(context)
|
||||
val beanArrayList: MutableList<PrivacyBean> = ArrayList()
|
||||
beanArrayList.add(PrivacyBean("用户协议", com.gh.gamecenter.common.R.string.disclaimer_url.toResString(), ", "))
|
||||
beanArrayList.add(PrivacyBean("隐私政策", com.gh.gamecenter.common.R.string.privacy_policy_url.toResString(), ", "))
|
||||
beanArrayList.add(
|
||||
PrivacyBean(
|
||||
"隐私政策",
|
||||
com.gh.gamecenter.common.R.string.privacy_policy_url.toResString(),
|
||||
", "
|
||||
)
|
||||
)
|
||||
|
||||
val btnLoginWidth =
|
||||
(context.resources.displayMetrics.widthPixels / context.resources.displayMetrics.density - 80).toInt()
|
||||
|
||||
@ -188,20 +204,22 @@ object LoginHelper {
|
||||
.setNumberSize(28) //手机号码字体大小
|
||||
.setNumberTextBold(true)
|
||||
.setNumberColor(com.gh.gamecenter.common.R.color.text_primary.toColor(context)) //手机号码字体颜色
|
||||
.setNumFieldOffsetY(407) //号码栏Y偏移量
|
||||
.setNumberFieldOffsetBottomY(298) //号码栏Y偏移量
|
||||
// slogan
|
||||
.setSloganTextColor(com.gh.gamecenter.common.R.color.text_tertiary.toColor(context))
|
||||
.setSloganTextSize(12)
|
||||
.setSloganOffsetY(445)
|
||||
.setSloganOffsetY(-1)
|
||||
.setSloganBottomOffsetY(278)
|
||||
// 登录按钮
|
||||
.setLogBtnImgPath("download_button_normal_style") //登录按钮背景
|
||||
.setLogBtnText("一键登录") //登录按钮相关
|
||||
.setLogBtnTextColor(Color.WHITE)
|
||||
.setLogBtnTextSize(16)
|
||||
.setLogBtnTextBold(false)
|
||||
.setLogBtnOffsetY(487) //登录按钮Y偏移量
|
||||
.setLogBtnWidth(btnLoginWidth)
|
||||
.setLogBtnHeight(40)
|
||||
.setLogBtnHeight(44)
|
||||
.setLogBtnOffsetY(-1)
|
||||
.setLogBtnBottomOffsetY(202)
|
||||
.setPrivacyCheckDialogLogBtnImgPath("download_button_normal_style")
|
||||
.setCheckedImgPath("ic_selector_selected")
|
||||
.setUncheckedImgPath("ic_selector_default")
|
||||
@ -210,8 +228,11 @@ object LoginHelper {
|
||||
// 服务条款、用户协议、隐私政策
|
||||
.setPrivacyState(false) //默认不勾选
|
||||
.setPrivacyUnderlineText(true)
|
||||
.setPrivacyTopOffsetY(563)
|
||||
.setAppPrivacyColor(com.gh.gamecenter.common.R.color.text_tertiary.toColor(context), com.gh.gamecenter.common.R.color.text_tertiary.toColor(context))
|
||||
.setPrivacyOffsetY(140)
|
||||
.setAppPrivacyColor(
|
||||
com.gh.gamecenter.common.R.color.text_tertiary.toColor(context),
|
||||
com.gh.gamecenter.common.R.color.text_tertiary.toColor(context)
|
||||
)
|
||||
.setPrivacyNameAndUrlBeanList(
|
||||
beanArrayList
|
||||
)
|
||||
@ -223,7 +244,10 @@ object LoginHelper {
|
||||
}
|
||||
.setPrivacyUnderlineText(true)
|
||||
.setPrivacyWithBookTitleMark(true)
|
||||
.setAppPrivacyColor(com.gh.gamecenter.common.R.color.text_tertiary.toColor(context), com.gh.gamecenter.common.R.color.text_secondary.toColor(context))
|
||||
.setAppPrivacyColor(
|
||||
com.gh.gamecenter.common.R.color.text_tertiary.toColor(context),
|
||||
com.gh.gamecenter.common.R.color.text_secondary.toColor(context)
|
||||
)
|
||||
.setPrivacyMarginL(40) //隐私条款距离手机左右边缘的边距
|
||||
.setPrivacyMarginR(40)
|
||||
// 添加自定义布局
|
||||
|
||||
@ -1,9 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout 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"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/closeBtn"
|
||||
@ -13,20 +18,22 @@
|
||||
app:srcCompat="@drawable/ic_login_close" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_phone_number_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginTop="387dp"
|
||||
android:layout_gravity="center_horizontal|bottom"
|
||||
android:layout_marginBottom="334dp"
|
||||
android:includeFontPadding="false"
|
||||
android:text="本机号码"
|
||||
android:textColor="@color/text_tertiary"
|
||||
android:textSize="12sp" />
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/rl_phone_number_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="407dp"
|
||||
android:layout_centerHorizontal="true">
|
||||
android:layout_gravity="center_horizontal|bottom"
|
||||
android:layout_marginBottom="298dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/phonePlaceHolder"
|
||||
@ -43,10 +50,10 @@
|
||||
android:id="@+id/changeLoginBtn"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:padding="2dp"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:layout_toRightOf="@+id/phonePlaceHolder"
|
||||
android:padding="2dp"
|
||||
android:src="@drawable/ic_quick_login_change" />
|
||||
</RelativeLayout>
|
||||
|
||||
@ -54,13 +61,15 @@
|
||||
android:id="@+id/privacyCheckboxClickView"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:layout_marginTop="563dp"
|
||||
android:layout_marginLeft="36dp" />
|
||||
android:layout_marginLeft="36dp"
|
||||
android:layout_marginTop="563dp" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_other_login"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="657dp"
|
||||
android:layout_gravity="bottom"
|
||||
android:layout_marginBottom="48dp"
|
||||
android:gravity="center"
|
||||
android:orientation="horizontal">
|
||||
|
||||
@ -68,8 +77,8 @@
|
||||
android:id="@+id/qqBtn"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="10dp"
|
||||
android:background="@drawable/bg_quick_login_third_party"
|
||||
android:padding="10dp"
|
||||
android:src="@drawable/ic_quick_login_qq" />
|
||||
|
||||
<ImageView
|
||||
@ -77,8 +86,8 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="32dp"
|
||||
android:padding="10dp"
|
||||
android:background="@drawable/bg_quick_login_third_party"
|
||||
android:padding="10dp"
|
||||
android:src="@drawable/ic_quick_login_wechat" />
|
||||
|
||||
<ImageView
|
||||
@ -86,9 +95,10 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="32dp"
|
||||
android:padding="10dp"
|
||||
android:background="@drawable/bg_quick_login_third_party"
|
||||
android:padding="10dp"
|
||||
android:src="@drawable/ic_quick_login_weibo" />
|
||||
</LinearLayout>
|
||||
|
||||
</FrameLayout>
|
||||
</RelativeLayout>
|
||||
@ -1,15 +1,17 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/ui_surface">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:src="@drawable/bg_quick_login"
|
||||
app:layout_constraintDimensionRatio="1440:1920"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
android:scaleType="centerCrop"
|
||||
android:src="@drawable/bg_quick_login" />
|
||||
|
||||
|
||||
</RelativeLayout>
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
Reference in New Issue
Block a user