chore: 仅 DEBUG 或自编译启用新 UI

This commit is contained in:
HuanCheng65 2023-02-15 21:57:46 +08:00
parent f2e80a86c7
commit c81241bdc4
No known key found for this signature in database
GPG Key ID: E9031EF91A805148
3 changed files with 13 additions and 6 deletions

View File

@ -40,8 +40,9 @@ android {
vectorDrawables { vectorDrawables {
useSupportLibrary true useSupportLibrary true
} }
manifestPlaceholders = [ manifestPlaceholders = [
is_self_build: "$isSelfBuild" is_self_build: "$isSelfBuild",
enable_new_ui: "${debug || isSelfBuild}",
] ]
} }
buildFeatures { buildFeatures {
@ -194,14 +195,14 @@ dependencies {
implementation fileTree(include: ["*.jar"], dir: "libs") implementation fileTree(include: ["*.jar"], dir: "libs")
//AndroidX //AndroidX
implementation "androidx.appcompat:appcompat:1.6.0" implementation "androidx.appcompat:appcompat:1.6.1"
implementation "androidx.annotation:annotation:1.5.0" implementation "androidx.annotation:annotation:1.5.0"
implementation "androidx.constraintlayout:constraintlayout:2.1.4" implementation "androidx.constraintlayout:constraintlayout:2.1.4"
implementation "androidx.core:core-ktx:1.9.0" implementation "androidx.core:core-ktx:1.9.0"
implementation 'androidx.core:core-splashscreen:1.0.0' implementation 'androidx.core:core-splashscreen:1.0.0'
implementation "androidx.preference:preference-ktx:1.2.0" implementation "androidx.preference:preference-ktx:1.2.0"
implementation "androidx.gridlayout:gridlayout:1.0.0" implementation "androidx.gridlayout:gridlayout:1.0.0"
implementation "androidx.browser:browser:1.4.0" implementation "androidx.browser:browser:1.5.0"
implementation "androidx.viewpager2:viewpager2:1.0.0" implementation "androidx.viewpager2:viewpager2:1.0.0"
implementation "androidx.palette:palette-ktx:1.0.0" implementation "androidx.palette:palette-ktx:1.0.0"
implementation "androidx.window:window:1.0.0" implementation "androidx.window:window:1.0.0"

View File

@ -117,6 +117,9 @@
<meta-data <meta-data
android:name="is_self_build" android:name="is_self_build"
android:value="${is_self_build}" /> android:value="${is_self_build}" />
<meta-data
android:name="enable_new_ui"
android:value="${enable_new_ui}" />
<activity <activity
android:name=".activities.MainActivity" android:name=".activities.MainActivity"
@ -140,7 +143,7 @@
<activity <activity
android:name=".MainActivityV2" android:name=".MainActivityV2"
android:configChanges="screenSize|screenLayout|orientation|smallestScreenSize|keyboard|navigation|keyboardHidden" android:configChanges="screenSize|screenLayout|orientation|smallestScreenSize|keyboard|navigation|keyboardHidden"
android:enabled="true" android:enabled="${enable_new_ui}"
android:exported="true" android:exported="true"
android:icon="@mipmap/ic_launcher_new" android:icon="@mipmap/ic_launcher_new"
android:roundIcon="@mipmap/ic_launcher_new_round" android:roundIcon="@mipmap/ic_launcher_new_round"

View File

@ -26,6 +26,7 @@ import com.github.panpf.sketch.decode.GifMovieDrawableDecoder
import com.github.panpf.sketch.decode.HeifAnimatedDrawableDecoder import com.github.panpf.sketch.decode.HeifAnimatedDrawableDecoder
import com.github.panpf.sketch.decode.WebpAnimatedDrawableDecoder import com.github.panpf.sketch.decode.WebpAnimatedDrawableDecoder
import com.github.panpf.sketch.http.OkHttpStack import com.github.panpf.sketch.http.OkHttpStack
import com.github.panpf.sketch.request.PauseLoadWhenScrollingDrawableDecodeInterceptor
import com.huanchengfly.tieba.post.activities.BaseActivity import com.huanchengfly.tieba.post.activities.BaseActivity
import com.huanchengfly.tieba.post.components.ClipBoardLinkDetector import com.huanchengfly.tieba.post.components.ClipBoardLinkDetector
import com.huanchengfly.tieba.post.components.dialogs.LoadingDialog import com.huanchengfly.tieba.post.components.dialogs.LoadingDialog
@ -102,6 +103,7 @@ class App : Application(), IApp, IGetter, SketchFactory {
setWebViewPath(this) setWebViewPath(this)
} }
val isSelfBuild = applicationMetaData.getBoolean("is_self_build") val isSelfBuild = applicationMetaData.getBoolean("is_self_build")
val enableNewUi = applicationMetaData.getBoolean("enable_new_ui")
if (!isSelfBuild) { if (!isSelfBuild) {
Distribute.setUpdateTrack(if (appPreferences.checkCIUpdate) UpdateTrack.PRIVATE else UpdateTrack.PUBLIC) Distribute.setUpdateTrack(if (appPreferences.checkCIUpdate) UpdateTrack.PRIVATE else UpdateTrack.PUBLIC)
Distribute.setListener(MyDistributeListener()) Distribute.setListener(MyDistributeListener())
@ -112,7 +114,7 @@ class App : Application(), IApp, IGetter, SketchFactory {
} }
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM) AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM)
ThemeUtils.init(ThemeDelegate) ThemeUtils.init(ThemeDelegate)
AppIconUtil.setIcon() if (enableNewUi) AppIconUtil.setIcon()
registerActivityLifecycleCallbacks(ClipBoardLinkDetector) registerActivityLifecycleCallbacks(ClipBoardLinkDetector)
PluginManager.init(this) PluginManager.init(this)
CoroutineScope(Dispatchers.IO).apply { CoroutineScope(Dispatchers.IO).apply {
@ -702,6 +704,7 @@ class App : Application(), IApp, IGetter, SketchFactory {
userAgent(System.getProperty("http.agent")) userAgent(System.getProperty("http.agent"))
}.build()) }.build())
components { components {
addDrawableDecodeInterceptor(PauseLoadWhenScrollingDrawableDecodeInterceptor())
addDrawableDecoder( addDrawableDecoder(
when { when {
Build.VERSION.SDK_INT >= Build.VERSION_CODES.P -> GifAnimatedDrawableDecoder.Factory() Build.VERSION.SDK_INT >= Build.VERSION_CODES.P -> GifAnimatedDrawableDecoder.Factory()