JakeWharton/u2020

Debug Drawer as gradle dependency

IgorGanapolsky opened this issue · 8 comments

Hi,
I was wondering if it is possible to abstract out the Debug Drawer into a separate library that can be pulled into any app as a gradle dependency. In your sample, your are specifically using Dagger1, and there is a lot of code to look at just to understand how the debug drawer is implemented. I think it would be great if folks can use your implementation with any project (and Dagger2) without understanding all the separate classes that comprise the drawer.

Thanks,
Igor

The only fundamental concept is that AppContainer is in src/main/java/ with a "default" implementation that just doesn't really do anything and in src/main/debug/ (or whatever variant you want) you create a DebugAppContainer which can wrap the root layout in one that has a drawer. I purposely did not make this a library or something complex because I want it to be thought of as a pattern. A ton of apps have developer settings and tweaks, and this is one way (of many) to present those. Shipping a library means there needs to be thought on API, usage patterns, etc. whereas something that's simply a pattern can be copied, changed, and/or ignored. Plus it means that you don't have to even use Dagger 1 or 2 in order to accomplish it!

Ok. Then how can I avoid the separate single-screen app that you have
installed with u2020 - which shows the debug screen? I am having a hard
time discerning between the internal, internalDebug and internalRelease
folders...

Thank you,
Igor

On Tue, Aug 11, 2015 at 12:40 AM, Jake Wharton notifications@github.com
wrote:

The only fundamental concept is that AppContainer is in src/main/java/
with a "default" implementation that just doesn't really do anything and in
src/main/debug/ (or whatever variant you want) you create a
DebugAppContainer which can wrap the root layout in one that has a
drawer. I purposely did not make this a library or something complex
because I want it to be thought of as a pattern. A ton of apps have
developer settings and tweaks, and this is one way (of many) to present
those. Shipping a library means there needs to be thought on API, usage
patterns, etc. whereas something that's simply a pattern can be copied,
changed, and/or ignored. Plus it means that you don't have to even use
Dagger 1 or 2 in order to accomplish it!


Reply to this email directly or view it on GitHub
#186 (comment).

Adding (or removing) the second activity is a very simple change. I added it in db8518b. There's not a whole lot going on to make that work so it should be pretty straightforward to keep it out of your app.

We'll be updating the README with more description soon (#87).

Hi @JakeWharton, @IgorGanapolsky sent you a Bitcoin tip worth 3,623 bits ($1.00), and I'm here to deliver it ➔ collect your tip.

Learn more about ChangeTip

Hi @IgorGanapolsky, I've delivered a Bitcoin tip worth 3,623 bits ($1.00) from @BashCo to your ChangeTip wallet.

Learn about ChangeTip