{"action":"created","issue":{"url":"https://api.github.com/repos/facebook/fresco/issues/912","labels_url":"https://api.github.com/repos/facebook/fresco/issues/912/labels{/name}","comments_url":"https://api.github.com/repos/facebook/fresco/issues/912/comments","events_url":"https://api.github.com/repos/facebook/fresco/issues/912/events","html_url":"https://github.com/facebook/fresco/issues/912","id":126598724,"number":912,"title":"Not able to set hotspot on \"overlayImage\" drawable set in xml ","user":{"login":"sagartrehan","id":3183438,"avatar_url":"https://avatars.githubusercontent.com/u/3183438?v=3","gravatar_id":"","url":"https://api.github.com/users/sagartrehan","html_url":"https://github.com/sagartrehan","followers_url":"https://api.github.com/users/sagartrehan/followers","following_url":"https://api.github.com/users/sagartrehan/following{/other_user}","gists_url":"https://api.github.com/users/sagartrehan/gists{/gist_id}","starred_url":"https://api.github.com/users/sagartrehan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sagartrehan/subscriptions","organizations_url":"https://api.github.com/users/sagartrehan/orgs","repos_url":"https://api.github.com/users/sagartrehan/repos","events_url":"https://api.github.com/users/sagartrehan/events{/privacy}","received_events_url":"https://api.github.com/users/sagartrehan/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/facebook/fresco/labels/enhancement","name":"enhancement","color":"84b6eb"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2016-01-14T07:35:42Z","updated_at":"2016-01-20T16:09:50Z","closed_at":null,"body":"I have set \"app:overlayImage\" drawable on SimpleDraweeView in xml layout for adding selector ripple effect on top of SimpleDraweeView. Setting \"overlayImage\" attribute correctly showing ripple effect on image but hot spot is always showing from center. To solve this I need the overlayImage drawable that I had set in xml resource but I didn't find any method to get overlayImage drawable programmatically.\r\n\r\nIf I prepare GenericDraweeHierarchy programmatically then I can prepare overlayImage drawable and can set touch listener hot spot to it. Code snippet:\r\n\r\nSimpleDraweeView image = (SimpleDraweeView) findViewById(R.id.image);\r\nGenericDraweeHierarchyBuilder builder = new GenericDraweeHierarchyBuilder(mContext.getResources());\r\nDrawable overlayImage = getDrawable(R.drawable.image_selector);\r\nbuilder.setOverlay(overlayImage);\r\n\r\nimage.setHierarchy(builder.build());\r\n\r\nif (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {\r\nview.setOnTouchListener(new View.OnTouchListener() {\r\n@TargetApi(Build.VERSION_CODES.LOLLIPOP)\r\n@Override\r\npublic boolean onTouch(View v, MotionEvent event) {\r\nif (overlayImage != null) {\r\noverlayImage.setHotspot(event.getX(), event.getY());\r\n}\r\nreturn false;\r\n}\r\n});\r\n}\r\n\r\nBut I do not want to create GenericDraweeHierarchy programmatically as I had already set different attributes in xml and do not want to change it and set programmatically. Please suggest any method to get \"overlayImage\" drawable that I had set in xml layout resource.\r\n\r\nPlease let me know if I can add hot spot in any other way"},"comment":{"url":"https://api.github.com/repos/facebook/fresco/issues/comments/173252467","html_url":"https://github.com/facebook/fresco/issues/912#issuecomment-173252467","issue_url":"https://api.github.com/repos/facebook/fresco/issues/912","id":173252467,"user":{"login":"plamenko","id":3705123,"avatar_url":"https://avatars.githubusercontent.com/u/3705123?v=3","gravatar_id":"","url":"https://api.github.com/users/plamenko","html_url":"https://github.com/plamenko","followers_url":"https://api.github.com/users/plamenko/followers","following_url":"https://api.github.com/users/plamenko/following{/other_user}","gists_url":"https://api.github.com/users/plamenko/gists{/gist_id}","starred_url":"https://api.github.com/users/plamenko/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/plamenko/subscriptions","organizations_url":"https://api.github.com/users/plamenko/orgs","repos_url":"https://api.github.com/users/plamenko/repos","events_url":"https://api.github.com/users/plamenko/events{/privacy}","received_events_url":"https://api.github.com/users/plamenko/received_events","type":"User","site_admin":false},"created_at":"2016-01-20T16:09:50Z","updated_at":"2016-01-20T16:09:50Z","body":"@sagartrehan pull requests are always welcome :) If you would like to give it a shot, here are the two drawables that need to be modified: [ForwardingDrawable] (https://github.com/facebook/fresco/blob/master/drawee/src/main/java/com/facebook/drawee/drawable/ForwardingDrawable.java) and [ArrayDrawable] (https://github.com/facebook/fresco/blob/master/drawee/src/main/java/com/facebook/drawee/drawable/ArrayDrawable.java).\r\n\r\nWe just need to add something along these lines:\r\n\r\n```Java\r\n  @Override\r\n  @TargetApi(Build.VERSION_CODES.LOLLIPOP)\r\n  public void setHotspot(float x, float y) {\r\n    mCurrentDelegate.setHotspot(x, y);\r\n  }\r\n```\r\n"}}