andbook!.pdf - Learning Android Get an anddev.org - Android-Shirt Back to index
anddev.org Header Logo
FAQ Search Top rated articles Browse Feeds anddev.org - Authors Contact Details Register Log in

new widget - Panel

Goto page Previous  1, 2, 3, 4, 5  Next
 
       anddev.org - Android Development Community | Android Tutorials | Index -> View, Layout & Resource Problems
Author Message
pskink
Master Developer
Master Developer


Joined: 24 Nov 2008
Posts: 367

PostPosted: Mon Jan 19, 2009 11:50 am    Post subject: Reply with quote

darolla wrote:
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


thanks, did you see latest version? (0.7)

for wish: i didn't really think about that when designing my widget, but hey, i said to myself: use your force/imagination Luke! i thought for a while and came into idea of using FrameLayouts. and voila we gotit!!! android really ROCKS!

for suggestion: i use several pngs not by mistake. that way you can make any animation you like, e.g. some smooth warping from one shape to another, etc, etc.
i know it uses more resources but gives you full freedom...

_________________
pskink


Last edited by pskink on Thu Jan 22, 2009 9:24 pm; edited 4 times in total
Back to top
View user's profile Send private message
pskink
Master Developer
Master Developer


Joined: 24 Nov 2008
Posts: 367

PostPosted: Mon Jan 19, 2009 12:20 pm    Post subject: Reply with quote

FYI:

fixed flickering when two animations are running in the same time, added overlayed left/right panels

_________________
pskink


Last edited by pskink on Thu Jan 22, 2009 8:28 pm; edited 1 time in total
Back to top
View user's profile Send private message
pskink
Master Developer
Master Developer


Joined: 24 Nov 2008
Posts: 367

PostPosted: Tue Jan 20, 2009 12:06 am    Post subject: Reply with quote

FYI:

some polising / make-up before v 1.0

daRolla: now you can see red button in its full glory :)

_________________
pskink


Last edited by pskink on Thu Jan 22, 2009 8:28 pm; edited 1 time in total
Back to top
View user's profile Send private message
Emmanuel7
Senior Developer
Senior Developer


Joined: 12 Dec 2008
Posts: 161
Location: Paris

PostPosted: Tue Jan 20, 2009 2:47 am    Post subject: Reply with quote

Hum...
you're going too fast for me Smile

Anyway, I made my little contribution, with dealing with the dragging of the handle to move the panel.
I think it is important because I feel it is part of the fun of this widget ( even if you forget about it after ten uses ).

* This version is based on your 0.6 version, so not up to date
* it look like there are some buggy frames in the bottom panel...
* The click is not longer working ( Sad ). But I am unsure of how I can make the difference between a click and a drag !

So still a first step, but I think it is promising !

_________________
Emmanuel
My Android development blog : http://androidblogger.blogspot.com/
My application site : http://www.alocaly.com
Back to top
View user's profile Send private message Visit poster's website
darolla
Master Developer
Master Developer


Joined: 25 Sep 2008
Posts: 228
Location: Dortmund, Germany

PostPosted: Tue Jan 20, 2009 7:40 am    Post subject: Reply with quote

I think a drag is a motion, and a click is a click. both have different event listeners.

although I dont understand the sourcecode completely...

greetings,
darolla
Back to top
View user's profile Send private message
pskink
Master Developer
Master Developer


Joined: 24 Nov 2008
Posts: 367

PostPosted: Tue Jan 20, 2009 10:13 am    Post subject: Reply with quote

Emmanuel7 wrote:
Hum...
you're going too fast for me :)

Anyway, I made my little contribution, with dealing with the dragging of the handle to move the panel.
I think it is important because I feel it is part of the fun of this widget ( even if you forget about it after ten uses ).

* This version is based on your 0.6 version, so not up to date
* it look like there are some buggy frames in the bottom panel...
* The click is not longer working ( :( ). But I am unsure of how I can make the difference between a click and a drag !

So still a first step, but I think it is promising !


thanks for contributing! i'll try to integrate it with current version

_________________
pskink
Back to top
View user's profile Send private message
Emmanuel7
Senior Developer
Senior Developer


Joined: 12 Dec 2008
Posts: 161
Location: Paris

PostPosted: Tue Jan 20, 2009 2:18 pm    Post subject: Reply with quote

Just to elaborate, as my last post was at 3 am for me, and I was getting quite tired :

* The click is clicking on the button, and releasing on the button.
* The drag is cliking on the button, moving, and releasing the button.

But when you click, you can always move by a small amount because..euh...we are not perfect clicker.
Especially, I imagine, on a mobile phone where you are clicking with your finger on pixels that are 1/100 of your finger !

So we have to activate the click behaviour when the release position is 'near' the click position.
I've just tested on the emulator, and that's the home page behaviour. Even if you drag up the panel, then come back two pixels away from the start position, it is considered as a click, and not as a drag

So adding this behavior in my code is no big deal.

Then we can get rid of the click listener, that is of no use now.
with my behaviour, if you release the drag in the upper half of the panel, it will open, otherwise, it will close ( for a BOTTOM panel ).

I still have two questions :
* What is the OnFinishInflate methode about ? I though it was called after the view and its children have been given their size / pos, but it is not the case ! So I don't understand what we must do in this function vs what is done in the constructor
* Is there a callback we can use when the view and its children have been constructed and given their size / pos. In order to mimic this function, I post a message on the OnFinishInflate, and the view is constructed when I receive this message.
* I didn't check the 'fling' mechanism, but I'm not sure it is that important !

more to do :
* I think it is possible to clean the code a little, and remove some dead code / var. We should also put get rid of constantly calling getOrientation, or getVisibility, and use var instead.
* Adding a closePanel and openPanel is about 4 lines, and would be useful ( the application should be able to open/ close the panel when it needs to ).


I'll try to work on it tonigh, it's just two steps from being really great and totally functionnal !!

_________________
Emmanuel
My Android development blog : http://androidblogger.blogspot.com/
My application site : http://www.alocaly.com
Back to top
View user's profile Send private message Visit poster's website
pskink
Master Developer
Master Developer


Joined: 24 Nov 2008
Posts: 367

PostPosted: Tue Jan 20, 2009 5:03 pm    Post subject: Reply with quote

Emmanuel7 wrote:
Just to elaborate, as my last post was at 3 am for me, and I was getting quite tired :

* The click is clicking on the button, and releasing on the button.
* The drag is cliking on the button, moving, and releasing the button.

But when you click, you can always move by a small amount because..euh...we are not perfect clicker.
Especially, I imagine, on a mobile phone where you are clicking with your finger on pixels that are 1/100 of your finger !

So we have to activate the click behaviour when the release position is 'near' the click position.
I've just tested on the emulator, and that's the home page behaviour. Even if you drag up the panel, then come back two pixels away from the start position, it is considered as a click, and not as a drag


.


just found that google guys already did it!!!

the answer is GestureDetector: it supports even on flying!!!

based on your patch i'll have something tomorrow.

_________________
pskink
Back to top
View user's profile Send private message
pskink
Master Developer
Master Developer


Joined: 24 Nov 2008
Posts: 367

PostPosted: Tue Jan 20, 2009 8:26 pm    Post subject: Reply with quote

Emmanuel7 wrote:

I still have two questions :
* What is the OnFinishInflate methode about ? I though it was called after the view and its children have been given their size / pos, but it is not the case ! So I don't understand what we must do in this function vs what is done in the constructor
* Is there a callback we can use when the view and its children have been constructed and given their size / pos. In order to mimic this function, I post a message on the OnFinishInflate, and the view is constructed when I receive this message.


1) onFinishInflate is called when children have been inflated from xml but ifaik children are not measured yet

2) i think it's onLayout

_________________
pskink
Back to top
View user's profile Send private message
darolla
Master Developer
Master Developer


Joined: 25 Sep 2008
Posts: 228
Location: Dortmund, Germany

PostPosted: Tue Jan 20, 2009 8:34 pm    Post subject: Reply with quote

http://www.anddev.org/viewtopic.php?p=14967
Back to top
View user's profile Send private message
pskink
Master Developer
Master Developer


Joined: 24 Nov 2008
Posts: 367

PostPosted: Tue Jan 20, 2009 9:09 pm    Post subject: Reply with quote

darolla wrote:
http://www.anddev.org/viewtopic.php?p=14967


yes, it's really pretty cool

my latest version uses it, works like a charm ;) no need for fancy calculations obout scroling, flying etc etc

in v 0.10 i implemented scrolling/tracking and flying

however when animation is invoked via flying there is one thing: there is visible difference bettween speed during flying and speed when starting animation

it can be fixed (it think) by calculating interpolator's derivative, and based on flying velocity calculate animation duration but, well ma math classes were long time ago and i may be wrong...

anyone with fresh math / physics classes? :D

_________________
pskink


Last edited by pskink on Thu Jan 22, 2009 8:31 pm; edited 1 time in total
Back to top
View user's profile Send private message
Emmanuel7
Senior Developer
Senior Developer


Joined: 12 Dec 2008
Posts: 161
Location: Paris

PostPosted: Wed Jan 21, 2009 2:59 am    Post subject: Reply with quote

Waoo !!

it's getting really nice !

I must admit I don't really see what is missing now in order to make it a real v1.0 version.

Two little points :
* First :
There is a bug ! when you drag the handle to have the panel fully expanded ( and pass the limit ), if you release the click button, the panel will instantly close itself. I changed the line 318 :
Java:
if (calculatedDuration == 0 ) {

into
Java:
if (calculatedDuration == 0 && mIsShrinking) {


And it looks like the problem is fixed !
(it's in the startAnimation runnable )

*Second point :
I added another layout for you to test, to show something cool that perhaps you didn't think about :
You can have several panel on the same side !!!

And I think you should still add some functions to open / close the panel, both with and without the animation, from outside code.( but it should be something like 4 lines of code from what I have seen )

Really a nice thread Smile

_________________
Emmanuel
My Android development blog : http://androidblogger.blogspot.com/
My application site : http://www.alocaly.com
Back to top
View user's profile Send private message Visit poster's website
darolla
Master Developer
Master Developer


Joined: 25 Sep 2008
Posts: 228
Location: Dortmund, Germany

PostPosted: Wed Jan 21, 2009 8:44 am    Post subject: Reply with quote

it's really nice Wink

I've found a little bug: open the bottom widget, and try to hit the checkbox. the left widget is opened Sad so the checkbox is unreachable...

btw: this widget isnt a standard widget. alrite. but cant it be found inside the original sources? it has to be there, because its part of android, isnt it???

altough the graphic cant be found in the sdk...

greetings,
darolla
Back to top
View user's profile Send private message
darolla
Master Developer
Master Developer


Joined: 25 Sep 2008
Posts: 228
Location: Dortmund, Germany

PostPosted: Wed Jan 21, 2009 8:45 am    Post subject: Reply with quote

if you click next to the orange grip, the widget openes, too.

so the click hotspot isnt correct?

greetings,
darolla
Back to top
View user's profile Send private message
Emmanuel7
Senior Developer
Senior Developer


Joined: 12 Dec 2008
Posts: 161
Location: Paris

PostPosted: Wed Jan 21, 2009 9:58 am    Post subject: Reply with quote

I don't think having a unreachable widget when a panel is opened is a bug, just a GUI design issue.
this was just a feature sample, and is not said to be any pratical.

As for the android version, you can find the code here.

I'm unsure why google has released their version, but I'm not sure you can have it on the 4 borders of your app (only bottom and right )

_________________
Emmanuel
My Android development blog : http://androidblogger.blogspot.com/
My application site : http://www.alocaly.com
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
       anddev.org - Android Development Community | Android Tutorials | Index -> View, Layout & Resource Problems All times are GMT + 1 Hour
Goto page Previous  1, 2, 3, 4, 5  Next
Page 2 of 5

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum


© 2007, Android Development Community
All rights reserved.
Powered by phpBB.