Skip to content
This repository was archived by the owner on Feb 26, 2023. It is now read-only.
This repository was archived by the owner on Feb 26, 2023. It is now read-only.

@DebugView annotation to enable HierarchyView using ViewServer #169

@pyricau

Description

@pyricau

@romainguy recently told me about ViewServer, a utility class he open sourced, which can be used to enable HierarchyViewer on your apps even if you don't have a rooted / engineer build phone.

The source is here: https://github.com/romainguy/ViewServer/tree/master/src/com/android/debug/hv

I think it could be nice to bake such a feature into AndroidAnnotations using a specific annotation (such as @DebugView), e.g. :

@DebugView
@EActivity
public class MyActivity extends Activity {

}

This would automatically enable the ViewServer on the activity, ie doing this :

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        // Set content view, etc.
        ViewServer.get(this).addWindow(this);
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
        ViewServer.get(this).removeWindow(this);
    }

    @Override
    public void onResume() {
        super.onResume();
        ViewServer.get(this).setFocusedWindow(this);
    }

Also note that android:debuggable must be set to true in the AndroidManifest.xml for the ViewServer to work.

Should we issue a compile warning on a ViewServer annotation if android:debuggable is false ?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions