fix: API 变动导致编译失败
This commit is contained in:
parent
bb9c9ef974
commit
c112cf79eb
|
|
@ -1,6 +1,5 @@
|
|||
plugins {
|
||||
id 'com.android.application'
|
||||
id 'com.didiglobal.booster'
|
||||
id 'kotlin-android'
|
||||
id 'kotlin-kapt'
|
||||
id 'kotlinx-serialization'
|
||||
|
|
@ -8,6 +7,7 @@ plugins {
|
|||
id 'com.squareup.wire'
|
||||
id 'com.google.devtools.ksp' version "$kotlin_version-1.0.13"
|
||||
id "org.jetbrains.kotlin.plugin.parcelize"
|
||||
// id 'com.didiglobal.booster'
|
||||
}
|
||||
|
||||
def keystoreProperties = new Properties()
|
||||
|
|
@ -28,8 +28,8 @@ if (!isSelfBuild) {
|
|||
}
|
||||
|
||||
android {
|
||||
buildToolsVersion = '34.0.0'
|
||||
compileSdk 34
|
||||
buildToolsVersion '33.0.0'
|
||||
defaultConfig {
|
||||
applicationId "com.huanchengfly.tieba.post"
|
||||
minSdkVersion 21
|
||||
|
|
@ -49,9 +49,6 @@ android {
|
|||
buildFeatures {
|
||||
compose true
|
||||
}
|
||||
composeOptions {
|
||||
kotlinCompilerExtensionVersion compose_compiler_version
|
||||
}
|
||||
signingConfigs {
|
||||
release {
|
||||
keyAlias keystoreProperties["releaseKeyAlias"]
|
||||
|
|
@ -79,12 +76,15 @@ android {
|
|||
multiDexEnabled true
|
||||
}
|
||||
}
|
||||
composeOptions {
|
||||
kotlinCompilerExtensionVersion compose_compiler_version
|
||||
}
|
||||
compileOptions {
|
||||
targetCompatibility JavaVersion.VERSION_1_8
|
||||
sourceCompatibility JavaVersion.VERSION_1_8
|
||||
targetCompatibility JavaVersion.VERSION_11
|
||||
sourceCompatibility JavaVersion.VERSION_11
|
||||
}
|
||||
kotlinOptions {
|
||||
jvmTarget = '1.8'
|
||||
jvmTarget = '11'
|
||||
// freeCompilerArgs += ["-P", "plugin:androidx.compose.compiler.plugins.kotlin:suppressKotlinVersionCompatibilityCheck=true"]
|
||||
freeCompilerArgs += ["-P", "plugin:androidx.compose.compiler.plugins.kotlin:reportsDestination=" + project.buildDir.absolutePath + "/compose_metrics"]
|
||||
freeCompilerArgs += ["-P", "plugin:androidx.compose.compiler.plugins.kotlin:metricsDestination=" + project.buildDir.absolutePath + "/compose_metrics"]
|
||||
|
|
@ -167,7 +167,7 @@ dependencies {
|
|||
implementation composeBom
|
||||
androidTestImplementation composeBom
|
||||
|
||||
implementation 'androidx.compose.runtime:runtime-tracing:1.0.0-alpha04'
|
||||
implementation 'androidx.compose.runtime:runtime-tracing:1.0.0-alpha03'
|
||||
implementation 'androidx.compose.material:material'
|
||||
implementation 'androidx.compose.material:material-icons-core'
|
||||
// Optional - Add full set of material icons
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ import android.os.Build
|
|||
import android.os.Bundle
|
||||
import android.os.Handler
|
||||
import android.os.Looper
|
||||
import androidx.compose.animation.AnimatedContentScope
|
||||
import androidx.compose.animation.AnimatedContentTransitionScope
|
||||
import androidx.compose.animation.ExperimentalAnimationApi
|
||||
import androidx.compose.animation.core.AnimationSpec
|
||||
import androidx.compose.animation.core.Spring
|
||||
|
|
@ -50,12 +50,12 @@ import androidx.datastore.preferences.core.stringPreferencesKey
|
|||
import androidx.lifecycle.flowWithLifecycle
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import androidx.navigation.NavController
|
||||
import androidx.navigation.compose.rememberNavController
|
||||
import androidx.navigation.plusAssign
|
||||
import androidx.window.layout.FoldingFeature
|
||||
import androidx.window.layout.WindowInfoTracker
|
||||
import com.github.panpf.sketch.compose.AsyncImage
|
||||
import com.github.panpf.sketch.fetch.newFileUri
|
||||
import com.google.accompanist.navigation.animation.rememberAnimatedNavController
|
||||
import com.google.accompanist.navigation.material.BottomSheetNavigator
|
||||
import com.google.accompanist.navigation.material.ExperimentalMaterialNavigationApi
|
||||
import com.google.accompanist.navigation.material.ModalBottomSheetLayout
|
||||
|
|
@ -297,35 +297,35 @@ class MainActivityV2 : BaseComposeActivity() {
|
|||
rootDefaultAnimations = RootNavGraphDefaultAnimations(
|
||||
enterTransition = {
|
||||
slideIntoContainer(
|
||||
AnimatedContentScope.SlideDirection.Start,
|
||||
AnimatedContentTransitionScope.SlideDirection.Start,
|
||||
animationSpec = animationSpec,
|
||||
initialOffset = { it }
|
||||
)
|
||||
},
|
||||
exitTransition = {
|
||||
slideOutOfContainer(
|
||||
AnimatedContentScope.SlideDirection.End,
|
||||
AnimatedContentTransitionScope.SlideDirection.End,
|
||||
animationSpec = animationSpec,
|
||||
targetOffset = { -it }
|
||||
)
|
||||
},
|
||||
popEnterTransition = {
|
||||
slideIntoContainer(
|
||||
AnimatedContentScope.SlideDirection.Start,
|
||||
AnimatedContentTransitionScope.SlideDirection.Start,
|
||||
animationSpec = animationSpec,
|
||||
initialOffset = { -it }
|
||||
)
|
||||
},
|
||||
popExitTransition = {
|
||||
slideOutOfContainer(
|
||||
AnimatedContentScope.SlideDirection.End,
|
||||
AnimatedContentTransitionScope.SlideDirection.End,
|
||||
animationSpec = animationSpec,
|
||||
targetOffset = { it }
|
||||
)
|
||||
},
|
||||
),
|
||||
)
|
||||
val navController = rememberAnimatedNavController()
|
||||
val navController = rememberNavController()
|
||||
val bottomSheetNavigator =
|
||||
rememberBottomSheetNavigator(
|
||||
animationSpec = spring(stiffness = Spring.StiffnessMediumLow),
|
||||
|
|
|
|||
|
|
@ -435,7 +435,7 @@ fun ForumPage(
|
|||
val tbs by viewModel.uiState.collectPartialAsState(prop1 = ForumUiState::tbs, initial = null)
|
||||
|
||||
val account = LocalAccount.current
|
||||
val pagerState = rememberPagerState()
|
||||
val pagerState = rememberPagerState { 2 }
|
||||
val coroutineScope = rememberCoroutineScope()
|
||||
val lazyListStates = persistentListOf(rememberLazyListState(), rememberLazyListState())
|
||||
|
||||
|
|
@ -830,7 +830,6 @@ fun ForumPage(
|
|||
|
||||
if (forumInfo != null) {
|
||||
HorizontalPager(
|
||||
pageCount = 2,
|
||||
state = pagerState,
|
||||
modifier = Modifier.fillMaxSize(),
|
||||
verticalAlignment = Alignment.Top,
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ import kotlinx.coroutines.launch
|
|||
fun HistoryPage(
|
||||
navigator: DestinationsNavigator
|
||||
) {
|
||||
val pagerState = rememberPagerState()
|
||||
val pagerState = rememberPagerState { 2 }
|
||||
val coroutineScope = rememberCoroutineScope()
|
||||
val scaffoldState = rememberScaffoldState()
|
||||
|
||||
|
|
@ -138,7 +138,6 @@ fun HistoryPage(
|
|||
) {
|
||||
ProvideNavigator(navigator = navigator) {
|
||||
HorizontalPager(
|
||||
pageCount = 2,
|
||||
state = pagerState,
|
||||
modifier = Modifier.fillMaxSize(),
|
||||
verticalAlignment = Alignment.Top,
|
||||
|
|
|
|||
|
|
@ -122,17 +122,22 @@ fun MainPage(
|
|||
}
|
||||
}
|
||||
|
||||
val pagerState = rememberPagerState()
|
||||
val hideExplore by rememberPreferenceAsState(
|
||||
key = booleanPreferencesKey("hideExplore"),
|
||||
defaultValue = LocalContext.current.appPreferences.hideExplore
|
||||
)
|
||||
|
||||
val pageCount by remember {
|
||||
derivedStateOf {
|
||||
if (hideExplore) 3 else 4
|
||||
}
|
||||
}
|
||||
val pagerState = rememberPagerState { pageCount }
|
||||
LaunchedEffect(hideExplore) {
|
||||
if (pagerState.currentPage == 3 && hideExplore) {
|
||||
pagerState.scrollToPage(2)
|
||||
}
|
||||
}
|
||||
|
||||
val coroutineScope = rememberCoroutineScope()
|
||||
val themeColors = ExtendedTheme.colors
|
||||
val navigationItems by remember {
|
||||
|
|
@ -188,8 +193,6 @@ fun MainPage(
|
|||
).toImmutableList()
|
||||
}
|
||||
}
|
||||
val pageCount by remember { derivedStateOf { navigationItems.size } }
|
||||
|
||||
val navigationType by remember {
|
||||
derivedStateOf {
|
||||
when (windowWidthSizeClass) {
|
||||
|
|
@ -270,7 +273,6 @@ fun MainPage(
|
|||
) { paddingValues ->
|
||||
LazyLoadHorizontalPager(
|
||||
contentPadding = paddingValues,
|
||||
pageCount = pageCount,
|
||||
state = pagerState,
|
||||
key = { navigationItems[it].id },
|
||||
modifier = Modifier.fillMaxSize(),
|
||||
|
|
|
|||
|
|
@ -136,7 +136,7 @@ fun ExplorePage() {
|
|||
),
|
||||
).toImmutableList()
|
||||
}
|
||||
val pagerState = rememberPagerState(initialPage = if (account != null) 1 else 0)
|
||||
val pagerState = rememberPagerState(initialPage = if (account != null) 1 else 0) { pages.size }
|
||||
val coroutineScope = rememberCoroutineScope()
|
||||
|
||||
onGlobalEvent<GlobalEvent.Refresh>(
|
||||
|
|
@ -167,7 +167,6 @@ fun ExplorePage() {
|
|||
) { paddingValues ->
|
||||
LazyLoadHorizontalPager(
|
||||
contentPadding = paddingValues,
|
||||
pageCount = pages.size,
|
||||
state = pagerState,
|
||||
key = { pages[it].id },
|
||||
modifier = Modifier.fillMaxSize(),
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ fun NotificationsPage() {
|
|||
NotificationsListPage(type = NotificationsType.AtMe)
|
||||
}
|
||||
)
|
||||
val pagerState = rememberPagerState()
|
||||
val pagerState = rememberPagerState { pages.size }
|
||||
val coroutineScope = rememberCoroutineScope()
|
||||
Scaffold(
|
||||
backgroundColor = Color.Transparent,
|
||||
|
|
@ -87,9 +87,8 @@ fun NotificationsPage() {
|
|||
modifier = Modifier.fillMaxSize(),
|
||||
) { paddingValues ->
|
||||
LazyLoadHorizontalPager(
|
||||
contentPadding = paddingValues,
|
||||
pageCount = pages.size,
|
||||
state = pagerState,
|
||||
contentPadding = paddingValues,
|
||||
key = { pages[it].first },
|
||||
modifier = Modifier.fillMaxSize(),
|
||||
verticalAlignment = Alignment.Top,
|
||||
|
|
|
|||
|
|
@ -176,7 +176,7 @@ class PhotoViewActivity : BaseComposeActivityWithParcelable<PhotoViewData>() {
|
|||
Surface(color = Color.Black) {
|
||||
if (items.isNotEmpty()) {
|
||||
val coroutineScope = rememberCoroutineScope()
|
||||
val pagerState = rememberPagerState(initialPage = initialIndex)
|
||||
val pagerState = rememberPagerState(initialPage = initialIndex) { pageCount }
|
||||
LaunchedEffect(initialIndex) {
|
||||
if (pagerState.currentPage != initialIndex) pagerState.scrollToPage(initialIndex)
|
||||
}
|
||||
|
|
@ -204,7 +204,6 @@ class PhotoViewActivity : BaseComposeActivityWithParcelable<PhotoViewData>() {
|
|||
}
|
||||
Box(modifier = Modifier.fillMaxSize()) {
|
||||
HorizontalPager(
|
||||
pageCount = pageCount,
|
||||
state = pagerState,
|
||||
key = {
|
||||
"${items[it].overallIndex}"
|
||||
|
|
|
|||
|
|
@ -73,7 +73,6 @@ import androidx.compose.ui.platform.LocalDensity
|
|||
import androidx.compose.ui.platform.LocalSoftwareKeyboardController
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.text.AnnotatedString
|
||||
import androidx.compose.ui.text.ExperimentalTextApi
|
||||
import androidx.compose.ui.text.font.FontWeight
|
||||
import androidx.compose.ui.text.rememberTextMeasurer
|
||||
import androidx.compose.ui.unit.dp
|
||||
|
|
@ -111,7 +110,7 @@ import com.huanchengfly.tieba.post.utils.StringUtil
|
|||
import com.huanchengfly.tieba.post.utils.appPreferences
|
||||
import com.ramcosta.composedestinations.annotation.Destination
|
||||
import com.ramcosta.composedestinations.navigation.DestinationsNavigator
|
||||
import com.ramcosta.composedestinations.spec.DestinationStyle
|
||||
import com.ramcosta.composedestinations.spec.DestinationStyleBottomSheet
|
||||
import kotlinx.collections.immutable.ImmutableList
|
||||
import kotlinx.collections.immutable.persistentListOf
|
||||
import kotlinx.coroutines.FlowPreview
|
||||
|
|
@ -128,10 +127,10 @@ import kotlin.concurrent.thread
|
|||
|
||||
// TODO: 将软键盘状态相关逻辑抽离出来
|
||||
@OptIn(
|
||||
ExperimentalTextApi::class, ExperimentalLayoutApi::class, ExperimentalComposeUiApi::class,
|
||||
ExperimentalLayoutApi::class, ExperimentalComposeUiApi::class,
|
||||
FlowPreview::class
|
||||
)
|
||||
@Destination(style = DestinationStyle.BottomSheet::class)
|
||||
@Destination(style = DestinationStyleBottomSheet::class)
|
||||
@Composable
|
||||
fun ReplyPage(
|
||||
navigator: DestinationsNavigator,
|
||||
|
|
|
|||
|
|
@ -98,7 +98,7 @@ fun BlockListPage(
|
|||
}
|
||||
|
||||
val context = LocalContext.current
|
||||
val pagerState = rememberPagerState()
|
||||
val pagerState = rememberPagerState { 2 }
|
||||
val coroutineScope = rememberCoroutineScope()
|
||||
val blackList by viewModel.uiState.collectPartialAsState(
|
||||
prop1 = BlockListUiState::blackList,
|
||||
|
|
@ -217,7 +217,6 @@ fun BlockListPage(
|
|||
)
|
||||
}
|
||||
HorizontalPager(
|
||||
pageCount = 2,
|
||||
state = pagerState,
|
||||
modifier = Modifier.fillMaxSize(),
|
||||
contentPadding = paddingValues,
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@ import com.huanchengfly.tieba.post.utils.StringUtil
|
|||
import com.huanchengfly.tieba.post.utils.TiebaUtil
|
||||
import com.ramcosta.composedestinations.annotation.Destination
|
||||
import com.ramcosta.composedestinations.navigation.DestinationsNavigator
|
||||
import com.ramcosta.composedestinations.spec.DestinationStyle
|
||||
import com.ramcosta.composedestinations.spec.DestinationStyleBottomSheet
|
||||
import kotlinx.collections.immutable.ImmutableList
|
||||
import kotlinx.collections.immutable.persistentListOf
|
||||
import kotlinx.coroutines.delay
|
||||
|
|
@ -105,7 +105,7 @@ fun SubPostsPage(
|
|||
}
|
||||
|
||||
@Destination(
|
||||
style = DestinationStyle.BottomSheet::class
|
||||
style = DestinationStyleBottomSheet::class
|
||||
)
|
||||
@Composable
|
||||
fun SubPostsSheetPage(
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@ import androidx.compose.foundation.pager.HorizontalPager
|
|||
import androidx.compose.foundation.pager.PageSize
|
||||
import androidx.compose.foundation.pager.PagerDefaults
|
||||
import androidx.compose.foundation.pager.PagerState
|
||||
import androidx.compose.foundation.pager.rememberPagerState
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.CompositionLocalProvider
|
||||
import androidx.compose.runtime.LaunchedEffect
|
||||
|
|
@ -54,9 +53,8 @@ fun ProvideShouldLoad(
|
|||
@OptIn(ExperimentalFoundationApi::class)
|
||||
@Composable
|
||||
fun LazyLoadHorizontalPager(
|
||||
pageCount: Int,
|
||||
state: PagerState,
|
||||
modifier: Modifier = Modifier,
|
||||
state: PagerState = rememberPagerState(),
|
||||
contentPadding: PaddingValues = PaddingValues(0.dp),
|
||||
pageSize: PageSize = PageSize.Fill,
|
||||
beyondBoundsPageCount: Int = 0,
|
||||
|
|
@ -69,10 +67,9 @@ fun LazyLoadHorizontalPager(
|
|||
pageNestedScrollConnection: NestedScrollConnection = PagerDefaults.pageNestedScrollConnection(
|
||||
Orientation.Horizontal
|
||||
),
|
||||
pageContent: @Composable (page: Int) -> Unit
|
||||
pageContent: @Composable (page: Int) -> Unit,
|
||||
) {
|
||||
HorizontalPager(
|
||||
pageCount = pageCount,
|
||||
state = state,
|
||||
modifier = modifier,
|
||||
contentPadding = contentPadding,
|
||||
|
|
@ -92,4 +89,4 @@ fun LazyLoadHorizontalPager(
|
|||
pageContent(it)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
26
build.gradle
26
build.gradle
|
|
@ -12,7 +12,7 @@ buildscript {
|
|||
compose_bom_version = '2023.09.01'
|
||||
wire_version = '4.7.2'
|
||||
hilt_version = '2.46.1'
|
||||
booster_version = '4.15.0'
|
||||
booster_version = '4.16.2'
|
||||
lottie_version = '6.1.0'
|
||||
debug = gradle.startParameter.taskNames.any {
|
||||
it.contains('debug') || it.contains('Debug')
|
||||
|
|
@ -24,22 +24,22 @@ buildscript {
|
|||
maven { url "https://maven.aliyun.com/repository/public" }
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:7.4.2'
|
||||
classpath 'com.android.tools.build:gradle:8.1.1'
|
||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||
classpath "org.jetbrains.kotlin:kotlin-serialization:$kotlin_version"
|
||||
classpath "com.google.dagger:hilt-android-gradle-plugin:$hilt_version"
|
||||
classpath "com.squareup.wire:wire-gradle-plugin:$wire_version"
|
||||
classpath "com.didiglobal.booster:booster-gradle-plugin:$booster_version"
|
||||
classpath "com.didiglobal.booster:booster-transform-webview:$booster_version"
|
||||
classpath "com.didiglobal.booster:booster-transform-shared-preferences:$booster_version"
|
||||
if (!debug) {
|
||||
classpath "com.didiglobal.booster:booster-transform-activity-thread:$booster_version"
|
||||
// classpath "com.didiglobal.booster:booster-transform-finalizer-watchdog-daemon:$booster_version"
|
||||
// classpath "com.didiglobal.booster:booster-transform-res-check:$booster_version"
|
||||
// classpath "com.didiglobal.booster:booster-transform-toast:$booster_version"
|
||||
classpath "com.didiglobal.booster:booster-task-compression-processed-res:$booster_version"
|
||||
classpath "com.didiglobal.booster:booster-transform-r-inline:$booster_version"
|
||||
}
|
||||
// classpath "com.didiglobal.booster:booster-gradle-plugin:$booster_version"
|
||||
// classpath "com.didiglobal.booster:booster-transform-webview:$booster_version"
|
||||
// classpath "com.didiglobal.booster:booster-transform-shared-preferences:$booster_version"
|
||||
// if (!debug) {
|
||||
// classpath "com.didiglobal.booster:booster-transform-activity-thread:$booster_version"
|
||||
//// classpath "com.didiglobal.booster:booster-transform-finalizer-watchdog-daemon:$booster_version"
|
||||
//// classpath "com.didiglobal.booster:booster-transform-res-check:$booster_version"
|
||||
//// classpath "com.didiglobal.booster:booster-transform-toast:$booster_version"
|
||||
// classpath "com.didiglobal.booster:booster-task-compression-processed-res:$booster_version"
|
||||
// classpath "com.didiglobal.booster:booster-transform-r-inline:$booster_version"
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -11,3 +11,6 @@ org.gradle.jvmargs=-Xmx4096m -Dfile.encoding=UTF-8
|
|||
org.gradle.parallel=true
|
||||
# org.gradle.unsafe.configuration-cache=true
|
||||
booster.transform.r.inline.ignores=android/*,androidx/*,com/huanchengfly/tieba/post/R$color
|
||||
android.defaults.buildfeatures.buildconfig=true
|
||||
android.nonTransitiveRClass=false
|
||||
android.nonFinalResIds=false
|
||||
|
|
|
|||
|
|
@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
|
|||
distributionPath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-all.zip
|
||||
|
|
|
|||
Loading…
Reference in New Issue