Discussion Forums  >  Plugins, Customizing, Source Code

Replies: 5    Views: 24

krompa
Lost but trying
Profile
Posts: 257
Reg: Jun 14, 2013
Bristol
8,820
06/23/14 06:11 AM (10 years ago)

Disabling Automatic Restart of Interactive Quiz Plug-in

If for some reason the Interactive Quiz Plug-in (Android, BTv3) is interrupted, it automatically restarts the quiz (at the "3,2,1,Go" screen). This is not a bad thing ... However, I would like it to point to the menu screen instead of restarting the quiz automatically. Where can I find the relevant code to change in the app? I would have thought it would be in some kind of onPause, onRestart or onStop statement but I can't find it. p.s I don't think BTv2 apps had this problem as it didn't automatically restart. The reason I ask is that I have added a 3rd party leaderboard (Swarm Connect) which effectively interrupts the quiz when the leaderboard is shown. So the cycle of the app is as follows - Quiz starts, Quiz Questions are asked, Quiz Ends, Leaderboard Shows, "3,2,1,Go" Quiz starts ... thus sending the user into an endless quiz cycle that would continue until the quizzer dies. Your thoughts welcome.
 
SmugWimp
Smugger than thou...
Profile
Posts: 6316
Reg: Nov 07, 2012
Tamuning, GU
81,410
like
06/23/14 03:07 PM (10 years ago)
Before we get into any specifics, I'd like to say that 'If' a class (a plugin java file) does not have an 'onStart', 'onStop', 'onPause', then all you really need to do is add one. They weren't put in there because they probably weren't needed, and it would be handled at a higher level regardless. If you 'DO' add one, just be sure to call the 'super' method inside, so that the higher level still does it's housekeeping chores. If you're not sure of the format (and I never am) just cheat; look at another class that does have one, and modify it (if need be) to suit your needs. @Override public void onResume() { super.onResume(); // your stuff here, after 'super' BT_debugger.showIt(fragmentName + ":onResume"); } @Override public void onPause() { super.onPause(); BT_debugger.showIt(fragmentName + ":onPause"); } @Override public void onStop(){ super.onStop(); BT_debugger.showIt(fragmentName + ":onStop"); } @Override public void onDestroy() { super.onDestroy(); BT_debugger.showIt(fragmentName + ":onDestroy"); } @Override public void onStart() { super.onStart(); BT_debugger.showIt(fragmentName + ":onStart"); } That said, there is an onStop method starting around line 376, and an onPause method just before that on line 364. At least, in my version. Maybe your plugin needs an update? there is also the 'endQuiz' method on line 1118. Cheers! -- Smug
 
krompa
Lost but trying
Profile
Posts: 257
Reg: Jun 14, 2013
Bristol
8,820
like
06/23/14 03:30 PM (10 years ago)
Hi Smug Yeah, I found plenty of methods in the java code, but nothing stood out as to the specific action of restarting at the 3,2,1,go part. I'll take another look with fresh eyes in the morning. Its been a long day in front of the screen. Off to bed with an Android book!
 
SmugWimp
Smugger than thou...
Profile
Posts: 6316
Reg: Nov 07, 2012
Tamuning, GU
81,410
like
06/23/14 03:47 PM (10 years ago)
Well, what happens (in theory anyway) is that, the screen opens, and if new, does an 'onCreate', after which it will do an 'onStart' (which merely calls the superclass) and then 'onResume' which will crank up the 'parseScreenData' either immediately, or eventually (depending if it has data in the bundle, or via URL). If the screen is not new, it should just head to 'onResume', which will (again) call parseScreenData. In the 'parseScreenData' method, on line 476 is where it calls the startCountdown method. But messing with it 'there' will entail some kind of 'if' statement, so that it will still run under 'normal' circumstances, because the 'onResume' trigger needs to be called for it to work. I'm not comfortable with many suggestions, because I'm not familiar with the 'Swarm' code. Let us know how you faire... Cheers! -- Smug
 
krompa
Lost but trying
Profile
Posts: 257
Reg: Jun 14, 2013
Bristol
8,820
like
06/24/14 02:20 AM (10 years ago)
Thanks Smug. Highlighting startCountdown shows there is a sneaky one right at the end of the code circa line 1494. My bet it is that one that needs altering. I'll have a play around and see.
 
krompa
Lost but trying
Profile
Posts: 257
Reg: Jun 14, 2013
Bristol
8,820
like
06/24/14 03:17 AM (10 years ago)
It was the one at line 476. Cheers for your help in locating it Smug. The one at line 1494 relates to the play button in the action bar.
 

Login + Screen Name Required to Post

pointerLogin to participate so you can start earning points. Once you're logged in (and have a screen name entered in your profile), you can subscribe to topics, follow users, and start learning how to make apps like the pros.