Skip to content

Commit

Permalink
Merge pull request #136 from vanpra/0.7.0
Browse files Browse the repository at this point in the history
Library release 0.7.0
  • Loading branch information
PranavMaganti authored Mar 9, 2022
2 parents 704724c + fe0c536 commit 42e1e30
Show file tree
Hide file tree
Showing 25 changed files with 413 additions and 187 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties', 'buildSrc/src/main/kotlin/*') }}
- name: Build, lint and spotless
run: ./gradlew spotlessCheck assemble assembleAndroidTest lintDebug
run: ./gradlew spotlessCheck assemble assembleAndroidTest
- name: Cleanup Gradle Cache
run: |
rm -f ~/.gradle/caches/modules-2/modules-2.lock
Expand Down
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# Changelog

### 0.7.0 - 2021-03-03

- Update compose to 1.1.1
- [BREAKING CHANGE] Modify arguments of the `input` component to better match those of `TextField`
- Add `textFieldStyle` parameter to `input` component to allow for outlined text field style ([#92](https://github.com/vanpra/compose-material-dialogs/issues/92))
- Add text color options for month and day of week header text of date picker ([#124](https://github.com/vanpra/compose-material-dialogs/issues/124))
- Add ability to change time picker title color ([#123](https://github.com/vanpra/compose-material-dialogs/issues/123))
- Fix bug which causes input field to lose focus on validity change ([#132](https://github.com/vanpra/compose-material-dialogs/issues/132))

### 0.6.3 - 2021-01-21

- Update compose to 1.1.0-rc01
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

[![Codacy Badge](https://app.codacy.com/project/badge/Grade/ae8d455118164f43a24732761a970cc8)](https://www.codacy.com/gh/vanpra/compose-material-dialogs/dashboard?utm_source=github.com&utm_medium=referral&utm_content=vanpra/compose-material-dialogs&utm_campaign=Badge_Grade)![Build & Test](https://github.com/vanpra/compose-material-dialogs/actions/workflows/main.yml/badge.svg)

**Current Library Compose Version: 1.1.0-rc01**
**Current Library Compose Version: 1.1.1**

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

Expand All @@ -19,7 +19,7 @@
```gradle
dependencies {
...
implementation "io.github.vanpra.compose-material-dialogs:core:0.6.3"
implementation "io.github.vanpra.compose-material-dialogs:core:0.7.0"
...
}
```
Expand All @@ -35,7 +35,7 @@ dependencies {
```gradle
dependencies {
...
implementation "io.github.vanpra.compose-material-dialogs:datetime:0.6.3"
implementation "io.github.vanpra.compose-material-dialogs:datetime:0.7.0"
...
}
```
Expand All @@ -51,7 +51,7 @@ dependencies {
```gradle
dependencies {
...
implementation "io.github.vanpra.compose-material-dialogs:color:0.6.3"
implementation "io.github.vanpra.compose-material-dialogs:color:0.7.0"
...
}
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ import androidx.compose.ui.text.input.ImeAction
import com.vanpra.composematerialdialogdemos.DialogAndShowButton
import com.vanpra.composematerialdialogdemos.R
import com.vanpra.composematerialdialogs.iconTitle
import com.vanpra.composematerialdialogs.input
import com.vanpra.composematerialdialogs.message
import com.vanpra.composematerialdialogs.title
import input

/**
* @brief Basic Dialog Demos
Expand Down Expand Up @@ -80,7 +80,20 @@ fun BasicDialogDemo() {
}
) {
title(res = R.string.input_dialog_title)
input(label = "Name", hint = "Jon Smith") {
input(label = "Name", placeholder = "Jon Smith") {
Log.d("SELECTION:", it)
}
}

DialogAndShowButton(
buttonText = "Outlined Input Dialog",
buttons = {
negativeButton("Cancel")
positiveButton("Ok")
}
) {
title(res = R.string.input_dialog_title)
input(label = "Name", placeholder = "Jon Smith", textFieldStyle = TextFieldStyle.Outlined) {
Log.d("SELECTION:", it)
}
}
Expand All @@ -96,7 +109,7 @@ fun BasicDialogDemo() {
title(res = R.string.input_dialog_title)
input(
label = "Name",
hint = "Jon Smith",
placeholder = "Jon Smith",
focusRequester = focusRequester,
focusOnShow = true
) {
Expand All @@ -113,7 +126,7 @@ fun BasicDialogDemo() {
) {
title(res = R.string.input_dialog_title)
input(
label = "Name", hint = "Jon Smith",
label = "Name", placeholder = "Jon Smith",
keyboardActions = KeyboardActions(
onDone = { submit() }
),
Expand All @@ -133,7 +146,7 @@ fun BasicDialogDemo() {
title("Please enter your email")
input(
label = "Email",
hint = "hello@example.com",
placeholder = "hello@example.com",
errorMessage = "Invalid email",
isTextValid = {
Patterns.EMAIL_ADDRESS.matcher(it).matches() && it.isNotEmpty()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import androidx.compose.ui.graphics.Color
import androidx.compose.ui.platform.LocalContext
import com.vanpra.composematerialdialogdemos.DialogAndShowButton
import com.vanpra.composematerialdialogs.MaterialDialogButtons
import com.vanpra.composematerialdialogs.datetime.date.DatePickerDefaults
import com.vanpra.composematerialdialogs.datetime.date.datepicker
import com.vanpra.composematerialdialogs.datetime.time.TimePickerColors
import com.vanpra.composematerialdialogs.datetime.time.TimePickerDefaults
Expand Down Expand Up @@ -92,7 +93,7 @@ fun DateTimeDialogDemo() {
buttonText = "Date Picker Dialog",
buttons = { defaultDateTimeDialogButtons() }
) {
datepicker {
datepicker(colors = DatePickerDefaults.colors(headerBackgroundColor = Color.Red)) {
println(it.toString())
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@ import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.material.Button
import androidx.compose.material.MaterialTheme
import androidx.compose.material.Text
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.AccountCircle
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateListOf
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
Expand Down Expand Up @@ -47,7 +49,7 @@ private val ringtones =
"Zen Too"
)
private val labels = listOf("None", "Forums", "Social", "Updates", "Promotions", "Spam", "Bin")
private val emails = listOf(
private val emails = mutableStateListOf(
"joe@material-dialog.com",
"jane@material-dialog.com",
"dan@material-dialog.com",
Expand All @@ -68,12 +70,17 @@ fun BasicListDialogDemo() {
DialogAndShowButton(buttonText = "Simple List Dialog") {
title(res = R.string.backup_dialog_title)
listItems(emails)
Button(onClick = { emails.add("test@test.com") }) {
Text("Add")
}
}

DialogAndShowButton(buttonText = "Custom List Dialog") {
title(res = R.string.backup_dialog_title)
listItems(
modifier = Modifier.padding(bottom = 8.dp).padding(horizontal = 24.dp),
modifier = Modifier
.padding(bottom = 8.dp)
.padding(horizontal = 24.dp),
list = emails,
item = { _, email ->
Row(Modifier.fillMaxWidth()) {
Expand Down
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ buildscript {

dependencies {
classpath(Dependencies.Kotlin.gradlePlugin)
classpath("com.android.tools.build:gradle:7.2.0-alpha07")
classpath("com.android.tools.build:gradle:7.3.0-alpha04")
classpath("com.vanniktech:gradle-maven-publish-plugin:0.18.0")
classpath("org.jetbrains.dokka:dokka-gradle-plugin:1.6.0")
classpath(Dependencies.Shot.core)
Expand Down
18 changes: 9 additions & 9 deletions buildSrc/src/main/kotlin/Dependencies.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,49 +2,49 @@ object Dependencies {
const val desugar = "com.android.tools:desugar_jdk_libs:1.1.5"

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

const val core = "io.github.vanpra.compose-material-dialogs:core:$version"
const val datetime = "io.github.vanpra.compose-material-dialogs:datetime:$version"
const val color = "io.github.vanpra.compose-material-dialogs:color:$version"
}

object Ktlint {
const val version = "0.42.1"
const val version = "0.44.0"
}

object Accompanist {
private const val version = "0.22.0-rc"
private const val version = "0.23.1"
const val pager = "com.google.accompanist:accompanist-pager:$version"
}

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

object Shot {
private const val version = "5.12.2"
private const val version = "5.13.0"
const val core = "com.karumi:shot:$version"
const val android = "com.karumi:shot-android:$version"
}

object Google {
const val material = "com.google.android.material:material:1.6.0-alpha02"
const val material = "com.google.android.material:material:1.5.0"
}

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

object Testing {
const val version = "1.4.1-alpha03"
const val version = "1.4.1-alpha04"
const val core = "androidx.test:core:$version"
const val rules = "androidx.test:rules:$version"
const val runner = "androidx.test:runner:$version"
}

object Compose {
const val version = "1.1.0-rc01"
const val version = "1.1.1"

const val ui = "androidx.compose.ui:ui:$version"
const val material = "androidx.compose.material:material:$version"
Expand All @@ -55,7 +55,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.0-rc01"
const val navigation = "androidx.navigation:navigation-compose:2.4.1"
}
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import androidx.compose.ui.test.performTextClearance
import androidx.compose.ui.test.performTextInput
import androidx.test.ext.junit.runners.AndroidJUnit4
import com.vanpra.composematerialdialogs.MaterialDialogScope
import com.vanpra.composematerialdialogs.input
import com.vanpra.composematerialdialogs.rememberMaterialDialogState
import com.vanpra.composematerialdialogs.test.R
import com.vanpra.composematerialdialogs.test.utils.DialogWithContent
Expand All @@ -21,6 +20,7 @@ import com.vanpra.composematerialdialogs.test.utils.extensions.onDialogInput
import com.vanpra.composematerialdialogs.test.utils.extensions.onDialogInputError
import com.vanpra.composematerialdialogs.test.utils.extensions.onPositiveButton
import com.vanpra.composematerialdialogs.title
import input
import org.junit.Assert.assertEquals
import org.junit.Rule
import org.junit.Test
Expand Down Expand Up @@ -51,7 +51,7 @@ class InputDialogTest {

@Test
fun checkHintTextIsShown() {
setupBasicInputDialog { input(label = testLabel, hint = testHint) }
setupBasicInputDialog { input(label = testLabel, placeholder = testHint) }
composeTestRule.onNodeWithText(testHint, true).assertExists()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import androidx.compose.ui.test.junit4.createComposeRule
import androidx.test.ext.junit.runners.AndroidJUnit4
import com.karumi.shot.ScreenshotTest
import com.vanpra.composematerialdialogs.iconTitle
import com.vanpra.composematerialdialogs.input
import com.vanpra.composematerialdialogs.message
import com.vanpra.composematerialdialogs.test.R
import com.vanpra.composematerialdialogs.test.utils.DialogWithContent
Expand Down Expand Up @@ -92,20 +91,4 @@ class BasicDialogTest : ScreenshotTest {
}
compareScreenshot(composeTestRule.onDialog())
}

@Test
fun dialogWithInput() {
composeTestRule.setContentAndWaitForIdle {
DialogWithContent(
buttons = {
negativeButton("Cancel")
positiveButton("Ok")
}
) {
title(res = R.string.input_dialog_title)
input(label = "Name", hint = "Jon Smith")
}
}
compareScreenshot(composeTestRule.onDialog())
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
package com.vanpra.composematerialdialogs.test.screenshot

import androidx.compose.ui.test.junit4.createComposeRule
import androidx.test.ext.junit.runners.AndroidJUnit4
import com.karumi.shot.ScreenshotTest
import com.vanpra.composematerialdialogs.test.R
import com.vanpra.composematerialdialogs.test.utils.DialogWithContent
import com.vanpra.composematerialdialogs.test.utils.extensions.onDialog
import com.vanpra.composematerialdialogs.test.utils.extensions.setContentAndWaitForIdle
import com.vanpra.composematerialdialogs.title
import input
import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith

@RunWith(AndroidJUnit4::class)
class InputDialogTest : ScreenshotTest {
@get:Rule
val composeTestRule = createComposeRule()

@Test
fun dialogWithFilledInput() {
composeTestRule.setContentAndWaitForIdle {
DialogWithContent(
buttons = {
negativeButton("Cancel")
positiveButton("Ok")
}
) {
title(res = R.string.input_dialog_title)
input(label = "Name", placeholder = "Jon Smith")
}
}
compareScreenshot(composeTestRule.onDialog())
}

@Test
fun dialogWithOutlinedInput() {
composeTestRule.setContentAndWaitForIdle {
DialogWithContent(
buttons = {
negativeButton("Cancel")
positiveButton("Ok")
}
) {
title(res = R.string.input_dialog_title)
input(
label = "Name",
placeholder = "Jon Smith",
textFieldStyle = TextFieldStyle.Outlined
)
}
}
compareScreenshot(composeTestRule.onDialog())
}
}
Loading

0 comments on commit 42e1e30

Please sign in to comment.