Guest User

Untitled

a guest
Jan 11th, 2020
105
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package com.dunno.aenen.forgottobuy;
  2.  
  3. import android.content.Context;
  4. import android.graphics.Canvas;
  5. import android.graphics.Paint;
  6. import android.util.AttributeSet;
  7. import android.util.Log;
  8. import android.view.View;
  9. import android.widget.EditText;
  10.  
  11. import com.amazon.euclid.renderer.ZSceneNode;
  12. import com.amazon.euclid.view.ZDelegate;
  13. import com.amazon.euclid.view.ZQuaternion;
  14. import com.amazon.euclid.view.ZVec3;
  15. import com.amazon.euclid.view.ZViewInterface;
  16.  
  17. public class ZEditText extends EditText implements ZViewInterface {
  18. //paint for drawing custom view
  19. private Paint circlePaint;
  20.  
  21. public ZEditText(Context context) {
  22. super(context);//paint object for drawing in onDraw
  23. circlePaint = new Paint();
  24. }
  25.  
  26. public ZEditText(Context context, AttributeSet attrs) {
  27. super(context, attrs);//paint object for drawing in onDraw
  28. circlePaint = new Paint();
  29. }
  30.  
  31. public ZEditText(Context context, AttributeSet attrs, int defStyleAttr) {
  32. super(context, attrs, defStyleAttr);//paint object for drawing in onDraw
  33. circlePaint = new Paint();
  34. }
  35.  
  36. @Override
  37. protected void onDraw(Canvas canvas) {
  38. //get half of the width and height as we are working with a circle
  39. int viewWidthHalf = this.getMeasuredWidth()/2;
  40. int viewHeightHalf = this.getMeasuredHeight()/2;
  41. //get the radius as half of the width or height, whichever is smaller
  42. //subtract ten so that it has some space around it
  43. int radius = 0;
  44. if(viewWidthHalf>viewHeightHalf)
  45. radius=viewHeightHalf-10;
  46. else
  47. radius=viewWidthHalf-10;
  48. circlePaint.setStyle(Paint.Style.FILL);
  49. circlePaint.setAntiAlias(true);
  50. canvas.drawCircle(viewWidthHalf, viewHeightHalf, radius, circlePaint);
  51. }
  52.  
  53. @Override
  54. public ZDelegate getDelegate() {
  55. Log.d("somethingsomething", "getDelegate()");
  56. return new ZDelegate() {
  57. @Override
  58. public View getView() {
  59. return getView();
  60. }
  61.  
  62. @Override
  63. public ZSceneNode getBaseNode() {
  64. return new ZSceneNode();
  65. }
  66.  
  67. @Override
  68. public ZSceneNode getAttachmentNode() {
  69. return new ZSceneNode();
  70. }
  71.  
  72. @Override
  73. public void updateSceneNode() {
  74.  
  75. }
  76.  
  77. @Override
  78. public void onMeasureDepth(int i) {
  79.  
  80. }
  81.  
  82. @Override
  83. public void setMeasuredDepth(int i) {
  84.  
  85. }
  86.  
  87. @Override
  88. public int getMeasuredDepth() {
  89. return 1;
  90. }
  91.  
  92. @Override
  93. public void setBaselineDepth(int i) {
  94.  
  95. }
  96.  
  97. @Override
  98. public int getBaselineDepth() {
  99. return 1;
  100. }
  101.  
  102. @Override
  103. public int getMinimumDepth() {
  104. return 1;
  105. }
  106.  
  107. @Override
  108. public void setMinimumDepth(int i) {
  109.  
  110. }
  111.  
  112. @Override
  113. public void onLayoutDepth(int i, int i2) {
  114.  
  115. }
  116.  
  117. @Override
  118. public int getFront() {
  119. return 1;
  120. }
  121.  
  122. @Override
  123. public int getBack() {
  124. return 1;
  125. }
  126.  
  127. @Override
  128. public int getDepth() {
  129. return 1;
  130. }
  131.  
  132. @Override
  133. public void setX(float v) {
  134.  
  135. }
  136.  
  137. @Override
  138. public void setTranslationX(float v) {
  139.  
  140. }
  141.  
  142. @Override
  143. public void setY(float v) {
  144.  
  145. }
  146.  
  147. @Override
  148. public void setTranslationY(float v) {
  149.  
  150. }
  151.  
  152. @Override
  153. public float getZ() {
  154. return 0;
  155. }
  156.  
  157. @Override
  158. public void setZ(float v) {
  159.  
  160. }
  161.  
  162. @Override
  163. public float getTranslationZ() {
  164. return 0;
  165. }
  166.  
  167. @Override
  168. public void setTranslationZ(float v) {
  169.  
  170. }
  171.  
  172. @Override
  173. public ZVec3 getPosition() {
  174. return new ZVec3(1);
  175. }
  176.  
  177. @Override
  178. public void getPosition(ZVec3 zVec3) {
  179.  
  180. }
  181.  
  182. @Override
  183. public void setPosition(float v, float v2, float v3) {
  184.  
  185. }
  186.  
  187. @Override
  188. public ZVec3 getTranslation() {
  189. return new ZVec3(1);
  190. }
  191.  
  192. @Override
  193. public void getTranslation(ZVec3 zVec3) {
  194.  
  195. }
  196.  
  197. @Override
  198. public void setTranslation(float v, float v2, float v3) {
  199.  
  200. }
  201.  
  202. @Override
  203. public void setScaleX(float v) {
  204.  
  205. }
  206.  
  207. @Override
  208. public void setScaleY(float v) {
  209.  
  210. }
  211.  
  212. @Override
  213. public void setScaleZ(float v) {
  214.  
  215. }
  216.  
  217. @Override
  218. public void setScale(ZVec3 zVec3) {
  219.  
  220. }
  221.  
  222. @Override
  223. public void setScale(float v, float v2, float v3) {
  224.  
  225. }
  226.  
  227. @Override
  228. public float getScaleZ() {
  229. return 0;
  230. }
  231.  
  232. @Override
  233. public ZVec3 getScale() {
  234. return new ZVec3(1);
  235. }
  236.  
  237. @Override
  238. public void getScale(ZVec3 zVec3) {
  239.  
  240. }
  241.  
  242. @Override
  243. public ZQuaternion getOrientation() {
  244. return new ZQuaternion();
  245. }
  246.  
  247. @Override
  248. public void getOrientation(ZQuaternion zQuaternion) {
  249.  
  250. }
  251.  
  252. @Override
  253. public void setOrientation(ZQuaternion zQuaternion) {
  254.  
  255. }
  256.  
  257. @Override
  258. public ZVec3 getPivot() {
  259. return new ZVec3(1);
  260. }
  261.  
  262. @Override
  263. public void getPivot(ZVec3 zVec3) {
  264.  
  265. }
  266.  
  267. @Override
  268. public void setPivot(float v, float v2, float v3) {
  269.  
  270. }
  271.  
  272. @Override
  273. public void setPivot(ZVec3 zVec3) {
  274.  
  275. }
  276.  
  277. @Override
  278. public void setVisibility(int i) {
  279.  
  280. }
  281.  
  282. @Override
  283. public void setPaddingDepth(int i, int i2) {
  284.  
  285. }
  286.  
  287. @Override
  288. public int getPaddingFront() {
  289. return 0;
  290. }
  291.  
  292. @Override
  293. public int getPaddingBack() {
  294. return 0;
  295. }
  296. };
  297. }
  298. }
RAW Paste Data