GithubHelp home page GithubHelp logo

aaaliua / slidingdebugmenu Goto Github PK

View Code? Open in Web Editor NEW

This project forked from lemonlabs/slidingdebugmenu

0.0 2.0 0.0 9.93 MB

SlidingDebugMenu is a helper layout for Android developers that allows easy access to the state of the device and its settings from anywhere in your application

License: Apache License 2.0

Java 100.00%

slidingdebugmenu's Introduction

SlidingDebugMenu

SlidingDebugMenu is a helper layout for developers that allows easy access to the state of the device and its settings from anywhere in your application. Use predefined modules or implement your own to suit your development needs!

Example Image

Default modules

Network module allows switching state of your wifi, mobile networks and bluetooth provided your device supports them and display their current state.

Log module controls which level of log should be output, provided you use our Log wrapper class.

Location module allows to easily retrieve current location and its parameters, access location settings and show your location in a map. This module uses GooglePlayServices, so it will not work on devices without it.

Build module provides some basic info about the installed application.

Including in your project

Currently the library is only distributed through Maven central repository.

Gradle:

repositories {
    mavenCentral()
}

dependencies {
    compile 'co.lemonlabs:slidingdebugmenu:0.1.0'
}

Maven:

<dependency>
    <groupId>co.lemonlabs</groupId>
    <artifactId>slidingdebugmenu</artifactId>
    <version>0.1.0</version>
</dependency>

Usage

The library supports Android 2.3+ and is currently only compatible with ActionBarCompat.

To use the default settings simply add this to your Activity's onCreate()

menu = SlidingDebugMenu.attach(this)

and add lifecycle callbacks in your onStop() and onStart().

@Override
public void onStop() {
    menu.onStop();
    super.onStop();
}

@Override
public void onStart() {
    super.onStart();
    menu.onStart();
}

Customization

To create a custom module extend MenuModule class and override getTitle() and getContent() methods. Optionally, you should override onStart() and onStop() if your module depends on the lifecycle of an Activity, like registering broadcast receivers, an EventBus, etc.

To attach a custom module to the debug drawer you can use one of:

menu = SlidingDebugMenu.attach(this)
menu.addModule(MenuModule module, boolean callOnStart)
menu.addModule(int position, MenuModule module, boolean callOnStart)

after attaching the drawer to an activity. Modules added this way will not persist after configuration changes or reinitialization of the menu.

OR

Use a static module editor before attaching it to the activity.

SlidingDebugMenu.edit()
    .add(CustomModule.class)
    .remove(BuildModule.class)
    .commit();
SlidingDebugMenu.attach(this)

Using this method will automatically reinitialize every module on reinitialization and they could be shared between multiple activities.

NOTE: Reflection is used to instantiate the modules, so currently only empty constructors are allowed. A dependency injection framework like Dagger would be useful in future releases.

See comments and examples for instructions of further customization of the menu.

Change Log

No changes so far

Dependencies

SlidingDebugMenu depends on

Acknowledgements

Developed By

Lemon Labs - [email protected]

License

Copyright 2014 Lemon Labs

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.

Ionicons is licensed under the MIT license.

=======

slidingdebugmenu's People

Contributors

balysv avatar mkuprionis avatar

Watchers

 avatar  avatar

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.