new widget - Panel

Put problem concerning Views, Layouts and other XML-Resources (like AndroidManifest) here.

new widget - Panel

Postby pskink » Wed Jan 14, 2009 11:59 pm

IMPORTANT !!!
now this code is hosted in svn at
http://code.google.com/p/android-misc-widgets/

what you see below drastically differs from newest stuff...


hi,

just created new widget - Panel, which can be expanded & collapsed.

change between expanded <-> collapsed states is done using customizable animation.

it's relatively small (~130 lines of code) but functional :)

any comments appreciated
Attachments
Panel.avi.zip
(308.17 KiB) Downloaded 3627 times
Panel.tar.gz
v 0.12
(75.05 KiB) Downloaded 2818 times
panelExpanded.png
panelExpanded.png (13.42 KiB) Viewed 46339 times
panelCollapsed.png
panelCollapsed.png (11.59 KiB) Viewed 46339 times
Last edited by pskink on Wed Jan 28, 2009 8:33 pm, edited 5 times in total.
pskink
pskink
Master Developer
Master Developer
 
Posts: 719
Joined: Mon Nov 24, 2008 3:49 pm

Top

Postby Emmanuel7 » Thu Jan 15, 2009 2:05 am

Really nice, congratulations !
I think it will interest a lot of people here !

Just two (small) points ( yes, I really did read your code :) ) :
* Why a setOrientation ( VERTICAL ) ? It won't work in horizontal mode ?
* The way you post a empty message to create a timer 'looks' strange. I've always seen a generic handler used, with mHandler.postDelayed(mUpdateTimeTask, mUpdateInterval ); called, with mUpdateTimeTask a runnable with a run() method doing whatever we want. Note that the fact that I always seen this method is far from meaning it is superior :)
* ( Yes, I know I said two points ) : your code is much more lighter than the Home sliding drawer (here ). Are there some features missing in your version ?

Thanks for this nice contribution !
Emmanuel7
Senior Developer
Senior Developer
 
Posts: 164
Joined: Fri Dec 12, 2008 2:17 am
Location: Paris

Postby pskink » Thu Jan 15, 2009 12:32 pm

Emmanuel7 wrote:Really nice, congratulations !
I think it will interest a lot of people here !

Just two (small) points ( yes, I really did read your code :) ) :
* Why a setOrientation ( VERTICAL ) ? It won't work in horizontal mode ?
* The way you post a empty message to create a timer 'looks' strange. I've always seen a generic handler used, with mHandler.postDelayed(mUpdateTimeTask, mUpdateInterval ); called, with mUpdateTimeTask a runnable with a run() method doing whatever we want. Note that the fact that I always seen this method is far from meaning it is superior :)
* ( Yes, I know I said two points ) : your code is much more lighter than the Home sliding drawer (here ). Are there some features missing in your version ?

Thanks for this nice contribution !


thanks for nice comment ;)

to be honest you inspired me to enhance my Panel: now it takes ~190 lines of code:

answering you question:
ad 1) both should work now, even more: you can select position from top, bottom, left & right (see layout file)

ad 2) posting messages is imho low level API of Handler (opposite to use Runnables). and since implementing widget is somehow low level job i decided to use low leve API. also this method is imho better if you use several postDelayed, you must create several anonymous Runnables (this is not case here since i use only two times) and with low level API you only have to make one anonymous Handler and handle message in dispatchMessage()

ad 3) sure it's missing some features: otherwise i would work at google ;) but if you ask if some features are missing it means that you didn't notice them and you don't care ;)

thanks and regards,
Last edited by pskink on Thu Jan 22, 2009 8:17 pm, edited 1 time in total.
pskink
pskink
Master Developer
Master Developer
 
Posts: 719
Joined: Mon Nov 24, 2008 3:49 pm

Postby MrSnowflake » Thu Jan 15, 2009 2:43 pm

Awsome, looks great, I'm probably gonna use it in my new project, I'm currently working on.

What's the licence? GPL/Apache/BSD/pure public domain?

I have one remark: in the exceptions you throw you are talking about id attributes with the name R.id.panelContent. But the actual Id is panelContent, without the R.id. ! Just so your exceptions become more correct :).
User avatar
MrSnowflake
Moderator
Moderator
 
Posts: 1439
Joined: Sat Feb 16, 2008 3:11 pm
Location: Flanders, Belgium

Postby pskink » Thu Jan 15, 2009 3:26 pm

MrSnowflake wrote:Awsome, looks great, I'm probably gonna use it in my new project, I'm currently working on.

What's the licence? GPL/Apache/BSD/pure public domain?

I have one remark: in the exceptions you throw you are talking about id attributes with the name R.id.panelContent. But the actual Id is panelContent, without the R.id. ! Just so your exceptions become more correct :).


thanks! nice to hear it... licence is: 'do what you want' :)

for exception: the check was 'stolen' from some google sources (TabHost.java IIRC) and i wanted to be consistent since they also used R.id prefix.

i'm facing minor problems with padding - hope to upload new version really soon
pskink
pskink
Master Developer
Master Developer
 
Posts: 719
Joined: Mon Nov 24, 2008 3:49 pm

Postby pskink » Thu Jan 15, 2009 11:43 pm

hi,

this is my third version of Panel, this time i did little polishing: comments, javadocs etc, also changed a bit Panel's XML attributes

i'm experiencing small problem though (see TODOs), it is visible when content is LinearLayout, maybe some of you could help?

thanks
Last edited by pskink on Thu Jan 22, 2009 8:18 pm, edited 1 time in total.
pskink
pskink
Master Developer
Master Developer
 
Posts: 719
Joined: Mon Nov 24, 2008 3:49 pm

Top

Postby MrSnowflake » Fri Jan 16, 2009 10:24 am

pskink wrote:for exception: the check was 'stolen' from some google sources (TabHost.java IIRC) and i wanted to be consistent since they also used R.id prefix.
Oh rly? :). Well then, that's very good then and you may ignore, my ignorance :).
User avatar
MrSnowflake
Moderator
Moderator
 
Posts: 1439
Joined: Sat Feb 16, 2008 3:11 pm
Location: Flanders, Belgium

Postby pskink » Fri Jan 16, 2009 12:49 pm

MrSnowflake wrote:Well then, that's very good then and you may ignore, my ignorance :).


i wouldn't call it 'ignorance', rather good detective's inspection/investigation :) - good for you!

seems that my widget gets final shape - i added two XML attributes 'closedHandle' and 'openedHandle' so client's code is now MUCH simplier - see Test.java.

listener got Panel parameter which simplifies life a lot.

also added two simple getters - getHandle() and getContent().

yet, problem with measuring content still exists :(
Last edited by pskink on Thu Jan 22, 2009 8:21 pm, edited 1 time in total.
pskink
pskink
Master Developer
Master Developer
 
Posts: 719
Joined: Mon Nov 24, 2008 3:49 pm

Postby MrSnowflake » Fri Jan 16, 2009 1:09 pm

pskink wrote:
MrSnowflake wrote:Well then, that's very good then and you may ignore, my ignorance :).

i wouldn't call it 'ignorance', rather good detective's inspection/investigation :) - good for you!
I would say not so good, as I didn't know those are the same as Google uses. On the other hand, as I didn't know this, it must mean I never encountered such an Exception, which means my coding skills are through the roof :D.
User avatar
MrSnowflake
Moderator
Moderator
 
Posts: 1439
Joined: Sat Feb 16, 2008 3:11 pm
Location: Flanders, Belgium

Postby Emmanuel7 » Sat Jan 17, 2009 2:58 am

Wahooo !!

There are four of them on every sides !

Congratulation on continuing to improve your widget !
Emmanuel7
Senior Developer
Senior Developer
 
Posts: 164
Joined: Fri Dec 12, 2008 2:17 am
Location: Paris

Postby pskink » Sat Jan 17, 2009 11:26 am

Emmanuel7 wrote:Wahooo !!

There are four of them on every sides !

Congratulation on continuing to improve your widget !


finally fixed the problem with measuring content dimensions.

now code not only is shorter but also MUCH MUCH simplier

also added small extra widget with animated drawables (try to "long press" top red button)

as always any comments welcome
Last edited by pskink on Thu Jan 22, 2009 8:23 pm, edited 1 time in total.
pskink
pskink
Master Developer
Master Developer
 
Posts: 719
Joined: Mon Nov 24, 2008 3:49 pm

Postby pskink » Sat Jan 17, 2009 9:38 pm

BANG!

now even i am impressed since code is yet more simple but got extra flexibility - Interpolators.

i must say Animations and Interpolators really ROCK!

cheers
Last edited by pskink on Thu Jan 22, 2009 8:25 pm, edited 1 time in total.
pskink
pskink
Master Developer
Master Developer
 
Posts: 719
Joined: Mon Nov 24, 2008 3:49 pm

Postby pskink » Mon Jan 19, 2009 12:07 am

pskink wrote:BANG!

now even i am impressed since code is yet more simple but got extra flexibility - Interpolators.

i must say Animations and Interpolators really ROCK!

cheers


and how it looks like now...

anyone wanting to write tutorial?

enjoy :D
Attachments
panelExpanded.png
panelExpanded.png (18.7 KiB) Viewed 46174 times
panelCollapsed.png
panelCollapsed.png (17.19 KiB) Viewed 46174 times
Last edited by pskink on Thu Jan 22, 2009 8:26 pm, edited 1 time in total.
pskink
pskink
Master Developer
Master Developer
 
Posts: 719
Joined: Mon Nov 24, 2008 3:49 pm

Postby darolla » Mon Jan 19, 2009 10:26 am

hi,

very well done, mate !!!

But I've got 1 wish and 1 suggestion ;)

wish: how about placing the new new widget above the view, using overlay technique?

suggestion: the red button animation is done using lots of PNGs. take a look at drawMagicFlame inside ColorButton.java of the Calculator sources I'll attach, the buttons are lightly transparent and the color animation is painted into the background of the button...

greetings,
darolla
Attachments
Calculator.zip
(115.6 KiB) Downloaded 2012 times
User avatar
darolla
Master Developer
Master Developer
 
Posts: 273
Joined: Thu Sep 25, 2008 5:16 pm
Location: Dortmund, Germany

Postby MrSnowflake » Mon Jan 19, 2009 11:24 am

Yeah, what Darola says is true, I think you should use overlays, because now, you see that the drawer handle is beneath the listview, and you don't see the listview continue next to the handle.

I would make a tut, but I have exams now...

BTW: How do you do such overlay stuff darola? :)
User avatar
MrSnowflake
Moderator
Moderator
 
Posts: 1439
Joined: Sat Feb 16, 2008 3:11 pm
Location: Flanders, Belgium

Top
Next

Return to View, Layout & Resource Problems

Who is online

Users browsing this forum: No registered users and 6 guests