Skip to content

Commit

Permalink
Updated ReadMe
Browse files Browse the repository at this point in the history
  • Loading branch information
r_kay committed Aug 22, 2017
1 parent 03b1ec1 commit cae68b6
Show file tree
Hide file tree
Showing 20 changed files with 137 additions and 72 deletions.
Binary file modified .gradle/3.3/taskArtifacts/fileHashes.bin
Binary file not shown.
Binary file modified .gradle/3.3/taskArtifacts/fileSnapshots.bin
Binary file not shown.
Binary file modified .gradle/3.3/taskArtifacts/taskArtifacts.bin
Binary file not shown.
Binary file modified .gradle/3.3/taskArtifacts/taskArtifacts.lock
Binary file not shown.
4 changes: 2 additions & 2 deletions .idea/libraries/2_common_1_0_0_alpha5.xml

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

6 changes: 3 additions & 3 deletions .idea/libraries/2_runtime_1_0_0_alpha5.xml

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

12 changes: 12 additions & 0 deletions .idea/libraries/circleimageview_2_1_0.xml

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

2 changes: 1 addition & 1 deletion .idea/libraries/common_1_0_0_alpha5.xml

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

11 changes: 11 additions & 0 deletions .idea/libraries/dagger_2_11.xml

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

12 changes: 12 additions & 0 deletions .idea/libraries/dagger_android_2_11.xml

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

12 changes: 12 additions & 0 deletions .idea/libraries/dagger_android_support_2_11.xml

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

9 changes: 9 additions & 0 deletions .idea/libraries/jsr305_1_3_9.xml

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

4 changes: 2 additions & 2 deletions .idea/libraries/runtime_1_0_0_alpha5.xml

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

Binary file added List.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
71 changes: 66 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,80 @@ Room is an annotation based SQL Database Library. It allows you to fairly easily
- create "Entities", or Data Models, which help you convert convert between SQL Data to Java Objects
- interact with the Database via Annotations like @Query().

There's plenty of other features, but in a nutshell, it's basically a way to build and interact with an SQL Database in an easier way than older framework tools. Suffice it to say that one had to write a lot of Boilerplate code, navigate some fairly obscure documentation, and Open/Close many a Cursor and Database Connection carefully.
There's plenty of other features, but in a nutshell, it's basically a way to build and interact with an SQL Database in an easier way than older framework tools. Suffice it to say that one had to write a lot of Boilerplate code, navigate some fairly obscure documentation, and Open/Close many a Cursor and Database Connection in the past.

I'm happy to say that my experience with Room has been far different. The documentation, I/O Talks, and especially the Codelabs (links down below) do a really good job explaining the API.


**Preview:**
<img src="" alt="" width="270" height="480"/>
## Features

**List - Display Data in a RecyclerView, w/ Swipe to Delete**
<img src="list.png" alt="" width="270" height="480"/>

**Create - Create a new Item by selecting a Color, and typing a Message**
<img src="create.png" alt="" width="270" height="480"/>

**Detail - View an Item in Detail**
<img src="detail.png" alt="" width="270" height="480"/>

## Model-View-ViewModel Architecture

One of the biggest challenges for this project, was to decouple what M-V-VM actually means, from the various explanations and implementations of it.

As a very big proponent of MVP for my Front Ends, there were several scenarios I had difficulty understanding through MVVM; particularly in scenarios where having a Controller/Presenter to handle more complex View interactions seems to make more sense. To make matters worse, I saw some people handled such scenarios by creating what is essentially C/P-V-VM-M, and some people chose to turn the VM into more of ViewModelController (which begs the question as to why the f&*% it's called a ViewModel and it also controls the View, indirectly or otherwise).

After many paragraphs of discussion on the wiseAss Slack channel, I've decided to define the MVVM Architectural Style as follows:

View - Responsible for:
1. Forwards Events to the VM
2. Observes Data exposed by the VM
3. Updates the UI according to such exposed Data


ViewModel - Responsible for:
1. Handling events from the View (which usually means asking the Model for Data)
2. Exposes "Observable" data to the View. The fundamental feature of MVVM is that the VM should not have any direct dependencies on Views! In other words, the VM may only communicate back to the V through an Observable-Observer relationship; No direct method calls allowed.

Model - Responsible for:
1. Managing Data.

**Note:** This part of the App should not have any knowledge of the View, nor should it have direct knowledge of the VMs which use it.

**Rough Diagram:**
<img src="mvvm_aac.jpg" alt="" width="540" height="960"/>


## API Stack:
Although the Primary focus of this project is to demo Android Architecture Components (particularly Room Persistence Library), I've added a few other APIs which I'd be likely to use in such an App.

Project APIs:
* Room as our Database
* LiveData for exposing/Managing Data Streams
* ViewModel for decoupling VMs from LifeCycle events
* Dagger 2 and ViewModelProvider.Factory for managing Dependency Injection in ViewModels and the Repository.
* ViewPagerIndicator (Jake Wharton)
* CircleImageView (Henning Dodenhof)

**Upcoming Features**
* DataBinding (although MVVM does not 'need' DataBinding, it's certainly worth implementing in many cases)

## Resources and Inspiration

I'm happy to say that my experience learning Room was much more enjoyable than my experience learning to use SQLiteOpenHelper and Cursors. The Codelab for Room was a great intro, and there are also several Open Source Projects which helped me understand how to put everything together.

Room I/O 2017 Talk:
https://www.youtube.com/watch?v=MfHsPGQ6bgE&t=1418s

Room Codelab:
https://codelabs.developers.google.com/codelabs/android-persistence/#0

Lifecycle (VM + Lifecycle + LiveData) Codelab:
https://codelabs.developers.google.com/codelabs/android-lifecycles/#0

A few AAC Samples (this were super helpful; thank you to these Devs!):
https://github.com/googlesamples/android-architecture-components

## About Me
I'm an Android Dev living in Victoria BC Canada. I'm a major Nerd, and rambling about Software is quite therapeutic for me, to the extent that I have a [Youtube Channel](https://www.youtube.com/user/gosuddr93) mostly dedicated to that. I also do a Weekly Live Android Developer Q&A Series most Sundays at 8:00AM PDT (GMT -7). You can watch that at the aforementioned time [here](https://www.youtube.com/c/wiseAss/live).
I'm an Android Dev living in Victoria BC Canada. I'm a major Nerd, and rambling about Software is quite therapeutic for me, to the extent that I have a [Youtube Channel](https://www.youtube.com/user/gosuddr93) mostly dedicated to that. I also do a Weekly Live Android Developer Q&A Series most Sundays at 9:00AM PDT (GMT -7). You can watch that at the aforementioned time [here](https://www.youtube.com/c/wiseAss/live).

**Please Read**
I don't release this stuff for free because I don't like money. Actually, I could use all the help I can get to improve my Equipment, Production Quality, Content, and pay my living expenses. If my content is worth even the average fancy Hipster Coffee to you, then please Consider sending me a Fiver once on Patreon.
Expand Down
15 changes: 7 additions & 8 deletions app/app.iml
Original file line number Diff line number Diff line change
Expand Up @@ -41,20 +41,20 @@
<sourceFolder url="file://$MODULE_DIR$/src/prodDebug/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/prodDebug/rs" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/prodDebug/shaders" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/r/androidTest/prod/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/androidTest/prod/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/androidTest/prod/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/androidTest/prod/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/apt/androidTest/prod/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/androidTest/prod/debug" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/resValues/androidTest/prod/debug" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/testProdDebug/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/testProdDebug/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/testProdDebug/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/testProdDebug/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testProdDebug/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testProdDebug/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testProdDebug/shaders" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/r/androidTest/prod/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/androidTest/prod/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/androidTest/prod/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/androidTest/prod/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/apt/androidTest/prod/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/androidTest/prod/debug" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/resValues/androidTest/prod/debug" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/prod/res" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/prod/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/prod/assets" type="java-resource" />
Expand Down Expand Up @@ -145,7 +145,6 @@
<orderEntry type="library" exported="" name="extensions-1.0.0-alpha5" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="espresso-idling-resource-2.2.2" level="project" />
<orderEntry type="library" exported="" name="dagger-2.11" level="project" />
<orderEntry type="library" exported="" name="picasso-2.5.2" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="byte-buddy-agent-1.6.14" level="project" />
<orderEntry type="library" exported="" name="constraint-layout-1.0.2" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="hamcrest-library-1.3" level="project" />
Expand Down
1 change: 0 additions & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ dependencies {
compile "com.google.dagger:dagger:$rootProject.daggerVersion"
annotationProcessor "com.google.dagger:dagger-compiler:$rootProject.daggerVersion"

compile "com.squareup.picasso:picasso:$rootProject.picassoVersion"

//instead of check Project level build.gradle for version values
compile "com.android.support:appcompat-v7:$rootProject.supportLibraryVersion"
Expand Down

This file was deleted.

Binary file added create.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 detail.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit cae68b6

Please sign in to comment.