[] Port of Jake Wharton's U2020 sample app with use of MVP and Dagger 2

Related tags

Demo u2020-mvp
Overview

U+2020-mvp

[DEPRECATED] We recomend to try Moxy framework instead of our solution.

Port of Jake Wharton's U2020 sample app with use of MVP pattern and Dagger 2.

Debug drawer

Dagger 2

Watch the corresponding talk or view the slides.

TODO

MVP

TODO

Testing

Espresso 2 and JUnit4 are used for tests. Activities are instrumented by ActivityRule (by Jake Wharton).

Android Studio Template

Also we've created a u2020-mvp Android Studio Template to quickly generate the u2020-mvp classes.

Libraries

License

Copyright 2014 Live Typing

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.
Comments
  • Presenter lifecycle tied to Activity's

    Presenter lifecycle tied to Activity's

    Hi guys,

    It looks to me as though the presenters' lifecycles are coupled to their instantiating activity's. Please let me know if I missed something, and whether or not this is a conscious design choice.

    Thank you!

    discussion 
    opened by cxzhang2 4
  • Hi, TestGalleryComponent having problem, I was using AS 1.1.0 to run it

    Hi, TestGalleryComponent having problem, I was using AS 1.1.0 to run it

    Dagger_GalleryActivityTest$TestGalleryComponent

    F:\Git\Samples\u2020-mvp\app\src\androidTest\java\ru\ltst\u2020mvp\tests\GalleryActivityTest.java Error:(89, 5) error: ru.ltst.u2020mvp.tests.GalleryActivityTest.TestGalleryComponent (unscoped) cannot depend on scoped components: @ru.ltst.u2020mvp.ui.ApplicationScope ru.ltst.u2020mvp.U2020Component @ru.ltst.u2020mvp.ui.gallery.GalleryScope ru.ltst.u2020mvp.ui.gallery.GalleryComponent

    bug 
    opened by shawnthye 3
  • Enhancement in GalleryDatabase.java

    Enhancement in GalleryDatabase.java

    Hi, I am looking at your code in GalleryDatabase, and I see this comment:

        // Warning: Gross shit follows! Where you at Java 8?
    

    galleryService.listGallery(section, Sort.VIRAL, 1) .filter(Results.isSuccess()) .map(new GalleryToImageList()) .flatMap(new Func1<List<Image>, Observable<? extends Image>>() { @Override public Observable<? extends Image> call(List<Image> iterable) { return Observable.from(iterable); } }) .filter(new Func1<Image, Boolean>() { @Override public Boolean call(Image image) { return !image.is_album; // No albums. } }) .toList() .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .subscribe(galleryRequest);

    I have thought about how to enhance this code block with Java 8, but cannot figure it out. I mean, Java 8 Streams are nice, but they won't provide any improvement to the code you've already written.

    Thoughts? Igor

    opened by IgorGanapolsky 2
  • Possible unused code (presenter exposed by GalleryComponent)

    Possible unused code (presenter exposed by GalleryComponent)

    Hi! could you please verify if in the class GalleryComponent.java this line GalleryActivity.Presenter presenter() is necessary? Direct like: https://github.com/LiveTyping/u2020-mvp/blob/master/app/src/main/java/ru/ltst/u2020mvp/ui/gallery/GalleryComponent.java#L14

    In can compile/execute the app without the line, in fact the presenter in injected in the GalleryActivity.

    Ps. I'm studying/testing Dagger2 in these days, so I'm not sure if this is a real issue or not! :wink:

    enhancement 
    opened by fpezzato 2
  • Lock/Unloke device on any activity of u2020-mvp application

    Lock/Unloke device on any activity of u2020-mvp application

    After unlock device the previous activity remain above of lock screen. For understanding, please see video

    Case from video:

    1. Start application
    2. Lock device
    3. Unlock device (Showed previous activity of application instead of common lock screen)
    4. Select item (After that showed common lock screen)
    5. Unlock deveice (Passes to next activity after click by item)
    bug help wanted 
    opened by cosic 1
  • Unused code

    Unused code

    Hi, What is the purpose of ActivityHierarchyServer NONE here: https://github.com/IgorGanapolsky/u2020-mvp/blob/master/app/src/main/java/ru/ltst/u2020mvp/ui/ActivityHierarchyServer.java#L14

    It seems similar to the Empty inner class below it.

    enhancement 
    opened by IgorGanapolsky 1
  • There's a problem with Registry class

    There's a problem with Registry class

    In u2020-mvp as example of app the Registry looks like a good solution for attachment/detachment a view to presenter. But for production app there's problems with attachment view to presenter when I try to open the same activity that already has existed in activity stack with Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_SINGLE_TOP flags.

    For example, there're in activity stack:

    Activity A1 (ViewA1, presenterA1) Activity B (ViewB, presenterB)

    And I add new Activity A:

    Activity A2 (ViewA2)

    So, I haven't had the attached presenter.

    What it's happened when I made startActivity(ActivityA.class):

    ActivityA2.onCreate(); /* Created a new presenter for Activity2. 
    Generated key in Registry class. This key the same like as at 
    Activity1 presenter. So it will be replaced. */
    ActivityA2.onStart(); /* Look for the existing presenter by key 
    and makes the attachment the view to presenter. */
    ActivityB.onStop();
    ActivityA1.onStop(); /* Look for the presenter by key and makes
     the detachment view from presenter. */
    

    So, we got ActivityA2 with presenter without attached view.

    opened by cosic 0
  • Update 3rd Party SDKs etc

    Update 3rd Party SDKs etc

    It's hard to find a good example of Dagger2 being used with different product flavours. Yours seems to be a good example, but a lot of the SDKs are out of date. I've updated a bunch of them.

    opened by jonathan-caryl 0
  • Added Dagger 2 architecture to test module

    Added Dagger 2 architecture to test module

    • added test component which provides application scope dependencies and can inject test classes
    • added test module which force mock mode
    • added test application inherited from project application which eliminates the needs to change app component runtime
    • changed test instrumentation runner to use test project application instead of regular app during instrumentation testing
    • added some tests
    • added some testing utils
    • refactored existing tests
    opened by gleberemeev 4
  • Reusing common views in u2020-MVP

    Reusing common views in u2020-MVP

    This isn't so much of an issue but more of a design question. How would you go about reusing common views in u2020-mvp?

    For example, I'd like to create a common LoginView which can be shown in different activities/fragments. The associated LoginComponent, LoginPresenter, and LoginModule all use @LoginScope. The idea here is to have all the functionality of logging-in encapsulated in LoginView which I can use at anytime.

    I tried to accomplish this in few ways and ran into issues. For the examples below, let's assume we want to put LoginView into our MainActivity.

    • Include LoginModule in MainComponent as follows. I ran into issues with Dagger complaining about @LoginScope being used in @MainScope.
    @MainScope
    @Component(
            dependencies = ApplicationComponent.class,
            modules = {
                MainModule.class,
                LoginModule.class
           }
    )
    
    • Defining LoginComponent as the "parent" component and MainComponent as a subcomponent. This solution is not desirable either because the common component acts as the "parent" component. Also you run into the issue of not being able to use multiple common components.
    @MainScope
    @Subcomponent(
        modules = MainModule.class)
    
    @LoginScope
    @Component(
            dependencies = ApplicationComponent.class,
            modules = LoginModule.class
    )
    

    Is there no proper way to use common views in u2020-mvp?

    The other option is to include the common view as part of a Fragment however there isn't an example here of mvp with Dagger injection of Fragments, views and its presenters.

    discussion 
    opened by charleschenster 2
  • Change place where a View binds with a Presenter

    Change place where a View binds with a Presenter

    Now we're making the attaching/detaching View to Presenter through onStart()/onStop() methods in Activity. I offer to use onAttachedToWindow()/onDetachedToWindow() methods instead of them.

    discussion 
    opened by cosic 4
Owner
Live Typing
Mobile and Web App Development Company
Live Typing
A sample Android app which showcases advanced usage of Dagger among other open source libraries.

U+2020 A sample Android app which showcases advanced usage of Dagger among other open source libraries. Watch the corresponding talk or view the slide

Jake Wharton 5.7k Dec 22, 2022
🔥 Android MVP with Volley usage simple registration App 🔥

?? Android MVP with Volley usage simple registration App ?? This is a MVP architecture app that uses volley .Project is made using Android Studio. Vol

ABHISHEK KUMAR PATHAK 3 Aug 7, 2022
A sample Android app that demonstrates how to use Firebase Authentication, Crashlytics, Cloud Firestore and Hilt with Jetpack Compose UI

showcase.mp4 Make it So This is a sample Android app that demonstrates how to use Firebase Authentication, Crashlytics, Cloud Firestore and Hilt with

null 107 Dec 31, 2022
This project is focused on the sample using the API's new preview version of Android-L, use of transitions, shadows etc...

Android L preview example Description This project is focused on the sample using the API's new preview version of Android-L, use of transitions, shad

Saul Molinero 165 Nov 10, 2022
This project is focused on the sample using the API's new preview version of Android-L, use of transitions, shadows etc...

Android L preview example Description This project is focused on the sample using the API's new preview version of Android-L, use of transitions, shad

Saul Molinero 165 Nov 10, 2022
Android sample app following best practices: Kotlin, Compose, Coroutines and Flow, Hilt, JetPack Navigation, ViewModel, MVVM and MVI, Retrofit, Coil

Foodies - Modern Android Architecture Foodies is a sample project that presents a modern 2021 approach to Android app development. The project tries t

null 362 Jan 2, 2023
A sample app showing how to build an app using the MVI architecture pattern.

MVI Example This application was streamed live on Twitch to demonstrate how to build an application using MVI. You can find the VOD here for now: http

Adam McNeilly 46 Jan 2, 2023
How to apply meaningful and delightful motion in a sample Android app

Applying meaningful motion on Android How to apply meaningful and delightful motion in a sample Android app Read the complete post at https://medium.c

André Mion 167 Dec 19, 2022
A sample Grocery Store app built using the Room, MVVM, Live Data, Rx Java, Dependency Injection (Kotlin Injection) and support Dark Mode

Apps Intro A sample Grocery Store app built using the Room, MVVM, Live Data, Rx Java, Dependency Injection (Kotlin Injection) and support Dark Mode In

Irsyad Abdillah 25 Dec 9, 2022
A sample Android application with a strong focus on a clean architecture, automated unit and UI testing and continuous integration.

Android playground This is a sample Android application with a strong focus on a clean architecture, automated unit and UI testing and continuous inte

null 6 Jun 4, 2022
Quality-Tools-for-Android 7.5 0.0 L5 Java This is an Android sample app + tests that will be used to work on various project to increase the quality of the Android platform.

Quality Tools for Android This is an Android sample app + tests that will be used to work on various project to increase the quality of the Android pl

Stéphane Nicolas 1.3k Dec 27, 2022
📚 Sample Android Components Architecture on a modular word focused on the scalability, testability and maintainability written in Kotlin, following best practices using Jetpack.

Android Components Architecture in a Modular Word Android Components Architecture in a Modular Word is a sample project that presents modern, 2020 app

Madalin Valceleanu 2.3k Dec 30, 2022
Sample application demonstrating Android design and animation

android-movies-demo This is a sample application showing off some interesting design/development interactions for a talk given at Droidcon 2013. As it

Daniel Lew 359 Jan 1, 2023
Sample to show how to implement blur graphical tricks

BlurEffectForAndroidDesign Sample to show how to implement blur graphical tricks All the explanations could be found here: http://nicolaspomepuy.fr/?p

Nicolas POMEPUY 2k Dec 28, 2022
Sample material transition animations for Android

See ListOfThings for a newer implementation. Android Material Transitions This Android project samples some Material Design-ish transitions for list i

Todd Way 1.2k Dec 7, 2022
Sample Project for Android Support Library 23.2

SnapShot: Contains features Vector Drawable Animated Vector Drawable AppCompat DayNight theme Bottom Sheets Using BottomSheetDialog in day-night mode.

Huqiu Liao 779 Nov 24, 2022
A simple sample showing the different types of notifications on Andoid

Notification example Simple notification. Expandable notification Progress notification Action button notification Notifications: MainActivity: Refs h

Saul Molinero 191 Nov 29, 2022
PlayPauseDrawable 1.9 0.0 L5 Java This is a sample Play & Pause Drawable with morphing animation for Android

#PlayPauseDrawable #Deprecated please go to https://github.com/tarek360/Material-Animation-Samples This is a sample Play & Pause Drawable with morphin

Ahmed Tarek 48 May 26, 2022