Skip to content

Commit

Permalink
升级Compose版本到1.0.0-beta09
Browse files Browse the repository at this point in the history
  • Loading branch information
zhujiang2 committed Jun 18, 2021
1 parent d41df9a commit ce0c47c
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 18 deletions.
2 changes: 1 addition & 1 deletion .idea/compiler.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,13 @@ android {

dependencies {

implementation 'androidx.core:core-ktx:1.3.2'
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'androidx.core:core-ktx:1.5.0'
implementation 'androidx.appcompat:appcompat:1.3.0'
implementation 'com.google.android.material:material:1.3.0'
implementation "androidx.compose.ui:ui:$compose_version"
implementation "androidx.compose.material:material:$compose_version"
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.3.0'
implementation 'androidx.activity:activity-compose:1.3.0-alpha04'
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.3.1'
implementation 'androidx.activity:activity-compose:1.3.0-beta01'
//implementation 'com.github.zhujiang521:Banner:1.3.3'
implementation project(path: ':banner')
testImplementation 'junit:junit:4.13.2'
Expand Down
2 changes: 1 addition & 1 deletion banner/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ android {

dependencies {
implementation "androidx.compose.material:material:$compose_version"
def accompanist_version = "0.10.0"
def accompanist_version = "0.12.0"
api "com.google.accompanist:accompanist-pager:$accompanist_version"
api "com.google.accompanist:accompanist-coil:$accompanist_version"
api "com.google.accompanist:accompanist-insets:$accompanist_version"
Expand Down
4 changes: 2 additions & 2 deletions banner/src/main/java/com/zj/banner/BannerPager.kt
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ fun <T : BaseBannerBean> BannerPager(
val pagerState = rememberPagerState(pageCount = items.size)

if (config.repeat) {
startBanner(pagerState, config.intervalTime)
StartBanner(pagerState, config.intervalTime)
}

Box(modifier = modifier.height(config.bannerHeight)) {
Expand All @@ -76,7 +76,7 @@ var mTimerTask: TimerTask? = null

@OptIn(ExperimentalPagerApi::class)
@Composable
fun startBanner(pagerState: PagerState, intervalTime: Long) {
fun StartBanner(pagerState: PagerState, intervalTime: Long) {
val coroutineScope = rememberCoroutineScope()
mTimer?.cancel()
mTimerTask?.cancel()
Expand Down
20 changes: 12 additions & 8 deletions banner/src/main/java/com/zj/banner/ui/indicator/NumberIndicator.kt
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@ import com.zj.banner.ui.indicator.BannerGravity.BottomRight
* @param gravity 指示器位置
*/
class NumberIndicator(
var backgroundColor: Color = Color(30, 30, 33, 90),
var numberColor: Color = Color.White,
var circleSize: Dp = 35.dp,
var fontSize: TextUnit = 15.sp,
private var backgroundColor: Color = Color(30, 30, 33, 90),
private var numberColor: Color = Color.White,
private var circleSize: Dp = 35.dp,
private var fontSize: TextUnit = 15.sp,
override var gravity: Int = BottomRight,
) : Indicator() {

@ExperimentalPagerApi
@OptIn(ExperimentalPagerApi::class)
@Composable
override fun DrawIndicator(pagerState: PagerState) {
val alignment: Alignment = when (gravity) {
Expand All @@ -52,14 +52,18 @@ class NumberIndicator(
}
else -> Alignment.BottomEnd
}
Box(modifier = Modifier.fillMaxSize().padding(10.dp), contentAlignment = alignment) {
Box(modifier = Modifier
.fillMaxSize()
.padding(10.dp), contentAlignment = alignment) {
Box(
modifier = Modifier.size(circleSize).clip(CircleShape)
modifier = Modifier
.size(circleSize)
.clip(CircleShape)
.background(color = backgroundColor),
contentAlignment = Alignment.Center
) {
Text(
"${pagerState.currentPage + 1}/${pagerState.pageCount}",
text = "${pagerState.currentPage + 1}/${pagerState.pageCount}",
color = numberColor,
fontSize = fontSize
)
Expand Down
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext {
compose_version = '1.0.0-beta07'
compose_version = '1.0.0-beta09'
}
repositories {
google()
Expand All @@ -11,7 +11,7 @@ buildscript {
}
dependencies {
classpath 'com.android.tools.build:gradle:7.0.0-beta03'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.4.32"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.10"

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand Down

0 comments on commit ce0c47c

Please sign in to comment.