Advertisement
Guest User

Untitled

a guest
Jun 28th, 2017
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.89 KB | None | 0 0
  1. class SecretsFragment < Android::App::Fragment
  2. TEXT_VIEW_TITLE = 1093
  3. TEXT_VIEW_INFO = 1093
  4. LIST_VIEW_SECRETS = 2093
  5.  
  6. def onCreateView(inflater, container, savedInstanceState)
  7. @view ||=
  8. begin
  9. @aa.fragment_view(
  10. @aa.title_view(TEXT_VIEW_TITLE, "developer commentary"),
  11. @aa.text_view(
  12. TEXT_VIEW_INFO,
  13. "welcome wanderer. tap below to listen to the original app store 2013 sound bites."
  14. ) do |ld, tv|
  15. ld.setMargins(30, 30, 30, 30)
  16. end,
  17. @aa.list_view(LIST_VIEW_SECRETS, self, commentary.map { |i| i[:title] }),
  18. )
  19. end
  20. end
  21.  
  22. def onClick view
  23. case view.id
  24. when BaseActivity::LINK_BACK
  25. if @player.nil?
  26. @aa.go_to_room
  27. else
  28. @player.stop
  29. @aa.go_to_room
  30. end
  31. end
  32. end
  33.  
  34. def onItemClick(parent, view, position, id)
  35. if !@player.nil?
  36. @player.release
  37. end
  38. @aa.toast "playing commentary"
  39. @player = Android::Media::MediaPlayer.create(@aa, commentary[position][:file])
  40. @player.start
  41. end
  42.  
  43. def commentary
  44. @commentary ||= [
  45. { title: "hello from amir.",
  46. file: resources.getIdentifier(:hello_from_amir, :raw, 'com.yourcompany.adarkroom') },
  47. { title: "hello from michael.",
  48. file: resources.getIdentifier(:hello_from_michael, :raw, 'com.yourcompany.adarkroom') },
  49. { title: "candies and bleak existentialism.",
  50. file: resources.getIdentifier(:candies_and_lollipops, :raw, 'com.yourcompany.adarkroom') },
  51. { title: "how a dark room ios came to be.",
  52. file: resources.getIdentifier(:how_a_dark_room_ios_came_to_be, :raw, 'com.yourcompany.adarkroom') },
  53. { title: "lighting the fire.",
  54. file: resources.getIdentifier(:lighting_the_fire, :raw, 'com.yourcompany.adarkroom') },
  55. { title: "the first 60 seconds.",
  56. file: resources.getIdentifier(:the_first_60_seconds, :raw, 'com.yourcompany.adarkroom') },
  57. { title: "a thank you to my wife.",
  58. file: resources.getIdentifier(:a_thank_you_to_my_wife, :raw, 'com.yourcompany.adarkroom') },
  59. { title: "my world is turned upside down.",
  60. file: resources.getIdentifier(:blind_gamers, :raw, 'com.yourcompany.adarkroom') },
  61. { title: "balancing an economy.",
  62. file: resources.getIdentifier(:balancing_the_economy, :raw, 'com.yourcompany.adarkroom') },
  63. { title: "the development of a dusty path.",
  64. file: resources.getIdentifier(:the_development_of_a_dusty_path, :raw, 'com.yourcompany.adarkroom') },
  65. { title: "walking the path.",
  66. file: resources.getIdentifier(:walking_the_path, :raw, 'com.yourcompany.adarkroom') },
  67. { title: "the slaves and friedrich nietzsche.",
  68. file: resources.getIdentifier(:slaves, :raw, 'com.yourcompany.adarkroom') },
  69. { title: "what do you mean i'm not human?!",
  70. file: resources.getIdentifier(:im_not_human, :raw, 'com.yourcompany.adarkroom') },
  71. { title: "mysteries of the locket.",
  72. file: resources.getIdentifier(:mystery_of_the_locket, :raw, 'com.yourcompany.adarkroom') },
  73. { title: "scraps on the cutting room floor.",
  74. file: resources.getIdentifier(:scraps, :raw, 'com.yourcompany.adarkroom') },
  75. { title: "mysteries of the ending.",
  76. file: resources.getIdentifier(:mystery_of_the_ending, :raw, 'com.yourcompany.adarkroom') },
  77. { title: "go forth and create.",
  78. file: resources.getIdentifier(:go_forth_and_create, :raw, 'com.yourcompany.adarkroom') },
  79. { title: "closing remarks.",
  80. file: resources.getIdentifier(:closing_remarks_amir, :raw, 'com.yourcompany.adarkroom') }
  81. ]
  82. end
  83.  
  84. def onAttach activity
  85. super
  86. @aa = activity
  87. ViewState.pause = true
  88. end
  89.  
  90. def onDetach
  91. super
  92. if !@player.nil?
  93. @player.stop
  94. end
  95. end
  96.  
  97. def onPause
  98. super
  99. if !@player.nil?
  100. @player.stop
  101. end
  102. end
  103. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement