Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
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

Copy link
Copy link
@pyricau

Description

@pyricau
Issue body actions

@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 ?

Reactions are currently unavailable

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.