Skip to content

Files

Latest commit

7500980 · May 12, 2021

History

History
137 lines (88 loc) · 4.86 KB

Readme.md

File metadata and controls

137 lines (88 loc) · 4.86 KB

Uinspector

A UI inspector to traverse a view hierarchy on Android

Build Jitpack hackmd-github-sync-badge

Preview

What are the properties Where is the view Select another view

Feature

  • Low intrusive, no code change required
  • Turn on/off inspector throught the notification
  • Select the target view by clicking on it
  • What's LayoutInspector can't do?
    • Tracking animations

    • Support to add your custom panel or custom view properties

      See more

Get Started

Add jcenter() to your project-level build.gradle

allprojects {
    repositories {
        jcenter()
    }
}

Add dependency to your module-level build.gradle

dependencies {
    ...
    // debugImplementation because Uinspector should only run in debug builds.
    debugImplementation 'com.huya.mobile:Uinspector:x.y.z'
}

x.y.z replace with Jitpack

That’s it, there is no code change needed!

Usage

  1. Start the inspector through the notification
  2. Tap the view you want to inspect
  3. Now you can see the properties on the popup panel

4. Uinspector intercept the 'single tap' event, but you can perform click on a View by double tap instead! And the scroll event/ key event can be dispatched as usual.

Optional Dependencies

  • Glide

    If an image is loaded with Glide, you can inspect the properties on the ImageView:

    Inspect ImageView with Glide

    glide model : The image source, maybe an url or a resource id

    glide error : The error drawable

    glide placeholder: The place holder drawable

    All you need to do is Add the gradle dependency on the Glide integration library:

    dependencies {
        debugImplementation 'com.huya.mobile:Uinspector-optional-glide:x.y.z'
    }

    x.y.z replace with Jitpack

To see more optional dependencies below:

Develop

  • You can develop your own panel and add it into UInspector:

    See Doc

  • UInspector will launch automatically when the application starts. You can disable this feature if you don't want this:

    dependencies {
         debugImplementation('com.huya.mobile:Uinspector:x.y.z') {
             // After excluding, UInspector won't launch until you invoke it's `create` method!
             exclude module: 'Uinspector-optional-autoinstall'
         }
    }
  • Development environment

    • Branch 2.x : Require jdk11, Android Studio Canary (Preview), enable Jetpack Compose feature (Developing).
    • Branch 1.x : Require jdk8, Android Studio 4.x (Stable).

Inspiration

License

Copyright 2020 Yves Cheung

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.