Giter VIP home page Giter VIP logo

android_congress's Introduction

Android_Congress

Instructions

Part 1 - Fork and Clone Repo

  1. Click the Fork symbol in the top right of the repo.
  2. Navigate to the newly forked repo in your account
  3. Click the green clone or download button on the repo.
  4. Copy the provided URL
  5. Open a git bash console in the directory where you want your project to be.
  6. Clone the repo into your workspace

Part 2 - Import the Project into Android Studio

  1. Open Android Studio
  2. Import the cloned project
    a. With an open project, go to File->New->Import
    b. With all projects closed, click Import Project

Part 3 - Create the List Activity using the MVVM Model

  1. Create the layout for an activity that will list the display name for all returned congresspeople.

You can see the data provided for all congresspeople in this query in the API documentation (https://projects.propublica.org/api-docs/congress-api/members/#lists-of-members)

  1. Write a CongressPersonOverview repository class that will wrap data from the provided library in a MutableLiveData object and return it.

Use ArrayList<CongresspersonOverview> rawData = CongressDao.getAllMembers(); to get overview details from the library.

  1. Write a ViewModelclass that returns a singleton LiveData object.

Remember, a singleton class doesn't have a public constructor. Intead, it has a getter that checks if the object has been instantiated, if it hasn't it builds the object and returns it. If it has, it returns the object.

  1. In your Activity class, attach your viewmodel to the view by using viewModel = ViewModelProviders.of(this).get(MyViewModel.class)
  2. Call the observe(Context, Observer) method. In the observer, write what the app should do each time the data is updated (ie update the UI).

You'll want to build a display name for each congressperson combining things like First and Last Name, party and state.
Add the congress person's ID to the Tag field of the View object so you can retreive it when the view is clicked. If this takes more than a few lines of code, do it in a separate method. You'll need to use runOnUiThread to perform the final process of attaching the new View to the UI.

  1. Be sure to thoroughly test this activity.

Part 4 - Create Details View Layout and Link the two together

  1. Create a layout for an Activity that will display details for a selected congress person.

You can see the data provided for each congressperson in this query in the API documentation (https://projects.propublica.org/api-docs/congress-api/members/#get-a-specific-member)

  1. In your list Activity, build an onClickListener that will retrieve the Tag from the view and attach it to an Intent which launches your new activity.
  2. Test your Intent.

Part 5 - Build a MVVM structure for your details activity

  1. Repeat steps 2 - 6 of part 3 for your new activity.

Use CongresspersonDetails profile = CongressDao.getMemberDetails(id); to get the congressperson's details (step 2)

Submit

Submit your project by creating a pull request on this project, your PM will review it and respond to you.

android_congress's People

Contributors

chancepayne avatar kylecole01 avatar

Watchers

James Cloos 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.