Commit f7e35c52 by 徐健

android10底部适配,心理咨询UI修改

parent 2d6e0797
...@@ -20,7 +20,6 @@ import com.alibaba.android.arouter.launcher.ARouter ...@@ -20,7 +20,6 @@ import com.alibaba.android.arouter.launcher.ARouter
import com.tbruyelle.rxpermissions2.RxPermissions import com.tbruyelle.rxpermissions2.RxPermissions
import com.umeng.analytics.MobclickAgent import com.umeng.analytics.MobclickAgent
import com.ydl.component.music.FragmentContainerActivity import com.ydl.component.music.FragmentContainerActivity
import com.ydl.component.mvp.DemoContract
import com.ydl.component.mvp.DemoPresenter import com.ydl.component.mvp.DemoPresenter
import com.ydl.media.audio.PlayService import com.ydl.media.audio.PlayService
import com.ydl.ydlcommon.modular.ModularServiceManager import com.ydl.ydlcommon.modular.ModularServiceManager
...@@ -34,6 +33,13 @@ import com.yidianling.user.widget.SecretDescriptionDialog.OnSecretDescriptionDia ...@@ -34,6 +33,13 @@ import com.yidianling.user.widget.SecretDescriptionDialog.OnSecretDescriptionDia
import com.yidianling.user.widget.SecretDialog import com.yidianling.user.widget.SecretDialog
import com.yidianling.user.widget.SecretDialog.OnSecretDialogListener import com.yidianling.user.widget.SecretDialog.OnSecretDialogListener
import kotlinx.android.synthetic.main.activity_main.* import kotlinx.android.synthetic.main.activity_main.*
import com.ydl.ydlcommon.utils.ResUtil.getResources
import com.alibaba.fastjson.serializer.AwtCodec.support
import android.support.v4.app.SupportActivity
import android.support.v4.app.SupportActivity.ExtraData
import com.ydl.component.mvp.DemoContract
/** /**
* Created by haorui on 2019-09-01 . * Created by haorui on 2019-09-01 .
...@@ -216,7 +222,6 @@ class MainActivity : BaseLceActivity<DemoContract.View, DemoContract.Presenter>( ...@@ -216,7 +222,6 @@ class MainActivity : BaseLceActivity<DemoContract.View, DemoContract.Presenter>(
} }
override fun reLoadData() { override fun reLoadData() {
mPresenter.loadHome() mPresenter.loadHome()
} }
......
ext { ext {
kotlin_version = "1.3.21" kotlin_version = "1.3.21"
dev_mode = true dev_mode = false
ydl_app = [ ydl_app = [
appName : "心理咨询壹点灵", appName : "心理咨询壹点灵",
...@@ -45,9 +45,9 @@ ext { ...@@ -45,9 +45,9 @@ ext {
"m-confide" : "0.0.48.6", "m-confide" : "0.0.48.6",
"m-consultant" : "0.0.57.4", "m-consultant" : "0.0.57.4",
"m-fm" : "0.0.29.3", "m-fm" : "0.0.29.3",
"m-user" : "0.0.59.18", "m-user" : "0.0.59.23",
"m-home" : "0.0.19.1", "m-home" : "0.0.19.1",
"m-im" : "0.0.16.6", "m-im" : "0.0.16.9",
"m-dynamic" : "0.0.6.1", "m-dynamic" : "0.0.6.1",
"m-muse" : "0.0.28.9", "m-muse" : "0.0.28.9",
...@@ -69,10 +69,10 @@ ext { ...@@ -69,10 +69,10 @@ ext {
//-------------- 功能组件 -------------- //-------------- 功能组件 --------------
//第一步 //第一步
"ydl-platform" : "0.0.39.6", "ydl-platform" : "0.0.39.16",
//第二步 若干 //第二步 若干
"ydl-webview" : "0.0.38.5", "ydl-webview" : "0.0.38.15",
"ydl-media" : "0.0.20", "ydl-media" : "0.0.20",
"ydl-pay" : "0.0.17", "ydl-pay" : "0.0.17",
"m-audioim" : "0.0.48.1", "m-audioim" : "0.0.48.1",
...@@ -115,10 +115,10 @@ ext { ...@@ -115,10 +115,10 @@ ext {
//-------------- 功能组件 -------------- //-------------- 功能组件 --------------
//第一步 //第一步
"ydl-platform" : "0.0.39.6", "ydl-platform" : "0.0.39.16",
//第二步 若干 //第二步 若干
"ydl-webview" : "0.0.38.5", "ydl-webview" : "0.0.38.15",
"ydl-media" : "0.0.20", "ydl-media" : "0.0.20",
"ydl-pay" : "0.0.17", "ydl-pay" : "0.0.17",
"m-audioim" : "0.0.48.1", "m-audioim" : "0.0.48.1",
......
...@@ -172,7 +172,7 @@ class CollectUserInformationView( ...@@ -172,7 +172,7 @@ class CollectUserInformationView(
return@setOnClickListener return@setOnClickListener
} }
ageStr = "年龄:${(Calendar.getInstance().get(Calendar.YEAR) - year)}岁" ageStr = "年龄:${(Calendar.getInstance().get(Calendar.YEAR) - year)}岁"
if ((Calendar.getInstance().get(Calendar.YEAR) - year) < 16) { if ((Calendar.getInstance().get(Calendar.YEAR) - year) <= 16) {
isNeedShowCheckAgeDialog = true isNeedShowCheckAgeDialog = true
} }
......
...@@ -10,6 +10,7 @@ import com.ydl.webview.NewH5Activity ...@@ -10,6 +10,7 @@ import com.ydl.webview.NewH5Activity
import com.ydl.ydl_router.manager.YDLRouterManager import com.ydl.ydl_router.manager.YDLRouterManager
import com.ydl.ydl_router.manager.YDLRouterParams import com.ydl.ydl_router.manager.YDLRouterParams
import com.ydl.ydlcommon.base.BaseActivity import com.ydl.ydlcommon.base.BaseActivity
import com.ydl.ydlcommon.base.config.HttpConfig
import com.ydl.ydlcommon.data.http.RxUtils import com.ydl.ydlcommon.data.http.RxUtils
import com.ydl.ydlcommon.router.IYDLRouterConstant import com.ydl.ydlcommon.router.IYDLRouterConstant
import com.ydl.ydlcommon.utils.actionutil.ActionCountUtils import com.ydl.ydlcommon.utils.actionutil.ActionCountUtils
...@@ -72,7 +73,7 @@ class CollectFocusActivity : BaseActivity() { ...@@ -72,7 +73,7 @@ class CollectFocusActivity : BaseActivity() {
}).setNullTitleDesc( }).setNullTitleDesc(
"确定要退出吗?\n" + "确定要退出吗?\n" +
"很多人在这里得到了帮助哦~" "很多人在这里得到了帮助哦"
).setCancelText("确定").setSureText("取消") ).setCancelText("确定").setSureText("取消")
} }
collectOutDialog?.show() collectOutDialog?.show()
...@@ -94,7 +95,7 @@ class CollectFocusActivity : BaseActivity() { ...@@ -94,7 +95,7 @@ class CollectFocusActivity : BaseActivity() {
userInfoBean.userInfoList = ArrayList() userInfoBean.userInfoList = ArrayList()
userInfoBean.userInfoList.add( userInfoBean.userInfoList.add(
UserInfoCollectParam( UserInfoCollectParam(
mList.filter { it.isFocus }.joinToString { it.id }, mList.filter { it.isFocus }.map { it.id }.joinToString(","),
"consultAttention" "consultAttention"
) )
) )
...@@ -223,6 +224,7 @@ class CollectFocusActivity : BaseActivity() { ...@@ -223,6 +224,7 @@ class CollectFocusActivity : BaseActivity() {
@SuppressLint("CheckResult") @SuppressLint("CheckResult")
private fun jumpToNewUserH5() { private fun jumpToNewUserH5() {
var cateIds = mList.filter { it.isFocus }.map { it.id }.joinToString(",")
UserHttpImpl.getInstance().getNewUserJumpUrl() UserHttpImpl.getInstance().getNewUserJumpUrl()
.compose(RxUtils.resultJavaData()) .compose(RxUtils.resultJavaData())
.subscribeOn(Schedulers.newThread()) .subscribeOn(Schedulers.newThread())
...@@ -232,7 +234,7 @@ class CollectFocusActivity : BaseActivity() { ...@@ -232,7 +234,7 @@ class CollectFocusActivity : BaseActivity() {
upload_focus_info_btn.postDelayed({ upload_focus_info_btn.postDelayed({
completeDialog?.dismiss() completeDialog?.dismiss()
if (!isFinishing) { if (!isFinishing) {
val h5Params = H5Params(it, "mainPage") val h5Params = H5Params("$it?cateIds=$cateIds", H5Params.BackLimit.NewUserBackLimit)
NewH5Activity.start(this, h5Params) NewH5Activity.start(this, h5Params)
} }
}, 1000) }, 1000)
......
...@@ -3,6 +3,7 @@ package com.yidianling.user.ui.collect ...@@ -3,6 +3,7 @@ package com.yidianling.user.ui.collect
import android.annotation.SuppressLint import android.annotation.SuppressLint
import android.content.Intent import android.content.Intent
import android.graphics.Color import android.graphics.Color
import android.support.v4.content.ContextCompat
import android.util.Log import android.util.Log
import android.view.KeyEvent import android.view.KeyEvent
import android.widget.NumberPicker import android.widget.NumberPicker
...@@ -94,7 +95,7 @@ class CollectSexAndBirthActivity : BaseActivity() { ...@@ -94,7 +95,7 @@ class CollectSexAndBirthActivity : BaseActivity() {
} }
}).setNullTitleDesc("确定要退出吗?\n" + }).setNullTitleDesc("确定要退出吗?\n" +
"很多人在这里得到了帮助哦~").setCancelText("确定").setSureText("取消") "很多人在这里得到了帮助哦").setCancelText("确定").setSureText("取消")
} }
collectOutDialog?.show() collectOutDialog?.show()
} }
...@@ -166,6 +167,7 @@ class CollectSexAndBirthActivity : BaseActivity() { ...@@ -166,6 +167,7 @@ class CollectSexAndBirthActivity : BaseActivity() {
}) })
} }
@SuppressLint("ResourceAsColor")
private fun checkUpSelect() { private fun checkUpSelect() {
if (selectedSex == 1) { if (selectedSex == 1) {
male_rl.setBackgroundResource(R.drawable.user_collect_select_bg) male_rl.setBackgroundResource(R.drawable.user_collect_select_bg)
...@@ -173,7 +175,7 @@ class CollectSexAndBirthActivity : BaseActivity() { ...@@ -173,7 +175,7 @@ class CollectSexAndBirthActivity : BaseActivity() {
male_img.setImageResource(R.drawable.user_male_selected) male_img.setImageResource(R.drawable.user_male_selected)
female_img.setImageResource(R.drawable.user_female_unselected) female_img.setImageResource(R.drawable.user_female_unselected)
male_txt.setTextColor(Color.parseColor("#1DA1F2")) male_txt.setTextColor(Color.parseColor("#1DA1F2"))
female_txt.setTextColor(Color.parseColor("#242424")) female_txt.setTextColor(ContextCompat.getColor(mContext, R.color.user_main_theme))
sex_and_birth_upload_btn.setBackgroundResource(R.drawable.user_collect_bottom_btn_bg) sex_and_birth_upload_btn.setBackgroundResource(R.drawable.user_collect_bottom_btn_bg)
} else if (selectedSex == 2) { } else if (selectedSex == 2) {
...@@ -182,7 +184,7 @@ class CollectSexAndBirthActivity : BaseActivity() { ...@@ -182,7 +184,7 @@ class CollectSexAndBirthActivity : BaseActivity() {
male_img.setImageResource(R.drawable.user_male_unselected) male_img.setImageResource(R.drawable.user_male_unselected)
female_img.setImageResource(R.drawable.user_female_selected) female_img.setImageResource(R.drawable.user_female_selected)
male_txt.setTextColor(Color.parseColor("#242424")) male_txt.setTextColor(Color.parseColor("#242424"))
female_txt.setTextColor(Color.parseColor("#1DA1F2")) female_txt.setTextColor(ContextCompat.getColor(mContext, R.color.user_main_theme))
sex_and_birth_upload_btn.setBackgroundResource(R.drawable.user_collect_bottom_btn_bg) sex_and_birth_upload_btn.setBackgroundResource(R.drawable.user_collect_bottom_btn_bg)
} else { } else {
......
package com.yidianling.user.ui.collect.widget package com.yidianling.user.ui.collect.widget
import android.annotation.SuppressLint
import android.content.Context import android.content.Context
import android.graphics.Color import android.graphics.Color
import android.graphics.Typeface import android.graphics.Typeface
import android.support.v4.content.ContextCompat
import android.util.AttributeSet import android.util.AttributeSet
import android.view.Gravity import android.view.Gravity
import android.view.View import android.view.View
...@@ -53,10 +55,11 @@ class CollectFocusView : LinearLayout { ...@@ -53,10 +55,11 @@ class CollectFocusView : LinearLayout {
} }
@SuppressLint("ResourceAsColor")
fun setFocus(focus: Boolean) { fun setFocus(focus: Boolean) {
if (focus) { if (focus) {
user_focus_title.setTextColor(Color.parseColor("#1DA1F2")) user_focus_title.setTextColor(ContextCompat.getColor(mContext, R.color.user_main_theme))
user_focus_desc.setTextColor(Color.parseColor("#1DA1F2")) user_focus_desc.setTextColor(ContextCompat.getColor(mContext, R.color.user_main_theme))
user_focus_title.typeface = Typeface.defaultFromStyle(Typeface.BOLD) user_focus_title.typeface = Typeface.defaultFromStyle(Typeface.BOLD)
setBackgroundResource(R.drawable.user_collect_select_bg) setBackgroundResource(R.drawable.user_collect_select_bg)
} else { } else {
......
...@@ -8,6 +8,6 @@ ...@@ -8,6 +8,6 @@
android:color="@color/user_main_theme"/> android:color="@color/user_main_theme"/>
<solid <solid
android:color="#EDF8FF"/> android:color="@color/user_main_theme_bright"/>
</shape> </shape>
\ No newline at end of file
...@@ -139,13 +139,14 @@ ...@@ -139,13 +139,14 @@
<RelativeLayout <RelativeLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="64dp" android:layout_height="64dp"
android:gravity="center"> android:gravity="center_horizontal">
<TextView <TextView
android:id="@+id/sex_and_birth_upload_btn" android:id="@+id/sex_and_birth_upload_btn"
android:layout_marginLeft="17dp" android:layout_marginLeft="17dp"
android:layout_marginRight="17dp" android:layout_marginRight="17dp"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="44dp" android:layout_height="44dp"
android:layout_marginTop="10dp"
android:gravity="center" android:gravity="center"
android:text="确定" android:text="确定"
android:textSize="17dp" android:textSize="17dp"
......
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners android:radius="22dp"/>
<gradient
android:angle="180"
android:startColor="@color/user_main_theme"
android:endColor="@color/user_main_theme"/>
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners android:radius="22dp"/>
<gradient
android:angle="180"
android:startColor="@color/user_main_theme_66"
android:endColor="@color/user_main_theme_66"/>
</shape>
\ No newline at end of file
...@@ -2,6 +2,8 @@ ...@@ -2,6 +2,8 @@
<resources> <resources>
<!--主题色--> <!--主题色-->
<color name="user_main_theme">#fdbd00</color> <color name="user_main_theme">#fdbd00</color>
<color name="user_main_theme_66">#66fdbd00</color>
<!--主题浅色--> <!--主题浅色-->
<color name="user_main_theme_light">#FFEC8C</color> <color name="user_main_theme_light">#FFEC8C</color>
<!--主题亮色--> <!--主题亮色-->
......
...@@ -2,6 +2,8 @@ ...@@ -2,6 +2,8 @@
<resources> <resources>
<!--主题色--> <!--主题色-->
<color name="user_main_theme">#1da1f2</color> <color name="user_main_theme">#1da1f2</color>
<color name="user_main_theme_66">#661da1f2</color>
<!--主题浅色--> <!--主题浅色-->
<color name="user_main_theme_light">#60BDF5</color> <color name="user_main_theme_light">#60BDF5</color>
<!--主题亮色--> <!--主题亮色-->
......
...@@ -2,18 +2,24 @@ package com.ydl.ydlcommon.base ...@@ -2,18 +2,24 @@ package com.ydl.ydlcommon.base
import android.app.Activity import android.app.Activity
import android.content.res.Resources import android.content.res.Resources
import android.graphics.Color
import android.os.Bundle import android.os.Bundle
import android.support.annotation.LayoutRes import android.support.annotation.LayoutRes
import android.support.v7.app.AppCompatActivity import android.support.v7.app.AppCompatActivity
import android.util.Log import android.util.Log
import android.view.View import android.view.View
import android.view.ViewGroup
import android.widget.FrameLayout
import android.widget.LinearLayout
import com.trello.rxlifecycle2.android.ActivityEvent import com.trello.rxlifecycle2.android.ActivityEvent
import com.ydl.ydlcommon.R
import com.ydl.ydlcommon.base.lifecycle.IActivityLifecycleable import com.ydl.ydlcommon.base.lifecycle.IActivityLifecycleable
import com.ydl.ydlcommon.bean.StatusBarOptions import com.ydl.ydlcommon.bean.StatusBarOptions
import com.ydl.ydlcommon.ui.LoadingDialogFragment import com.ydl.ydlcommon.ui.LoadingDialogFragment
import com.ydl.ydlcommon.utils.ActivityManager import com.ydl.ydlcommon.utils.ActivityManager
import com.ydl.ydlcommon.utils.AndroidSystemHelper import com.ydl.ydlcommon.utils.AndroidSystemHelper
import com.ydl.ydlcommon.utils.StatusBarUtils import com.ydl.ydlcommon.utils.StatusBarUtils
import com.yidianling.common.tools.RxImageTool
import io.reactivex.subjects.BehaviorSubject import io.reactivex.subjects.BehaviorSubject
import io.reactivex.subjects.Subject import io.reactivex.subjects.Subject
import kotlin.properties.Delegates import kotlin.properties.Delegates
...@@ -24,7 +30,7 @@ import kotlin.properties.Delegates ...@@ -24,7 +30,7 @@ import kotlin.properties.Delegates
* e-mail : zhangwch@yidianling.com * e-mail : zhangwch@yidianling.com
* time : 2018/01/27 * time : 2018/01/27
*/ */
abstract class BaseActivity : AppCompatActivity(),IActivityLifecycleable { abstract class BaseActivity : AppCompatActivity(), IActivityLifecycleable {
private val mLifecycleSubject = BehaviorSubject.create<ActivityEvent>() private val mLifecycleSubject = BehaviorSubject.create<ActivityEvent>()
var mContext: Activity by Delegates.notNull() var mContext: Activity by Delegates.notNull()
...@@ -57,19 +63,49 @@ abstract class BaseActivity : AppCompatActivity(),IActivityLifecycleable { ...@@ -57,19 +63,49 @@ abstract class BaseActivity : AppCompatActivity(),IActivityLifecycleable {
override fun setContentView(@LayoutRes layoutResID: Int) { override fun setContentView(@LayoutRes layoutResID: Int) {
if (getStatusViewOptions()?.isAddStatusView) { if (getStatusViewOptions()?.isAddStatusView) {
val returnViews = StatusBarUtils.initStatusBarView(this, layoutResID, getStatusViewOptions()) val options = getStatusViewOptions()
options.bottomStatusColor = getDefaultBottomColor()
val returnViews =
StatusBarUtils.initStatusBarView(this, layoutResID, getStatusViewOptions())
if(returnViews.size > 1){ if (returnViews.size > 1) {
statusView = returnViews[1]; statusView = returnViews[1];
} }
super.setContentView(returnViews[0]) super.setContentView(returnViews[0])
AndroidSystemHelper.fixAndroidBug5497Workaround(this) AndroidSystemHelper.fixAndroidBug5497Workaround(this)
} else { } else {
super.setContentView(layoutResID)
//判定是否有底部小横条
if (StatusBarUtils.hasBottomNavigatorLine(this)) {
val containerView =
View.inflate(this, R.layout.platform_layout_bottom_fit_root, null) as ViewGroup
val rootView = containerView.findViewById<FrameLayout>(R.id.ll_bottom_fit_root);
val layoutView = View.inflate(this, layoutResID, null)
val params =
ViewGroup.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.MATCH_PARENT
)
rootView.addView(layoutView, params)
val bottomView = containerView.findViewById<View>(R.id.ll_bottom_fit_v)
bottomView.visibility = View.VISIBLE
bottomView.setBackgroundColor(getDefaultBottomColor())
super.setContentView(containerView)
} else {
super.setContentView(layoutResID)
}
} }
} }
open fun getDefaultBottomColor(): Int {
return Color.parseColor("#00000000")
}
override fun onDestroy() { override fun onDestroy() {
super.onDestroy() super.onDestroy()
ActivityManager.getInstance().removeStack(this) ActivityManager.getInstance().removeStack(this)
...@@ -88,7 +124,7 @@ abstract class BaseActivity : AppCompatActivity(),IActivityLifecycleable { ...@@ -88,7 +124,7 @@ abstract class BaseActivity : AppCompatActivity(),IActivityLifecycleable {
return AndroidSystemHelper.fixResourcesScale(res) return AndroidSystemHelper.fixResourcesScale(res)
} }
open fun getStatusViewOptions():StatusBarOptions{ open fun getStatusViewOptions(): StatusBarOptions {
return StatusBarOptions() return StatusBarOptions()
} }
......
...@@ -55,7 +55,7 @@ abstract class BaseFragment : Fragment() ,IFragmentLifecycleable{ ...@@ -55,7 +55,7 @@ abstract class BaseFragment : Fragment() ,IFragmentLifecycleable{
layoutResId != 0 -> { layoutResId != 0 -> {
val childView = inflater.inflate(layoutResId, container, false) val childView = inflater.inflate(layoutResId, container, false)
if (getStatusViewOptions().isAddStatusView){ if (getStatusViewOptions().isAddStatusView){
val returnViews = StatusBarUtils.initStatusBarView(activity!!, childView, getStatusViewOptions()) val returnViews = StatusBarUtils.initStatusBarView(activity!!, childView, getStatusViewOptions(), true)
return returnViews[0] return returnViews[0]
}else{ }else{
......
package com.ydl.ydlcommon.bean package com.ydl.ydlcommon.bean
import android.graphics.Color
import android.os.Build import android.os.Build
/** /**
...@@ -20,6 +21,7 @@ class StatusBarOptions { ...@@ -20,6 +21,7 @@ class StatusBarOptions {
return "#1da1f2" return "#1da1f2"
} }
} }
var bottomStatusColor: Int = Color.parseColor("#00000000") //底部颜色默认透明色,个别页面自己设置即可
constructor(isAddStatusView: Boolean = false, statusBarDarkMode: Boolean= false) { constructor(isAddStatusView: Boolean = false, statusBarDarkMode: Boolean= false) {
this.isAddStatusView = isAddStatusView this.isAddStatusView = isAddStatusView
......
...@@ -15,6 +15,7 @@ import android.support.v4.widget.DrawerLayout ...@@ -15,6 +15,7 @@ import android.support.v4.widget.DrawerLayout
import android.view.View import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
import android.view.WindowManager import android.view.WindowManager
import android.widget.FrameLayout
import android.widget.LinearLayout import android.widget.LinearLayout
import com.ydl.ydlcommon.R import com.ydl.ydlcommon.R
import com.ydl.ydlcommon.bean.StatusBarOptions import com.ydl.ydlcommon.bean.StatusBarOptions
...@@ -997,25 +998,38 @@ class StatusBarUtils { ...@@ -997,25 +998,38 @@ class StatusBarUtils {
return initStatusBarView( return initStatusBarView(
context, context,
child, child,
statusBarOptions statusBarOptions,
false
) )
} }
fun initStatusBarView( fun initStatusBarView(
context: Activity,child:View, context: Activity,
statusBarOptions: StatusBarOptions child:View,
statusBarOptions: StatusBarOptions,
isFragment: Boolean = false
): Array<View> { ): Array<View> {
var returnView = arrayOfNulls<View>(2) var returnView = arrayOfNulls<View>(2)
val containerView = View.inflate(context, R.layout.platform_layout_root, null) as ViewGroup val containerView = View.inflate(context, R.layout.platform_layout_root, null) as ViewGroup
val rootView = containerView.findViewById<LinearLayout>(R.id.ll_root); val rootView = containerView.findViewById<FrameLayout>(R.id.ll_root)
val statusView = val statusView =
initStatus(context, rootView, statusBarOptions); initStatus(context, containerView, statusBarOptions)
val params = val params =
ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT) ViewGroup.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.MATCH_PARENT
)
rootView.addView(child, params) rootView.addView(child, params)
if (!isFragment && hasBottomNavigatorLine(context)) {
val bottomView = containerView.findViewById<View>(R.id.ll_bottom_v)
bottomView.visibility = View.VISIBLE
bottomView.setBackgroundColor(statusBarOptions.bottomStatusColor)
}
returnView[0] = containerView returnView[0] = containerView
if (statusView != null){ if (statusView != null){
...@@ -1025,21 +1039,39 @@ class StatusBarUtils { ...@@ -1025,21 +1039,39 @@ class StatusBarUtils {
return returnView as Array<View> return returnView as Array<View>
} }
/**
* 判定是否含有底部小横条,当底部导航高度像素小于50时,认为是有小横条
*/
fun hasBottomNavigatorLine(context: Context): Boolean {
return try {
val clazz = Class.forName("com.android.internal.R\$dimen")
val `object` = clazz.newInstance()
val heightStr = clazz.getField("navigation_bar_height").get(`object`).toString()
val height = Integer.parseInt(heightStr)
val bottomNavigatorHeight = context.resources.getDimensionPixelSize(height)
bottomNavigatorHeight < 50
} catch (e: Exception) {
false
}
}
fun initStatus( fun initStatus(
context: Activity, context: Activity,
rootView: View, containerView: View,
statusBarOptions: StatusBarOptions statusBarOptions: StatusBarOptions
):View? { ):View? {
var statusView:View ?=null var statusView:View ?=null
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
statusView = rootView.findViewById<View>(R.id.view_status_place_holder) statusView = containerView.findViewById<View>(R.id.view_status_place_holder)
statusView?.setBackgroundColor(Color.parseColor(statusBarOptions.statusColor)) statusView?.setBackgroundColor(Color.parseColor(statusBarOptions.statusColor))
val statusBarHeight = val statusBarHeight =
getStatusBarHeight(context) getStatusBarHeight(context)
val layoutParams = statusView?.getLayoutParams() as LinearLayout.LayoutParams statusView?.let {
layoutParams.height = statusBarHeight val layoutParams = statusView?.getLayoutParams() as LinearLayout.LayoutParams
statusView?.layoutParams = layoutParams layoutParams.height = statusBarHeight
statusView?.layoutParams = layoutParams
}
setTransparentForImageView(context, null) setTransparentForImageView(context, null)
} }
if (statusBarOptions.statusBarDarkMode) { if (statusBarOptions.statusBarDarkMode) {
......
...@@ -3,8 +3,9 @@ ...@@ -3,8 +3,9 @@
android:shape="rectangle"> android:shape="rectangle">
<gradient <gradient
android:endColor="#fdbd00" android:angle="0"
android:startColor="#FFEC8C"/> android:startColor="#fdbd00"
android:endColor="#fdbd00"/>
<corners android:bottomRightRadius="8dp" /> <corners android:bottomRightRadius="8dp" />
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
android:shape="rectangle"> android:shape="rectangle">
<gradient <gradient
android:angle="180"
android:endColor="#1DA1F2" android:endColor="#1DA1F2"
android:startColor="#23B2FA"/> android:startColor="#23B2FA"/>
......
<?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:orientation="vertical">
<FrameLayout
android:id="@+id/ll_bottom_fit_root"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1">
</FrameLayout>
<View
android:id="@+id/ll_bottom_fit_v"
android:layout_width="match_parent"
android:layout_height="10dp"
android:visibility="gone">
</View>
</LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/ll_root"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:orientation="vertical"> android:orientation="vertical">
...@@ -11,4 +10,19 @@ ...@@ -11,4 +10,19 @@
android:background="@color/platform_white" android:background="@color/platform_white"
android:layout_height="0dp"/> android:layout_height="0dp"/>
<FrameLayout
android:id="@+id/ll_root"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1">
</FrameLayout>
<View
android:id="@+id/ll_bottom_v"
android:layout_width="match_parent"
android:layout_height="10dp"
android:visibility="gone">
</View>
</LinearLayout> </LinearLayout>
\ No newline at end of file
...@@ -14,7 +14,7 @@ class H5Params : Serializable { ...@@ -14,7 +14,7 @@ class H5Params : Serializable {
this.title = title this.title = title
} }
constructor(url: String, backLimit: String, boolean: Boolean = true): super() { constructor(url: String, backLimit: BackLimit, boolean: Boolean = true): super() {
this.url =url this.url =url
if (boolean) { if (boolean) {
this.backLimit = backLimit this.backLimit = backLimit
...@@ -69,7 +69,11 @@ class H5Params : Serializable { ...@@ -69,7 +69,11 @@ class H5Params : Serializable {
var phone: String? = null var phone: String? = null
/** /**
* h5页面返回按钮限制(根据传入的backLimit判断返回至哪个页面) * h5页面返回按钮限制(根据传入的backLimit判断返回至哪个页面)
* mainPage -- 首页
*/ */
var backLimit: String = "" var backLimit: BackLimit = BackLimit.NewUserBackLimit
enum class BackLimit{
NewUserBackLimit //新用户H5页面返回拦截
}
} }
\ No newline at end of file
...@@ -623,10 +623,6 @@ public class NewH5Activity extends BaseActivity implements PtrHandler { ...@@ -623,10 +623,6 @@ public class NewH5Activity extends BaseActivity implements PtrHandler {
finish(); finish();
} }
else if ("mainPage".equals(h5Params.getBackLimit())) {
WebModularServiceUtils.Companion.startMain(NewH5Activity.this);
finish();
}
else { else {
if (ActivityManager.Companion.getInstance().getActivitys().size() == 1) { if (ActivityManager.Companion.getInstance().getActivitys().size() == 1) {
WebModularServiceUtils.Companion.startMain(NewH5Activity.this); WebModularServiceUtils.Companion.startMain(NewH5Activity.this);
...@@ -823,10 +819,6 @@ public class NewH5Activity extends BaseActivity implements PtrHandler { ...@@ -823,10 +819,6 @@ public class NewH5Activity extends BaseActivity implements PtrHandler {
tb_title.setImageListener(v -> { tb_title.setImageListener(v -> {
if (wv_content.canGoBack()) { if (wv_content.canGoBack()) {
wv_content.goBack(); wv_content.goBack();
}
else if ("mainPage".equals(h5Params.getBackLimit())) {
WebModularServiceUtils.Companion.startMain(NewH5Activity.this);
finish();
} else { } else {
finish(); finish();
} }
...@@ -841,12 +833,7 @@ public class NewH5Activity extends BaseActivity implements PtrHandler { ...@@ -841,12 +833,7 @@ public class NewH5Activity extends BaseActivity implements PtrHandler {
if (h5Params.getShowUrlTitle()) { if (h5Params.getShowUrlTitle()) {
WebModularServiceUtils.Companion.startMain(NewH5Activity.this); WebModularServiceUtils.Companion.startMain(NewH5Activity.this);
finish(); finish();
} } else {
else if ("mainPage".equals(h5Params.getBackLimit())) {
WebModularServiceUtils.Companion.startMain(NewH5Activity.this);
finish();
}
else {
if (ActivityManager.Companion.getInstance().getActivitys().size() == 1) { if (ActivityManager.Companion.getInstance().getActivitys().size() == 1) {
WebModularServiceUtils.Companion.startMain(NewH5Activity.this); WebModularServiceUtils.Companion.startMain(NewH5Activity.this);
} }
...@@ -1140,11 +1127,7 @@ public class NewH5Activity extends BaseActivity implements PtrHandler { ...@@ -1140,11 +1127,7 @@ public class NewH5Activity extends BaseActivity implements PtrHandler {
if (h5Params.isSplash()) { if (h5Params.isSplash()) {
WebModularServiceUtils.Companion.startMain(NewH5Activity.this); WebModularServiceUtils.Companion.startMain(NewH5Activity.this);
finish(); finish();
} } else {
else if ("mainPage".equals(h5Params.getBackLimit())) {
WebModularServiceUtils.Companion.startMain(NewH5Activity.this);
finish();
}else {
if (ActivityManager.Companion.getInstance().getActivitys().size() == 1) { if (ActivityManager.Companion.getInstance().getActivitys().size() == 1) {
WebModularServiceUtils.Companion.startMain(NewH5Activity.this); WebModularServiceUtils.Companion.startMain(NewH5Activity.this);
} }
...@@ -1288,8 +1271,9 @@ public class NewH5Activity extends BaseActivity implements PtrHandler { ...@@ -1288,8 +1271,9 @@ public class NewH5Activity extends BaseActivity implements PtrHandler {
/** /**
* 如果进行返回按钮限制,则判断限制类型 * 如果进行返回按钮限制,则判断限制类型
*/ */
if ("mainPage".equals(h5Params.getBackLimit())) { if (H5Params.BackLimit.NewUserBackLimit.equals(h5Params.getBackLimit())) {
ModularServiceManager.INSTANCE.provide(IAppService.class).mainIntent(this); callJSFunc("showGuideModal");
return false;
} }
......
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