Skip to content

handsomecode/pixel-perfect-for-android

Repository files navigation

PixelPerfect

PixelPerfect is aimed to help you to create pixel perfect UI for Android apps. It lets developers and designers easily compare implementation with reference design and fix visual difference between them.

Pixel Perfect Sample

Supported features:

  • Picking overlay image.
  • Adjustment transparency.
  • Moving overlay.
  • Measuring offset.
  • Inverse mode.

Download

Grab via Gradle:

compile 'is.handsome.pixelperfect:pixelperfect:1.0.1'

or Maven:

<dependency>
<groupId>is.handsome.pixelperfect</groupId>
<artifactId>pixelperfect</artifactId>
<version>1.0.1</version>
<type>pom</type>
</dependency>

Getting started

Show PixelPerfect

PixelPerfect.show(HomeActivity.this);

In default configuration PixelPerfect will be linked with 'pixelperfect' assets folder.

Assets

If you want to use different folder, please read Configuration section.

Hide PixelPerfect

PixelPerfect.hide();

Configuration

PixelPerfect.Config provides possibility to configure major attributes of PixelPerfect. This snippet demonstrates usage of custom overlayImagesAssetsPath (assets folder for overlay images) and overlayActiveImageName (name of active by default overlay image):

PixelPerfect.Config config = new PixelPerfect.Config.Builder()
.overlayImagesAssetsPath("my_overlays")
.overlayActiveImageName("main.png")
.build();
PixelPerfect.show(HomeActivity.this, config);

Permissions and Android Marshmallow+

PixelPerfect requires SYSTEM_ALERT_WINDOW permission to run properly. So, for Marshmallow and later versions you have to handle permissions with PixelPerfect.hasPermission(context) and PixelPerfect.askForPermission(context) methods.

You can find demonstartion of its usage in Sample app.