Skip to content
This repository has been archived by the owner on Dec 26, 2022. It is now read-only.

1.1.0 dev #5

Merged
merged 3 commits into from
Aug 9, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,23 @@

##### Breaking

## 1.1.0

##### Enhancements

* issue4 - Remove PMD
[isuPatches]("https://github.com/isuPatches") [#4]("https://github.com/isuPatches/android-viewglu/issues/4")

* issue3 - Update applicationId
[isuPatches]("https://github.com/isuPatches") [#3]("https://github.com/isuPatches/android-viewglu/issues/3")

* issue2 - Support normal (non-AppCompat) Activity
[isuPatches]("https://github.com/isuPatches") [#2]("https://github.com/isuPatches/android-viewglu/issues/2")

##### Bug Fixes

##### Breaking

## 1.0.0

Initial release
7 changes: 5 additions & 2 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ android {
buildToolsVersion = BuildVersions.BUILD_TOOLS

defaultConfig {
applicationId = "com.isupatches.android.viewbinding.delegates.sample"
applicationId = "com.isupatches.android.viewglu.sample"

minSdk = BuildVersions.MIN_SDK
targetSdk = BuildVersions.TARGET_SDK
Expand Down Expand Up @@ -98,8 +98,11 @@ android {
}

dependencies {
/*
* Toggle these to test release binary vs. source code
*/
// implementation(project(":viewglu"))
implementation("com.isupatches.android:viewglu:0.1.0-SNAPSHOT") {
implementation("com.isupatches.android:viewglu:1.0.0") {
isChanging = true
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ object Versions {
const val DEXCOUNT: String = "2.1.0-RC01"
const val KTLINT_PLUGIN: String = "10.1.0"
const val KTLINT: String = "0.41.0"
const val PMD: String = "6.36.0"

// Documentation
const val DOKKA: String = "1.5.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@

| Name | Summary |
|---|---|
| [paste](paste.md) | [androidJvm]<br>fun <[VIEW_BINDING](paste.md)> [Fragment](https://developer.android.com/reference/kotlin/androidx/fragment/app/Fragment.html).[paste](paste.md)(): [ReadWriteProperty](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.properties/-read-write-property/index.html)<[Fragment](https://developer.android.com/reference/kotlin/androidx/fragment/app/Fragment.html), [VIEW_BINDING](paste.md)><br> Description<br>Helps manage the ViewBinding for a [Fragment](https://developer.android.com/reference/kotlin/androidx/fragment/app/Fragment.html) so that it is properly destroyed and not leaked.<br>[androidJvm]<br>inline fun <[VIEW_BINDING](paste.md) : ViewBinding> [AppCompatActivity](https://developer.android.com/reference/kotlin/androidx/appcompat/app/AppCompatActivity.html).[paste](paste.md)(crossinline bindingInflater: ([LayoutInflater](https://developer.android.com/reference/kotlin/android/view/LayoutInflater.html)) -> [VIEW_BINDING](paste.md)): [Lazy](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-lazy/index.html)<[VIEW_BINDING](paste.md)><br> Description<br>Helps to apply a ViewBinding to an [AppCompatActivity](https://developer.android.com/reference/kotlin/androidx/appcompat/app/AppCompatActivity.html) by invoking the inflater. |
| [paste](paste.md) | [androidJvm]<br>fun <[VIEW_BINDING](paste.md)> [Fragment](https://developer.android.com/reference/kotlin/androidx/fragment/app/Fragment.html).[paste](paste.md)(): [ReadWriteProperty](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.properties/-read-write-property/index.html)<[Fragment](https://developer.android.com/reference/kotlin/androidx/fragment/app/Fragment.html), [VIEW_BINDING](paste.md)><br> Description<br>Helps manage the ViewBinding for a [Fragment](https://developer.android.com/reference/kotlin/androidx/fragment/app/Fragment.html) so that it is properly destroyed and not leaked.<br>[androidJvm]<br>inline fun <[VIEW_BINDING](paste.md) : ViewBinding> [Activity](https://developer.android.com/reference/kotlin/android/app/Activity.html).[paste](paste.md)(crossinline bindingInflater: ([LayoutInflater](https://developer.android.com/reference/kotlin/android/view/LayoutInflater.html)) -> [VIEW_BINDING](paste.md)): [Lazy](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-lazy/index.html)<[VIEW_BINDING](paste.md)><br> Description<br>Helps to apply a ViewBinding to an [Activity](https://developer.android.com/reference/kotlin/android/app/Activity.html) by invoking the inflater.<br>[androidJvm]<br>inline fun <[VIEW_BINDING](paste.md) : ViewBinding> [AppCompatActivity](https://developer.android.com/reference/kotlin/androidx/appcompat/app/AppCompatActivity.html).[paste](paste.md)(crossinline bindingInflater: ([LayoutInflater](https://developer.android.com/reference/kotlin/android/view/LayoutInflater.html)) -> [VIEW_BINDING](paste.md)): [Lazy](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-lazy/index.html)<[VIEW_BINDING](paste.md)><br> Description<br>Helps to apply a ViewBinding to an [AppCompatActivity](https://developer.android.com/reference/kotlin/androidx/appcompat/app/AppCompatActivity.html) by invoking the inflater. |
34 changes: 34 additions & 0 deletions documentation/viewglu/com.isupatches.android.viewglu/paste.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,40 @@ Patches Klinefelter

07/2021

[androidJvm]\
inline fun <[VIEW_BINDING](paste.md) : ViewBinding> [Activity](https://developer.android.com/reference/kotlin/android/app/Activity.html).[paste](paste.md)(crossinline bindingInflater: ([LayoutInflater](https://developer.android.com/reference/kotlin/android/view/LayoutInflater.html)) -> [VIEW_BINDING](paste.md)): [Lazy](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-lazy/index.html)<[VIEW_BINDING](paste.md)>

#### Description

Helps to apply a ViewBinding to an [Activity](https://developer.android.com/reference/kotlin/android/app/Activity.html) by invoking the inflater.

#### Notes

<ul><li>Uses the activity's layout inflater</li><li>The [LazyThreadSafetyMode](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-lazy-thread-safety-mode/index.html) is set to NONE</li><li>Still requires the activity to apply the inflated binding</li></ul>

#### Example Usage

<pre><code>
private val binding: ActivityMainBinding by paste(ActivityMainBinding::inflate)

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(binding.root)
}
</code></pre>

#### Return

Lazy<ViewBinding>

#### Author

Patches Klinefelter

#### Since

08/2021

[androidJvm]\
fun <[VIEW_BINDING](paste.md)> [Fragment](https://developer.android.com/reference/kotlin/androidx/fragment/app/Fragment.html).[paste](paste.md)(): [ReadWriteProperty](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.properties/-read-write-property/index.html)<[Fragment](https://developer.android.com/reference/kotlin/androidx/fragment/app/Fragment.html), [VIEW_BINDING](paste.md)>

Expand Down
1 change: 1 addition & 0 deletions documentation/viewglu/package-list
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
$dokka.format:gfm-v1
$dokka.linkExtension:md
$dokka.location:com.isupatches.android.viewglu////PointingToDeclaration/viewglu/com.isupatches.android.viewglu/index.md
$dokka.location:com.isupatches.android.viewglu//paste/android.app.Activity#kotlin.Function1[android.view.LayoutInflater,TypeParam(bounds=[androidx.viewbinding.ViewBinding])]/PointingToDeclaration/viewglu/com.isupatches.android.viewglu/paste.md
$dokka.location:com.isupatches.android.viewglu//paste/androidx.appcompat.app.AppCompatActivity#kotlin.Function1[android.view.LayoutInflater,TypeParam(bounds=[androidx.viewbinding.ViewBinding])]/PointingToDeclaration/viewglu/com.isupatches.android.viewglu/paste.md
$dokka.location:com.isupatches.android.viewglu//paste/androidx.fragment.app.Fragment#/PointingToDeclaration/viewglu/com.isupatches.android.viewglu/paste.md
com.isupatches.android.viewglu
Expand Down
22 changes: 0 additions & 22 deletions gradle/pmd.gradle.kts

This file was deleted.

35 changes: 35 additions & 0 deletions viewglu/src/main/java/com/isupatches/android/viewglu/ViewGlu.kt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
*/
package com.isupatches.android.viewglu

import android.app.Activity
import android.view.LayoutInflater
import androidx.appcompat.app.AppCompatActivity
import androidx.fragment.app.Fragment
Expand Down Expand Up @@ -60,6 +61,40 @@ inline fun <VIEW_BINDING : ViewBinding> AppCompatActivity.paste(
}
}

/**
* #### Description
*
* Helps to apply a [ViewBinding] to an [Activity] by invoking the inflater.
*
* #### Notes
* - Uses the activity's layout inflater
* - The [LazyThreadSafetyMode] is set to NONE
* - Still requires the activity to apply the inflated binding
*
* #### Example Usage
* <pre><code>
* private val binding: ActivityMainBinding by paste(ActivityMainBinding::inflate)
*
* override fun onCreate(savedInstanceState: Bundle?) {
* super.onCreate(savedInstanceState)
* setContentView(binding.root)
* }
* </code></pre>
*
* @receiver [AppCompatActivity]
* @return Lazy<ViewBinding>
*
* @author Patches Klinefelter
* @since 08/2021
*/
inline fun <VIEW_BINDING : ViewBinding> Activity.paste(
crossinline bindingInflater: (LayoutInflater) -> VIEW_BINDING
): Lazy<VIEW_BINDING> {
return lazy(LazyThreadSafetyMode.NONE) {
bindingInflater.invoke(layoutInflater)
}
}

/**
* #### Description
*
Expand Down