Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
ShenghuoquanBusiness
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
bp
ShenghuoquanBusiness
Commits
b45d4f69
Commit
b45d4f69
authored
Jul 08, 2021
by
shiyl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
锁定应用为竖屏,并修改生活名称修改的UI问题
parent
27489ca6
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
62 additions
and
56 deletions
+62
-56
BaseActivity.kt
...mmon/src/main/java/com/yidian/common/base/BaseActivity.kt
+59
-53
LifeAccountModifyNameActivity.kt
...an/newscontent/ui/center/LifeAccountModifyNameActivity.kt
+3
-3
No files found.
CommonLib/Common/src/main/java/com/yidian/common/base/BaseActivity.kt
View file @
b45d4f69
package
com.yidian.common.base
import
android.annotation.SuppressLint
import
android.content.pm.ActivityInfo
import
android.os.Bundle
import
android.view.View
import
androidx.viewbinding.ViewBinding
...
...
@@ -10,75 +12,79 @@ import com.yidian.nightmode.preference.NightModeConfig
import
com.yidian.xpage.XPageViewProtocol
abstract
class
BaseActivity
<
VB
:
ViewBinding
>
:
NightAppCompatActivity
(),
XPageViewProtocol
{
protected
lateinit
var
viewBind
:
VB
abstract
class
BaseActivity
<
VB
:
ViewBinding
>
:
NightAppCompatActivity
(),
XPageViewProtocol
{
override
fun
onCreate
(
savedInstanceState
:
Bundle
?)
{
super
.
onCreate
(
savedInstanceState
)
viewBind
=
createViewBinding
()
extraViewBinding
()
setContentView
(
viewBind
.
root
)
init
(
savedInstanceState
)
}
protected
lateinit
var
viewBind
:
VB
/**
* 如果有多个viewBinding需要初始化时
*/
open
fun
extraViewBinding
()
{
@SuppressLint
(
"SourceLockedOrientationActivity"
)
override
fun
onCreate
(
savedInstanceState
:
Bundle
?)
{
super
.
onCreate
(
savedInstanceState
)
viewBind
=
createViewBinding
()
requestedOrientation
=
ActivityInfo
.
SCREEN_ORIENTATION_PORTRAIT
extraViewBinding
()
setContentView
(
viewBind
.
root
)
init
(
savedInstanceState
)
}
}
/**
* 如果有多个viewBinding需要初始化时
*/
open
fun
extraViewBinding
()
{
override
fun
updateCover
(
isNight
:
Boolean
)
{
}
}
override
fun
getCurrentTheme
(
isNight
:
Boolean
):
Int
{
return
if
(
isNight
)
R
.
style
.
subway_theme_night
else
R
.
style
.
subway_theme_day
}
override
fun
updateCover
(
isNight
:
Boolean
)
{}
override
fun
setContentView
(
view
:
View
){
SystemBarUtils
.
setStatusBarTransparent
(
this
.
window
)
if
(
allowChangeStatusBarTextColor
()
)
{
setStatusBarTextColor
(
NightModeConfig
.
getInstance
().
nightMode
)
}
super
.
setContentView
(
view
)
override
fun
getCurrentTheme
(
isNight
:
Boolean
):
Int
{
return
if
(
isNight
)
R
.
style
.
subway_theme_night
else
R
.
style
.
subway_theme_day
}
override
fun
setContentView
(
view
:
View
)
{
SystemBarUtils
.
setStatusBarTransparent
(
this
.
window
)
if
(
allowChangeStatusBarTextColor
())
{
setStatusBarTextColor
(
NightModeConfig
.
getInstance
().
nightMode
)
}
super
.
setContentView
(
view
)
}
private
fun
allowChangeStatusBarTextColor
():
Boolean
{
return
SystemBarUtils
.
supportTranslucentStatusBar
()
&&
SystemBarUtils
.
supportChangeStatusBarTextColor
()
}
abstract
fun
createViewBinding
():
VB
private
fun
allowChangeStatusBarTextColor
():
Boolean
{
return
SystemBarUtils
.
supportTranslucentStatusBar
()
&&
SystemBarUtils
.
supportChangeStatusBarTextColor
()
}
override
fun
onNightModeChanged
(
isNight
:
Boolean
)
{
super
.
onNightModeChanged
(
isNight
)
if
(
allowChangeStatusBarTextColor
())
{
setStatusBarTextColor
(
isNight
)
}
}
abstract
fun
createViewBinding
():
VB
open
fun
setStatusBarTextColor
(
isNight
:
Boolean
)
{
if
(
isNight
)
{
if
(
this
.
useWhiteStatusBarTextColorInNightMode
())
{
SystemBarUtils
.
setStatusBarTextColorWhite
(
this
)
}
else
{
SystemBarUtils
.
setStatusBarTextColorBlack
(
this
)
}
}
else
if
(
this
.
useBlackStatusBarTextColorInDayMode
())
{
SystemBarUtils
.
setStatusBarTextColorBlack
(
this
)
}
else
{
SystemBarUtils
.
setStatusBarTextColorWhite
(
this
)
}
override
fun
onNightModeChanged
(
isNight
:
Boolean
)
{
super
.
onNightModeChanged
(
isNight
)
if
(
allowChangeStatusBarTextColor
())
{
setStatusBarTextColor
(
isNight
)
}
}
open
fun
setStatusBarTextColor
(
isNight
:
Boolean
)
{
if
(
isNight
)
{
if
(
this
.
useWhiteStatusBarTextColorInNightMode
())
{
SystemBarUtils
.
setStatusBarTextColorWhite
(
this
)
}
else
{
SystemBarUtils
.
setStatusBarTextColorBlack
(
this
)
}
}
else
if
(
this
.
useBlackStatusBarTextColorInDayMode
())
{
SystemBarUtils
.
setStatusBarTextColorBlack
(
this
)
}
else
{
SystemBarUtils
.
setStatusBarTextColorWhite
(
this
)
}
}
private
fun
useBlackStatusBarTextColorInDayMode
():
Boolean
{
private
fun
useBlackStatusBarTextColorInDayMode
():
Boolean
{
return
true
}
return
true
}
private
fun
useWhiteStatusBarTextColorInNightMode
():
Boolean
{
private
fun
useWhiteStatusBarTextColorInNightMode
():
Boolean
{
return
true
}
return
true
}
protected
open
fun
init
(
savedInstanceState
:
Bundle
?)
{}
protected
open
fun
init
(
savedInstanceState
:
Bundle
?)
{}
}
Components/newscontent/src/main/java/com/yidian/shenghuoquan/newscontent/ui/center/LifeAccountModifyNameActivity.kt
View file @
b45d4f69
...
...
@@ -100,9 +100,9 @@ class LifeAccountModifyNameActivity : BaseActivity<ActivityLifeAccountModifyName
// 生活号名称修改成功 发送事件通知商户基本信息页面和商户管理中心页面
XEventManager
.
post
(
XBaseEvent
(
XEventConfig
.
LIFE_ACCOUNT_NAME_MODIFY
,
viewBind
.
evLifeAccountName
.
getEditContent
()))
XPageManager
.
pop
(
null
)
}
else
{
// 生活号名称修改失败 提示
viewBind
.
evLifeAccountName
.
showErrorTips
(
resources
.
getString
(
R
.
string
.
life_account_name_already_exist
))
//
} else {
//
// 生活号名称修改失败 提示
//
viewBind.evLifeAccountName.showErrorTips(resources.getString(R.string.life_account_name_already_exist))
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment