Git Product home page Git Product logo

avenging's Introduction

AppIcon

Avenging - MVP project

Android Arsenal MaterialUp Build Status codecov Codacy Badge minSdkVersion compileSdkVersion

Read more on the blog post: Avening - MVP without RxJava or Dagger

Android app built with an MVP approach without RxJava or Dagger.

Uses Marvel Comics API as a service which contains all the information about its vast library. Data provided by Marvel. © 2016 MARVEL

What is MVP (ModelViewPresenter)?

  • View is a layer that displays data and reacts to user actions. On Android, this could be an Activity, a Fragment, an android.view.View or a Dialog.
  • Model is a data access layer such as database API or remote server API.
  • Presenter is a layer that provides View with data from Model. Presenter also handles background tasks.

Most of the modern Android applications just use View-Model architecture. Programmers are involved into fight with View complexities instead of solving business tasks. Using only Model-View in your application you usually end up with "everything is connected with everything", which translates into harder scalability. With the MVP approach it easier to understand the role of each element. You didn’t became a developer to be wasting time on boring code maintenance, but to build awesome stuff!

Mobile List Mobile Profile Mobile Comic Mobile Search Mobile List Error

Wear List Default Wear List Gallery Wear List Loading Wear List Error

This sample is available

Get it on Google Play

Configs & API authentication

If you wish to run your own CI (I'm using Travis) ensure you have the following environment variables on your CI config:

  • IS_ CI_JOB = true
  • CI_ PUBLIC_KEY = < YOUR-PUBLIC-KEY >
  • CI_ PRIVATE_KEY = < YOUR-PRIVATE-KEY >

To run locally have your private and public keys in your gradle.properties file (project's root folder).

  • marvelPublicKey = < YOUR-PUBLIC-KEY >
  • marvelPrivateKey = < YOUR-PRIVATE-KEY >

Mind the markedown spaces.

Dependencies

CORE

  • Retrofit A type-safe HTTP client for Android and Java
  • Jackson A default ObjectMapper instance will be created or one can be configured and passed to the JacksonConverter construction to further control the serialization.
  • Mockito Mocking framework for unit tests written in Java
  • LeakCanary A memory leak detection library for Android and Java.

MOBILE

  • Design Support Library The Design package provides APIs to support adding material design components and patterns to your apps.A flexible view for providing a limited window into a large data set.
  • Picasso A powerful image downloading and caching library for Android
  • Espresso Use Espresso to write concise, beautiful, and reliable Android UI tests

WEAR

  • Play Services Google Play services.
  • Google Support Support v4 This library is designed to be used with Android 1.6 (API level 4) and higher. It includes the largest set of APIs compared to the other libraries
  • Picasso A powerful image downloading and caching library for Android

Issues: Fell free to open a new issue. Follow the ISSUE_TEMPLATE.MD

Contributing

Contributions are always welcome!

Follow the "fork-and-pull" Git workflow.

  1. Fork the repo on GitHub
  2. Clone the project to your own machine
  3. Commit changes to your own branch
  4. Merge with current development branch
  5. Push your work back up to your fork
  6. Submit a Pull request your changes can be reviewed (please refere the issue if reported)

Prevent code-style related changes (at least run Ctrl+⌥+O, ⌥+⌘+L) before commiting.

License

Copyright © 2016 Joaquim Ley

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.

avenging's People

Contributors

andremion avatar figengungor avatar imgbot[bot] avatar joaquimley avatar shisheng-1 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

avenging's Issues

mobile: List fragment on configuration change

ANR on configuration change in List screen

Context

App should not crash on the List screen rotation

Process

  • On List screen make the screen rotate
  • Application sometimes crashes

Expected result

Should be able to rotate screen without loosing any info or causing ANRs

Current result

Application sometimes crashes on configuration change

Possible Fix

  • Handle the save instance state and retrieve required data on resume.

Import project directly to Android Studio throws error Unkown property 'marvelProductionEndPoint'

Here is the full error:

Error:(18, 0) Could not get unknown property 'marvelProductionEndpoint' for ProductFlavor_Decorated{name=main, dimension=null, minSdkVersion=DefaultApiVersion{mApiLevel=11, mCodename='null'}, targetSdkVersion=DefaultApiVersion{mApiLevel=24, mCodename='null'}, renderscriptTargetApi=null, renderscriptSupportModeEnabled=null, renderscriptSupportModeBlasEnabled=null, renderscriptNdkModeEnabled=null, versionCode=null, versionName=null, applicationId=null, testApplicationId=null, testInstrumentationRunner=null, testInstrumentationRunnerArguments={}, testHandleProfiling=null, testFunctionalTest=null, signingConfig=null, resConfig=null, mBuildConfigFields={}, mResValues={}, mProguardFiles=[], mConsumerProguardFiles=[], mManifestPlaceholders={}, mWearAppUnbundled=null} of type com.android.build.gradle.internal.dsl.ProductFlavor. <a href="openFile:/Users/smarques84/AndroidStudioProjects/avenging/core/build.gradle">Open File</a>

core: Custom retrofit converter to remove DataWrapper<T>

Using customer converters we can delegate the deserialization of the meta-data to the HTTP client, instead of having the abstract model Jake Wharton's talk on custom converters.

Context

This enables us to remove unnecessary boilerplate encapsulating models/code.

Process

See the talk then:

  1. Create custom converter
  2. Configure the custom converter to deserialize the metadata
  3. Feed the actual model(s) directly
  4. Make necessary Presenter(s), Service interfaces changes

wear: tests-ui - List

Automate the UI flow of the app

More info here

Process

Create Instrumentation tests for the List features

  • Search (correct characters displayed)
  • List refresh
  • List click
  • List end reached (onLoadMore())
  • No connection
  • No results

wear: Search via Voice

This isn't mandatory, more like a "nice-to-have".

Tutorial from android developer documents here

  • Use google voice recognition for search characters feature.

wear: List improvements

Change list mode to wear-guidelines, handle list clicks to launch the new details activity.

Tasks

  • Change list UI to 3 items per screen.

  • Handle the onLoadMore() function

  • (try to) Fix flickering effect when the dataset changes

  • List click should start the new details activity

  • Extra: Add voice recognition for search feature #25

wear: Character Details

The wear version of the app isn't really showing any content on the details screen

Context

We should have a similar experience as the mobile version, showing the description, list of comics, events etc.

Process

  1. User clicks on an (initial) character list item
  2. Character details activity should start
  3. First screen Image, other screens should appear by this order using a swipe right:
  • Description
  • Comics (list scroll down)
  • Series (list scroll down)
  • Stories (list scroll down)
  • Related links (list scroll down)

Expected result

Screens should appear with the list order

Improve global vars to project:build.gradle

Some variables (such as compileSdkVersion and buildToolsVersion) don't need to be secret therefore shouldn't/don't need to be on gradle.settings

Context

With the current situation we have a (very) verbose build.gradle and unnecessary CI variables.

Process

Does not apply.

Expected result

Does not apply

Current result

Does not apply

Possible Fix

After passing to the project's build.gradle like this:

    ext.buildToolsVer = '24.0.0'
    ext.androidSupportVer = '24.1.1'
    ext.googlePlayServicesVer = '9.0.2'

We can remove both the CI variables and verbose build.gradle variables.

Tasks to keep track of this enhancement:

  • Move variables from gradle.properties to project:build.gradle
  • Get variables from project:build.gradle from both mobile and wear modules
  • Update README.MD
  • Remove CI variables (this is outside of the project scope)
  • Update CI (.travis.yml) to accept licenses
  • What went wrong:
    A problem occurred configuring project ':core'.

    You have not accepted the license agreements of the following SDK components:
    [Android SDK Build-Tools 24.0.2].
    Before building your project, you need to accept the license agreements and complete the installation of the missing components using the Android Studio SDK Manager.
    Alternatively, to learn how to transfer the license agreements from one workstation to another, go to http://d.android.com/r/studio-ui/export-licenses.html

Memory leak - ListActivity on config change

@figengungor reported this.

Noticed that when orientation is changed on ListActivity several times, LeakCanary finds a memory leak.

Context

Apparently, RecyclerView in ListFragment leaks ListActivity. When the adapter is detached from RecyclerView in onDestroyView(), the memory leak is fixed.

Process

[ordered list the process to finding and recreating the issue, example below]

  1. User opens app
  2. Wait for the Character's list is retrieved
  3. Move the device to force multiple configuration changes

Expected result

There should be no memory leaks

Current result

LeakCanary detects a memory leak, the Adapter is holding a reference to the ListFragment since it has the setRetainInstance(true) the onDestroy() is not called.

Possible Fix

  • Set the adapter to null in the ListFragment#onDestroyView but this isn't very elegant. #19

LeakCanary screenshot

9bb5e0de-a22d-11e6-9ef0-f8d0705a1264

Thanks!

Proguard rules

Been trying hard to get a minified version working but can't seem to get the correct rules.

Context

Building with minifyEnabled = true / proguard gives many warning ultimately failing.

Process

  • Build with prouguard (minifyEnabled = true).

Expected result

  • App should be built

Current result

  • Fails to build

Possible Fix

  • Get the necessary proguard rules

Thanks!

wear: Black screen/flickering on listing

onLoadMore black screen

Context

notifyDataSetChanged() causes the whole adapter to be refreshed which (in some cases) causes a black screen and requires user interaction to refresh the view

Process

  • Start app
  • Scroll through the the characters while in the list mode
  • Once the end is reached (server makes a request)
  • Upon receiving the new data set, screen sometimes gets black

    Expected result

    Receiving pagination should be invisible to the user

Current result

Sometimes screen becomes black.

Possible Fix

Change from GridViewPagerAdapter to fragment adapter

mobile: tests-ui - List

Automate the UI flow of the app

More info here

Process

Create Instrumentation tests for the List features

  • Search (correct characters displayed)
  • List refresh
  • List click
  • List end reached (onLoadMore())
  • No connection
  • No results

Memory leak - ListActivity on config change

Noticed that when orientation is changed on ListActivity several times, LeakCanary finds a memory leak.

Context

Apparently, RecyclerView in ListFragment leaks ListActivity. When the adapter is detached from RecyclerView in onDestroyView(), the memory leak is fixed.

Process

[ordered list the process to finding and recreating the issue, example below]

  1. User opens app
  2. Wait for the Character's list is retrieved
  3. Move the device to force multiple configuration changed

Expected result

There should be no memory leaks

Current result

LeakCanary detects a memory leak, the Adapter is holding a reference to the ListFragment since it has the setRetainInstance(true) the onDestroy() is not called.

Possible Fix

  • Set the adapter to null in the ListFragment#onDestroyView but this isn't very elegant. #19

LeakCanary screenshot

9bb5e0de-a22d-11e6-9ef0-f8d0705a1264

Thanks!

mobile: Character fragment on configuration change

ANR on configuration change in Character detail screen

Context

App should not crash on the Character details screen rotation

Process

  • On the list screen click on any character
  • On character details screen make the screen rotate
  • Application sometimes crashes

Expected result

Should be able to rotate screen without loosing any info or causing ANRs

Current result

Application sometimes crashes on configuration change

Possible Fix

  • Handle the save instance state and retrieve required data on resume.

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.