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.
Notice how the "scrolled" line in the DebugOverlay is added and removed when the scroll view is present.
API Level 16 (Android 4.1) and above.
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'
}
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...
}
}
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.