Giter Site home page Giter Site logo

pedrovgs / effectiveandroidui Goto Github PK

View Code? Open in Web Editor NEW
6.0K 6.0K 1.2K 994 KB

Sample project created to show some of the best Android practices to work in the Android UI Layer. The UI layer of this project has been implemented using MVP or MVVM (without binding engine) to show how this patterns works. This project is used during the talk "EffectiveAndroidUI".

License: Apache License 2.0

Java 100.00%

effectiveandroidui's People

Contributors

dayerdl avatar egor-n avatar forever4313 avatar hugoangeles0810 avatar jorgecastilloprz avatar lidi avatar pedrovgs avatar vic-gonzi avatar xfumihiro 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  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

effectiveandroidui's Issues

Ups! Something went wrong :(

I cloned the repo, build, installed and run and I'm only getting "Ups! Something went wrong :(". Is it possible to easily display something meaningful?

network issues

Hi there,
very interesting project, particularly the way you deal with the landscape/portrait stuff, it s transparent for the coder
I have a question about the network issues (event hough I know there is no actual request..)
for example in GetTvShowsInteractor class, we wait for some data received later on and then passed to the nofityTvShowsLoaded method. What if the context disappears meanwhile, like somebody killed the app, in your opinion, should'nt the callback object be a WeakReference?

Crashed in Smartisan T1

when i click item in the main view, it crashed. this is the error:

26643-26643/com.github.pedrovgs.effectiveandroidui E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.github.pedrovgs.effectiveandroidui, PID: 26643
android.view.InflateException: Binary XML file line #7: Error inflating class
at android.view.LayoutInflater.createView(LayoutInflater.java:620)
at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
at android.view.LayoutInflater.onCreateView(LayoutInflater.java:669)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:694)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:755)
at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
at com.github.pedrovgs.effectiveandroidui.ui.renderer.chapter.ChapterRenderer.inflate(ChapterRenderer.java:61)
at com.pedrogomez.renderers.Renderer.onCreate(Renderer.java:52)
at com.pedrogomez.renderers.RendererBuilder.createRenderer(RendererBuilder.java:143)
at com.pedrogomez.renderers.RendererBuilder.build(RendererBuilder.java:115)
at com.pedrogomez.renderers.RendererAdapter.getView(RendererAdapter.java:89)
at android.widget.HeaderViewListAdapter.getView(HeaderViewListAdapter.java:220)
at android.widget.AbsListView.obtainView(AbsListView.java:2377)
at android.widget.ListView.makeAndAddView(ListView.java:1792)
at android.widget.ListView.fillDown(ListView.java:693)
at android.widget.ListView.fillFromTop(ListView.java:754)
at android.widget.ListView.layoutChildren(ListView.java:1632)
at android.widget.AbsListView.onLayout(AbsListView.java:2202)
at android.view.View.layout(View.java:14845)
at android.view.ViewGroup.layout(ViewGroup.java:4633)
at com.github.pedrovgs.DraggableView.onLayout(DraggableView.java:433)
at android.view.View.layout(View.java:14845)
at android.view.ViewGroup.layout(ViewGroup.java:4633)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:453)
at android.widget.FrameLayout.onLayout(FrameLayout.java:388)
at android.view.View.layout(View.java:14845)
at android.view.ViewGroup.layout(ViewGroup.java:4633)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:453)
at android.widget.FrameLayout.onLayout(FrameLayout.java:388)
at android.view.View.layout(View.java:14845)
at android.view.ViewGroup.layout(ViewGroup.java:4633)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:453)
at android.widget.FrameLayout.onLayout(FrameLayout.java:388)
at android.view.View.layout(View.java:14845)
at android.view.ViewGroup.layout(ViewGroup.java:4633)
at android.support.v7.internal.widget.ActionBarOverlayLayout.onLayout(ActionBarOverlayLayout.java:437)
at android.view.View.layout(View.java:14845)
at android.view.ViewGroup.layout(ViewGroup.java:4633)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:453)
at android.widget.FrameLayout.onLayout(FrameLayout.java:388)
at android.view.View.layout(View.java:14845)
at android.view.ViewGroup.layout(ViewGroup.java:4633)
at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1671)
at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1525)
at android.widget.LinearLayout.onLayout(LinearLayout.java:1434)
at android.view.View.layout(View.java:14845)
at android.view.ViewGroup.layout(ViewGroup.java:4633)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:453)
at android.widget.FrameLayout.onLayout(FrameLayout.java:388)
at com.android.internal.policy.impl.PhoneWindow$DecorView.onLayout(PhoneWindow.java:2966)
at android.view.View.layout(View.java:14845)
at android.view.ViewGroup.layout(ViewGroup.java:4633)
at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:2070)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1810)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1065)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:5790)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:761)
at android.view.Choreographer.doCallbacks(Choreographer.java:574)
at android.view.Choreographer.doFrame(Choreographer.java:5

Error occurred in the line 61 of the ChapterRenderer.class, this is the code:
@Override protected View inflate(LayoutInflater layoutInflater, ViewGroup viewGroup) { return layoutInflater.inflate(R.layout.row_chapter, viewGroup, false); }

i don't know why such a error occurred.

Error:Could not find com.android.support:appcompat-v7:19.1.0.

Hi Sir, I tried your example but I'm having issue in importing it into Android Studio. Below is the error im having. I already installed the Android Support Repository but still got this error. Btw, im still new to using gradle build. Hoping that you can help me.

Error:Could not find com.android.support:appcompat-v7:19.1.0.
Required by:
EffectiveAndroidUI-master:app:unspecified

Please install the Android Support Repository from the Android SDK Manager.
Open Android SDK Manager

thanks

Considering activity lifecycle

Hi,
first of all thank you for your work.
One think i didn't understand is how to deal with the lifecycle of the activities related to the jobexecutor as the jobs are running in a threadpool and i need the possibility to cancel a job (while navigating through activities).
Can you give an example how you would integrate for example Loaders (or is using loaders not a good approach in this architecture) or RxJava?
Another question is, when and how to cleanup references (like callback in interactor, when presenter is no more interested in interactor results).

Crashing in samsung galaxy note 3 v4.3

Part of error report:

FATAL EXCEPTION: main
android.view.InflateException: Binary XML file line #11: Error inflating class android.widget.TextView
    at android.view.LayoutInflater.createView(LayoutInflater.java:613)
                                                                                        at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
                                                                                        at android.view.LayoutInflater.onCreateView(LayoutInflater.java:660)
                                                                                        at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:685)
                                                                                        at android.view.LayoutInflater.rInflate(LayoutInflater.java:746)
                                                                                        at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
                                                                                        at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
                                                                                        at com.github.pedrovgs.effectiveandroidui.ui.renderer.tvshow.TvShowRenderer.inflate(TvShowRenderer.java:66)

Inflation error occurs in TvShowRenderer line 66 when inflating R.layout.row_tv_show

Crashed in my MI4 phone

the crash log:
01-15 11:57:23.631 11565-11565/? D/dalvikvm: Late-enabling CheckJNI
01-15 11:57:23.701 11565-11565/com.github.pedrovgs.effectiveandroidui W/dalvikvm: VFY: unable to find class referenced in signature (Landroid/view/SearchEvent;)
01-15 11:57:23.701 11565-11565/com.github.pedrovgs.effectiveandroidui I/dalvikvm: Could not find method android.view.Window$Callback.onSearchRequested, referenced from method android.support.v7.internal.view.WindowCallbackWrapper.onSearchRequested
01-15 11:57:23.701 11565-11565/com.github.pedrovgs.effectiveandroidui W/dalvikvm: VFY: unable to resolve interface method 14134: Landroid/view/Window$Callback;.onSearchRequested (Landroid/view/SearchEvent;)Z
01-15 11:57:23.701 11565-11565/com.github.pedrovgs.effectiveandroidui D/dalvikvm: VFY: replacing opcode 0x72 at 0x0002
01-15 11:57:23.701 11565-11565/com.github.pedrovgs.effectiveandroidui I/dalvikvm: Could not find method android.view.Window$Callback.onWindowStartingActionMode, referenced from method android.support.v7.internal.view.WindowCallbackWrapper.onWindowStartingActionMode
01-15 11:57:23.701 11565-11565/com.github.pedrovgs.effectiveandroidui W/dalvikvm: VFY: unable to resolve interface method 14138: Landroid/view/Window$Callback;.onWindowStartingActionMode (Landroid/view/ActionMode$Callback;I)Landroid/view/ActionMode;
01-15 11:57:23.701 11565-11565/com.github.pedrovgs.effectiveandroidui D/dalvikvm: VFY: replacing opcode 0x72 at 0x0002
01-15 11:57:23.741 11565-11565/com.github.pedrovgs.effectiveandroidui I/dalvikvm: Could not find method android.content.res.TypedArray.getChangingConfigurations, referenced from method android.support.v7.internal.widget.TintTypedArray.getChangingConfigurations
01-15 11:57:23.741 11565-11565/com.github.pedrovgs.effectiveandroidui W/dalvikvm: VFY: unable to resolve virtual method 421: Landroid/content/res/TypedArray;.getChangingConfigurations ()I
01-15 11:57:23.741 11565-11565/com.github.pedrovgs.effectiveandroidui D/dalvikvm: VFY: replacing opcode 0x6e at 0x0002
01-15 11:57:23.741 11565-11565/com.github.pedrovgs.effectiveandroidui I/dalvikvm: Could not find method android.content.res.TypedArray.getType, referenced from method android.support.v7.internal.widget.TintTypedArray.getType
01-15 11:57:23.741 11565-11565/com.github.pedrovgs.effectiveandroidui W/dalvikvm: VFY: unable to resolve virtual method 443: Landroid/content/res/TypedArray;.getType (I)I
01-15 11:57:23.741 11565-11565/com.github.pedrovgs.effectiveandroidui D/dalvikvm: VFY: replacing opcode 0x6e at 0x0002
01-15 11:57:23.801 11565-11565/com.github.pedrovgs.effectiveandroidui D/dalvikvm: GC_FOR_ALLOC freed 395K, 26% free 23039K/30732K, paused 15ms, total 15ms
01-15 11:57:23.811 11565-11565/com.github.pedrovgs.effectiveandroidui I/dalvikvm-heap: Grow heap (frag case) to 39.105MB for 9000016-byte allocation
01-15 11:57:23.871 11565-11565/com.github.pedrovgs.effectiveandroidui I/Adreno-EGL: <qeglDrvAPI_eglInitialize:410>: EGL 1.4 QUALCOMM build: YWEN_+PATCH[ES]_msm8974_refs/tags/AU_LINUX_ANDROID_LNX.LA.3.5.2.2.1_RB1.04.04.04.090.059__release_ENGG ()
OpenGL ES Shader Compiler Version: E031.24.00.15
Build Date: 11/04/15 Wed
Local Branch: tip
Remote Branch: quic/kk_3.5_1
Local Patches: 14b1eae272f4a5ed345b2294a1c76becd9b27371 rb: re-work change "ES2.0 Fix for shadow cached VBO validation"
c63208cf6c1fe92a04d7ed7e26be44f2f51c94e9 Revert "Fix for perf regression from "ES2.0 Fix for shadow cached VBO validation""
01-15 11:57:23.901 11565-11565/com.github.pedrovgs.effectiveandroidui D/OpenGLRenderer: Enabling debug mode 0
01-15 11:57:23.981 11565-11565/com.github.pedrovgs.effectiveandroidui I/Timeline: Timeline: Activity_idle id: android.os.BinderProxy@42d5f680 time:180624621
01-15 11:57:25.371 11565-11565/com.github.pedrovgs.effectiveandroidui D/AndroidRuntime: Shutting down VM
01-15 11:57:25.371 11565-11565/com.github.pedrovgs.effectiveandroidui W/dalvikvm: threadid=1: thread exiting with uncaught exception (group=0x41755d58)
01-15 11:57:25.421 11565-11565/com.github.pedrovgs.effectiveandroidui E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.github.pedrovgs.effectiveandroidui, PID: 11565
android.view.InflateException: Binary XML file line #11: Error inflating class android.widget.TextView
at android.view.LayoutInflater.createView(LayoutInflater.java:623)
at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
at android.view.LayoutInflater.onCreateView(LayoutInflater.java:672)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:697)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:758)
at android.view.LayoutInflater.inflate(LayoutInflater.java:495)
at android.view.LayoutInflater.inflate(LayoutInflater.java:400)
at com.github.pedrovgs.effectiveandroidui.ui.renderer.tvshow.TvShowRenderer.inflate(TvShowRenderer.java:66)
at com.pedrogomez.renderers.Renderer.onCreate(Renderer.java:52)
at com.pedrogomez.renderers.RendererBuilder.createRenderer(RendererBuilder.java:143)
at com.pedrogomez.renderers.RendererBuilder.build(RendererBuilder.java:115)
at com.pedrogomez.renderers.RendererAdapter.getView(RendererAdapter.java:89)
at android.widget.AbsListView.obtainView(AbsListView.java:2257)
at android.widget.GridView.onMeasure(GridView.java:1044)
at android.view.View.measure(View.java:16529)
at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:719)
at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:455)
at android.view.View.measure(View.java:16529)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5125)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
at android.view.View.measure(View.java:16529)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5125)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
at android.support.v7.internal.widget.ContentFrameLayout.onMeasure(ContentFrameLayout.java:124)
at android.view.View.measure(View.java:16529)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5125)
at android.support.v7.internal.widget.ActionBarOverlayLayout.onMeasure(ActionBarOverlayLayout.java:393)
at android.view.View.measure(View.java:16529)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5125)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
at android.view.View.measure(View.java:16529)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5125)
at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1404)
at android.widget.LinearLayout.measureVertical(LinearLayout.java:695)
at android.widget.LinearLayout.onMeasure(LinearLayout.java:588)
at android.view.View.measure(View.java:16529)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5125)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
at com.android.internal.policy.impl.PhoneWindow$DecorView.onMeasure(PhoneWindow.java:2291)
at android.view.View.measure(View.java:16529)
at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:1973)
at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1170)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1352)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1057)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:5666)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:761)
at android.view.Choreographer.doCallbacks(Choreographer.java:574)
at android.view.Choreographer.doFrame(Choreographer.java:544)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:747)
at android.os.Handler.handleCallback(Handler.java:733)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5072)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
at com.android.internal.os.ZygoteInit.main(ZygoteI
01-15 11:57:27.361 11565-11565/com.github.pedrovgs.effectiveandroidui I/Process: Sending signal. PID: 11565 SIG: 9

Plugin with id 'sonar-runner' not found

When i try to build the app i get this :

Error:(13, 0) Plugin with id 'sonar-runner' not found. <a href="openFile:C:\Users\Yunus\Documents\Android Architecture\AndroidUI\EffectiveAndroidUI\app\build.gradle">Open File</a>

BaseFragment onInjectDependencies called on method onAttach

Hola Pedro:

He estado trasteando un poco el código de baseActivity y baseFragment y me parece que hay un pequeño bug cuando se restauran los fragments.
Hay veces (cuando el activity y sus fragments son restaurados) en el que el fragment llama a onAttach antes de que el activity pase por onCreate (creo que solo se garantiza que el activity esté correctamente inicializado en el método onActivityCreated del fragment). En este caso, la clase BaseFragment llama a inject antes de que el grafo de Dagger esté correctamente inicializado provocando un NullPointerException.

Posible solución:
Llamar a injectDependencies (clase fragment que a su vez llama a inject del activity) en onActivityCreated y utilizar los objectos "injected" solo posteriormente a esta llamada.

PD: Enhorabuena por el trabajo realizado.

Crash on rotate screen

Hi,
I've created a proyect with your BaseActivity FragmentActivity and BaseApplication, but sometimes on inject(Object object) method activityScopeGraph is null. Do you know why it could happen?

Trust anchor for certification path not found

I have put my twitterConsumerKey and twitterConsumerSecret in fabric.properties file, but when i come to the logingactivity then click the login button, i got the error:
com.twitter.sdk.android.core.TwitterApiException: java.security.cert.CertPathValidatorException: Trust anchor for certification path not found.
what is the problem? thanks for advance.

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.