Skip to content

Commit

Permalink
[API Change] Changes in API + Added Apache License (#88)
Browse files Browse the repository at this point in the history
* [API Change] Changes in API + Added Apache License
  • Loading branch information
hi-manshu committed Oct 15, 2022
1 parent 6a1e2ae commit 769834b
Show file tree
Hide file tree
Showing 54 changed files with 784 additions and 45 deletions.
@@ -1,3 +1,18 @@
/*
* Copyright 2022 Kalendar Contributors
*
* 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.himanshoe.sample

import androidx.test.ext.junit.runners.AndroidJUnit4
Expand All @@ -17,6 +32,9 @@ class ExampleInstrumentedTest {
fun useAppContext() {
// Context of the app under test.
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
assertEquals("com.himanshoe.sample", appContext.packageName)
assertEquals(
"com.himanshoe.sample",
appContext.packageName
)
}
}
15 changes: 15 additions & 0 deletions app/src/main/java/com/himanshoe/sample/MainActivity.kt
@@ -1,3 +1,18 @@
/*
* Copyright 2022 Kalendar Contributors
*
* 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.himanshoe.sample

import android.os.Bundle
Expand Down
15 changes: 15 additions & 0 deletions app/src/main/java/com/himanshoe/sample/Navigator.kt
@@ -1,3 +1,18 @@
/*
* Copyright 2022 Kalendar Contributors
*
* 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.himanshoe.sample

import androidx.compose.runtime.Composable
Expand Down
15 changes: 15 additions & 0 deletions app/src/main/java/com/himanshoe/sample/demo/KalendarDemo.kt
@@ -1,3 +1,18 @@
/*
* Copyright 2022 Kalendar Contributors
*
* 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.himanshoe.sample.demo

import androidx.compose.foundation.background
Expand Down
15 changes: 15 additions & 0 deletions app/src/main/java/com/himanshoe/sample/demo/KalendarEndlossDemo.kt
@@ -1,3 +1,18 @@
/*
* Copyright 2022 Kalendar Contributors
*
* 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.himanshoe.sample.demo

import androidx.compose.foundation.background
Expand Down
15 changes: 15 additions & 0 deletions app/src/test/java/com/himanshoe/sample/ExampleUnitTest.kt
@@ -1,3 +1,18 @@
/*
* Copyright 2022 Kalendar Contributors
*
* 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.himanshoe.sample

import org.junit.Assert.assertEquals
Expand Down
11 changes: 1 addition & 10 deletions buildSrc/src/main/kotlin/Dependencies.kt
Expand Up @@ -16,7 +16,6 @@ object Deps {
val uiToolingPreview by lazy { "androidx.compose.ui:ui-tooling-preview:${Versions.compose}" }
val material by lazy { "androidx.compose.material:material:${Versions.compose}" }
val activity by lazy { "androidx.activity:activity-compose:${Versions.activity}" }
val viewmodel by lazy { "androidx.lifecycle:lifecycle-viewmodel-compose:2.4.1" }
val pagination by lazy { "androidx.paging:paging-compose:1.0.0-alpha14"}
}

Expand Down Expand Up @@ -44,19 +43,11 @@ object Deps {
}
}

object Desugar {
val jdk by lazy { "com.android.tools:desugar_jdk_libs:1.1.5" }
}

object Gradle {
val kotlinGradlePlugin by lazy { "org.jetbrains.kotlin:kotlin-gradle-plugin:${Versions.kotlin}" }
val androidGradlePlugin by lazy { "com.android.tools.build:gradle:${Versions.androidGradlePlugin}" }
val vanniktechGradlePlugin by lazy { "com.vanniktech:gradle-maven-publish-plugin:${Versions.vanniktechGradlePlugin}" }
val ktlintGradlePlugin by lazy { "org.jlleitschuh.gradle:ktlint-gradle:${Versions.ktlint}" }
val detektGradlePlugin by lazy { "io.gitlab.arturbosch.detekt:detekt-gradle-plugin:${Versions.detekt}" }
}
}

object ProjectPath {
const val kalendar = ":kalendar"
}
}
4 changes: 2 additions & 2 deletions gradle.properties
Expand Up @@ -11,8 +11,8 @@ org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
# AndroidX package structure to make it clearer which packages are bundled with the
# Android operating system, and which are packaged with your app"s APK
# AndroidX
packaged with your app"s APK
# https://developer.android.com/topic/libraries/support-library/androidx-rn
android.useAndroidX=true
# Automatically convert third-party libraries to use AndroidX
Expand Down
1 change: 0 additions & 1 deletion kalendar-endlos/build.gradle.kts
Expand Up @@ -46,7 +46,6 @@ dependencies {
implementation(Deps.Compose.activity)

debugApi(Deps.Compose.uiTooling)
implementation(Deps.Compose.viewmodel)
implementation(Deps.Compose.pagination)

testImplementation(Deps.Test.jUnit)
Expand Down
@@ -1,3 +1,18 @@
/*
* Copyright 2022 Kalendar Contributors
*
* 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.himanshoe.kalendar.endlos

import androidx.test.ext.junit.runners.AndroidJUnit4
Expand All @@ -17,6 +32,9 @@ class ExampleInstrumentedTest {
fun useAppContext() {
// Context of the app under test.
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
assertEquals("com.himanshoe.kalendar.endlos.test", appContext.packageName)
assertEquals(
"com.himanshoe.kalendar.endlos.test",
appContext.packageName
)
}
}
@@ -1,15 +1,30 @@
/*
* Copyright 2022 Kalendar Contributors
*
* 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.himanshoe.kalendar.endlos

import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.lifecycle.viewmodel.compose.viewModel
import androidx.paging.compose.collectAsLazyPagingItems
import com.himanshoe.kalendar.endlos.color.KalendarColors
import com.himanshoe.kalendar.endlos.color.KalendarThemeColor
import com.himanshoe.kalendar.endlos.component.day.config.KalendarDayColors
import com.himanshoe.kalendar.endlos.component.day.config.KalendarDayDefaultColors
import com.himanshoe.kalendar.endlos.model.KalendarDay
import com.himanshoe.kalendar.endlos.model.KalendarEvent
import com.himanshoe.kalendar.endlos.paging.rememberKalendarPagingController

@Composable
fun Kalendar(
Expand All @@ -19,10 +34,10 @@ fun Kalendar(
onCurrentDayClick: (KalendarDay, List<KalendarEvent>) -> Unit = { _, _ -> },
kalendarDayColors: KalendarDayColors = KalendarDayDefaultColors.defaultColors(),
) {
val kalendarViewModel: KalendarViewModel = viewModel()
val kalendarPagingController = rememberKalendarPagingController()
KalendarEndloss(
modifier = modifier,
kalendarItems = kalendarViewModel.getDates().collectAsLazyPagingItems(),
kalendarItems = kalendarPagingController.dates.collectAsLazyPagingItems(),
kalendarEvents = kalendarEvents,
onCurrentDayClick = onCurrentDayClick,
kalendarDayColors = kalendarDayColors,
Expand All @@ -38,10 +53,10 @@ fun Kalendar(
onCurrentDayClick: (KalendarDay, List<KalendarEvent>) -> Unit = { _, _ -> },
kalendarDayColors: KalendarDayColors = KalendarDayDefaultColors.defaultColors(),
) {
val kalendarViewModel: KalendarViewModel = viewModel()
val kalendarPagingController = rememberKalendarPagingController()
KalendarEndloss(
modifier = modifier,
kalendarItems = kalendarViewModel.getDates().collectAsLazyPagingItems(),
kalendarItems = kalendarPagingController.dates.collectAsLazyPagingItems(),
kalendarEvents = kalendarEvents,
onCurrentDayClick = onCurrentDayClick,
kalendarDayColors = kalendarDayColors,
Expand Down
@@ -1,3 +1,18 @@
/*
* Copyright 2022 Kalendar Contributors
*
* 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.himanshoe.kalendar.endlos

import androidx.compose.foundation.background
Expand Down
@@ -1,3 +1,18 @@
/*
* Copyright 2022 Kalendar Contributors
*
* 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.himanshoe.kalendar.endlos

import androidx.compose.foundation.layout.Arrangement
Expand Down

This file was deleted.

@@ -1,3 +1,18 @@
/*
* Copyright 2022 Kalendar Contributors
*
* 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.himanshoe.kalendar.endlos.color

import androidx.compose.runtime.Stable
Expand Down
@@ -1,3 +1,18 @@
/*
* Copyright 2022 Kalendar Contributors
*
* 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.himanshoe.kalendar.endlos.component.day

import androidx.compose.foundation.BorderStroke
Expand Down
@@ -1,3 +1,18 @@
/*
* Copyright 2022 Kalendar Contributors
*
* 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.himanshoe.kalendar.endlos.component.day.config

import androidx.compose.ui.graphics.Color
Expand Down
@@ -1,3 +1,18 @@
/*
* Copyright 2022 Kalendar Contributors
*
* 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.himanshoe.kalendar.endlos.component.day.config

sealed interface KalendarDayState {
Expand Down

0 comments on commit 769834b

Please sign in to comment.