new widget - Panel

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

Postby pskink » Mon Jan 19, 2009 11:50 am

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...
Last edited by pskink on Thu Jan 22, 2009 9:24 pm, edited 4 times in total.
pskink
pskink
Master Developer
Master Developer
 
Posts: 719
Joined: Mon Nov 24, 2008 3:49 pm

Top

Postby pskink » Mon Jan 19, 2009 12:20 pm

FYI:

fixed flickering when two animations are running in the same time, added overlayed left/right panels
Last edited by pskink on Thu Jan 22, 2009 8:28 pm, edited 1 time in total.
pskink
pskink
Master Developer
Master Developer
 
Posts: 719
Joined: Mon Nov 24, 2008 3:49 pm

Postby pskink » Tue Jan 20, 2009 12:06 am

FYI:

some polising / make-up before v 1.0

daRolla: now you can see red button in its full glory :)
Last edited by pskink on Thu Jan 22, 2009 8:28 pm, edited 1 time in total.
pskink
pskink
Master Developer
Master Developer
 
Posts: 719
Joined: Mon Nov 24, 2008 3:49 pm

Postby Emmanuel7 » Tue Jan 20, 2009 2:47 am

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 !
Attachments
Panel.zip
Panel.java
(2.85 KiB) Downloaded 262 times
Emmanuel7
Senior Developer
Senior Developer
 
Posts: 164
Joined: Fri Dec 12, 2008 2:17 am
Location: Paris

Postby darolla » Tue Jan 20, 2009 7:40 am

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
User avatar
darolla
Master Developer
Master Developer
 
Posts: 273
Joined: Thu Sep 25, 2008 5:16 pm
Location: Dortmund, Germany

Postby pskink » Tue Jan 20, 2009 10:13 am

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
pskink
Master Developer
Master Developer
 
Posts: 719
Joined: Mon Nov 24, 2008 3:49 pm

Top

Postby Emmanuel7 » Tue Jan 20, 2009 2:18 pm

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 !!
Emmanuel7
Senior Developer
Senior Developer
 
Posts: 164
Joined: Fri Dec 12, 2008 2:17 am
Location: Paris

Postby pskink » Tue Jan 20, 2009 5:03 pm

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
pskink
Master Developer
Master Developer
 
Posts: 719
Joined: Mon Nov 24, 2008 3:49 pm

Postby pskink » Tue Jan 20, 2009 8:26 pm

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
pskink
Master Developer
Master Developer
 
Posts: 719
Joined: Mon Nov 24, 2008 3:49 pm

Postby darolla » Tue Jan 20, 2009 8:34 pm

User avatar
darolla
Master Developer
Master Developer
 
Posts: 273
Joined: Thu Sep 25, 2008 5:16 pm
Location: Dortmund, Germany

Postby pskink » Tue Jan 20, 2009 9:09 pm

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
Last edited by pskink on Thu Jan 22, 2009 8:31 pm, edited 1 time in total.
pskink
pskink
Master Developer
Master Developer
 
Posts: 719
Joined: Mon Nov 24, 2008 3:49 pm

Postby Emmanuel7 » Wed Jan 21, 2009 2:59 am

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 :
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. if (calculatedDuration == 0 ) {
  2.  
  3.  
Parsed in 0.031 seconds, using GeSHi 1.0.8.4

into
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. if (calculatedDuration == 0 && mIsShrinking) {
  2.  
  3.  
  4.  
  5.  
Parsed in 0.030 seconds, using GeSHi 1.0.8.4

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 :)
Attachments
main.zip
(1.19 KiB) Downloaded 167 times
Emmanuel7
Senior Developer
Senior Developer
 
Posts: 164
Joined: Fri Dec 12, 2008 2:17 am
Location: Paris

Postby darolla » Wed Jan 21, 2009 8:44 am

it's really nice ;)

I've found a little bug: open the bottom widget, and try to hit the checkbox. the left widget is opened :( 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
User avatar
darolla
Master Developer
Master Developer
 
Posts: 273
Joined: Thu Sep 25, 2008 5:16 pm
Location: Dortmund, Germany

Postby darolla » Wed Jan 21, 2009 8:45 am

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

so the click hotspot isnt correct?

greetings,
darolla
User avatar
darolla
Master Developer
Master Developer
 
Posts: 273
Joined: Thu Sep 25, 2008 5:16 pm
Location: Dortmund, Germany

Postby Emmanuel7 » Wed Jan 21, 2009 9:58 am

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 )
Emmanuel7
Senior Developer
Senior Developer
 
Posts: 164
Joined: Fri Dec 12, 2008 2:17 am
Location: Paris

Top
PreviousNext

Return to View, Layout & Resource Problems

Who is online

Users browsing this forum: No registered users and 5 guests