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

Switch component and GLE equivalent #30

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
I am not sure how this is handled in android, so going off what i think.  My 
thoughts are its probably best to do this as a boolean.  True is on.  False is 
off.  But it could also be done as an int, 0 and 1.  And what I mean by this is 
what the status method would be.

like Switch.Status() would return true or 1 for on, and false or 0 for off.  I 
think right?

along with this should be a method for Switch.Status(boolean/int) so that you 
can set the status programmatically.

Can't think of what else someone would use.  Maybe a method like Switch.Count() 
that returns the number of times the switch has been flipped?  (If so a 
Switch.Reset() should be made to reset this).

There should probably be events too.  Well actually the only event I can think 
of is "Switched", or "Flipped", or whatever, when the switch changes.

I guess maybe an event for "On", and one for "Off", might make things insanely 
easy....?

All of this is just off the top of my head cause i need to use a switch now.  I 
can work with whatever functionality you provide...and oh ya, if this already 
exists I am gonna kick myself, cause i just wasted a lot of time. (couldn't 
find it...i looked).

Original issue reported on code.google.com by bric...@gmail.com on 3 May 2012 at 12:55

GoogleCodeExporter commented 8 years ago
Also I don't see any reason this class wouldn't work identically for the 
ToggleButton view?  

Original comment by bric...@gmail.com on 3 May 2012 at 2:57

GoogleCodeExporter commented 8 years ago
Looking at the different SDK's a little more, I DEFINITELY think this class 
needs to apply to both "switch views" and "toggle button views".  As the switch 
is not present until the more recent API's, while the toggle button has been 
around since API 3.  This way I can use the fancy switch on users running ICS, 
and the toggle button for older users running GB.

Original comment by bric...@gmail.com on 4 May 2012 at 12:20

GoogleCodeExporter commented 8 years ago
Possible component name....ToggleSwitch

Original comment by bric...@gmail.com on 4 May 2012 at 12:56

GoogleCodeExporter commented 8 years ago
You can't have the class represent two different views. If you want a 
togglebutton, along with a Switch, it can be added. Put in a new issue for that.

Switcher is the new class name. Since it's like a checkbox in function, it 
throws the same "Changed" event, along with the boolean. Or, you can get the 
state with switch.SwitchedOn() .

Original comment by IMPINC...@gmail.com on 7 May 2012 at 5:11

GoogleCodeExporter commented 8 years ago
Actually, the GLE component caused an issue, like I was afraid of. It's fine if 
you're bulding your app on android 4.0, or higher. But if you base an app off a 
lower API, it will cause an error in Eclipse until you delete the file. So, I 
won't add a GLE component for it.

The class will remain (Switcher), just drop the default android Switch in the 
GLE if you want to use it.

I suppose I will just add the Toggle class, so that there is at least one type 
that is droppable in the GLE.

Original comment by IMPINC...@gmail.com on 7 May 2012 at 5:35

GoogleCodeExporter commented 8 years ago

Original comment by IMPINC...@gmail.com on 10 May 2012 at 3:11

GoogleCodeExporter commented 8 years ago
Awesome! thank!

Ya i noticed when I have the switch view in the app, if I run on anything below 
ICS it crashes, even if i hide the view.

I was originally hoping to use button anything below 14, and switch for 
anything above, but it would have to be done programatically which I cant 
figure out how to do..

Original comment by bric...@gmail.com on 10 May 2012 at 3:24

GoogleCodeExporter commented 8 years ago

Original comment by IMPINC...@gmail.com on 10 May 2012 at 7:43