Skip to content

Commit

Permalink
Update documentation with new screenshot and updated launcher icon
Browse files Browse the repository at this point in the history
  • Loading branch information
ashdavies committed Jun 10, 2018
1 parent 00dea50 commit 2c4ab2f
Show file tree
Hide file tree
Showing 25 changed files with 28 additions and 14 deletions.
18 changes: 11 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
## Droidcon Berlin 2018: Leveraging Android Databinding with Kotlin
Android databinding is considered as both a powerful toolchain, empowering your views with access to view data without the necessity to build cumbersome presenters, and conversely as an overly complex, convoluted mess of binding statements opening the door to unnecessary, irresponsible domain logic in your view layouts.
Whilst the latter of these statements can be true, databinding offers a very powerful code generation syntax, allowing you to utilise the power of the compiler to ensure that your binding statements are runtime safe. Combining this with the concise syntax afforded by Kotlin allows us to dramatically cut down on boilerplate and build complex user interfaces with relative ease.
## Droidcon Berlin 2018: Leveraging Android Data Binding with Kotlin
Android Data Binding is considered as both a powerful toolchain, empowering your views with access to view data without the necessity to build cumbersome presenters, and conversely as an overly complex, convoluted mess of binding statements opening the door to unnecessary, irresponsible domain logic in your view layouts.

Whilst the latter of these statements can be true, data binding offers a very powerful code generation syntax, allowing you to utilise the power of the compiler to ensure that your binding statements are runtime safe. Combining this with the concise syntax afforded by Kotlin allows us to dramatically cut down on boilerplate and build complex user interfaces with relative ease.

In this talk, you can learn how to utilise extension bindings and property delegates with your layouts, and manage your screen state transformations with true, and safe two-way binding, allowing you to build a fully reactive observable view layout.

## Project
An example application for the Android Data Binding library, implementing retrofit to fetch a list of repositories and update a RecyclerView using the binding methods to display each repository as a view component.
Enter a GitHub username in the ActionBar SearchView component to trigger the observable request, the application uses Retrofit to query the open GitHub api for repositories, results are returned in the RecyclerView with data bindigs.
An example application for the Android Data Binding library, making use of Retrofit, Coroutines, Moshi, and Android Jetpack components, to fetch a list of GitHub repositories and update a RecyclerView using the binding methods to display each repository as a view component.

Enter a GitHub username in the ActionBar SearchView component to trigger the observable request, the application uses Retrofit to query the open GitHub api for repositories, results are returned in the RecyclerView with data bindings.

![device-2015-06-02-145653](https://cloud.githubusercontent.com/assets/1892070/7936230/c3141dc0-0937-11e5-9463-35d8cb06092a.png)
![device-2018-06-10-200109](https://github.com/ashdavies/data-binding/raw/master/art/device-2018-06-10-200109.png)
![device-2018-06-10-191700](https://github.com/ashdavies/data-binding/raw/master/art/device-2018-06-10-191700.png)

## Links
- [Play Store Listing] (https://play.google.com/store/apps/details?id=com.chaos.databinding)
- [Play Store Listing](https://play.google.com/store/apps/details?id=io.ashdavies.databinding)
- [AndroidX](https://developer.android.com/topic/libraries/support-library/androidx-rn)
- [Coroutines](https://kotlinlang.org/docs/reference/coroutines.html)
- [Data Binding](https://developer.android.com/topic/libraries/data-binding/)
Expand Down
Binary file added art/device-2018-06-10-191700.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added art/device-2018-06-10-200109.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added mobile/src/main/ic_launcher-web.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@ internal class EmptyLiveData<in T>(items: LiveData<List<T>>, loading: LiveData<B
init {
addSource(items) { value = it?.isEmpty() ?: false && loading.value ?: false }
addSource(loading) { value = it ?: false && items.value?.isEmpty() ?: false }
value = true
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ internal class RepoActivity : AppCompatActivity() {
recycler.layoutManager = LinearLayoutManager(this)
recycler.itemDecorations += DividerItemDecoration(this, VERTICAL)

search.onActionViewExpanded()
//search.onActionViewExpanded()

model.items.observe(this, NotNullObserver { adapter.items = it })
model.error.observe(this, NotNullObserver(::error))
Expand Down
7 changes: 1 addition & 6 deletions mobile/src/main/res/layout/list_item.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
android:layout_margin="@dimen/activity_default_margin">

<TextView
style="@style/Base.TextAppearance.AppCompat.Large"
style="@style/Base.TextAppearance.AppCompat.Medium"
android:id="@+id/name"
android:layout_width="0dp"
android:layout_height="wrap_content"
Expand All @@ -26,7 +26,6 @@
tools:text="data-binding"/>

<TextView
style="@style/Base.TextAppearance.AppCompat.Medium"
android:id="@+id/description"
android:layout_width="0dp"
android:layout_height="wrap_content"
Expand All @@ -38,7 +37,6 @@
tools:text="Droidcon Berlin 2018: Leveraging Android Databinding with Kotlin"/>

<TextView
style="@style/Base.TextAppearance.AppCompat.Small"
android:id="@+id/updatedAt"
android:layout_width="0dp"
android:layout_height="wrap_content"
Expand All @@ -57,7 +55,6 @@
app:constraint_referenced_ids="language,stargazersCount,watchersCount"/>

<TextView
style="@style/Base.TextAppearance.AppCompat.Small"
android:id="@+id/language"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
Expand All @@ -76,7 +73,6 @@
app:layout_constraintTop_toBottomOf="@+id/language"/>

<TextView
style="@style/Base.TextAppearance.AppCompat.Small"
android:id="@+id/stargazersCount"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
Expand All @@ -98,7 +94,6 @@
app:layout_constraintTop_toBottomOf="@+id/stargazersIcon"/>

<TextView
style="@style/Base.TextAppearance.AppCompat.Small"
android:id="@+id/watchersCount"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
Expand Down
5 changes: 5 additions & 0 deletions mobile/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@color/ic_launcher_background"/>
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
</adaptive-icon>
5 changes: 5 additions & 0 deletions mobile/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@color/ic_launcher_background"/>
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
</adaptive-icon>
Binary file modified mobile/src/main/res/mipmap-hdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified mobile/src/main/res/mipmap-mdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified mobile/src/main/res/mipmap-xhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified mobile/src/main/res/mipmap-xxhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions mobile/src/main/res/values/ic_launcher_background.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="ic_launcher_background">#5264AE</color>
</resources>

0 comments on commit 2c4ab2f

Please sign in to comment.