Skip to content

Commit c24d73e

Browse files
committed
Require data argument in WeekViewItem again
1 parent f2e7ad6 commit c24d73e

File tree

4 files changed

+128
-6
lines changed

4 files changed

+128
-6
lines changed

core/src/main/java/com/alamkanak/weekview/CalendarExtensions.kt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,6 @@ internal val Calendar.year: Int
6161

6262
internal fun Calendar.isEqual(other: Calendar) = timeInMillis == other.timeInMillis
6363

64-
internal fun Calendar.isNotEqual(other: Calendar) = isEqual(other).not()
65-
6664
internal operator fun Calendar.plus(days: Days): Calendar {
6765
return copy().apply {
6866
add(Calendar.DATE, days.days)

core/src/main/java/com/alamkanak/weekview/ResolvedWeekViewEvent.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -154,13 +154,13 @@ internal fun ResolvedWeekViewEntity.toWeekViewItem(): WeekViewItem {
154154
cornerRadius = style.cornerRadius,
155155
),
156156
configuration = WeekViewItem.Configuration(
157-
respectDayGap = this is WeekViewEntity.Event<*>,
157+
respectDayGap = this is ResolvedWeekViewEntity.Event<*>,
158158
arrangement = when (this) {
159159
is ResolvedWeekViewEntity.Event<*> -> WeekViewItem.Arrangement.Foreground
160160
is ResolvedWeekViewEntity.BlockedTime -> WeekViewItem.Arrangement.Background
161161
},
162-
canBeDragged = this is WeekViewEntity.Event<*>,
162+
canBeDragged = this is ResolvedWeekViewEntity.Event<*>,
163163
),
164-
data = (this as? ResolvedWeekViewEntity.Event<*>)?.data,
164+
data = (this as? ResolvedWeekViewEntity.Event<*>)?.data ?: Unit,
165165
)
166166
}

core/src/main/java/com/alamkanak/weekview/WeekViewItem.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ data class WeekViewItem(
1919
val timing: Timing,
2020
val style: Style = Style(),
2121
val configuration: Configuration = Configuration(),
22-
val data: Any? = null,
22+
val data: Any,
2323
) {
2424

2525
/**
Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
apply plugin: 'maven-publish'
2+
apply plugin: 'signing'
3+
apply plugin: 'org.jetbrains.dokka'
4+
5+
ext {
6+
PUBLISH_GROUP_ID = 'com.thellmund.android-week-view'
7+
PUBLISH_VERSION = '5.3.0'
8+
}
9+
10+
task androidSourcesJar(type: Jar) {
11+
archiveClassifier.set('sources')
12+
if (project.plugins.findPlugin("com.android.library")) {
13+
from android.sourceSets.main.java.srcDirs
14+
from android.sourceSets.main.kotlin.srcDirs
15+
} else {
16+
from sourceSets.main.java.srcDirs
17+
from sourceSets.main.kotlin.srcDirs
18+
}
19+
}
20+
21+
task javadocJar(type: Jar, dependsOn: dokkaJavadoc) {
22+
archiveClassifier.set('javadoc')
23+
from dokkaJavadoc.outputDirectory
24+
}
25+
26+
artifacts {
27+
archives androidSourcesJar
28+
archives javadocJar
29+
}
30+
31+
group = PUBLISH_GROUP_ID
32+
version = PUBLISH_VERSION
33+
34+
ext["signing.keyId"] = ''
35+
ext["signing.password"] = ''
36+
ext["signing.secretKeyRingFile"] = ''
37+
ext["ossrhUsername"] = ''
38+
ext["ossrhPassword"] = ''
39+
ext["sonatypeStagingProfileId"] = ''
40+
41+
File secretPropsFile = project.rootProject.file('local.properties')
42+
if (secretPropsFile.exists()) {
43+
Properties p = new Properties()
44+
p.load(new FileInputStream(secretPropsFile))
45+
p.each { name, value ->
46+
ext[name] = value
47+
}
48+
} else {
49+
ext["signing.keyId"] = System.getenv('SIGNING_KEY_ID')
50+
ext["signing.password"] = System.getenv('SIGNING_PASSWORD')
51+
ext["signing.secretKeyRingFile"] = System.getenv('SIGNING_SECRET_KEY_RING_FILE')
52+
ext["ossrhUsername"] = System.getenv('OSSRH_USERNAME')
53+
ext["ossrhPassword"] = System.getenv('OSSRH_PASSWORD')
54+
ext["sonatypeStagingProfileId"] = System.getenv('SONATYPE_STAGING_PROFILE_ID')
55+
}
56+
57+
publishing {
58+
publications {
59+
release(MavenPublication) {
60+
groupId PUBLISH_GROUP_ID
61+
artifactId PUBLISH_ARTIFACT_ID
62+
version PUBLISH_VERSION
63+
64+
if (project.plugins.findPlugin("com.android.library")) {
65+
artifact("$buildDir/outputs/aar/${project.getName()}-release.aar")
66+
} else {
67+
artifact("$buildDir/libs/${project.getName()}-${version}.jar")
68+
}
69+
70+
artifact androidSourcesJar
71+
artifact javadocJar
72+
73+
pom {
74+
name = PUBLISH_ARTIFACT_ID
75+
description = 'Display highly customizable calendar views in your Android app'
76+
url = 'https://github.com/thellmund/Android-Week-View'
77+
packaging = 'aar'
78+
licenses {
79+
license {
80+
name = 'The Apache Software License, Version 2.0'
81+
url = 'https://www.apache.org/licenses/LICENSE-2.0.txt'
82+
}
83+
}
84+
developers {
85+
developer {
86+
id = 'thellmund'
87+
name = 'Till Hellmund'
88+
89+
}
90+
}
91+
scm {
92+
connection = 'scm:git:github.com/thellmund/Android-Week-View.git'
93+
developerConnection = 'scm:git:ssh://github.com/thellmund/Android-Week-View.git'
94+
url = 'https://github.com/thellmund/Android-Week-View/tree/main'
95+
}
96+
withXml {
97+
def dependenciesNode = asNode().appendNode('dependencies')
98+
99+
project.configurations.implementation.allDependencies.each {
100+
def dependencyNode = dependenciesNode.appendNode('dependency')
101+
dependencyNode.appendNode('groupId', it.group)
102+
dependencyNode.appendNode('artifactId', it.name)
103+
dependencyNode.appendNode('version', it.version)
104+
}
105+
}
106+
}
107+
}
108+
}
109+
repositories {
110+
maven {
111+
name = "sonatype"
112+
url = "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
113+
114+
credentials {
115+
username ossrhUsername
116+
password ossrhPassword
117+
}
118+
}
119+
}
120+
}
121+
122+
signing {
123+
sign publishing.publications
124+
}

0 commit comments

Comments
 (0)