diff --git a/README.md b/README.md index a74ca1e..58aba92 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,7 @@ Simplified notification construction for Android. [![Codecov](https://img.shields.io/codecov/c/github/karn/notify.svg?style=flat-square)](https://codecov.io/gh/Karn/notify) [![GitHub (pre-)release](https://img.shields.io/github/release/karn/notify/all.svg?style=flat-square) ](./../../releases) +[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2FKarn%2Fnotify.svg?type=small)](https://app.fossa.io/projects/git%2Bgithub.com%2FKarn%2Fnotify?ref=badge_small) Notify is a Fluent API for Android notifications which lets you build notifications without worrying how they'll look across devices or API versions. You can bring deterministic notifications to your Android projects with clarity & ease so you can finally stop fighting Developer documentation and get back to dev work that really matters. diff --git a/build.gradle b/build.gradle index 985fcc1..123096b 100644 --- a/build.gradle +++ b/build.gradle @@ -1,6 +1,5 @@ // Top-level build file where you can add configuration options common to all sub-projects/modules. group = 'io.karn' -version = '1.2.0' subprojects { apply from: rootProject.file('gradle/configuration.gradle') diff --git a/docs/advanced.md b/docs/advanced.md index cdd0cb2..79a2970 100644 --- a/docs/advanced.md +++ b/docs/advanced.md @@ -24,14 +24,14 @@ Notify .with(context) .meta { // this: Payload.Meta // Launch the MainActivity once the notification is clicked. - clickIntent = PendingIntent.getActivity(this@MainActivity, + clickIntent = PendingIntent.getActivity(context, 0, - Intent(this@MainActivity, MainActivity::class.java), + Intent(context, MainActivity::class.java), 0) // Start a service which clears the badge count once the notification is dismissed. - clearIntent = PendingIntent.getService(this@MainActivity, + clearIntent = PendingIntent.getService(context, 0, - Intent(this@MainActivity, MyNotificationService::class.java) + Intent(context, MyNotificationService::class.java) .putExtra("action", "clear_badges"), 0) } @@ -61,9 +61,9 @@ Notify // The text corresponding to the action -- this is what shows . "Clear", // Swap this PendingIntent for whatever Intent is to be processed when the action is clicked. - PendingIntent.getService(this@MainActivity, + PendingIntent.getService(context, 0, - Intent(this@MainActivity, MyNotificationService::class.java) + Intent(context, MyNotificationService::class.java) .putExtra("action", "clear_badges"), 0) )) @@ -79,7 +79,7 @@ This is a particularly effective method of reducing the clutter of the notificat ```Kotlin Notify - .with(this) + .with(context) .content { // this: Payload.Content.Default title = "New dessert menu" text = "The Cheesecake Factory has a new dessert for you to try!" diff --git a/gradle/configuration.gradle b/gradle/configuration.gradle index e3344f1..b2c0f1e 100644 --- a/gradle/configuration.gradle +++ b/gradle/configuration.gradle @@ -7,6 +7,9 @@ def versions = [ + libCode: 11, + libName: '1.2.1', + kotlin: '1.3.11', core: '1.0.1', appcompat: '1.0.2', @@ -49,6 +52,7 @@ def testDependencies = [ ] ext.config = [ + "versions": versions, "deps" : dependencies, "testDeps": testDependencies, "build" : build diff --git a/library/build.gradle b/library/build.gradle index 4618265..c52c5fb 100644 --- a/library/build.gradle +++ b/library/build.gradle @@ -1,3 +1,27 @@ +/* + * MIT License + * + * Copyright (c) 2018 Karn Saheb + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + // Top-level build file where you can add configuration options common to all sub-projects/modules. apply plugin: 'com.android.library' apply plugin: 'kotlin-android' @@ -13,8 +37,8 @@ android { targetSdkVersion config.build.targetSdk minSdkVersion config.build.minSdk - versionCode 10 - versionName "1.2.0" + versionCode config.versions.libCode + versionName config.versions.libName testInstrumentationRunner config.testDeps.instrumentationRunner } diff --git a/library/src/main/AndroidManifest.xml b/library/src/main/AndroidManifest.xml index 7954e12..38f5282 100644 --- a/library/src/main/AndroidManifest.xml +++ b/library/src/main/AndroidManifest.xml @@ -1,4 +1,28 @@ + + diff --git a/library/src/main/java/io/karn/notify/Notify.kt b/library/src/main/java/io/karn/notify/Notify.kt index 541c12d..60c7976 100644 --- a/library/src/main/java/io/karn/notify/Notify.kt +++ b/library/src/main/java/io/karn/notify/Notify.kt @@ -1,3 +1,27 @@ +/* + * MIT License + * + * Copyright (c) 2018 Karn Saheb + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + package io.karn.notify import android.app.NotificationManager @@ -76,7 +100,7 @@ class Notify internal constructor(internal var context: Context) { * {@see Notify#defaultConfig((NotifyConfig) -> Unit)}. */ fun with(context: Context): NotifyCreator { - return NotifyCreator(Notify(context), defaultConfig) + return NotifyCreator(Notify(context)) } /** diff --git a/library/src/main/java/io/karn/notify/NotifyCreator.kt b/library/src/main/java/io/karn/notify/NotifyCreator.kt index 7530fe6..dea3ccb 100644 --- a/library/src/main/java/io/karn/notify/NotifyCreator.kt +++ b/library/src/main/java/io/karn/notify/NotifyCreator.kt @@ -1,7 +1,30 @@ +/* + * MIT License + * + * Copyright (c) 2018 Karn Saheb + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + package io.karn.notify import androidx.core.app.NotificationCompat -import io.karn.notify.entities.NotifyConfig import io.karn.notify.entities.Payload import io.karn.notify.internal.RawNotification import io.karn.notify.internal.utils.Action @@ -12,11 +35,11 @@ import io.karn.notify.internal.utils.NotifyScopeMarker * Fluent API for creating a Notification object. */ @NotifyScopeMarker -class NotifyCreator internal constructor(private val notify: Notify, config: NotifyConfig = NotifyConfig()) { +class NotifyCreator internal constructor(private val notify: Notify) { private var meta = Payload.Meta() - private var alerts = config.defaultAlerting - private var header = config.defaultHeader.copy() + private var alerts = Notify.defaultConfig.defaultAlerting + private var header = Notify.defaultConfig.defaultHeader.copy() private var content: Payload.Content = Payload.Content.Default() private var actions: ArrayList? = null private var stackable: Payload.Stackable? = null diff --git a/library/src/main/java/io/karn/notify/entities/NotifyConfig.kt b/library/src/main/java/io/karn/notify/entities/NotifyConfig.kt index e062737..41d1d9e 100644 --- a/library/src/main/java/io/karn/notify/entities/NotifyConfig.kt +++ b/library/src/main/java/io/karn/notify/entities/NotifyConfig.kt @@ -1,3 +1,27 @@ +/* + * MIT License + * + * Copyright (c) 2018 Karn Saheb + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + package io.karn.notify.entities import android.app.NotificationManager diff --git a/library/src/main/java/io/karn/notify/entities/Payload.kt b/library/src/main/java/io/karn/notify/entities/Payload.kt index 7e99967..bace5ae 100644 --- a/library/src/main/java/io/karn/notify/entities/Payload.kt +++ b/library/src/main/java/io/karn/notify/entities/Payload.kt @@ -1,3 +1,27 @@ +/* + * MIT License + * + * Copyright (c) 2018 Karn Saheb + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + package io.karn.notify.entities import android.app.PendingIntent @@ -108,11 +132,13 @@ sealed class Payload { */ @ColorInt var lightColor: Int = Notify.NO_LIGHTS, /** - * Vibration pattern for notification on this notifyChannel. + * Vibration pattern for notification on this notifyChannel. This is only set on + * notifications with importance that is at least [Notify.IMPORTANCE_NORMAL] or higher. */ var vibrationPattern: List = ArrayList(), /** - * A custom notification sound if any. + * A custom notification sound if any. This is only set on notifications with importance + * that is at least [Notify.IMPORTANCE_NORMAL] or higher. */ var sound: Uri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION) ) diff --git a/library/src/main/java/io/karn/notify/internal/NotificationChannelInterop.kt b/library/src/main/java/io/karn/notify/internal/NotificationChannelInterop.kt index 0c2eee2..38d5eed 100644 --- a/library/src/main/java/io/karn/notify/internal/NotificationChannelInterop.kt +++ b/library/src/main/java/io/karn/notify/internal/NotificationChannelInterop.kt @@ -1,3 +1,27 @@ +/* + * MIT License + * + * Copyright (c) 2018 Karn Saheb + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + package io.karn.notify.internal import android.annotation.SuppressLint @@ -25,7 +49,7 @@ internal object NotificationChannelInterop { // Create the NotificationChannel, but only on API 26+ because // the NotificationChannel class is new and not in the support library - val channel = NotificationChannel(alerting.channelKey, alerting.channelName, alerting.channelImportance + 2).apply { + val channel = NotificationChannel(alerting.channelKey, alerting.channelName, alerting.channelImportance + 3).apply { description = alerting.channelDescription // Set the lockscreen visibility. diff --git a/library/src/main/java/io/karn/notify/internal/NotificationInterop.kt b/library/src/main/java/io/karn/notify/internal/NotificationInterop.kt index b07ef1b..c43148e 100644 --- a/library/src/main/java/io/karn/notify/internal/NotificationInterop.kt +++ b/library/src/main/java/io/karn/notify/internal/NotificationInterop.kt @@ -1,3 +1,27 @@ +/* + * MIT License + * + * Copyright (c) 2018 Karn Saheb + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + package io.karn.notify.internal import android.app.NotificationManager @@ -147,7 +171,7 @@ internal object NotificationInterop { // Attach alerting options. payload.alerting.apply { - // Register the default alerting. + // Register the default alerting. Applies channel configuration on API >= 26. NotificationChannelInterop.with(this) // The visibility of the notification on the lockscreen. @@ -158,18 +182,29 @@ internal object NotificationInterop { builder.setLights(lightColor, 500, 2000) } - // The vibration pattern. - vibrationPattern - .takeIf { it.isNotEmpty() } - ?.also { - builder.setVibrate(it.toLongArray()) - } + // Manual specification of the priority. According to the documentation, this is only + // one of the factors that affect the notifications priority and that this behaviour may + // differ on different platforms. + // It seems that the priority is also affected by the sound that is set for the + // notification as such we'll wrap the behaviour of the sound and also of the vibration + // to prevent the notification from being reclassified to a different priority. + // This doesn't seem to be the case for API >= 26, however, a future PR should tackle + // API nuances and ensure that behaviour has been tested. + // TODO: Test API nuances. + builder.priority = channelImportance - // A custom alerting sound. - builder.setSound(sound) + // If the notification's importance is normal or greater then we configure + if (channelImportance >= Notify.IMPORTANCE_NORMAL) { + // The vibration pattern. + vibrationPattern + .takeIf { it.isNotEmpty() } + ?.also { + builder.setVibrate(it.toLongArray()) + } - // Manual specification of the priority. - builder.priority = channelImportance + // A custom alerting sound. + builder.setSound(sound) + } } var style: NotificationCompat.Style? = null diff --git a/library/src/main/java/io/karn/notify/internal/NotifyExtender.kt b/library/src/main/java/io/karn/notify/internal/NotifyExtender.kt index 662ab35..374c084 100644 --- a/library/src/main/java/io/karn/notify/internal/NotifyExtender.kt +++ b/library/src/main/java/io/karn/notify/internal/NotifyExtender.kt @@ -1,3 +1,27 @@ +/* + * MIT License + * + * Copyright (c) 2018 Karn Saheb + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + package io.karn.notify.internal import android.os.Bundle diff --git a/library/src/main/java/io/karn/notify/internal/RawNotification.kt b/library/src/main/java/io/karn/notify/internal/RawNotification.kt index 574acb6..7fc6144 100644 --- a/library/src/main/java/io/karn/notify/internal/RawNotification.kt +++ b/library/src/main/java/io/karn/notify/internal/RawNotification.kt @@ -1,3 +1,27 @@ +/* + * MIT License + * + * Copyright (c) 2018 Karn Saheb + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + package io.karn.notify.internal import io.karn.notify.entities.Payload diff --git a/library/src/main/java/io/karn/notify/internal/utils/Aliases.kt b/library/src/main/java/io/karn/notify/internal/utils/Aliases.kt index 51c9a03..5a85262 100644 --- a/library/src/main/java/io/karn/notify/internal/utils/Aliases.kt +++ b/library/src/main/java/io/karn/notify/internal/utils/Aliases.kt @@ -1,3 +1,27 @@ +/* + * MIT License + * + * Copyright (c) 2018 Karn Saheb + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + package io.karn.notify.internal.utils import androidx.core.app.NotificationCompat diff --git a/library/src/main/java/io/karn/notify/internal/utils/Annotations.kt b/library/src/main/java/io/karn/notify/internal/utils/Annotations.kt index 1b40ef7..411a409 100644 --- a/library/src/main/java/io/karn/notify/internal/utils/Annotations.kt +++ b/library/src/main/java/io/karn/notify/internal/utils/Annotations.kt @@ -1,3 +1,27 @@ +/* + * MIT License + * + * Copyright (c) 2018 Karn Saheb + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + package io.karn.notify.internal.utils import androidx.annotation.IntDef diff --git a/library/src/main/java/io/karn/notify/internal/utils/Errors.kt b/library/src/main/java/io/karn/notify/internal/utils/Errors.kt index ae3f47b..f42dea2 100644 --- a/library/src/main/java/io/karn/notify/internal/utils/Errors.kt +++ b/library/src/main/java/io/karn/notify/internal/utils/Errors.kt @@ -1,3 +1,27 @@ +/* + * MIT License + * + * Copyright (c) 2018 Karn Saheb + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + package io.karn.notify.internal.utils internal object Errors { diff --git a/library/src/main/java/io/karn/notify/internal/utils/Utils.kt b/library/src/main/java/io/karn/notify/internal/utils/Utils.kt index 2e26d38..62b341c 100644 --- a/library/src/main/java/io/karn/notify/internal/utils/Utils.kt +++ b/library/src/main/java/io/karn/notify/internal/utils/Utils.kt @@ -1,3 +1,27 @@ +/* + * MIT License + * + * Copyright (c) 2018 Karn Saheb + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + package io.karn.notify.internal.utils import android.text.Html diff --git a/library/src/main/res/drawable/ic_android_black.xml b/library/src/main/res/drawable/ic_android_black.xml index 401cbf6..3421298 100644 --- a/library/src/main/res/drawable/ic_android_black.xml +++ b/library/src/main/res/drawable/ic_android_black.xml @@ -1,3 +1,27 @@ + + + + + diff --git a/sample/src/main/java/presentation/MainActivity.kt b/sample/src/main/java/presentation/MainActivity.kt index 596405c..955eef5 100644 --- a/sample/src/main/java/presentation/MainActivity.kt +++ b/sample/src/main/java/presentation/MainActivity.kt @@ -1,3 +1,27 @@ +/* + * MIT License + * + * Copyright (c) 2018 Karn Saheb + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + package presentation import android.graphics.BitmapFactory diff --git a/sample/src/main/res/drawable-v21/default_button_filled.xml b/sample/src/main/res/drawable-v21/default_button_filled.xml index e96b949..71f6b8f 100644 --- a/sample/src/main/res/drawable-v21/default_button_filled.xml +++ b/sample/src/main/res/drawable-v21/default_button_filled.xml @@ -1,4 +1,28 @@ + + diff --git a/sample/src/main/res/drawable-v21/default_button_outline.xml b/sample/src/main/res/drawable-v21/default_button_outline.xml index cfd1925..5990b0b 100644 --- a/sample/src/main/res/drawable-v21/default_button_outline.xml +++ b/sample/src/main/res/drawable-v21/default_button_outline.xml @@ -1,4 +1,28 @@ + + diff --git a/sample/src/main/res/drawable/default_button_filled.xml b/sample/src/main/res/drawable/default_button_filled.xml index 518ee05..14c5b2e 100644 --- a/sample/src/main/res/drawable/default_button_filled.xml +++ b/sample/src/main/res/drawable/default_button_filled.xml @@ -1,4 +1,28 @@ + + diff --git a/sample/src/main/res/drawable/default_button_outline.xml b/sample/src/main/res/drawable/default_button_outline.xml index 7697d2e..80bd2b3 100644 --- a/sample/src/main/res/drawable/default_button_outline.xml +++ b/sample/src/main/res/drawable/default_button_outline.xml @@ -1,4 +1,28 @@ + + diff --git a/sample/src/main/res/drawable/ic_notify_logo.xml b/sample/src/main/res/drawable/ic_notify_logo.xml index de9dcd3..1489c56 100644 --- a/sample/src/main/res/drawable/ic_notify_logo.xml +++ b/sample/src/main/res/drawable/ic_notify_logo.xml @@ -1,3 +1,27 @@ + + + + + + #4A90E2 #326299 diff --git a/sample/src/main/res/values/strings.xml b/sample/src/main/res/values/strings.xml index 05cf1ad..03c3072 100644 --- a/sample/src/main/res/values/strings.xml +++ b/sample/src/main/res/values/strings.xml @@ -1,3 +1,27 @@ + + Notify diff --git a/sample/src/main/res/values/styles.xml b/sample/src/main/res/values/styles.xml index e5b67d5..1e71fa3 100644 --- a/sample/src/main/res/values/styles.xml +++ b/sample/src/main/res/values/styles.xml @@ -1,3 +1,27 @@ + +