Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class SecretsFragment < Android::App::Fragment
- TEXT_VIEW_TITLE = 1093
- TEXT_VIEW_INFO = 1093
- LIST_VIEW_SECRETS = 2093
- def onCreateView(inflater, container, savedInstanceState)
- @view ||=
- begin
- @aa.fragment_view(
- @aa.title_view(TEXT_VIEW_TITLE, "developer commentary"),
- @aa.text_view(
- TEXT_VIEW_INFO,
- "welcome wanderer. tap below to listen to the original app store 2013 sound bites."
- ) do |ld, tv|
- ld.setMargins(30, 30, 30, 30)
- end,
- @aa.list_view(LIST_VIEW_SECRETS, self, commentary.map { |i| i[:title] }),
- )
- end
- end
- def onClick view
- case view.id
- when BaseActivity::LINK_BACK
- if @player.nil?
- @aa.go_to_room
- else
- @player.stop
- @aa.go_to_room
- end
- end
- end
- def onItemClick(parent, view, position, id)
- if !@player.nil?
- @player.release
- end
- @aa.toast "playing commentary"
- @player = Android::Media::MediaPlayer.create(@aa, commentary[position][:file])
- @player.start
- end
- def commentary
- @commentary ||= [
- { title: "hello from amir.",
- file: resources.getIdentifier(:hello_from_amir, :raw, 'com.yourcompany.adarkroom') },
- { title: "hello from michael.",
- file: resources.getIdentifier(:hello_from_michael, :raw, 'com.yourcompany.adarkroom') },
- { title: "candies and bleak existentialism.",
- file: resources.getIdentifier(:candies_and_lollipops, :raw, 'com.yourcompany.adarkroom') },
- { title: "how a dark room ios came to be.",
- file: resources.getIdentifier(:how_a_dark_room_ios_came_to_be, :raw, 'com.yourcompany.adarkroom') },
- { title: "lighting the fire.",
- file: resources.getIdentifier(:lighting_the_fire, :raw, 'com.yourcompany.adarkroom') },
- { title: "the first 60 seconds.",
- file: resources.getIdentifier(:the_first_60_seconds, :raw, 'com.yourcompany.adarkroom') },
- { title: "a thank you to my wife.",
- file: resources.getIdentifier(:a_thank_you_to_my_wife, :raw, 'com.yourcompany.adarkroom') },
- { title: "my world is turned upside down.",
- file: resources.getIdentifier(:blind_gamers, :raw, 'com.yourcompany.adarkroom') },
- { title: "balancing an economy.",
- file: resources.getIdentifier(:balancing_the_economy, :raw, 'com.yourcompany.adarkroom') },
- { title: "the development of a dusty path.",
- file: resources.getIdentifier(:the_development_of_a_dusty_path, :raw, 'com.yourcompany.adarkroom') },
- { title: "walking the path.",
- file: resources.getIdentifier(:walking_the_path, :raw, 'com.yourcompany.adarkroom') },
- { title: "the slaves and friedrich nietzsche.",
- file: resources.getIdentifier(:slaves, :raw, 'com.yourcompany.adarkroom') },
- { title: "what do you mean i'm not human?!",
- file: resources.getIdentifier(:im_not_human, :raw, 'com.yourcompany.adarkroom') },
- { title: "mysteries of the locket.",
- file: resources.getIdentifier(:mystery_of_the_locket, :raw, 'com.yourcompany.adarkroom') },
- { title: "scraps on the cutting room floor.",
- file: resources.getIdentifier(:scraps, :raw, 'com.yourcompany.adarkroom') },
- { title: "mysteries of the ending.",
- file: resources.getIdentifier(:mystery_of_the_ending, :raw, 'com.yourcompany.adarkroom') },
- { title: "go forth and create.",
- file: resources.getIdentifier(:go_forth_and_create, :raw, 'com.yourcompany.adarkroom') },
- { title: "closing remarks.",
- file: resources.getIdentifier(:closing_remarks_amir, :raw, 'com.yourcompany.adarkroom') }
- ]
- end
- def onAttach activity
- super
- @aa = activity
- ViewState.pause = true
- end
- def onDetach
- super
- if !@player.nil?
- @player.stop
- end
- end
- def onPause
- super
- if !@player.nil?
- @player.stop
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement