Guest User

Untitled

a guest
Jul 19th, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.56 KB | None | 0 0
  1. private void DrawStaticFrame()
  2. {
  3. System.out.println("Getting Surafe Holder");
  4.  
  5. final SurfaceHolder holder = getSurfaceHolder();
  6.  
  7. System.out.println("Surafe Holder: " + holder + ". Getting Canvas");
  8.  
  9. Canvas c = null;
  10. try
  11. {
  12. System.out.println("Trying to lock canvas: " + c);
  13.  
  14. c = holder.lockCanvas();
  15.  
  16. System.out.println("Canvas Locked");
  17.  
  18. if (c != null)
  19. {
  20. System.out.println("Painting Static background");
  21.  
  22. PaintStaticBackground(c);
  23.  
  24. System.out.println("Static Background Painted");
  25. }
  26. }
  27. catch(Exception e)
  28. {
  29. System.out.println("Exception: " + e.getMessage());
  30. }
  31. finally
  32. {
  33. if (c != null) holder.unlockCanvasAndPost(c);
  34. }
  35.  
  36. }
  37.  
  38. void DrawAnimatedFrames()
  39. {
  40. final SurfaceHolder holder = getSurfaceHolder();
  41.  
  42. Canvas c = null;
  43. try
  44. {
  45. c = holder.lockCanvas();
  46. if (c != null)
  47. {
  48. PaintBatteryBackground(c);
  49. PaintBatteryForeground(c);
  50.  
  51. PaintDateTimeBackground(c);
  52. PaintDateTimeForeground(c);
  53. }
  54. }
  55. finally
  56. {
  57. if (c != null) holder.unlockCanvasAndPost(c);
  58. }
  59.  
  60. // Reschedule the next redraw
  61. mHandler.removeCallbacks(mDrawCube);
  62. if (mVisible)
  63. {
  64. mHandler.postDelayed(mDrawCube, 100);
  65. }
  66. }
Add Comment
Please, Sign In to add comment