Skip to content

Commit

Permalink
update assignment, transient
Browse files Browse the repository at this point in the history
  • Loading branch information
Francesco Cannizzaro committed Sep 2, 2017
1 parent f6cbbd4 commit 89e34f2
Show file tree
Hide file tree
Showing 11 changed files with 20 additions and 19 deletions.
2 changes: 1 addition & 1 deletion .idea/misc.xml

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

4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ android {

dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
implementation 'com.android.support:appcompat-v7:26.0.1'
implementation 'com.android.support:appcompat-v7:26.0.2'
implementation 'org.jsoup:jsoup:1.10.3'
implementation 'com.android.support:recyclerview-v7:26.0.1'
implementation 'com.android.support:recyclerview-v7:26.0.2'
implementation 'net.idik:slimadapter:2.1.2'
implementation 'com.squareup.picasso:picasso:2.5.2'
compile project(path: ':library')
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

buildscript {
ext.kotlin_version = '1.1.4-2'
ext.kotlin_version = '1.1.4-3'
repositories {
google()
jcenter()
Expand Down
4 changes: 2 additions & 2 deletions library/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ android {
defaultConfig {
minSdkVersion 14
targetSdkVersion 26
versionCode 4
versionName "1.0.4"
versionCode 5
versionName "1.0.5"
}
buildTypes {
release {
Expand Down
3 changes: 2 additions & 1 deletion library/src/main/java/com/fcannizzaro/ksoup/IKsoup.kt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ import kotlin.properties.Delegates

open class IKsoup(var query: String = "") {

var element by Delegates.notNull<Element>()
@Transient
var element: Element? = null

open fun afterBind() {
// called after element is bound.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ class bindAttr(private val query: String, private val attr: String, private val

operator fun getValue(ref: IKsoup, property: KProperty<*>): String? {

if (!assigned) {
if (!assigned && ref.element != null) {
assigned = true
value = extractAttr(ref.element, query, attr, trim)
value = extractAttr(ref.element!!, query, attr, trim)
}

return value
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ class bindClass(private val instance: IKsoup, private val parent: IKsoup) {

element = parent.element

if (query.isNotEmpty()) {
element = element.select(query).first()
if (query.isNotEmpty() && element != null) {
element = element!!.select(query).first()
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ class bindImage(private val query: String, private val trim: Boolean = true) {

operator fun getValue(ref: IKsoup, property: KProperty<*>): String? {

if (!assigned) {
if (!assigned && ref.element != null) {
assigned = true
value = extractImage(ref.element, query, trim)
value = extractImage(ref.element!!, query, trim)
}

return value
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ class bindLink(private val query: String, private val trim: Boolean = true) {

operator fun getValue(ref: IKsoup, property: KProperty<*>): String? {

if (!assigned) {
if (!assigned && ref.element != null) {
assigned = true
value = extractLink(ref.element, query, trim)
value = extractLink(ref.element!!, query, trim)
}

return value
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ class bindList(private val clazz: IKsoup) {

operator fun <T> getValue(ref: IKsoup, property: KProperty<*>): List<T> {

if (!assigned) {
if (!assigned && ref.element != null) {
assigned = true
value = extractList(ref.element, clazz)
value = extractList(ref.element!!, clazz)
}

return value as List<T>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ class bindText(private var query: String, private val trim: Boolean = true) {

operator fun getValue(ref: IKsoup, property: KProperty<*>): String? {

if (!assigned) {
if (!assigned && ref.element != null) {
assigned = true
value = extractText(ref.element, query, trim)
value = extractText(ref.element!!, query, trim)
}

return value
Expand Down

0 comments on commit 89e34f2

Please sign in to comment.