{"action":"created","comment":{"url":"https://api.github.com/repos/facebook/stetho/pulls/comments/38958928","id":38958928,"diff_hunk":"@@ -0,0 +1,54 @@\n+/*\n+ * Copyright (c) 2014-present, Facebook, Inc.\n+ * All rights reserved.\n+ *\n+ * This source code is licensed under the BSD-style license found in the\n+ * LICENSE file in the root directory of this source tree. An additional grant\n+ * of patent rights can be found in the PATENTS file in the same directory.\n+ */\n+\n+package com.facebook.stetho.inspector.helper;\n+\n+import android.annotation.TargetApi;\n+import android.os.Build;\n+import android.support.annotation.Nullable;\n+import android.view.ViewDebug;\n+\n+public class IntegerFormatter {\n+  private static IntegerFormatter cachedFormatter;\n+\n+  public static IntegerFormatter getInstance() {\n+    if (cachedFormatter == null) {\n+      synchronized (IntegerFormatter.class) {\n+        if (cachedFormatter == null) {\n+          if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {\n+            cachedFormatter = new IntegerFormatterWithHex();\n+          } else {\n+            cachedFormatter = new IntegerFormatter();\n+          }\n+        }\n+      }\n+    }\n+\n+    return cachedFormatter;\n+  }\n+\n+  private IntegerFormatter() {\n+  }\n+\n+  public String format(Integer integer, @Nullable ViewDebug.ExportedProperty annotation) {\n+    return String.valueOf(integer);\n+  }\n+\n+  private static class IntegerFormatterWithHex extends IntegerFormatter {\n+    @Override\n+    @TargetApi(Build.VERSION_CODES.LOLLIPOP)\n+    public String format(Integer integer, @Nullable ViewDebug.ExportedProperty annotation) {\n+      if (annotation != null && annotation.formatToHexString()) {\n+        return \"0x\" + Integer.toHexString(integer);\n+      }\n+\n+      return super.format(integer, annotation);\n+    }\n+  }\n+}","path":"stetho/src/main/java/com/facebook/stetho/inspector/helper/IntegerFormatter.java","position":54,"original_position":54,"commit_id":"9a7037b1bfca13e5bbb2c87c066e66f051192179","original_commit_id":"9a7037b1bfca13e5bbb2c87c066e66f051192179","user":{"login":"rickbrew","id":10873410,"avatar_url":"https://avatars.githubusercontent.com/u/10873410?v=3","gravatar_id":"","url":"https://api.github.com/users/rickbrew","html_url":"https://github.com/rickbrew","followers_url":"https://api.github.com/users/rickbrew/followers","following_url":"https://api.github.com/users/rickbrew/following{/other_user}","gists_url":"https://api.github.com/users/rickbrew/gists{/gist_id}","starred_url":"https://api.github.com/users/rickbrew/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rickbrew/subscriptions","organizations_url":"https://api.github.com/users/rickbrew/orgs","repos_url":"https://api.github.com/users/rickbrew/repos","events_url":"https://api.github.com/users/rickbrew/events{/privacy}","received_events_url":"https://api.github.com/users/rickbrew/received_events","type":"User","site_admin":false},"body":"we need a newline here. some tools freak out without it, apparently. http://stackoverflow.com/questions/729692/why-should-files-end-with-a-newline","created_at":"2015-09-08T18:03:03Z","updated_at":"2015-09-08T18:03:03Z","html_url":"https://github.com/facebook/stetho/pull/261#discussion_r38958928","pull_request_url":"https://api.github.com/repos/facebook/stetho/pulls/261","_links":{"self":{"href":"https://api.github.com/repos/facebook/stetho/pulls/comments/38958928"},"html":{"href":"https://github.com/facebook/stetho/pull/261#discussion_r38958928"},"pull_request":{"href":"https://api.github.com/repos/facebook/stetho/pulls/261"}}},"pull_request":{"url":"https://api.github.com/repos/facebook/stetho/pulls/261","id":42763136,"html_url":"https://github.com/facebook/stetho/pull/261","diff_url":"https://github.com/facebook/stetho/pull/261.diff","patch_url":"https://github.com/facebook/stetho/pull/261.patch","issue_url":"https://api.github.com/repos/facebook/stetho/issues/261","number":261,"state":"open","locked":false,"title":"Added the ability to inspect an element's style","user":{"login":"ichub","id":2636237,"avatar_url":"https://avatars.githubusercontent.com/u/2636237?v=3","gravatar_id":"","url":"https://api.github.com/users/ichub","html_url":"https://github.com/ichub","followers_url":"https://api.github.com/users/ichub/followers","following_url":"https://api.github.com/users/ichub/following{/other_user}","gists_url":"https://api.github.com/users/ichub/gists{/gist_id}","starred_url":"https://api.github.com/users/ichub/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ichub/subscriptions","organizations_url":"https://api.github.com/users/ichub/orgs","repos_url":"https://api.github.com/users/ichub/repos","events_url":"https://api.github.com/users/ichub/events{/privacy}","received_events_url":"https://api.github.com/users/ichub/received_events","type":"User","site_admin":false},"body":"This pull request adds the ability to view the style of an element that is selected in the elements tree using the same UI as what is shown in the styles tab when inspecting an element of a webpage.\r\n\r\nSome gotchas:\r\n\r\n* The names of style properties shown are not copied verbatim from the names of fields in the `View` class, but are translated to a format that Chrome understands. For example, `View` has a field called `paddingLeft`, but in order for that to be rendered correctly in Chrome, it needs to be transmitted as `padding-left`. \r\n\r\n* Default values are not transmitted, unless they are of an enum type, in which case they are *always* transmitted.\r\n\r\n* Due to inconsistencies between annotations present on certain Android SDK versions, some fields that are enums are not translated into their string representation. This is unfortunate, but the only way to get around it is by special-casing those one or two cases, which is probably not viable long-term.\r\n\r\nSome things that would be nice to add in the future:\r\n\r\n* Inferring some way the element's style 'class', so that the styles aren't all aggregated into one blob. Same with style inheritance.\r\n\r\n* In Chrome you can edit these CSS properties, but here you can't. Maybe a future project? Would probably relatively simple to add.\r\n\r\nStyle inspection of Stetho's 'Settings' button:\r\n\r\n<p align=\"center\">\r\n<img src=\"https://cloud.githubusercontent.com/assets/2636237/9415188/5872116c-47f2-11e5-8764-ebb2bd43bcbf.png\">\r\n\r\n<img src=\"https://cloud.githubusercontent.com/assets/2636237/9415244/ad7b3350-47f2-11e5-97de-7d84772b3021.png\">\r\n</p>","created_at":"2015-08-18T23:56:23Z","updated_at":"2015-09-08T18:03:03Z","closed_at":null,"merged_at":null,"merge_commit_sha":"55b06846b745f63086ab9b2b6b0d5ce8ecc33720","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/facebook/stetho/pulls/261/commits","review_comments_url":"https://api.github.com/repos/facebook/stetho/pulls/261/comments","review_comment_url":"https://api.github.com/repos/facebook/stetho/pulls/comments{/number}","comments_url":"https://api.github.com/repos/facebook/stetho/issues/261/comments","statuses_url":"https://api.github.com/repos/facebook/stetho/statuses/9a7037b1bfca13e5bbb2c87c066e66f051192179","head":{"label":"ichub:computedCSS","ref":"computedCSS","sha":"9a7037b1bfca13e5bbb2c87c066e66f051192179","user":{"login":"ichub","id":2636237,"avatar_url":"https://avatars.githubusercontent.com/u/2636237?v=3","gravatar_id":"","url":"https://api.github.com/users/ichub","html_url":"https://github.com/ichub","followers_url":"https://api.github.com/users/ichub/followers","following_url":"https://api.github.com/users/ichub/following{/other_user}","gists_url":"https://api.github.com/users/ichub/gists{/gist_id}","starred_url":"https://api.github.com/users/ichub/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ichub/subscriptions","organizations_url":"https://api.github.com/users/ichub/orgs","repos_url":"https://api.github.com/users/ichub/repos","events_url":"https://api.github.com/users/ichub/events{/privacy}","received_events_url":"https://api.github.com/users/ichub/received_events","type":"User","site_admin":false},"repo":{"id":39026882,"name":"stetho","full_name":"ichub/stetho","owner":{"login":"ichub","id":2636237,"avatar_url":"https://avatars.githubusercontent.com/u/2636237?v=3","gravatar_id":"","url":"https://api.github.com/users/ichub","html_url":"https://github.com/ichub","followers_url":"https://api.github.com/users/ichub/followers","following_url":"https://api.github.com/users/ichub/following{/other_user}","gists_url":"https://api.github.com/users/ichub/gists{/gist_id}","starred_url":"https://api.github.com/users/ichub/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ichub/subscriptions","organizations_url":"https://api.github.com/users/ichub/orgs","repos_url":"https://api.github.com/users/ichub/repos","events_url":"https://api.github.com/users/ichub/events{/privacy}","received_events_url":"https://api.github.com/users/ichub/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ichub/stetho","description":"Stetho is a debug bridge for Android applications, enabling the powerful Chrome Developer Tools and much more.","fork":true,"url":"https://api.github.com/repos/ichub/stetho","forks_url":"https://api.github.com/repos/ichub/stetho/forks","keys_url":"https://api.github.com/repos/ichub/stetho/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ichub/stetho/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ichub/stetho/teams","hooks_url":"https://api.github.com/repos/ichub/stetho/hooks","issue_events_url":"https://api.github.com/repos/ichub/stetho/issues/events{/number}","events_url":"https://api.github.com/repos/ichub/stetho/events","assignees_url":"https://api.github.com/repos/ichub/stetho/assignees{/user}","branches_url":"https://api.github.com/repos/ichub/stetho/branches{/branch}","tags_url":"https://api.github.com/repos/ichub/stetho/tags","blobs_url":"https://api.github.com/repos/ichub/stetho/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ichub/stetho/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ichub/stetho/git/refs{/sha}","trees_url":"https://api.github.com/repos/ichub/stetho/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ichub/stetho/statuses/{sha}","languages_url":"https://api.github.com/repos/ichub/stetho/languages","stargazers_url":"https://api.github.com/repos/ichub/stetho/stargazers","contributors_url":"https://api.github.com/repos/ichub/stetho/contributors","subscribers_url":"https://api.github.com/repos/ichub/stetho/subscribers","subscription_url":"https://api.github.com/repos/ichub/stetho/subscription","commits_url":"https://api.github.com/repos/ichub/stetho/commits{/sha}","git_commits_url":"https://api.github.com/repos/ichub/stetho/git/commits{/sha}","comments_url":"https://api.github.com/repos/ichub/stetho/comments{/number}","issue_comment_url":"https://api.github.com/repos/ichub/stetho/issues/comments{/number}","contents_url":"https://api.github.com/repos/ichub/stetho/contents/{+path}","compare_url":"https://api.github.com/repos/ichub/stetho/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ichub/stetho/merges","archive_url":"https://api.github.com/repos/ichub/stetho/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ichub/stetho/downloads","issues_url":"https://api.github.com/repos/ichub/stetho/issues{/number}","pulls_url":"https://api.github.com/repos/ichub/stetho/pulls{/number}","milestones_url":"https://api.github.com/repos/ichub/stetho/milestones{/number}","notifications_url":"https://api.github.com/repos/ichub/stetho/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ichub/stetho/labels{/name}","releases_url":"https://api.github.com/repos/ichub/stetho/releases{/id}","created_at":"2015-07-13T17:28:30Z","updated_at":"2015-07-13T17:28:31Z","pushed_at":"2015-09-04T22:56:49Z","git_url":"git://github.com/ichub/stetho.git","ssh_url":"git@github.com:ichub/stetho.git","clone_url":"https://github.com/ichub/stetho.git","svn_url":"https://github.com/ichub/stetho","homepage":"http://facebook.github.io/stetho/","size":1547,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"facebook:master","ref":"master","sha":"3ffd980a09a8488f3799c5fb239483d2a42d4f38","user":{"login":"facebook","id":69631,"avatar_url":"https://avatars.githubusercontent.com/u/69631?v=3","gravatar_id":"","url":"https://api.github.com/users/facebook","html_url":"https://github.com/facebook","followers_url":"https://api.github.com/users/facebook/followers","following_url":"https://api.github.com/users/facebook/following{/other_user}","gists_url":"https://api.github.com/users/facebook/gists{/gist_id}","starred_url":"https://api.github.com/users/facebook/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/facebook/subscriptions","organizations_url":"https://api.github.com/users/facebook/orgs","repos_url":"https://api.github.com/users/facebook/repos","events_url":"https://api.github.com/users/facebook/events{/privacy}","received_events_url":"https://api.github.com/users/facebook/received_events","type":"Organization","site_admin":false},"repo":{"id":29703871,"name":"stetho","full_name":"facebook/stetho","owner":{"login":"facebook","id":69631,"avatar_url":"https://avatars.githubusercontent.com/u/69631?v=3","gravatar_id":"","url":"https://api.github.com/users/facebook","html_url":"https://github.com/facebook","followers_url":"https://api.github.com/users/facebook/followers","following_url":"https://api.github.com/users/facebook/following{/other_user}","gists_url":"https://api.github.com/users/facebook/gists{/gist_id}","starred_url":"https://api.github.com/users/facebook/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/facebook/subscriptions","organizations_url":"https://api.github.com/users/facebook/orgs","repos_url":"https://api.github.com/users/facebook/repos","events_url":"https://api.github.com/users/facebook/events{/privacy}","received_events_url":"https://api.github.com/users/facebook/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/facebook/stetho","description":"Stetho is a debug bridge for Android applications, enabling the powerful Chrome Developer Tools and much more.","fork":false,"url":"https://api.github.com/repos/facebook/stetho","forks_url":"https://api.github.com/repos/facebook/stetho/forks","keys_url":"https://api.github.com/repos/facebook/stetho/keys{/key_id}","collaborators_url":"https://api.github.com/repos/facebook/stetho/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/facebook/stetho/teams","hooks_url":"https://api.github.com/repos/facebook/stetho/hooks","issue_events_url":"https://api.github.com/repos/facebook/stetho/issues/events{/number}","events_url":"https://api.github.com/repos/facebook/stetho/events","assignees_url":"https://api.github.com/repos/facebook/stetho/assignees{/user}","branches_url":"https://api.github.com/repos/facebook/stetho/branches{/branch}","tags_url":"https://api.github.com/repos/facebook/stetho/tags","blobs_url":"https://api.github.com/repos/facebook/stetho/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/facebook/stetho/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/facebook/stetho/git/refs{/sha}","trees_url":"https://api.github.com/repos/facebook/stetho/git/trees{/sha}","statuses_url":"https://api.github.com/repos/facebook/stetho/statuses/{sha}","languages_url":"https://api.github.com/repos/facebook/stetho/languages","stargazers_url":"https://api.github.com/repos/facebook/stetho/stargazers","contributors_url":"https://api.github.com/repos/facebook/stetho/contributors","subscribers_url":"https://api.github.com/repos/facebook/stetho/subscribers","subscription_url":"https://api.github.com/repos/facebook/stetho/subscription","commits_url":"https://api.github.com/repos/facebook/stetho/commits{/sha}","git_commits_url":"https://api.github.com/repos/facebook/stetho/git/commits{/sha}","comments_url":"https://api.github.com/repos/facebook/stetho/comments{/number}","issue_comment_url":"https://api.github.com/repos/facebook/stetho/issues/comments{/number}","contents_url":"https://api.github.com/repos/facebook/stetho/contents/{+path}","compare_url":"https://api.github.com/repos/facebook/stetho/compare/{base}...{head}","merges_url":"https://api.github.com/repos/facebook/stetho/merges","archive_url":"https://api.github.com/repos/facebook/stetho/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/facebook/stetho/downloads","issues_url":"https://api.github.com/repos/facebook/stetho/issues{/number}","pulls_url":"https://api.github.com/repos/facebook/stetho/pulls{/number}","milestones_url":"https://api.github.com/repos/facebook/stetho/milestones{/number}","notifications_url":"https://api.github.com/repos/facebook/stetho/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/facebook/stetho/labels{/name}","releases_url":"https://api.github.com/repos/facebook/stetho/releases{/id}","created_at":"2015-01-22T22:34:10Z","updated_at":"2015-09-08T13:27:30Z","pushed_at":"2015-09-04T22:56:50Z","git_url":"git://github.com/facebook/stetho.git","ssh_url":"git@github.com:facebook/stetho.git","clone_url":"https://github.com/facebook/stetho.git","svn_url":"https://github.com/facebook/stetho","homepage":"http://facebook.github.io/stetho/","size":3530,"stargazers_count":3185,"watchers_count":3185,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":267,"mirror_url":null,"open_issues_count":28,"forks":267,"open_issues":28,"watchers":3185,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/facebook/stetho/pulls/261"},"html":{"href":"https://github.com/facebook/stetho/pull/261"},"issue":{"href":"https://api.github.com/repos/facebook/stetho/issues/261"},"comments":{"href":"https://api.github.com/repos/facebook/stetho/issues/261/comments"},"review_comments":{"href":"https://api.github.com/repos/facebook/stetho/pulls/261/comments"},"review_comment":{"href":"https://api.github.com/repos/facebook/stetho/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/facebook/stetho/pulls/261/commits"},"statuses":{"href":"https://api.github.com/repos/facebook/stetho/statuses/9a7037b1bfca13e5bbb2c87c066e66f051192179"}}}}