Skip to content

Commit

Permalink
feat: 实现坑位方向可定制化功能(screenOrientation属性控制)
Browse files Browse the repository at this point in the history
  • Loading branch information
GitLqr committed Dec 11, 2021
1 parent 602ff74 commit e7e6446
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,12 @@ public class Replugin implements Plugin<Project> {

class RepluginConfig {

/**
* 屏幕方向
* 注意:默认是坚屏坑位:portrait,可配置为横屏坑位:landscape。
*/
def screenOrientation = "portrait"

/** 自定义进程的数量(除 UI 和 Persistent 进程) */
def countProcess = 3

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class ComponentsGenerator {
def static final expV = 'false'

def static final ori = 'android:screenOrientation'
def static final oriV = 'portrait'
def static oriV = 'portrait'

def static final theme = 'android:theme'
def static final themeTS = '@android:style/Theme.Translucent.NoTitleBar'
Expand All @@ -56,6 +56,8 @@ class ComponentsGenerator {
* @return String 插件化框架中需要的组件
*/
def static generateComponent(def applicationID, def config) {
updateConfig(applicationID, config)

// 是否使用 AppCompat 库(涉及到默认主题)
if (config.useAppCompat) {
themeNTS = THEME_NTS_USE_APP_COMPAT
Expand Down Expand Up @@ -247,6 +249,8 @@ class ComponentsGenerator {
* 生成多进程坑位配置
*/
def static generateMultiProcessComponent(def applicationID, def config) {
updateConfig(applicationID, config)

if (config.countProcess == 0) {
return ''
}
Expand Down Expand Up @@ -430,4 +434,11 @@ class ComponentsGenerator {
// 删除 application 标签
return writer.toString().replace("<application>", "").replace("</application>", "")
}

/**
* 更新配置
*/
def static updateConfig(def applicationID, def config){
oriV = config.screenOrientation
}
}

0 comments on commit e7e6446

Please sign in to comment.