Skip to content

Android application demonstrating the use of the Rick and Morty Graphql API

Notifications You must be signed in to change notification settings

himynameismoose/RickAndMortyApp

Repository files navigation

RickAndMortyApp

Let's get schwifty with this android application! What better way to source the characters of the hit adult animated TV show Rick and Morty! “Sometimes science is more art than science.” — Rick

In order for this application to use the Rick and Morty GraphQL API, Apollo Client was injected to access its schema.sdl. Queries were designed to gather characters from the show to display personal details that may be of useful knowledge for an upcoming trivia night.

Main Activity

Here we have the main activity shown as the application successfully starts.

This main activity shows a top app bar that shows the name of the application. I have also added the iconic Rick and Morty title to add familiarity. There are two buttons: View All Characters and Shared Preferences.

The main purpose of this app is to show details of the characters so it would only make sense to click on that first.

"SHOW ME WHAT YOU GOT!" - Cromulon

Character List

But wait! A use of the progress indicator is genuinely placed here while we wait for the list of characters to load. Here we see a new activity opens. At this time, an ApolloClient instance is used here to make a query to gather the characters from the API. We don't see that actually happening so the progress indicator represents that.

After waiting some time, the list finally loads!

The app bar displays a new title as we navigate to this activity. Each character is represented by a card in a recyclerview. We see the name of a character and its species type. As we are scrolling through the list, oh whoops! I accidentally clicked on a card. I wonder what happens?

Character Details

Oh? We have more details that we didn't even know? Awesome! This really confirms Jerry is a human.

This fragment displays character details. The app bar title changes again and we see an image of a character from the previous activity screen that displayed the list of characters. I added a little divider that made this screen a bit more appealing. Below the divider are more details of a character. This fragment does not really do much like the other activities. Another query is made to dive deeper of character details such as id, name, status, species and gender. Pretty cool, huh?

Shared Preferences

Let's head back to the main page. Remember that second button that was named Shared Preferences? Let's click on that!

This activity Shared Preferences to cache user local data. We see two EditText boxes that represents a user ID and a password. It is very similar to a login screen. We have four buttons that saves the new user data, clears the data, shows the default login, and shows. Here is my default login:

And there we have it! I foresee new features of this app coming soon!

Design Pattern

I did my best at incorporating the MVP architectural pattern. The model contains classes that created the ApolloClient instance and a repository that runs the GraphQL queries of the characters. The view folder represents the activity and fragment views. Lastly, we have the presenter that uses the models to format the activities and fragments.

Outro

I am happy to present you an android application that uses the Rick and Morty GraphQL API in Kotlin. Building this was so much fun and if you could not already tell, I am a big fan of the show! Thank you so much for your time and I am open to sharing ideas of future features to be added!

About

Android application demonstrating the use of the Rick and Morty Graphql API

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages