A good Debug tool entry is a must for every app. For the unified use of messy debugging tools and debugging features, you need a neat, internal display container.
Scenario 1: The general debugging tool provides a unified debugging interface by adding an entry at a certain point on the main interface of the application.
- The entrance is fixed. Entering the deep interface, calling the Debug tool must be returned to the Debug fixed entrance.
- There is a need for UI debugging, and debugging tools are not flexible enough
- The floating window faces the permission problem
- The function of the general floating window is too single
- Floating on the app affects the overall experience
This tool only provides a floating window style debugging tool interface practice, users can fill in the debugging test function to use.
- In-app display, no need to apply for any permissions;
- Support for drag and drop;
- Move beyond the screen limit;
- Automatically snap to the edge of the screen;
- Destroy the floating window flexibly;
- Real-time display of information such as memory usage;
- Click on the floating window to pop up the floating layer for function setting;
- The height of the floating layer can be flexibly adjusted;
- Debugging the floating layer can add multiple pages;
- Provide a variety of display controls, such as radio controls, multi-select controls, rich multi-select information controls, text controls, etc.
- Filling test function is convenient and convenient for maintenance;
- APP can be called out at any location, and the APP is automatically hidden outside;
- Chained calls, simple to call.
- Add the following code to onStart and onStop in the base class Activity (note that it must be the base class Activity)
@Override
protected void onStart() {
super.onStart();
DebugTools.get().attach(this);
}
@Override
protected void onStop() {
super.onStop();
DebugTools.get().detach(this);
}
- Display the Debug tool
DebugTools.get().add();
Dismiss
DebugTools.get().remove();
onBackPressed
@Override
public void onBackPressed() {
if (!DebugTools.get().dismissMenu()){
super.onBackPressed();
}
}
Fill data and display (in advance in onCreate, you need to call the attach once)
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
DebugTools.get().attach(this)
.fillMenuData(DebugConfig.getList())
.add();
}
Update floating window display information
DebugTools.get().updateInfo(memorySize, percent);
Support for four types of control fill lists
1.Radio
new RadioEntity().setGroupBtnName("接口类型1#接口类型2#接口类型3")
.setCheckPosition(getSelectedHostId())
.setOnCheckedChangeListener(getHostCheckedChangeListener()).setTitle("接口类型:");
2.Switch
new SwitchEntity().setChecked(true)
.setTitle("test feature toggle1")
.setInfo("动态功能开关测试1")
.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
Toast.makeText(BubbleContext.getAppContext(), "动态功能开关测试", Toast.LENGTH_SHORT).show();
}
});
3.Title
new TextEntity().setTitle("测试页面");
4.Simple
new SimpleEntity().setTitle("测试1")
.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Toast.makeText(BubbleContext.getAppContext(), "Test", Toast.LENGTH_SHORT).show();
}
});
This open source library draws on several open source libraries, thanks to the following open source libraries for the contribution of open source power:
https://github.com/zzz40500/AndroidSweetSheet
https://github.com/txusballesteros/bubbles-for-android
https://github.com/LongMaoC/WaterView