Skip to content

Commit

Permalink
separate view bindings to Kinding-Common project
Browse files Browse the repository at this point in the history
  • Loading branch information
Benny authored and Benny committed Jan 30, 2016
1 parent 75b86ce commit 3961ce3
Show file tree
Hide file tree
Showing 27 changed files with 132 additions and 52 deletions.
8 changes: 4 additions & 4 deletions kbinding/bintrayUpload.gradle → gradle/bintrayUpload.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ def bintrayUser = properties.getProperty("bintray.user")
def bintrayApikey = properties.getProperty("bintray.apikey")

// read properties
def projectName = "KBinding"
def projectDescription = "Android MVVM framework write by kotlin"
def projectGroupId = "com.benny.library"
def projectArtifactId = "KBinding"
//def projectName = "KBinding"
//def projectDescription = "Android MVVM framework write by kotlin"
//def projectGroupId = "com.benny.library"
//def projectArtifactId = "KBinding"
def projectVersionName = android.defaultConfig.versionName
def projectPackaging = "aar"
def projectSiteUrl = "https://github.com/BennyWang/KBinding"
Expand Down
2 changes: 2 additions & 0 deletions kbinding-common/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/build
*.iml
51 changes: 51 additions & 0 deletions kbinding-common/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
buildscript {
repositories {
mavenCentral()
}
dependencies {
}
}

apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'

android {
compileSdkVersion 23
buildToolsVersion "23.0.2"

defaultConfig {
minSdkVersion 14
targetSdkVersion 23
versionCode 2
versionName "0.1.1"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
lintOptions {
abortOnError false
}
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile project(':kbinding')

compile 'com.jakewharton.rxbinding:rxbinding:0.3.0'
}
repositories {
mavenCentral()
}

ext.projectName = "KBinding-Common"
ext.projectDescription = "Common Bindings for KBinding"
ext.projectGroupId = "com.benny.library"
ext.projectArtifactId = "KBinding"

apply from: rootProject.file('gradle/bintrayUpload.gradle')
17 changes: 17 additions & 0 deletions kbinding-common/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in /Users/benny/Development/Homebrew/opt/android-sdk/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the proguardFiles
# directive in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html

# Add any project specific keep options here:

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
1 change: 1 addition & 0 deletions kbinding-common/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<manifest package="com.benny.library.kbinding.common" />
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.benny.library.kbinding.dsl
package com.benny.library.common

import android.content.Context
import android.content.res.Resources
import android.graphics.*
import android.graphics.drawable.*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.benny.library.kbinding.dsl
package com.benny.library.common

import android.view.View
import android.view.ViewManager
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
@file:Suppress("UNUSED_PARAMETER")

package com.benny.library.kbinding.dsl
package com.benny.library.common.bindings

import android.support.v7.widget.RecyclerView
import android.widget.ListAdapter
import android.widget.ListView
import rx.Observable
import rx.functions.Action1

import com.benny.library.kbinding.bind.*
import com.benny.library.kbinding.converter.*
import com.benny.library.common.bindings.utils.AdapterViewPagingOnSubscribe
import com.benny.library.kbinding.adapter.AdapterPagingListener
import com.benny.library.kbinding.adapter.BaseListAdapter
import com.benny.library.kbinding.adapter.BaseRecyclerPagingAdapter
import com.benny.library.kbinding.bind.*
import com.benny.library.kbinding.converter.*
import com.benny.library.kbinding.dsl.utils.AdapterViewPagingOnSubscribe
import com.jakewharton.rxbinding.widget.RxAdapterView

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@file:Suppress("UNUSED_PARAMETER")

package com.benny.library.kbinding.dsl
package com.benny.library.common.bindings

import android.net.Uri
import android.widget.ImageView
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@file:Suppress("UNUSED_PARAMETER")

package com.benny.library.kbinding.dsl
package com.benny.library.common.bindings

import android.widget.RadioGroup
import com.benny.library.kbinding.bind.*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,25 @@
@file:Suppress("UNUSED_PARAMETER")

package com.benny.library.kbinding.dsl
package com.benny.library.common.bindings

import android.widget.TextView
import rx.Observable
import com.benny.library.kbinding.bind.*
import com.benny.library.kbinding.converter.*
import com.jakewharton.rxbinding.widget.RxTextView
import org.jetbrains.anko.AnkoException

/**
* Created by benny on 12/16/15.
*/
var TextView.textWeight: Int
get() = throw AnkoException("'android.widget.TextView.textWeight' property does not have a getter")
set(v) = setTypeface(typeface, v)

var TextView.textColorResource: Int
get() = throw AnkoException("'android.widget.TextView.textWeight' property does not have a getter")
set(v) = setTextColor(context.resources.getColor(v))

fun TextView.textChanges(): Observable<String> = RxTextView.textChanges(this).map { it.toString() }.skip(1)

//For TextView
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@file:Suppress("UNUSED_PARAMETER")

package com.benny.library.kbinding.dsl
package com.benny.library.common.bindings

import android.graphics.drawable.Drawable
import android.view.View
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.benny.library.kbinding.dsl.utils
package com.benny.library.common.bindings.utils

import android.view.View
import com.benny.library.kbinding.adapter.AdapterPagingListener
Expand Down
8 changes: 6 additions & 2 deletions kbinding/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ dependencies {

compile 'io.reactivex:rxjava:1.0.14'
compile 'io.reactivex:rxandroid:1.0.1'
compile 'com.jakewharton.rxbinding:rxbinding:0.3.0'

compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
compile "org.jetbrains.anko:anko-common:$anko_version"
Expand All @@ -53,4 +52,9 @@ repositories {
mavenCentral()
}

apply from: "bintrayUpload.gradle"
ext.projectName = "KBinding"
ext.projectDescription = "Android MVVM framework write by kotlin"
ext.projectGroupId = "com.benny.library"
ext.projectArtifactId = "KBinding"

apply from: rootProject.file('gradle/bintrayUpload.gradle')
2 changes: 1 addition & 1 deletion kbinding/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.benny.library.kbinding" />
<manifest package="com.benny.library.kbinding" />
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,3 @@ fun <T> AnkoContext<T>.inflate(viewComponent: ViewComponent, parent: ViewGroup,
view
}
}

var TextView.textWeight: Int
get() = throw AnkoException("'android.widget.TextView.textWeight' property does not have a getter")
set(v) = setTypeface(typeface, v)

var TextView.textColorResource: Int
get() = throw AnkoException("'android.widget.TextView.textWeight' property does not have a getter")
set(v) = setTextColor(context.resources.getColor(v))
1 change: 1 addition & 0 deletions sample/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ android {
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile project(':kbinding')
compile project(':kbinding-common')
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
compile 'com.android.support:gridlayout-v7:23.1.1'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,8 @@ import android.content.Context
import android.graphics.Color
import android.graphics.drawable.Drawable
import com.benny.app.sample.R
import com.benny.library.common.roundRect
import com.benny.library.kbinding.converter.OneWayConverter
import com.benny.library.kbinding.dsl.borderRoundRect
import com.benny.library.kbinding.dsl.color
import com.benny.library.kbinding.dsl.roundRect
import org.jetbrains.anko.dip
import java.text.DecimalFormat

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,19 @@ import android.os.Bundle
import android.support.v7.widget.Toolbar
import android.text.TextUtils
import android.view.Gravity
import com.benny.app.sample.R
import com.benny.app.sample.extension.progressBar
import com.benny.app.sample.network.service.caishuo.CaishuoService
import com.benny.app.sample.network.service.douban.DoubanService
import com.benny.app.sample.ui.extension.simpleDraweeView
import com.benny.app.sample.viewcomponent.TitleToolBarViewComponent
import com.benny.app.sample.viewcomponent.stock.StockInfoUI
import com.benny.app.sample.viewmodel.MovieViewModel
import com.benny.app.sample.viewmodel.StockViewModel
import org.jetbrains.anko.*
import org.jetbrains.anko.design.appBarLayout
import com.benny.library.kbinding.converter.StringConverter
import com.benny.library.kbinding.dsl.*
import com.benny.library.kbinding.view.ViewBinderComponent
import com.benny.library.kbinding.view.setContentView
import org.jetbrains.anko.*
import org.jetbrains.anko.appcompat.v7.toolbar
import org.jetbrains.anko.design.appBarLayout
import com.benny.library.common.bindings.*

import com.benny.app.sample.extension.progressBar
import com.benny.app.sample.network.service.douban.DoubanService
import com.benny.app.sample.ui.extension.simpleDraweeView
import com.benny.app.sample.viewcomponent.TitleToolBarViewComponent
import com.benny.app.sample.viewmodel.MovieViewModel
/**
* Created by benny on 12/30/15.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@ import android.graphics.Color
import android.os.Bundle
import android.support.v7.widget.Toolbar
import android.view.Gravity
import com.benny.app.sample.R
import com.benny.app.sample.extension.progressBar
import com.benny.app.sample.network.service.caishuo.CaishuoService
import com.benny.app.sample.viewcomponent.stock.StockInfoUI
import com.benny.app.sample.viewmodel.StockViewModel
import com.benny.library.common.bindings.fadeOut
import com.benny.library.common.bindings.until
import com.benny.library.kbinding.dsl.*
import com.benny.library.kbinding.view.ViewBinderComponent
import com.benny.library.kbinding.view.setContentView
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ import com.benny.app.sample.R
import org.jetbrains.anko.*

import com.benny.app.sample.viewmodel.LoginViewModel
import com.benny.library.common.bindings.*
import com.benny.library.common.borderRoundRect
import com.benny.library.common.stateList
import com.benny.library.common.viewStyle
import com.benny.library.common.style

import com.benny.library.kbinding.bind.BindingDelegate
import com.benny.library.kbinding.bind.BindingMode
import com.benny.library.kbinding.bind.Command
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,21 @@ import android.view.Gravity
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import com.benny.app.sample.extension.progressBar
import com.benny.app.sample.network.service.douban.DoubanService
import com.benny.app.sample.network.service.douban.model.Movie
import com.benny.app.sample.ui.activity.MovieDetailsActivity
import com.benny.app.sample.ui.activity.StockDetailsActivity
import com.benny.app.sample.viewcomponent.MovieItemView
import com.benny.library.kbinding.converter.ListToAdapterConverter
import com.benny.library.kbinding.view.ViewBinderComponent
import com.benny.app.sample.viewmodel.MovieViewModel
import com.benny.library.kbinding.view.ViewBinderComponent
import com.benny.library.common.bindings.*
import com.benny.library.kbinding.bind.BindingDelegate
import com.benny.library.kbinding.bind.Command
import com.benny.library.kbinding.converter.ListToAdapterConverter
import com.benny.library.kbinding.dsl.*
import org.jetbrains.anko.*
import org.jetbrains.anko.support.v4.act
import org.jetbrains.anko.support.v4.startActivity

import com.benny.app.sample.extension.progressBar
/**
* Created by benny on 1/28/16.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import android.util.Log
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import com.benny.app.sample.SampleApplication
import org.jetbrains.anko.*
import org.jetbrains.anko.support.v4.act
import com.benny.library.kbinding.view.ViewBinderComponent
Expand All @@ -15,12 +14,11 @@ import com.benny.app.sample.network.service.caishuo.CaishuoService
import com.benny.app.sample.ui.activity.StockDetailsActivity
import com.benny.app.sample.viewcomponent.StockItemView
import com.benny.app.sample.viewmodel.StockViewModel
import com.benny.library.common.bindings.*
import com.benny.library.kbinding.bind.BindingDelegate
import com.benny.library.kbinding.bind.Command
import com.benny.library.kbinding.converter.ListToAdapterConverter
import com.benny.library.kbinding.dsl.adapter
import com.benny.library.kbinding.dsl.bind
import com.benny.library.kbinding.dsl.itemClick
import org.jetbrains.anko.support.v4.startActivity

class StockFragment : BaseFragment() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ import com.benny.app.sample.converter.StockPriceConverter
import com.benny.app.sample.extension.generateViewId
import com.benny.app.sample.network.service.caishuo.model.Stock
import com.benny.app.sample.ui.extension.simpleDraweeView
import com.benny.library.common.bindings.*
import com.benny.library.common.roundRect
import com.benny.library.kbinding.converter.MultipleConverter
import com.benny.library.kbinding.converter.StringConverter
import com.benny.library.kbinding.dsl.*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import com.benny.app.sample.R
import com.benny.app.sample.converter.StockPriceChangeConverter
import com.benny.app.sample.converter.StockPriceConverter
import com.benny.app.sample.converter.TagBackgroundConverter
import com.benny.library.common.bindings.*
import org.jetbrains.anko.*

import com.benny.library.kbinding.view.ViewBinderComponent
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ import com.benny.app.sample.converter.StockPriceChangeConverter
import com.benny.app.sample.converter.StockPriceChangePercentageConverter
import com.benny.app.sample.converter.StockPriceConverter
import com.benny.app.sample.network.service.caishuo.model.MarketType
import com.benny.library.common.viewStyle
import com.benny.library.common.style
import com.benny.library.common.bindings.*
import com.benny.library.kbinding.converter.EmptyOneWayConverter
import com.benny.library.kbinding.converter.OneWayConverter
import com.benny.library.kbinding.dsl.*
Expand Down
2 changes: 1 addition & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
@@ -1 +1 @@
include ':kbinding', ':sample'
include ':kbinding', ':kbinding-common', ':sample'

0 comments on commit 3961ce3

Please sign in to comment.