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

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 ?

Activity

  1. a-thomas commented on Jul 3, 2012

    @a-thomas
    Contributor

    It's a really good idea ;) Very helpful class that I recently used.

    So, the annotation requirements for the @DebugView are having a ViewServer class in the android project and having android:debuggable set to true.

  2. pyricau commented on Feb 27, 2013

    @pyricau
    ContributorAuthor

    This should be documented somewhere. I'm reopening the issue until the documentation is done.

  3. pyricau commented on Feb 27, 2013

    @pyricau
    ContributorAuthor

    One more thing : please remove the milestone from the issue and add it to the pull request (once the issue is closed)

  4. ThomasFondrillon commented on Feb 27, 2013

    @ThomasFondrillon
    Contributor

    The documentation has been updated. I indicated that this annotation exists since AndroidAnnotations 3.0 whereas the 3.0 version is not released. Is this a problem?

  5. pyricau commented on Feb 27, 2013

    @pyricau
    ContributorAuthor

    No, it's fine. Just one thing missing: a link in the issue that points to the documentation, so that we can go there directly without searching. Here: HierarchyViewerSupport

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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