Skip to content
Permalink
Browse files

Extract binding adapters

  • Loading branch information...
chrisbanes committed Jul 26, 2019
1 parent 0c04f97 commit e21a8e8e2477026b5f0bd9d6aeace0d442dcd987
@@ -13,6 +13,7 @@
<option value="$PROJECT_DIR$/base" />
<option value="$PROJECT_DIR$/base-android" />
<option value="$PROJECT_DIR$/buildSrc" />
<option value="$PROJECT_DIR$/common-databinding" />
<option value="$PROJECT_DIR$/common-epoxy" />
<option value="$PROJECT_DIR$/common-glide" />
<option value="$PROJECT_DIR$/common-layouts" />
@@ -6,20 +6,18 @@
<module fileurl="file://$PROJECT_DIR$/base/base.iml" filepath="$PROJECT_DIR$/base/base.iml" />
<module fileurl="file://$PROJECT_DIR$/base-android/base-android.iml" filepath="$PROJECT_DIR$/base-android/base-android.iml" />
<module fileurl="file://$PROJECT_DIR$/buildSrc/buildSrc.iml" filepath="$PROJECT_DIR$/buildSrc/buildSrc.iml" />
<module fileurl="file://$PROJECT_DIR$/common-databinding/common-databinding.iml" filepath="$PROJECT_DIR$/common-databinding/common-databinding.iml" />
<module fileurl="file://$PROJECT_DIR$/common-epoxy/common-epoxy.iml" filepath="$PROJECT_DIR$/common-epoxy/common-epoxy.iml" />
<module fileurl="file://$PROJECT_DIR$/common-glide/common-glide.iml" filepath="$PROJECT_DIR$/common-glide/common-glide.iml" />
<module fileurl="file://$PROJECT_DIR$/common-layouts/common-layouts.iml" filepath="$PROJECT_DIR$/common-layouts/common-layouts.iml" />
<module fileurl="file://$PROJECT_DIR$/common-ui/common-ui.iml" filepath="$PROJECT_DIR$/common-ui/common-ui.iml" />
<module fileurl="file://$PROJECT_DIR$/data/data.iml" filepath="$PROJECT_DIR$/data/data.iml" />
<module fileurl="file://$PROJECT_DIR$/data-android/data-android.iml" filepath="$PROJECT_DIR$/data-android/data-android.iml" />
<module fileurl="file://$PROJECT_DIR$/discover/dev-tivi-discover.iml" filepath="$PROJECT_DIR$/discover/dev-tivi-discover.iml" />
<module fileurl="file://$PROJECT_DIR$/discover/discover.iml" filepath="$PROJECT_DIR$/discover/discover.iml" />
<module fileurl="file://$PROJECT_DIR$/epoxy-utils/epoxy-utils.iml" filepath="$PROJECT_DIR$/epoxy-utils/epoxy-utils.iml" />
<module fileurl="file://$PROJECT_DIR$/interactors/interactors.iml" filepath="$PROJECT_DIR$/interactors/interactors.iml" />
<module fileurl="file://$PROJECT_DIR$/tasks/tasks.iml" filepath="$PROJECT_DIR$/tasks/tasks.iml" />
<module fileurl="file://$PROJECT_DIR$/tivi.iml" filepath="$PROJECT_DIR$/tivi.iml" />
<module fileurl="file://$PROJECT_DIR$/discover/tivi-discover.iml" filepath="$PROJECT_DIR$/discover/tivi-discover.iml" />
<module fileurl="file://$PROJECT_DIR$/epoxy-utils/tivi-epoxy-utils.iml" filepath="$PROJECT_DIR$/epoxy-utils/tivi-epoxy-utils.iml" />
<module fileurl="file://$PROJECT_DIR$/tmdb/tmdb.iml" filepath="$PROJECT_DIR$/tmdb/tmdb.iml" />
<module fileurl="file://$PROJECT_DIR$/trakt/trakt.iml" filepath="$PROJECT_DIR$/trakt/trakt.iml" />
<module fileurl="file://$PROJECT_DIR$/trakt-auth/trakt-auth.iml" filepath="$PROJECT_DIR$/trakt-auth/trakt-auth.iml" />
@@ -164,6 +164,7 @@ dependencies {
implementation project(":common-epoxy")
implementation project(":common-layouts")
implementation project(":common-glide")
implementation project(":common-databinding")
implementation project(":data")
implementation project(":data-android")
implementation project(":trakt")
@@ -75,6 +75,7 @@ object Libs {
const val palette = "androidx.palette:palette:1.0.0"
const val recyclerview = "androidx.recyclerview:recyclerview:1.1.0-alpha06"
const val emoji = "androidx.emoji:emoji:1.0.0"
const val swiperefresh = "androidx.swiperefreshlayout:swiperefreshlayout:1.1.0-alpha02"

object Navigation {
private const val version = "2.1.0-alpha05"
@@ -0,0 +1,54 @@
/*
* Copyright 2017 Google LLC
*
* 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.
*
*/

import app.tivi.buildsrc.Libs

apply plugin: 'com.android.library'

apply plugin: 'kotlin-android'

apply plugin: 'kotlin-kapt'
kapt {
correctErrorTypes = true
useBuildCache = true
}

android {
compileSdkVersion buildConfig.compileSdk

defaultConfig {
minSdkVersion buildConfig.minSdk
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}

dataBinding {
enabled = true
}
}

dependencies {
implementation project(":base")
implementation project(":data")
implementation project(":common-ui")

implementation Libs.AndroidX.swiperefresh
implementation Libs.AndroidX.coreKtx
}
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright 2019 Google LLC
~
~ 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.
-->

<manifest package="app.tivi.common.databinding">
</manifest>
@@ -14,7 +14,7 @@
* limitations under the License.
*/

package app.tivi.ui.databinding
package app.tivi.databinding

import android.content.res.Resources
import android.graphics.Outline
@@ -0,0 +1,33 @@
/*
* Copyright 2019 Google LLC
*
* 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 app.tivi.databinding

import android.view.View
import androidx.databinding.BindingMethod
import androidx.databinding.BindingMethods
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout
import app.tivi.ui.widget.PopupMenuButton

@BindingMethods(
BindingMethod(type = View::class, attribute = "outlineProviderInstance", method = "setOutlineProvider"),
BindingMethod(type = SwipeRefreshLayout::class, attribute = "isRefreshing", method = "setRefreshing"),
BindingMethod(type = View::class, attribute = "clipToOutline", method = "setClipToOutline"),
BindingMethod(type = View::class, attribute = "activated", method = "setActivated"),
BindingMethod(type = PopupMenuButton::class, attribute = "popupMenuClickListener", method = "setMenuItemClickListener"),
BindingMethod(type = PopupMenuButton::class, attribute = "popupMenuListener", method = "setPopupMenuListener")
)
class TiviBindingMethods
@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright 2019 Google LLC
~
~ 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.
-->

<!-- This is a dummy file so that data-binding actually does some generation. Without this
any dependent libraries will not see our binding adapters. -->

<layout xmlns:android="http://schemas.android.com/apk/res/android">

<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
</FrameLayout>

<data></data>
</layout>
@@ -16,5 +16,5 @@
~
-->

<manifest package="app.tivi.common.ui">
<manifest package="app.tivi.common.glide">
</manifest>
@@ -50,7 +50,9 @@ dependencies {
implementation project(":common-ui")
implementation project(":common-epoxy")
implementation project(":common-glide")
implementation project(":common-databinding")

implementation Libs.AndroidX.coreKtx
implementation Libs.AndroidX.constraintlayout
implementation Libs.Dagger.androidSupport
implementation Libs.mvRx
@@ -15,8 +15,6 @@
*/

@EpoxyDataBindingPattern(rClass = R.class, layoutPrefix = "view_holder")
package app.tivi;
package app.tivi.common.layouts;

import com.airbnb.epoxy.EpoxyDataBindingPattern;

import app.tivi.common.layouts.R;
@@ -38,10 +38,6 @@ android {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}

dataBinding {
enabled = true
}
}

dependencies {

This file was deleted.

@@ -26,14 +26,8 @@ import androidx.annotation.MenuRes
import androidx.annotation.StyleRes
import androidx.appcompat.widget.AppCompatImageButton
import androidx.appcompat.widget.PopupMenu
import androidx.databinding.BindingMethod
import androidx.databinding.BindingMethods
import app.tivi.common.ui.R

@BindingMethods(
BindingMethod(type = PopupMenuButton::class, attribute = "popupMenuClickListener", method = "setMenuItemClickListener"),
BindingMethod(type = PopupMenuButton::class, attribute = "popupMenuListener", method = "setPopupMenuListener")
)
class PopupMenuButton : AppCompatImageButton {
constructor(context: Context) : this(context, null)
constructor(context: Context, attrs: AttributeSet?) : this(context, attrs, android.R.attr.actionOverflowButtonStyle)
@@ -52,6 +52,7 @@ dependencies {
implementation project(":common-epoxy")
implementation project(":common-layouts")
implementation project(":common-glide")
implementation project(":common-databinding")

implementation Libs.AndroidX.Lifecycle.extensions
implementation Libs.AndroidX.Lifecycle.reactive
@@ -21,6 +21,7 @@ include ':common-ui'
include ':common-layouts'
include ':common-epoxy'
include ':common-glide'
include ':common-databinding'
include ':data'
include ':data-android'
include ':trakt'

0 comments on commit e21a8e8

Please sign in to comment.
You can’t perform that action at this time.