Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Widget support #20

Closed
GoogleCodeExporter opened this issue Apr 6, 2015 · 6 comments
Closed

Widget support #20

GoogleCodeExporter opened this issue Apr 6, 2015 · 6 comments

Comments

@GoogleCodeExporter
Copy link

Please add support for automating the use of widgets in an easy format.  
Specifically, looking to handle the widget class inside of the bridge, allowing 
for the intents and broadcast receivers all to be handled without the user 
having to do anything.

if possible, would like to implement the widget as a component in the bridge 
(not sure if this is possible though).  Ideally then you would have a "click" 
event for the widget.  The user should be able to make all adjustments inside 
the click event, including changing the widget's graphic if needed. (Not sure 
how this would work with active widget, this is more for widgets that do a 
simple process of....load up with a graphic image...click the widget, stuff 
happens and the widget changes to a different graphic.)

Original issue reported on code.google.com by bric...@gmail.com on 9 Apr 2012 at 2:19

@GoogleCodeExporter
Copy link
Author

This is something I would like to add. How to do it is another question. I'm 
thinking of maybe having common functions put into a static class (such as 
changing the background of a view in the widget, or starting/stopping a 
service). The thing with widgets is that they can only use certain layouts 
(RelativeLayout, FrameLayout, and LinearLayout), and views (AnalogClock, 
Button, Chronometer, ImageButton, ImageView, ProgressBar, TextView, 
ViewFlipper, ListView, GridView, StackView, and AdapterViewFlipper). The other 
thing is that you can ONLY use those components, no variations.

Original comment by IMPINC...@gmail.com on 11 Apr 2012 at 1:55

  • Changed state: Accepted

@GoogleCodeExporter
Copy link
Author

ya this is a hard one to figure out...

Is the restriction that the layout and component information has to be built in 
to the class?

Or is it that the user has to know about these requirements while using the 
class?  (I assume its the former).

Maybe the way to do it is to start with widgets that will be commonly used 
(i.e. imageView), in a standard linearlayout and build the class as more 
options are needed?

Just throwing out some ideas...

Original comment by bric...@gmail.com on 12 Apr 2012 at 3:14

@GoogleCodeExporter
Copy link
Author

The idea is that you build the layout of the widget, and then pass that to the 
Widget class. The other thing is that an entry MUST be made in 
AndroidManifest.xml as well. This is necessary as the widget can be accessed 
when the application isn't running. I may try to crawl through the ADT source 
to see if I can do it through code (something like right click to add a new 
widget, like a form, or formservice). I'll post more when I look through the 
ADT source a bit more.

Original comment by IMPINC...@gmail.com on 12 Apr 2012 at 8:47

@GoogleCodeExporter
Copy link
Author

good deal....that sounds like a good way to do it (right click), or maybe if 
possible, even a "wizard" style deal, where you right click and choose add 
widget, then you get the wizard that comes up and you answer some questions and 
builds the proper source and layout files.

Just and idea.  Looking forward to seeing what you find.

Original comment by bric...@gmail.com on 13 Apr 2012 at 1:11

@GoogleCodeExporter
Copy link
Author

Ok, so I'm making some progress here. I got a simple widget to work through 
code (starting an activity, or service). I went the way of a wizard (so you 
will find it in the New category). It asks for some basic meta data for the 
widget like the widget name, minimum width/height, update period, and the 
initial base layout type (of the 3 that are allowed for a widget). The wizard 
will then create the necessary info xml file, layout xml file, widget class and 
adding the necessary nodes to the AndroidManifest.xml.

The widget class is super simple. The wizard will by default set the layout in 
code, all you have to do is tell it what to do with the buttons (ImageView, 
Button, ImageButton). More will be added to this, as you can also have things 
like TextBoxes, and ProgressBars and such, so you need to be able to define 
these somehow. This will come later.

Right now, for assigning the open activity/service to the widget, you use this 
method:

addFormClick(int resourceId, SomeForm.class);

This will set the onclick of the button to open the SomeForm form when the 
button (resourceId) is clicked.
To start a service, use addFormServiceClick in the same manner.

Original comment by IMPINC...@gmail.com on 14 Apr 2012 at 3:39

@GoogleCodeExporter
Copy link
Author

Done as of version 2.2.12 (if you have 2.2.6, that is lower than 2.2.12, as 12 
is larger than 6).

Check the wiki for some basic info on general use.

Original comment by IMPINC...@gmail.com on 23 Apr 2012 at 5:22

  • Changed state: Done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant