Skip to content

Commit

Permalink
Merge pull request #157 from vanpra/0.8.1-rc
Browse files Browse the repository at this point in the history
Library Version 0.8.1-rc
  • Loading branch information
PranavMaganti authored Jul 10, 2022
2 parents b1ce376 + bd82c98 commit c003db1
Show file tree
Hide file tree
Showing 16 changed files with 86 additions and 67 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Changelog

### 0.8.1-rc - 2022-05-25

- Update compose to 1.2.0-rc03 ([#156](https://github.com/vanpra/compose-material-dialogs/issues/156))
- Update kotlin to 1.7.0
- Remove `material-icons-extended` dependency ([#153](https://github.com/vanpra/compose-material-dialogs/issues/153))
- Add parameter for changing title and message style and color ([#150](https://github.com/vanpra/compose-material-dialogs/issues/150))

### 0.8.0-beta - 2022-05-25

- Update compose to 1.2.0-beta02 ([#149](https://github.com/vanpra/compose-material-dialogs/pull/149))
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

**Latest Stable Library Version: 0.7.2 (Supports Compose 1.1.1)**

**Latest Beta Library Version: 0.8.0-beta (Supports Compose 1.2.0-beta02)**
**Latest Beta Library Version: 0.8.1-rc (Supports Compose 1.2.0-rc03)**

### [See Releases and Changelog](https://github.com/vanpra/compose-material-dialogs/blob/main/CHANGELOG.md)

Expand Down
8 changes: 3 additions & 5 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,12 @@ plugins {
}

android {
compileSdk = 31
buildToolsVersion = "30.0.3"

defaultConfig {

applicationId = "com.vanpra.composematerialdialogs"
minSdk = 23
targetSdk = 30
targetSdk = 33
compileSdk = 33

versionName = "1.0"
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
Expand All @@ -38,7 +36,7 @@ android {
}

composeOptions {
kotlinCompilerExtensionVersion = Dependencies.AndroidX.Compose.version
kotlinCompilerExtensionVersion = Dependencies.AndroidX.Compose.compilerVersion
}
}

Expand Down
4 changes: 2 additions & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ buildscript {

dependencies {
classpath(Dependencies.Kotlin.gradlePlugin)
classpath("com.android.tools.build:gradle:7.4.0-alpha02")
classpath("com.android.tools.build:gradle:7.3.0-beta05")
classpath("com.vanniktech:gradle-maven-publish-plugin:0.19.0")
classpath("org.jetbrains.dokka:dokka-gradle-plugin:1.6.21")
classpath("org.jetbrains.dokka:dokka-gradle-plugin:1.7.0")
classpath(Dependencies.Shot.core)
}
}
Expand Down
3 changes: 1 addition & 2 deletions buildSrc/src/main/kotlin/CommonModulePlugin.kt
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,8 @@ class CommonModulePlugin: Plugin<Project> {

implementation(Dependencies.AndroidX.Compose.ui)
implementation(Dependencies.AndroidX.Compose.material)
implementation(Dependencies.AndroidX.Compose.materialIconsExtended)
implementation(Dependencies.AndroidX.Compose.animation)
implementation(Dependencies.AndroidX.Compose.foundationLayout)
implementation(Dependencies.AndroidX.Compose.animation)

androidTestImplementation(Dependencies.AndroidX.Compose.activity)
androidTestImplementation(Dependencies.AndroidX.Compose.testing)
Expand Down
17 changes: 9 additions & 8 deletions buildSrc/src/main/kotlin/Dependencies.kt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
object Dependencies {
const val desugar = "com.android.tools:desugar_jdk_libs:1.1.5"
const val desugar = "com.android.tools:desugar_jdk_libs:1.2.0"

object ComposeMaterialDialogs {
const val version = "0.6.3"
const val version = "0.7.0"

const val core = "io.github.vanpra.compose-material-dialogs:core:$version"
const val datetime = "io.github.vanpra.compose-material-dialogs:datetime:$version"
Expand All @@ -14,12 +14,12 @@ object Dependencies {
}

object Accompanist {
private const val version = "0.24.9-beta"
private const val version = "0.24.13-rc"
const val pager = "com.google.accompanist:accompanist-pager:$version"
}

object Kotlin {
private const val version = "1.6.21"
private const val version = "1.7.0"
const val gradlePlugin = "org.jetbrains.kotlin:kotlin-gradle-plugin:$version"
}

Expand All @@ -30,11 +30,11 @@ object Dependencies {
}

object Google {
const val material = "com.google.android.material:material:1.6.0"
const val material = "com.google.android.material:material:1.6.1"
}

object AndroidX {
const val coreKtx = "androidx.core:core-ktx:1.7.0"
const val coreKtx = "androidx.core:core-ktx:1.8.0"

object Testing {
const val version = "1.4.0"
Expand All @@ -44,7 +44,8 @@ object Dependencies {
}

object Compose {
const val version = "1.2.0-beta02"
const val version = "1.2.0-rc03"
const val compilerVersion = "1.2.0"

const val ui = "androidx.compose.ui:ui:$version"
const val material = "androidx.compose.material:material:$version"
Expand All @@ -55,7 +56,7 @@ object Dependencies {

const val testing = "androidx.compose.ui:ui-test-junit4:$version"
const val activity = "androidx.activity:activity-compose:1.4.0"
const val navigation = "androidx.navigation:navigation-compose:2.4.2"
const val navigation = "androidx.navigation:navigation-compose:2.5.0"
}
}
}
6 changes: 3 additions & 3 deletions color/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ plugins {
android {
defaultConfig {
minSdk = 21
compileSdk = 31
targetSdk = 31
compileSdk = 33
targetSdk = 33

testInstrumentationRunner = "com.karumi.shot.ShotTestRunner"
testApplicationId = "com.vanpra.composematerialdialogs.color.test"
Expand Down Expand Up @@ -42,7 +42,7 @@ android {
}

composeOptions {
kotlinCompilerExtensionVersion = Dependencies.AndroidX.Compose.version
kotlinCompilerExtensionVersion = Dependencies.AndroidX.Compose.compilerVersion
}
}

Expand Down
6 changes: 3 additions & 3 deletions core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ plugins {
android {
defaultConfig {
minSdk = 21
compileSdk = 31
targetSdk = 31
compileSdk = 33
targetSdk = 33

testInstrumentationRunner = "com.karumi.shot.ShotTestRunner"
testApplicationId = "com.vanpra.composematerialdialogs.test"
Expand Down Expand Up @@ -45,7 +45,7 @@ android {
}

composeOptions {
kotlinCompilerExtensionVersion = Dependencies.AndroidX.Compose.version
kotlinCompilerExtensionVersion = Dependencies.AndroidX.Compose.compilerVersion
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ import androidx.compose.runtime.getValue
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.unit.dp

/**
Expand All @@ -29,6 +31,8 @@ import androidx.compose.ui.unit.dp
fun MaterialDialogScope.title(
text: String? = null,
@StringRes res: Int? = null,
color: Color = MaterialTheme.colors.onSurface,
style: TextStyle = MaterialTheme.typography.h6,
center: Boolean = false
) {
val titleText = getString(res, text)
Expand All @@ -50,8 +54,8 @@ fun MaterialDialogScope.title(

Text(
text = titleText,
color = MaterialTheme.colors.onSurface,
style = MaterialTheme.typography.h6,
color = color,
style = style,
modifier = modifier
)
}
Expand All @@ -66,6 +70,8 @@ fun MaterialDialogScope.title(
fun MaterialDialogScope.iconTitle(
text: String? = null,
@StringRes textRes: Int? = null,
color: Color = MaterialTheme.colors.onSurface,
style: TextStyle = MaterialTheme.typography.h6,
icon: @Composable () -> Unit = {},
) {
val titleText = getString(textRes, text)
Expand All @@ -79,8 +85,8 @@ fun MaterialDialogScope.iconTitle(
Spacer(Modifier.width(14.dp))
Text(
text = titleText,
color = MaterialTheme.colors.onBackground,
style = MaterialTheme.typography.h6
color = color,
style = style
)
}
}
Expand All @@ -91,13 +97,18 @@ fun MaterialDialogScope.iconTitle(
* @param res message text from a string resource
*/
@Composable
fun MaterialDialogScope.message(text: String? = null, @StringRes res: Int? = null) {
fun MaterialDialogScope.message(
text: String? = null,
color: Color = MaterialTheme.colors.onSurface,
style: TextStyle = MaterialTheme.typography.body1,
@StringRes res: Int? = null
) {
val messageText = getString(res, text)

Text(
text = messageText,
color = MaterialTheme.colors.onSurface,
style = MaterialTheme.typography.body1,
color = color,
style = style,
modifier = Modifier
.padding(bottom = 28.dp, start = 24.dp, end = 24.dp)
)
Expand Down
6 changes: 3 additions & 3 deletions datetime/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ android {
}
defaultConfig {
minSdk = 21
compileSdk = 31
targetSdk = 31
compileSdk = 33
targetSdk = 33

testInstrumentationRunner = "com.karumi.shot.ShotTestRunner"
testApplicationId = "com.vanpra.composematerialdialogs.test"
Expand Down Expand Up @@ -45,7 +45,7 @@ android {
}

composeOptions {
kotlinCompilerExtensionVersion = Dependencies.AndroidX.Compose.version
kotlinCompilerExtensionVersion = Dependencies.AndroidX.Compose.compilerVersion
}

kotlinOptions {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ import androidx.compose.material.ContentAlpha
import androidx.compose.material.Icon
import androidx.compose.material.Text
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.ArrowDropDown
import androidx.compose.material.icons.filled.ArrowDropUp
import androidx.compose.material.icons.filled.KeyboardArrowLeft
import androidx.compose.material.icons.filled.KeyboardArrowRight
import androidx.compose.runtime.Composable
Expand All @@ -45,6 +43,7 @@ import androidx.compose.ui.draw.alpha
import androidx.compose.ui.draw.clip
import androidx.compose.ui.draw.clipToBounds
import androidx.compose.ui.platform.testTag
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.text.font.FontWeight.Companion.W400
import androidx.compose.ui.text.font.FontWeight.Companion.W600
Expand All @@ -56,6 +55,7 @@ import com.google.accompanist.pager.HorizontalPager
import com.google.accompanist.pager.PagerState
import com.google.accompanist.pager.rememberPagerState
import com.vanpra.composematerialdialogs.MaterialDialogScope
import com.vanpra.composematerialdialogs.datetime.R
import com.vanpra.composematerialdialogs.datetime.util.getFullLocalName
import com.vanpra.composematerialdialogs.datetime.util.getShortLocalName
import com.vanpra.composematerialdialogs.datetime.util.isSmallDevice
Expand Down Expand Up @@ -124,9 +124,7 @@ internal fun DatePickerImpl(
) { page ->
val viewDate = remember {
LocalDate.of(
state.yearRange.first + page / 12,
page % 12 + 1,
1
state.yearRange.first + page / 12, page % 12 + 1, 1
)
}

Expand Down Expand Up @@ -158,7 +156,7 @@ private fun YearPicker(
state: DatePickerState,
pagerState: PagerState,
) {
val gridState = rememberLazyGridState((viewDate.year - state.yearRange.first) / 3)
val gridState = rememberLazyGridState(viewDate.year - state.yearRange.first)
val coroutineScope = rememberCoroutineScope()

LazyVerticalGrid(
Expand Down Expand Up @@ -205,8 +203,7 @@ private fun YearPickerItem(
Text(
year.toString(),
style = TextStyle(
color = colors.dateTextColor(selected).value,
fontSize = 18.sp
color = colors.dateTextColor(selected).value, fontSize = 18.sp
)
)
}
Expand All @@ -223,9 +220,8 @@ private fun CalendarViewHeader(
) {
val coroutineScope = rememberCoroutineScope()
val month = remember { viewDate.month.getFullLocalName(locale) }
val yearDropdownIcon = remember(state.yearPickerShowing) {
if (state.yearPickerShowing) Icons.Default.ArrowDropUp else Icons.Default.ArrowDropDown
}
val arrowDropUp = painterResource(id = R.drawable.baseline_arrow_drop_up_24)
val arrowDropDown = painterResource(id = R.drawable.baseline_arrow_drop_down_24)

Box(
Modifier
Expand All @@ -251,7 +247,7 @@ private fun CalendarViewHeader(
Spacer(Modifier.width(4.dp))
Box(Modifier.size(24.dp), contentAlignment = Alignment.Center) {
Icon(
yearDropdownIcon,
if (state.yearPickerShowing) arrowDropUp else arrowDropDown,
contentDescription = "Year Selector",
tint = state.colors.calendarHeaderTextColor
)
Expand All @@ -269,14 +265,13 @@ private fun CalendarViewHeader(
modifier = Modifier
.testTag("dialog_date_prev_month")
.size(24.dp)
.clickable(
onClick = {
coroutineScope.launch {
if (pagerState.currentPage - 1 >= 0)
pagerState.animateScrollToPage(pagerState.currentPage - 1)
}
.clickable(onClick = {
coroutineScope.launch {
if (pagerState.currentPage - 1 >= 0) pagerState.animateScrollToPage(
pagerState.currentPage - 1
)
}
),
}),
tint = state.colors.calendarHeaderTextColor
)

Expand All @@ -288,14 +283,13 @@ private fun CalendarViewHeader(
modifier = Modifier
.testTag("dialog_date_next_month")
.size(24.dp)
.clickable(
onClick = {
coroutineScope.launch {
if (pagerState.currentPage + 1 < pagerState.pageCount)
pagerState.animateScrollToPage(pagerState.currentPage + 1)
}
.clickable(onClick = {
coroutineScope.launch {
if (pagerState.currentPage + 1 < pagerState.pageCount) pagerState.animateScrollToPage(
pagerState.currentPage + 1
)
}
),
}),
tint = state.colors.calendarHeaderTextColor
)
}
Expand Down Expand Up @@ -369,8 +363,7 @@ private fun DateSelectionBox(
.wrapContentSize(Alignment.Center)
.alpha(if (enabled) ContentAlpha.high else ContentAlpha.disabled),
style = TextStyle(
color = colors.dateTextColor(selected).value,
fontSize = 12.sp
color = colors.dateTextColor(selected).value, fontSize = 12.sp
)
)
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<vector android:height="24dp" android:tint="#000000"
android:viewportHeight="24" android:viewportWidth="24"
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="@android:color/white" android:pathData="M7,10l5,5 5,-5z"/>
</vector>
Loading

0 comments on commit c003db1

Please sign in to comment.