python748 / alternate-java-bridge-library

Automatically exported from code.google.com/p/alternate-java-bridge-library
Apache License 2.0
0 stars 0 forks source link

StopWatch not "Stopping" properly and starts as soon as it is instantiated #174

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Dynamically create and instantiate a stopwatch and a button
2. create a button, that when clicked, checks if the stopatch is running, and 
if it is, it executes stopwatch.stop(), if it is not running, it executes 
stopwatch.start().

What is the expected output? What do you see instead?
I expect when I make the stopwatch, it won't start till i execute the start 
command, and that when I stop and start it, it reflects this command 
internally.  Instead, when you click stop, it just stops the display from 
changing, once you start, it jumps forward.

Example:  I instantiate a stopwatch and start the program.  I wait 10 seconds, 
then press the start button.  Timer goes from 0, to 10 seconds as soon as i hit 
the button.  At 20 seconds I stop the watch, display says 20.  I wait 10 more 
seconds, and start it.  I expect it to be at 21 seconds, instead it jumps right 
to 30 and starts the time

What version of the product are you using? On what operating system?
Latest bitbucket pull, win 7 x64

Please provide any additional information below.
I added an "IsRunning" method to the class to tell if the clock is running.  
This is what I coded for that:

public boolean isRunning() {
        return mRunning;
    }

Original issue reported on code.google.com by bric...@gmail.com on 6 Jun 2013 at 6:39

GoogleCodeExporter commented 8 years ago
Ok, I tested this further, using a controlled fresh test app, using the latest 
jar instead of my own customized alt library.  Tried the following variations, 
same result every time.

Tested on gingerbread and jellybean
tested with the GLE instantiation and without it
tested with api 8, api 10, api 15, and api 17.

Same result every time.  I am convinced that i may never have had this working 
properly.  I am going to try and create my own stopwatch class, but would 
really just like to get this one working properly since it is all almost there. 
 I have a feeling my class will have the same problem or worse.  

If anyone has thoughts on what the problem might be i am open to suggestions.

Original comment by bric...@gmail.com on 26 Jun 2013 at 1:40

GoogleCodeExporter commented 8 years ago
Just documenting my progress here because i am only getting a few minutes here 
and there to look at this, but made a breakthrough just now.  

I realized the problem with the stopwatch is that it updates with the following 
method everytime, no matter what...

stopwatchtime = (current time in milliseconds) - (time that component was 
initiliazed).

This needs to be adjusted as that is obviously a false equation for a 
stopwatch.  Not sure on an obvious solutions, so if anyone has suggestions 
please post

Original comment by bric...@gmail.com on 28 Jun 2013 at 1:37

GoogleCodeExporter commented 8 years ago
Ok, I figured this out.  I just have to do some more testing and tweaking and 
then i'll upload a new fork. 

standby...

Original comment by bric...@gmail.com on 28 Jun 2013 at 2:43

GoogleCodeExporter commented 8 years ago
Ok this should be fixed.  I uploaded a new branch to the bridge.  Once Ryan 
merges it we should be good to go.

Original comment by bric...@gmail.com on 1 Jul 2013 at 2:43

GoogleCodeExporter commented 8 years ago

Original comment by bric...@gmail.com on 9 Jul 2013 at 4:48