Skip to content

Repository files navigation

Android Debug Drawer

Android Arsenal

Faster development with Debug Drawer

Features

Currently exists 10 modules:

DeviceModule - common information about your device

BuildModule - app build information

SettingsModule - open Developer, Battery, Default settings, open app info and possibility to uninstall app directly from itself

NetworkModule - enable/disable Wifi, Mobile or Bluetooth

OkHttpModule - common information about http client (requires extra dependency)

PicassoModule - image downloading and caching statistics (requires extra dependency)

ScalpelModule - tool to uncover the layers under your app (requires extra dependency) Thanks ebabel for contributing.

LocationModule - common location information (requires extra dependency)

LogModule - log viewer with sharing feature (requires extra dependency) Thanks Vilian for contributing.

FpsModule - measuring the FPS using Choreographer (requires extra dependency)

TODO

  • Network delay/error adapters
  • Take screenshot feature

You are always welcome to suggest modules!

Getting Started

Add Gradle dependency:

dependencies {
compile 'io.palaima.debugdrawer:debugdrawer:0.5.0'
}

If you are using popular OkHttp library. Probably you will be interesting in network statistics

dependencies {
compile 'io.palaima.debugdrawer:debugdrawer-okhttp:0.5.0'
}

Or if you are using Picasso library, also from Square Inc.

dependencies {
compile 'io.palaima.debugdrawer:debugdrawer-picasso:0.5.0'
}

ScalpelModule

dependencies {
compile 'io.palaima.debugdrawer:debugdrawer-scalpel:0.5.0'
}

LocationModule

dependencies {
compile 'io.palaima.debugdrawer:debugdrawer-location:0.5.0'
}

LogModule

dependencies {
compile 'io.palaima.debugdrawer:debugdrawer-log:0.5.0'
}

Takt library required FpsModule

dependencies {
compile 'io.palaima.debugdrawer:debugdrawer-fps:0.5.0'
}

You can try the SNAPSHOT version:

dependencies {
compile 'io.palaima.debugdrawer:debugdrawer:0.6.0-SNAPSHOT'
}

Make sure to add the snapshot repository:

repositories {
maven {
url "https://oss.sonatype.org/content/repositories/snapshots"
}
}

Putting All Together

1. Initialization in Activity

privateDebugDrawermDebugDrawer;
@OverrideprotectedvoidonCreate(BundlesavedInstanceState) {
super.onCreate(savedInstanceState);
if (BuildConfig.DEBUG) {
mDebugDrawer = newDebugDrawer.Builder(this).modules(
newLocationModule(this),
newScalpelModule(this),
newLogModule(),
newOkHttpModule(mOkHttpClient),
newPicassoModule(mPicasso),
newDeviceModule(this),
newBuildModule(this),
newNetworkModule(this),
newSettingsModule(this)
).build();
}
}

2. onStart/onStop

If you use NetworkModule/LocationModule or your own which is hooked with BroadcastReceivers you must call onStart/onStop in your activity

@OverrideprotectedvoidonStart() {
super.onStart();
if (mDebugDrawer != null) {
mDebugDrawer.onStart();
}
}
@OverrideprotectedvoidonStop() {
super.onStop();
if (mDebugDrawer != null) {
mDebugDrawer.onStop();
}
}

3. Timber - LogModule

If you want to use LogModule you need to use Timber for logging. Don't forget to plant needed log trees in Application class. Tree that is used by LogModule stored in LumberYard class.

Application class example:

publicclassDebugDrawerApplicationextendsApplication {
@OverridepublicvoidonCreate() {
super.onCreate();
LumberYardlumberYard = LumberYard.getInstance(this);
lumberYard.cleanUp();
Timber.plant(lumberYard.tree());
Timber.plant(newTimber.DebugTree());
}
}

4. Takt - FpsModule

If you want to use FpsModule you need to use Takt.

newFpsModule(Takt.stock(getApplication()))
}

Creating Your Own Module

Module must implement DrawerModule interface

publicinterfaceDrawerModule {
/** * Creates module view */ViewonCreateView(LayoutInflaterinflater, ViewGroupparent);
/** * Override this method if you need to refresh * some information when drawer is opened */voidonOpened();
/** * Override this method if you need to stop * some actions when drawer is closed */voidonClosed();
/** * Override this method if you need to start * some processes that would be killed when * onStop() is called * E.g. register receivers */voidonStart();
/** * Override this method if you need to do * some clean up when activity goes to foreground. * E.g. unregister receivers */voidonStop();
}

Sample

You can clone the project and compile it yourself (it includes a sample). MainActivity

Contributing

Want to contribute? You are welcome!

Pull Requests

  • Fork the repo and create your branch from dev.
  • If you've changed APIs, update the documentation.
  • Make sure your code lints.
  • Change README.md if necessary

Coding Style

  • Use the m member variable prefix for private fields
  • Opening braces to appear on the same line as code
  • All variables must be CamelCase

Developed By

Credits

License

Copyright 2015 Mantas Palaima.
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.

About

Android Debug Drawer for faster development

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages