Comments (6)
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.
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.
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.
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.
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.
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)
- Camera, which is a non-visible component is missing a constructor for FormService HOT 1
- Please change Events to use Event String on New Form creation template HOT 2
- HashMap.containsValue not returning true when it should HOT 6
- FileUtil.getFilePathFromImageContentUri crashing HOT 1
- Please adjust Notifier HOT 2
- Enable multiplier use in the GLE HOT 1
- Please make all components LONG clickable HOT 2
- DateSet event missing from events string HOT 2
- Please adjust the EventDispatcher.registerEventForDelegation command to make it more user friendly HOT 1
- TextBox getView and casting to EditText doesn't work HOT 2
- Added DecimalFilter class HOT 1
- Added ability to extend ListPickerActivity HOT 1
- Added features to AltRandom class HOT 1
- StopWatch not "Stopping" properly and starts as soon as it is instantiated HOT 5
- Please add Object[] to String[] conversion in the Convert class
- DateSelector and TimeSelector fire dispatchevent TWICE HOT 3
- Image Picture URL causes NetworkOnMainThreadException HOT 3
- Notifier - Add ShowAlertShort to show a short toast message DONE - PLEASE ADD TO BRIDGE HOT 1
- Rotary Dial Component
- AltRandom additions
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from alternate-java-bridge-library.