Skip to content

Commit

Permalink
Merge pull request #20 from lampione/develop
Browse files Browse the repository at this point in the history
merge develop into main
  • Loading branch information
lampione authored May 19, 2023
2 parents bc0fc47 + c2222dc commit 4aca29f
Show file tree
Hide file tree
Showing 25 changed files with 474 additions and 168 deletions.
51 changes: 51 additions & 0 deletions .idea/androidTestResultsUserPreferences.xml

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

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.

41 changes: 41 additions & 0 deletions .idea/inspectionProfiles/Project_Default.xml

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

6 changes: 6 additions & 0 deletions .idea/kotlinc.xml

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

3 changes: 1 addition & 2 deletions .idea/misc.xml

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

15 changes: 14 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ then add the latest ComposeCalendar version to your `app/build.gradle` file depe

```groovy
dependencies {
implementation 'com.squaredem:composecalendar:1.0.4'
implementation 'com.squaredem:composecalendar:1.1.0'
}
```

Expand Down Expand Up @@ -62,6 +62,19 @@ ComposeCalendar(

> Note: currently min and max dates are being coerced respectively to year **1900** and **2100**.
### Top bar customization

You can choose whether to show or hide the top bar with the selected date.
You can also pass a custom `DateFormat` for the string.

```kotlin
ComposeCalendar(
...
showSelectedDate = true,
selectedDateFormat = DateFormat.getDateInstance(DateFormat.DEFAULT)
)
```

## What's next

- Date range selection (from date A to date B)
Expand Down
15 changes: 8 additions & 7 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ plugins {
}

android {
compileSdk 32
compileSdk 33

defaultConfig {
applicationId "com.squaredem.composecalendardemo"
minSdk 26
targetSdk 32
targetSdk 33
versionCode 1
versionName "1.0"

Expand Down Expand Up @@ -43,23 +43,24 @@ android {
excludes += '/META-INF/{AL2.0,LGPL2.1}'
}
}
namespace 'composecalendardemo'
}

dependencies {

implementation "androidx.core:core-ktx:$corektx_version"
implementation "androidx.core:core-ktx:1.10.1"
implementation "androidx.compose.ui:ui:$compose_version"
implementation "androidx.compose.material3:material3:$material3_version"
implementation "androidx.compose.ui:ui-tooling-preview:$compose_version"
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.5.0'
implementation 'androidx.activity:activity-compose:1.5.0'
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.6.1'
implementation 'androidx.activity:activity-compose:1.7.1'
implementation project(path: ':composecalendar')

debugImplementation "androidx.compose.ui:ui-tooling:$compose_version"
debugImplementation "androidx.compose.ui:ui-test-manifest:$compose_version"

testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
androidTestImplementation "androidx.compose.ui:ui-test-junit4:$compose_version"
}
4 changes: 1 addition & 3 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="composecalendardemo">
xmlns:tools="http://schemas.android.com/tools">

<application
android:allowBackup="true"
Expand All @@ -16,7 +15,6 @@
<activity
android:name="com.squaredem.composecalendardemo.MainActivity"
android:exported="true"
android:label="@string/app_name"
android:theme="@style/Theme.ComposeCalendar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/*
* Copyright 2022 Matteo Miceli
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.squaredem.composecalendardemo

import android.os.Bundle
Expand All @@ -7,6 +23,7 @@ import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.padding
import androidx.compose.material3.Button
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
Expand Down Expand Up @@ -44,31 +61,30 @@ private fun MainActivityContent() {
) {

val showDialog = rememberSaveable { mutableStateOf(false) }
val selectedDateMillis = rememberSaveable { mutableStateOf<LocalDate?>(null) }
val selectedDate = rememberSaveable { mutableStateOf<LocalDate?>(null) }

Column(
modifier = Modifier.padding(16.dp),
verticalArrangement = Arrangement.spacedBy(16.dp),
horizontalAlignment = Alignment.CenterHorizontally
) {
selectedDateMillis.value?.let {
selectedDate.value?.let {
Text(text = it.toString())
}

Button(onClick = { showDialog.value = true }) {
Text("Show dialog")
}
}

if (showDialog.value) {
ComposeCalendar(
startDate = LocalDate.now(),
minDate = LocalDate.now(),
maxDate = LocalDate.MAX,
onDone = { it: LocalDate ->
selectedDateMillis.value = it
onDone = {
selectedDate.value = it
showDialog.value = false
},
onDismiss = { showDialog.value = false }
onDismiss = {
showDialog.value = false
}
)
}

Expand Down
14 changes: 6 additions & 8 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
buildscript {
ext {
compose_compiler_version = '1.2.0'
compose_version = '1.3.0-alpha01'
material3_version = '1.0.0-alpha14'
corektx_version = '1.8.0'
accompanist_version = '0.25.1'
compose_compiler_version = '1.4.3'
compose_version = '1.4.3'
material3_version = '1.1.0'
}
}

plugins {
id 'com.android.application' version '7.2.1' apply false
id 'com.android.library' version '7.2.1' apply false
id 'org.jetbrains.kotlin.android' version '1.7.0' apply false
id 'com.android.application' version '8.0.1' apply false
id 'com.android.library' version '8.0.1' apply false
id 'org.jetbrains.kotlin.android' version '1.8.10' apply false
id 'io.github.gradle-nexus.publish-plugin' version "1.1.0"
}

Expand Down
17 changes: 9 additions & 8 deletions composecalendar/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ plugins {
}

android {
compileSdk 32
compileSdk 33

defaultConfig {
minSdk 26
targetSdk 32
targetSdk 33

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles "consumer-rules.pro"
Expand All @@ -49,6 +49,7 @@ android {
composeOptions {
kotlinCompilerExtensionVersion compose_compiler_version
}
namespace 'com.squaredem.composecalendar'
}

dependencies {
Expand All @@ -64,18 +65,18 @@ dependencies {
// compose-material
implementation "androidx.compose.material:material-icons-extended:$compose_version"

// pager
implementation "com.google.accompanist:accompanist-pager:$accompanist_version"

testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
androidTestImplementation "androidx.compose.ui:ui-test-junit4:$compose_version"
debugImplementation "androidx.compose.ui:ui-tooling:$compose_version"
debugImplementation "androidx.compose.ui:ui-test-manifest:$compose_version"
}

ext {
PUBLISH_GROUP_ID = 'com.squaredem'
PUBLISH_ARTIFACT_ID = 'composecalendar'
PUBLISH_VERSION = '1.0.4'
PUBLISH_VERSION = '1.1.0'
}

apply from: "${rootProject.projectDir}/scripts/publish-module.gradle"
Loading

0 comments on commit 4aca29f

Please sign in to comment.