Android Debug Drawer for faster development

Overview

Android Debug Drawer

Android Arsenal

Faster development with Debug Drawer

Features

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,OkHttp3Module - common information about http client (requires extra dependency)

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

GlideModule - 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)

TimberModule - log viewer with sharing feature (requires extra dependency). Thanks AntonyGolovin for contributing.

ActionsModule - any context dependent action (ButtonAction, SwitchAction, SpinnerAction)

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

LogsModule - Logcat and OkHttp network calls interceptor (requires extra dependency). Credits Sloy

NetworkQualityModule - Error/delay rate managing for network calls (requires extra dependency). Credits Sloy

TODO

  • Take screenshot feature

You are always welcome to suggest modules!

Getting Started

Add Gradle dependencies:

DebugDrawer

dependencies {
   debugImplementation 'io.palaima.debugdrawer:debugdrawer:0.8.0'
   releaseImplementation 'io.palaima.debugdrawer:debugdrawer-no-op:0.8.0'
}

DebugView

dependencies {
   debugImplementation 'io.palaima.debugdrawer:debugdrawer-view:0.8.0'
   releaseImplementation 'io.palaima.debugdrawer:debugdrawer-view-no-op:0.8.0'
}

BuildModule, DeviceModule, SettingsModule, NetworkModule

dependencies {
   implementation 'io.palaima.debugdrawer:debugdrawer-commons:0.8.0'
}

ActionsModule - ButtonAction, SwitchAction, SpinnerAction

dependencies {
   implementation 'io.palaima.debugdrawer:debugdrawer-actions:0.8.0'
}

OkHttpModule, OkHttp3Module OkHttp library required

dependencies {
   implementation 'io.palaima.debugdrawer:debugdrawer-okhttp:0.8.0'
   implementation 'io.palaima.debugdrawer:debugdrawer-okhttp3:0.8.0'
}

PicassoModule Picasso library required

dependencies {
   implementation 'io.palaima.debugdrawer:debugdrawer-picasso:0.8.0'
}

GlideModule Glide library required

dependencies {
   implementation 'io.palaima.debugdrawer:debugdrawer-glide:0.8.0'
}

ScalpelModule Scalpel library required

dependencies {
   implementation 'io.palaima.debugdrawer:debugdrawer-scalpel:0.8.0'
}

LocationModule

dependencies {
   implementation 'io.palaima.debugdrawer:debugdrawer-location:0.8.0'
}

TimberModule Timber library required

dependencies {
   implementation 'io.palaima.debugdrawer:debugdrawer-timber:0.8.0'
}

FpsModule Takt library required

dependencies {
   implementation 'io.palaima.debugdrawer:debugdrawer-fps:0.8.0'
}

LogsModule Lynx & Chuck libraries required

dependencies {
   implementation 'io.palaima.debugdrawer:debugdrawer-logs:0.8.0'
}

NetworkQualityModule OkHttp library required

dependencies {
   implementation 'io.palaima.debugdrawer:debugdrawer-network-quality:0.8.0'
}

Putting All Together

1. Initialization in Activity

You could use DebugDrawer or DebugView depending on your needs

Example using DebugDrawer (For DebugView initialization check DebugViewActivity)

    private DebugDrawer debugDrawer;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        //...

        SwitchAction switchAction = new SwitchAction("Test switch", new SwitchAction.Listener() {
            @Override
            public void onCheckedChanged(boolean value) {
                Toast.makeText(MainActivity.this, "Switch checked", Toast.LENGTH_LONG).show();
            }
        });

        ButtonAction buttonAction = new ButtonAction("Test button", new ButtonAction.Listener() {
            @Override
            public void onClick() {
                Toast.makeText(MainActivity.this, "Button clicked", Toast.LENGTH_LONG).show();
            }
        });

        SpinnerAction<String> spinnerAction = new SpinnerAction<>(
            Arrays.asList("First", "Second", "Third"),
            new SpinnerAction.OnItemSelectedListener<String>() {
                @Override public void onItemSelected(String value) {
                    Toast.makeText(MainActivity.this, "Spinner item selected - " + value, Toast.LENGTH_LONG).show();
                }
            }
        );

        debugDrawer = new DebugDrawer.Builder(this)
            .modules(
                new ActionsModule(switchAction, buttonAction, spinnerAction),
                new FpsModule(Takt.stock(getApplication())),
                new LocationModule(this),
                new ScalpelModule(this),
                new TimberModule(),
                new OkHttp3Module(okHttpClient),
                new PicassoModule(picasso),
                new GlideModule(Glide.get(getContext())),
                new DeviceModule(this),
                new BuildModule(this),
                new NetworkModule(this),
                new SettingsModule(this)
            ).build();
    }

2. TimberModule

Don't forget to plant needed log trees in Application class. Tree that is used by TimberModule stored in LumberYard class.

Application class example:

    public class DebugDrawerApplication extends Application {
        @Override
        public void onCreate() {
            super.onCreate();

            LumberYard lumberYard = LumberYard.getInstance(this);
            lumberYard.cleanUp();

            Timber.plant(lumberYard.tree());
            Timber.plant(new Timber.DebugTree());
        }
    }

Creating and Publishing Your Own Module

Add implementation 'io.palaima.debugdrawer:debugdrawer-base:0.8.0' to your dependencies

Module must implement DebugModule interface or extend DebugModuleAdapter if you do not need lifecycle hooks

    public interface DebugModule {

        /**
         * Creates module view
         */
        @NonNull View onCreateView(@NonNull LayoutInflater inflater, @NonNull ViewGroup parent);

        /**
         * Override this method if you need to refresh
         * some information  when drawer is opened
         */
        void onOpened();

        /**
         * Override this method if you need to stop
         * some actions  when drawer is closed
         */
        void onClosed();

        /**
         * Override this method if you need to start
         * some processes
         */
        void onResume();

        /**
         * Override this method if you need to do
         * some clean up
         */
        void onPause();

        /**
         * Override this method if you need to start
         * some processes that would be killed when
         * onStop() is called
         * E.g. register receivers
         */
        void onStart();

        /**
         * Override this method if you need to do
         * some clean up when activity goes to foreground.
         * E.g. unregister receivers
         */
        void onStop();
    }

Sample

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

MainActivity

DebugViewActivity

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

  • Opening braces to appear on the same line as code
  • All variables must be camelCase
  • All resources must have dd_ prefix

Developed By

Credits

License

Copyright 2016 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.
Comments
  • StatusBar color disabled

    StatusBar color disabled

    On Android 5.1.1 (Nexus 5) Using io.palaima.debugdrawer:debugdrawer:0.1.1

    The StatusBar color is disabled

    Here's my code :

    @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.activity_main);
            ButterKnife.inject(this);
            stock();
            if (BuildConfig.DEBUG) {
    
                mDebugDrawer = new DebugDrawer.Builder(this).modules(
                        new DeviceModule(this),
                        new BuildModule(this),
                        new NetworkModule(this),
                        new SettingsModule(this)
                ).build();
            }
        }
    
    @Override
        protected void onStart() {
            super.onStart();
            if (mDebugDrawer != null) {
                mDebugDrawer.onStart();
            }
        }
    
        @Override
        protected void onStop() {
            super.onStop();
            if (mDebugDrawer != null) {
                mDebugDrawer.onStop();
            }
        }
    

    The issue seems to be in the my stock() function where i'm setting an android.support.v7.widget.Toolbar. If i remove the toolbar everything is fixed.

    Thanks,

    opened by nalmada 7
  • Fix SecurityException in NetworkController regarding missing Bluetooth permission

    Fix SecurityException in NetworkController regarding missing Bluetooth permission

    Fixes

    01-19 11:23:01.828 4500-4500/? E/AndroidRuntime: FATAL EXCEPTION: main Process: net.familo.android.dev, PID: 4500 java.lang.SecurityException: Need BLUETOOTH ADMIN permission: Neither user 10119 nor current process has android.permission.BLUETOOTH_ADMIN. at android.os.Parcel.readException(Parcel.java:1620) at android.os.Parcel.readException(Parcel.java:1573) at android.bluetooth.IBluetoothManager$Stub$Proxy.enable(IBluetoothManager.java:302) at android.bluetooth.BluetoothAdapter.enable(BluetoothAdapter.java:901) at io.palaima.debugdrawer.commons.NetworkController.setBluetoothEnabled(NetworkController.java:152) at io.palaima.debugdrawer.commons.NetworkModule$3.onCheckedChanged(NetworkModule.java:78) at android.widget.CompoundButton.setChecked(CompoundButton.java:156) at android.widget.Switch.setChecked(Switch.java:1070) at android.widget.Switch.toggle(Switch.java:1065) at android.widget.CompoundButton.performClick(CompoundButton.java:120) at android.view.View$PerformClick.run(View.java:21153) at android.os.Handler.handleCallback(Handler.java:739) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:148) at android.app.ActivityThread.main(ActivityThread.java:5417) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)

    opened by vanniktech 6
  • Change your DrawerLayout's id please

    Change your DrawerLayout's id please

    In debugdrawer/src/main/res/layout/debug_drawer.xml change the id of your DrawerLayout to something other than the default "drawer_layout" because if the application already has a navigation drawer with that same id it will create a lot of problems. Use something like "debug_drawer_layout" instead :)

    opened by Benjiko99 4
  • Merge tag can now be used for Activity layouts

    Merge tag can now be used for Activity layouts

    This approach is simpeler and probably more appropriate than the approach suggested in pull-request: #35

    • The DebugDrawer.Builder was only placing the first child from the root content view to the DebugDrawer content view, other child's where forgotten, a typical Christmas story 😉🎄
    • Made the "alreadyInflated" check a bit more robust
    • Updated Gradle build tools to version 2.3.1 (stable)

    TLDR: This fix makes it possible to use the merge tag for an activity layout.

    opened by Rolf-Smit 3
  • Added okhttp3 module

    Added okhttp3 module

    Because of OkHttp's package name change, the current debugdrawer-okhttp module won't work with OkHttp 3.0.0-RC1 and newer. This PR creates a new module, debugdrawer-okhttp3, which uses the latest revision of Square's library and provides an OkHttp3Module for usage with DebugDrawer. The demo app doesn't include this yet, since we're at the mercy of a new version of Picasso first, which provides a Downloader using OkHttp3, however this has recently been merged.

    opened by mannodermaus 3
  • Added log module

    Added log module

    Hi,

    I've ported log module from u2020 app. It has dependency on Jake Wharton's Timber (https://github.com/JakeWharton/timber). If user wants to use it he should add some lines to Application class. I also updated example app.

    User can see logs on the devise. He also can share log file. So he has same functions from u2020 app.

    screenshot_2015-08-09-19-34-29

    opened by AntonHolovin 3
  • Fixed NPE in NetworkController when BluetoothAdapter is null

    Fixed NPE in NetworkController when BluetoothAdapter is null

    I've got that issue on a GenyMotion Device. I don't know if that's the reason, in any case it should not crash since now I can't use the NetworkModule.

    opened by vanniktech 3
  • Dependency on api 15, should be lower

    Dependency on api 15, should be lower

    Hi, Thanks for making this lib! I cloned and changed api to 11 and there were no errors. If there are no reasons for api 15, would you lower it to 11?

    Edit: Looks like Switch requires api 14. Use compat library?

    opened by ebabel 3
  • I am maintaining a fork of DebugDrawer

    I am maintaining a fork of DebugDrawer

    So this great library was not maintained for almost two years. So I decided to fork it and continue to maintain it here: lenguyenthanh/DebugDrawer.

    I have done:

    • Upgrade Androidx and other dependencies
    • Fix #78

    I published it to https://jitpack.io/#lenguyenthanh/debugdrawer so anyone can use that. Here is an example:

        debugImplementation "com.github.lenguyenthanh.debugdrawer:debugdrawer-base:0.9.0"
        debugImplementation "com.github.lenguyenthanh.debugdrawer:debugdrawer:0.9.0"
        debugImplementation "com.github.lenguyenthanh.debugdrawer:debugdrawer-view:0.9.0"
        debugImplementation "com.github.lenguyenthanh.debugdrawer:debugdrawer-okhttp3:0.9.0"
        debugImplementation "com.github.lenguyenthanh.debugdrawer:debugdrawer-scalpel:0.9.0"
        debugImplementation "com.github.lenguyenthanh.debugdrawer:debugdrawer-picasso:0.9.0"
        debugImplementation "com.github.lenguyenthanh.debugdrawer:debugdrawer-timber:0.9.0"
        debugImplementation "com.github.lenguyenthanh.debugdrawer:debugdrawer-fps:0.9.0"
        debugImplementation "com.github.lenguyenthanh.debugdrawer:debugdrawer-actions:0.9.0"
        debugImplementation "com.github.lenguyenthanh.debugdrawer:debugdrawer-commons:0.9.0"
    

    Welcome to any PR or issues in my repository.

    opened by lenguyenthanh 2
  • Is this project still being maintained?

    Is this project still being maintained?

    Hi @palaima! I've started to implement the debug drawer in a few apps at my company, but needed some changes. I've sent a couple of PRs and have more things prepared. But I see there hasn't been any activity here for a few months.

    Right now I have my own fork of the library, and I was wondering if it's worth sending PRs here or better officially diverge my fork and publish it as an independent library. I would also be ok becoming a maintainer of your repository, if you wish.

    Could you please give us an update on your status with regard to the project? Thanks!

    opened by Sloy 2
  • Network delay/error adapters

    Network delay/error adapters

    I noticed this in the TODO section, and it sounds very useful for QA. As far as you're aware, has anyone started work on this? If not I might see if I can have a crack at it

    Cheers

    opened by kiwiandroiddev 2
  • Programmatically (de)activate the drawer

    Programmatically (de)activate the drawer

    I'd like to programmatically (de)activate the debug drawer, for example by turning a switch "debug mode" in settings.

    A solution may be to add 2 methods in DebugDrawer: enable() and disable(), to respond to dynamic changes.

    Moreover, the DebugDrawer.Builder::build() could receive a boolean parameter to enable or not the drawer while building it (true by default to be compatible with current behavior).

    opened by RoRoche 0
  • Bug in onActivityDestroyed() method.

    Bug in onActivityDestroyed() method.

    https://github.com/palaima/DebugDrawer/blob/49b5992a1148757bd740c4a0b7df10ef70ade6d8/debugdrawer/src/main/java/io/palaima/debugdrawer/DebugDrawerLifecycleCallbacks.java#L43-L47

    https://github.com/palaima/DebugDrawer/blob/49b5992a1148757bd740c4a0b7df10ef70ade6d8/debugdrawer/src/main/java/io/palaima/debugdrawer/DebugDrawerLifecycleCallbacks.java#L54-L59

    If three drawer is open, and the third drawer is destroyed, the previous two DebugDrawerLifecycleCallbacks will also be removed. I think the code in onActivityDestroyed method also need check If the Destroyed Activity is current activity or not.

    opened by Nstd 0
  • Navigation control in DebugDrawer?

    Navigation control in DebugDrawer?

    When we drag it from right to left we are able to see debug drawer.In the same way when we drag it from left to right we are getting some overlay , how to control it?

    opened by Harishy 2
  • Migrate OkHttp to version 4.0

    Migrate OkHttp to version 4.0

    Hello! Thank you guys for your work! Could you please tell me - are you planning to update the okhttp dependency to version 4.0? Right now it creates some problems, such as NoSuchMethodError in case of using 4.0 version.

    opened by ddshakirov 0
  • SecurityException

    SecurityException

    On some devices, I am getting SecurityException while switching ON/OFF WiFi connection:

    java.lang.RuntimeException:Error receiving broadcast Intent{act=android.net.conn.CONNECTIVITY_CHANGE flg=0x4000010bqHint=4VirtualScreenParam=Params{mDisplayId=-1,null,mFlags=0x00000000)}(has extras)}in io.palaima.debugdrawer.commons.NetworkController$NetworkReceiver@775e4b8 at android.app.LoadedApk$ReceiverDispatcher$Args.run(LoadedApk.java:1003) at android.os.Handler.handleCallback(Handler.java:739) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:158) at android.app.ActivityThread.main(ActivityThread.java:7224) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120) Caused by:java.lang.SecurityException:WifiService:Neither user 10619nor current process has android.permission.CHANGE_WIFI_STATE. at android.os.Parcel.readException(Parcel.java:1620) at android.os.Parcel.readException(Parcel.java:1573) at android.net.wifi.IWifiManager$Stub$Proxy.setWifiEnabled(IWifiManager.java:1665) at android.net.wifi.WifiManager.setWifiEnabled(WifiManager.java:2065) at io.palaima.debugdrawer.commons.NetworkController.setWifiEnabled(NetworkController.java:94) at io.palaima.debugdrawer.commons.NetworkModule$1.onCheckedChanged(NetworkModule.java:60) at android.widget.CompoundButton.setChecked(CompoundButton.java:165) at android.widget.Switch.setChecked(Switch.java:1138) at io.palaima.debugdrawer.commons.NetworkModule$4.onChanged(NetworkModule.java:124) at io.palaima.debugdrawer.commons.NetworkController$1.post(NetworkController.java:182) at io.palaima.debugdrawer.commons.NetworkController$NetworkReceiver.onReceive(NetworkController.java:219) at android.app.LoadedApk$ReceiverDispatcher$Args.run(LoadedApk.java:993) at android.os.Handler.handleCallback(Handler.java:739)  at android.os.Handler.dispatchMessage(Handler.java:95)  at android.os.Looper.loop(Looper.java:158)  at android.app.ActivityThread.main(ActivityThread.java:7224)  at java.lang.reflect.Method.invoke(Native Method)  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)

    opened by ghost 0
Owner
Mantas Palaima
Mantas Palaima
💙🔥 FlutterFire commons repository, makes FlutterFire app development faster, easier, and more fun!

???? FlutterFire commons repository, makes FlutterFire app development faster, easier, and more fun!

Kosuke Saigusa 18 Dec 1, 2022
A Dart Build Plugin that uploads debug symbols for Android, iOS/macOS and source maps for Web to Sentry via sentry-cli

Sentry Dart Plugin A Dart Build Plugin that uploads debug symbols for Android, iOS/macOS and source maps for Web to Sentry via sentry-cli. For doing i

Sentry 36 Jan 4, 2023
:bug: Flutter debug helper widget with common and custom actions

Debug Friend Flutter debug helper widget with common and custom actions This helps you reduce the development and testing time of new features Show so

Stanislav Ilin 43 Dec 7, 2022
Adds a side menu in all screens with debug information

Adds a side menu in all screens with debug information. You can decide which information to show and create new modules to include more information.

Sergi Martínez 27 Oct 7, 2022
UIWidget is a Unity Package which helps developers to create, debug and deploy efficient, cross-platform Apps.

⚠️ The main repository of UIWidgets has been moved to https://github.com/Unity-Technologies/com.unity.uiwidgets. Please visit the new site if you have

Unity Technologies 1.9k Dec 27, 2022
Write and debug tests easily, built on integration_test

flutter_convenient_test: Write and debug tests easily, built on integration_test Quick demo full_video.mov Have questions? Though used in production e

fzyzcjy 324 Dec 21, 2022
Best ever drawer in Flutter for Android and ISO.

Login & Register Screen in Flutter Best ever login and register screen in flutter to make precious application. This flutter app is made just to demon

Asad Malik 11 Aug 28, 2021
Readky is a Free Flutter News App Starter Template that can help you develop a News application much faster.

Readky. Introduction Readky is a Free Flutter News App Starter Template that can help you develop a News application much faster. You just need to add

Muhammad Rezky Sulihin 54 Nov 26, 2022
Hungry is a Free Flutter Recipe App Starter Template that can help you develop a Recipe application much faster.

Hungry is a Free Flutter Recipe App Starter Template that can help you develop a Recipe application much faster. You just need to add some adjustment to the frontend and you can create your own backend.

Muhammad Rezky Sulihin 48 Dec 20, 2022
A package help you to make api call and handle error faster, also you can check for internet before call api.

http_solver ##not for production use, only for learning purpose. A package help you to make api call and handle error faster, also you can check for i

Abdelrahman Saed 1 Jun 18, 2020
News App developed with Flutter featuring beautiful UI, category-based news, story for faster news reading, inbuilt article viewer, share feature, and more.

Ariel News App developed with Flutter featuring beautiful UI, category-based news, story for faster news reading, inbuilt article viewer, share featur

Hash Studios 30 Nov 9, 2022
The Integration Test Helper has pre-configured methods that allow for faster test deployment for end to end (e2e) test coverage.

The Integration Test Helper has pre-configured methods that allow for faster test deployment for end to end (e2e) test coverage (using Android and iOS

The Mobile Applications Community 2 Apr 7, 2022
The aim of this project is to assist flutter developers, especially juniors to create reusable widget faster in flutter.

FLUTTER WIDGET BUILDER A widget builder for flutter Explore the docs » View Demo · Report Bug · Request Feature Table of Contents About The Project Bu

null 10 Oct 27, 2022
My collection of bricks created by me to help you build Flutter projects faster I think.

My collection of bricks created by me to help you build Flutter projects faster I think. ?? Bricks Brick Description Version presentation_layer A bric

Nguyen Minh Dung 12 Nov 15, 2022
My collection of bricks to help you build projects faster or nothing else will 😆

My collection of bricks to help you build projects faster or nothing else will ?? Bricks ?? Brick Description Version annoying_analysis_options A bric

Prince Nna 4 Aug 20, 2022
A fast start flutter project to make aps faster and skip setup on every application. I am personally using this structure while creating a new project

Flutter Fast Start A fast start flutter project to make apps faster and skip setup on every application. I am personally using this structure while cr

Okan Demir 2 Dec 15, 2022
Let's create a selectable Flutter Navigation Drawer with routing that highlights the current item within the Flutter Sidebar Menu.

Flutter Tutorial - Sidebar Menu & Selectable Navigation Drawer Let's create a selectable Flutter Navigation Drawer with routing that highlights the cu

Johannes Milke 12 Dec 26, 2022
Let's create a Flutter Collapsible Sidebar Menu that can collapse and expand the Navigation Drawer in Flutter.

Flutter Tutorial - Collapsible Sidebar Menu & Navigation Drawer Let's create a Flutter Collapsible Sidebar Menu that can collapse and expand the Navig

Johannes Milke 22 Jan 3, 2023
Flutter Split View and Drawer Navigation example

Flutter Split View and Drawer Navigation example This repo contains the source code for this tutorial: Responsive layouts in Flutter: Split View and D

Andrea Bizzotto 32 Nov 17, 2022