• Stars
    star
    691
  • Rank 65,435 (Top 2 %)
  • Language
    Kotlin
  • License
    Apache License 2.0
  • Created almost 5 years ago
  • Updated over 3 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

👽 Built with MVVM pattern, Koin , Coroutines + Flows ,Architecture Components, Data Binding , Firebase , Unit/UI Tests ,Motion Layout

home

   

The-Force

An Android app consuming a Star Wars API to display Movie Characters it has been built with clean architecture principles, Repository Pattern and MVVM pattern as well as Architecture Components.

Min Api Level : 21 Supports Over 87% Devices

Build System : Gradle

Table of Contents

Prerequisite

To run the release build successfully in travis you will need to replace the default values in keystore.properties.samplefile with your own in a keystore.properties file.

Next archive your keystore file and the properties file with the following command

 tar cvf secrets.tar keystore.properties theforce.jks

Next encrypt the archive and add config to travis with the following command

travis encrypt-file --pro secrets.tar --add

Verify that in your travis.yml in the before_install it looks something like

before_install:
  - openssl aes-256-cbc -K $encrypted_5880cf525281_key -iv $encrypted_5880cf525281_iv -in secrets.tar.enc -out secrets.tar -d
  - tar xvf secrets.tar

Make sure to add only the *.enc file to git,leave out the keystore.properties and *.jks file. Add the following to the root .gitignore just to be sure

*.jks
*.tar
keystore.properties

If you encounter any error check this site out.

To setup the Travis CLI tools see this

Architecture

NB: Work in Progress - Feature Modularisation 🚧

The Application is split into a three layer architecture:

  • Presentation
  • Domain
  • Data

Architecture Flow Diagram

This provides better abstractions between framework implementations and the underlying business logic.It requires a number of classes to get things running but the pros outweigh the cons in terms of building an app that should scale.

The 3 layered architectural approach is majorly guided by clean architecture which provides a clear separation of concerns with its Abstraction Principle.

Presentation

app contains the UI files and handles binding of DI components from other modules. Binding of data is facilitated by jetpacks data binding by serving data from the viewmodel to the UI.The data being received is part of a viewstate class that has properties contained in the relevant state.

Domain

The domain module contains domain model classes which represent the data we will be handling across presentation and data layer.

Use cases are also provided in the domain layer and orchestrate the flow of data from the data layer onto the presentation layer and a split into modular pieces serving one particular purpose.

The UseCases use a BaseUseCase interface that defines the parameters its taking in and output this helps in creating fakes using in testing.

Data

  • data-remote

Handles data interacting with the network and is later serverd up to the presentation layer through domain object

  • data-local

Handles persistence of object with Room ORM from.This module is responsible for handling all local related logic and serves up data to and from the presentation layer through domain objects.

With this separation we can easily swap in new or replace the database being used without causeing major ripples across the codebase.

Testing

Each module has its own tests except for the domain module which is catered for since its part of the behavior under test.

All server responses in the tests are served by mock web server by appending relative urls to the localhost and the connected port as the base url.

In the data-remote module the responses are mocked using the mockwebserver and verified that they are what we expect.

In the data-local module an in memory database is being used to run the tests,this makes it a little faster compared to an actual db.

In the app module there are unit tests for the viewmodels and util classes and connected tests for the UI Screens.

The test instrumentation app uses modules that have been swaped with fakes for the network module so as to run requests on localhost with mockwebserver,this removes flakiness compared to relying on actual data from the real server aspects such as internet connection or network service might bring up issues and an in memory database for local data that also allows main thread queries since tests should also be fast and we are just asserting stuff works.

View models testing on live data were guided by this article

Libraries

Libraries used in the whole application are:

  • Jetpack🚀
    • Viewmodel - Manage UI related data in a lifecycle conscious way and act as a channel between use cases and ui
    • Data Binding - support library that allows binding of UI components in layouts to data sources,binds character details and search results to UI
    • Room - Provides abstraction layer over SQLite
  • Retrofit - type safe http client and supports coroutines out of the box.
  • Moshi - JSON Parser,used to parse requests on the data layer for Entities and understands Kotlin non-nullable and default parameters
  • okhttp-logging-interceptor - logs HTTP request and response data.
  • kotlinx.coroutines - Library Support for coroutines,provides runBlocking coroutine builder used in tests
  • Truth - Assertions Library,provides readability as far as assertions are concerned
  • MockWebServer - web server for testing HTTP clients ,verify requests and responses on the star wars api with the retrofit client.
  • Leak Canary - Leak Detection Library
  • Material Design - build awesome beautiful UIs.🔥🔥
  • Firebase - Backend As A Service for faster mobile development.
    • Crashylitics - Provide Realtime crash reports from users end.
  • Koin - A pragmatic lightweight dependency injection framework for Kotlin
  • Robolectric - Unit test on android framework.
  • Espresso - Test framework to write UI Tests
  • recyclerview-animators - Recycler View Animations
  • AboutLibraries -provide info on used open source libraries.
  • Stetho - debug bridge
  • Kiel - Kiel RecyclerView Adapter Builders

Contributors

  • Thanks to Zafer Celaloglu for the Dagger to Koin Refactor and additional test cases.

Feel free to contribute in any way to the project from typos in docs to code review are all welcome.

Demo

The codebase in most cases will be ahead of whats on the store.

Get it on Google Play

Google Play and the Google Play logo are trademarks of Google LLC.

Copyright Notice

Star Wars and all associated names are copyright Lucasfilm ltd.

Related Posts

Handling Dynamic Urls

License

  Copyright 2019 David Odari
  
  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at

      http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.

More Repositories

1

WeatherApp

☁️ ❄️ A KMP weather app built with Jetpack Compose , MVI , Unit Testing , Hilt and Location Services, Github Actions, Firebase + Material 3
Kotlin
170
star
2

Design-Pattern-Samples-App

🎨 Exploring creational,structural and behavioral design patterns using Kotlin
Kotlin
87
star
3

Material-Design-Android

My stash for all things material, animations, typography, iconography, transitions, Animated VD, Color Palette API, UI design, and more.
Kotlin
39
star
4

NightKing

🌃 Google I/O 19 Extended, Dark Theme Demo
Kotlin
25
star
5

FirebaseChatApp

A Chat app built on firebase features such as firebase-ui,database,storage and cloud messaging
Java
22
star
6

Moshey

An Android train booking app built using Androidx,Databinding, MVVM architecture,Android Jetpack Components and Firebase
Java
21
star
7

Dimba

A football companion app ⚽Live Fixtures ,Leagues & Team Standings: DI(Koin)+(Clean-MVVM)+Room+Retrofit with Coroutines + Jetpack + Dark Theme and more
Kotlin
20
star
8

Zikk-Music-App

[WIP]🎶 A Music Player App Sample in Kotlin using Androids' Mediaplayer APIs
Kotlin
19
star
9

Diary

Diary App ,demo for Room ORM ,ALC 5 Android Session
Java
15
star
10

WeatherStack-Android-App

Kotlin
11
star
11

tic-toc-tic-toc

Android Dev Challenge 2 : Countdown timer ⏱
Kotlin
10
star
12

Smoovie-android-TMDb

A Movies Android App built on TMDB API showcasing popular,trending and upcoming movies.Refactored to MVVM architecture using arch components.
Java
10
star
13

Tuli

Practice app for AAD Certification
Kotlin
8
star
14

picka

media picking library for android
Kotlin
7
star
15

WeatherUpdates

A compose MVI weather app, that polls for data every 10 seconds.
Kotlin
7
star
16

Pker

📸 A Sample Application based on Jetpacks' CameraX: 🤳 Selfie Cam + Back Camera,Flash,Zoom
Kotlin
6
star
17

Travelmantics

Get those holiday deals 🏖 ✈️
Kotlin
5
star
18

NotesApp

App for Android Series
Kotlin
5
star
19

simple-counter

Android counter custom view.
Kotlin
5
star
20

FirebaseApp

Firebase Demo for storage and messaging
Kotlin
5
star
21

RickNMortyCompose

A Rick and Morty Client Android app built with Jetpack Compose,Coroutines, Graphql & Hilt
Kotlin
5
star
22

AndroidGraphQLClient

My GraphQL playground with Rick and Morty API.apollo+coroutines+flow+paging3
Kotlin
5
star
23

TestAppSampleDSC

Dsc unit testing
Kotlin
4
star
24

tasksserver

📝 RESTful API built with Ktor + Deployed to Heroku
Kotlin
4
star
25

Jok3r-BDD-DevFest19

A sample application showcasing BDD on Android
Kotlin
4
star
26

Schedulers

Notifications + WorkManager/Foreground Services/Alarm Manager/DownloadManager(In Progress)
Kotlin
4
star
27

YoutubeApiAndroid

Youtube Android Player API samples
Java
4
star
28

NavigationComposeWorkshop

Kotlin
3
star
29

GoogleMapsAndroid

My Google Maps Playground
Kotlin
3
star
30

AnnotationProcessing

Kotlin
2
star
31

KotlinEverywhereGenerics

Sample of Kotlin Generics #kotlinEverywhereNairobi
Kotlin
2
star
32

Fise

A basic financial survey application built with flutter
Dart
2
star
33

MyExtensions

Library of things am tired of repeating on Android
Kotlin
2
star
34

Animes

Animations And Transitions
Kotlin
2
star
35

AfricasTalkingPlaypen

Code snippets implementing africas talking api service with pythons flask web framework
Python
2
star
36

Splashy

Android Client For Unsplash API
Kotlin
2
star
37

FragmentDataPassing

Short demo for passing data from fragment to fragment and having it all at the end
Kotlin
2
star
38

POLITICO-API

Api built with Python Flask Web Framework and Postgres backend for voting system
Python
2
star
39

JetpackComposeStarter

Getting Started with Jetpack Compose
Kotlin
2
star
40

ALC4.0

#5dayscodechallenge with fragments
Kotlin
1
star
41

odaridavid

1
star
42

ApiDemo

Demo for working with apis and json
Kotlin
1
star
43

pick-a-pup

Android Dev Challenge 1
Kotlin
1
star
44

JournalApp

A Journal Application made with firebase firestore
Java
1
star
45

DataStoreSample

GADS DataStore Demo
Kotlin
1
star
46

Populate-Room

Populate room with data on create sample
Kotlin
1
star
47

AndroidTMDB

A Compose MVI movie app using the TMDB api that infinite scrolls without paging lib
Kotlin
1
star
48

Isonge

[WIP]Template for a location-based map app
Kotlin
1
star
49

Build-IT-Bigger

A Joke Telling Android Gradle MultiProject App with paid and free version,an implementation of a Java and Android Library
Java
1
star
50

SampleRestfulApi

RESTful Api Demo Session code
Kotlin
1
star
51

DependencyInjection

Simple Dep Injection
Kotlin
1
star
52

DSC-Calc

A basic calculator built during DSC Meetup
Kotlin
1
star
53

Swatch-Movies-OMDb

A movie querying app built for android using Async Task
Java
1
star
54

Zensy

A basic remake of my firebase chat app in flutter
Dart
1
star
55

ExoPlayerAndroidSample

An implementation of Exo player Media Playback API with a media style notification,makes use of test examples from the google codelabs.
Java
1
star
56

Makta

Makta is an Android App that lets users borrow or lend their own books to other users on the platform,my final udacity and ALC scholarship project
Java
1
star