GithubHelp home page GithubHelp logo

volcanoscar / mvvm_hacker_news Goto Github PK

View Code? Open in Web Editor NEW

This project forked from hitherejoe/mvvm_hacker_news

0.0 2.0 0.0 4.76 MB

Android MVVM experiment project using the official Data Binding library

Java 100.00%

mvvm_hacker_news's Introduction

MVVM using Data Binding Build Status

I wanted to experiment creating an MVVM structured project using the official Data Binding library, so I stripped back an old project of mine and replaced relevant codebase with an MVVM approach. This is still experimental, so I'd love to hear any suggestion / improvements to the approach!

Screenshots

Currently writing a Medium article which should explain more... but for now:

Posts

Post cards displayed on the Post Screen (left, above) are built using the following classes:

Post - The post object

PostAdapter - The RecyclerView adapter used to set the view model

PostViewModel - The view model used to manage the display of the posts

item_post - The XML layout file which displays the post card

Comments

Comments displayed on the Comment Screen (right, above) are built using the following classes:

Comment - The comment object

CommentAdapter - The RecyclerView adapter used to set the corresponding view model. Comments work a bit differently from posts as this adapter uses logic to choose to use one of two view models based on the comment type

CommentViewModel - The view model used for standard comments on a post

CommentsHeaderViewModel - The view model used as a header for the post text with an ASK post

item_comment - The XML layout file which displays a standard comment

item_comments_header - The XML layout file used to display the header for an ASK post

Requirements

  • Android SDK.
  • Android 5.1 (API 22) .
  • Android SDK Tools
  • Android SDK Build tools 23.0.0.0
  • Android Support Repository
  • Android Support library

Building

To build, install and run a debug version, run this from the root of the project:

./gradlew installRunDebug

Testing

To run unit tests on your machine using [Robolectric] (http://robolectric.org/):

./gradlew testDebugUnitTest

To run automated tests on connected devices:

./gradlew connectedAndroidTest

mvvm_hacker_news's People

Contributors

hitherejoe avatar matt-oakes avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.