Skip to content

jpihl/DebugOverlay-Android-TransientInfo

Repository files navigation

DebugOverlay-Android-TransientInfo

Maven Central Javadocs API 16+ License

DebugOverlay-TransientInfo is an extension to the DebugOverlay library for Android. It allows custom data to be added and remove from the overlay while the application is running. This is useful when certain types of information is only relevant or available in specific parts of the application.

DebugOverlay Screen Capture

Notice how the "scrolled" line in the DebugOverlay is added and removed when the scroll view is present.

Requirements

API Level 16 (Android 4.1) and above.

Setup

Gradle:

dependencies {
  debugCompile 'com.ms-square:debugoverlay:1.1.3'
  releaseCompile 'com.ms-square:debugoverlay-no-op:1.1.3'
  testCompile 'com.ms-square:debugoverlay-no-op:1.1.3'

  compile ('com.github.jpihl:debugoverlay-ext-transient-info:1.0.0') {
    exclude module: 'debugoverlay'
  }
}

or

dependencies {
  // this will use a full debugoverlay lib even in the test/release build
  compile 'com.github.jpihl:debugoverlay-ext-transient-info:1.0.0'
}

Usage

Simple Example

In your Application class:

public class ExampleApplication extends Application {

  @Override public void onCreate() {
    super.onCreate();
    new DebugOverlay.Builder(this)
            .modules(new TransientInfoModule(1000),
                     new ...)
            .build()
            .install();
    // Normal app init code...
  }
}

In your Activity class where you want to monitor something:

public class ExampleActivity extends Activity {

  private final MyVideoPlayer videoPlayer = new MyVideoPlayer();

  @Override public void onCreate() {
    super.onCreate();
    TransientInfoModule.addProvider(new InfoProvider() {
      @Override String getInfo()
      {
        return "Frame drops: " + videoPlayer.frameDrops();
      }
    });
    // Normal activity onCreate code...
  }

  @Override public void onDestroy() {
    super.onCreate();
    TransientInfoModule.clearProviders();
    // Normal activity onDestroy code...
  }
}

License

Copyright 2017 Jeppe Pihl

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

Extension to DebugOverlay Android, which enables adding and removing parts of the DebugOverlay during the App's lifespan.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages