Code Monkey home page Code Monkey logo

Comments (6)

GoogleCodeExporter avatar GoogleCodeExporter commented on May 17, 2024
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 [email protected] on 11 Apr 2012 at 1:55

  • Changed state: Accepted

from alternate-java-bridge-library.

GoogleCodeExporter avatar GoogleCodeExporter commented on May 17, 2024
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 [email protected] on 12 Apr 2012 at 3:14

from alternate-java-bridge-library.

GoogleCodeExporter avatar GoogleCodeExporter commented on May 17, 2024
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 [email protected] on 12 Apr 2012 at 8:47

from alternate-java-bridge-library.

GoogleCodeExporter avatar GoogleCodeExporter commented on May 17, 2024
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 [email protected] on 13 Apr 2012 at 1:11

from alternate-java-bridge-library.

GoogleCodeExporter avatar GoogleCodeExporter commented on May 17, 2024
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 [email protected] on 14 Apr 2012 at 3:39

from alternate-java-bridge-library.

GoogleCodeExporter avatar GoogleCodeExporter commented on May 17, 2024
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 [email protected] on 23 Apr 2012 at 5:22

  • Changed state: Done

from alternate-java-bridge-library.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.