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: 326

PostPosted: Wed Jan 21, 2009 11:24 am    Post subject: Reply with quote

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


see 3 TODOs in Panel.java, last two are minor, but the first one imho should be fixed somehow, but i dont know how...

Emmanuel7 wrote:
Waoo !!
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 )


you were VERY close, but i think we should really avoid animation when calculatedDuration == 0 so:

Java:

if (calculatedDuration == 0) {
     mState = State.READY;
     if (mIsShrinking) {
          mContent.setVisibility(GONE);
     }
     return;
}


Emmanuel7 wrote:
*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 :)


big thanks for new layout! i added it as default

added also isOpen and setOpen methods: setOpen is little longer than 4 lines but still small ;)

_________________
pskink


Last edited by pskink on Thu Jan 22, 2009 8:35 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: 326

PostPosted: Wed Jan 21, 2009 11:29 am    Post subject: Reply with quote

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


this is not bug imho: run hierarchyviewer and see panels bounds. handle graphics is invisible on the sides but still belong to it.

graphics are in Launcher.apk on the emulator device

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


Joined: 24 Nov 2008
Posts: 326

PostPosted: Thu Jan 22, 2009 11:11 am    Post subject: Reply with quote

hi,

i managed to use GestureDetector in both cases - when panel is closed and opened.

i had to play with MotionEvents a bit before passing them to gesture detector but now it works much better ;)

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


Joined: 24 Nov 2008
Posts: 326

PostPosted: Thu Jan 22, 2009 9:49 pm    Post subject: Reply with quote

FYI:

added short movie in the first post of this thread

_________________
pskink
Back to top
View user's profile Send private message
MrSnowflake
Moderator
Moderator


Joined: 16 Feb 2008
Posts: 1437
Location: Flanders, Belgium

PostPosted: Thu Jan 22, 2009 10:31 pm    Post subject: Reply with quote

why do both the top and bottom drawer resize the inner layout and the right drawer doesn't? I don't really like the fact that the inner layout changes shape... But the rest looks awsome Smile
Back to top
View user's profile Send private message
pskink
Master Developer
Master Developer


Joined: 24 Nov 2008
Posts: 326

PostPosted: Thu Jan 22, 2009 11:15 pm    Post subject: Reply with quote

MrSnowflake wrote:
why do both the top and bottom drawer resize the inner layout and the right drawer doesn't? I don't really like the fact that the inner layout changes shape... But the rest looks awsome :)


bcoz top/bottom are 'inlined' panels, while left/right are 'overlayed'

i think that 'inlined' panels can be helpful sometimes, cannot give good examples right now, though... ;)

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


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

PostPosted: Fri Jan 23, 2009 12:03 am    Post subject: Reply with quote

movie is a funny idea Wink
Back to top
View user's profile Send private message
avolovoy
Experienced Developer
Experienced Developer


Joined: 03 Nov 2008
Posts: 68
Location: kansas

PostPosted: Fri Jan 23, 2009 5:23 am    Post subject: Reply with quote

Really really cool stuff . Can i make a suggestion ? Since i see couple of people working on this here may be it's good idea to move it to a project on code.google.com ? It'll ve SVN accessible which is good . Really awesome job though
_________________
Alexey Volovoy
Bytesharp.NET
Back to top
View user's profile Send private message Visit poster's website
pskink
Master Developer
Master Developer


Joined: 24 Nov 2008
Posts: 326

PostPosted: Fri Jan 23, 2009 9:26 am    Post subject: Reply with quote

avolovoy wrote:
Really really cool stuff . Can i make a suggestion ? Since i see couple of people working on this here may be it's good idea to move it to a project on code.google.com ? It'll ve SVN accessible which is good . Really awesome job though


Aleksiej,

are you reffering to some existing google project or to new one?

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


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

PostPosted: Fri Jan 23, 2009 9:56 am    Post subject: Reply with quote

hi,

I'd like to animate a tablerow which visibility is is VISIBLE or GONE, and this should be animated (maybe growing just like this panel)

can you maybe give me a starter to the animations?

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


Joined: 24 Nov 2008
Posts: 326

PostPosted: Fri Jan 23, 2009 11:48 am    Post subject: Reply with quote

darolla wrote:
hi,

I'd like to animate a tablerow which visibility is is VISIBLE or GONE, and this should be animated (maybe growing just like this panel)

can you maybe give me a starter to the animations?

greetings,
darolla


hi, as far as i remember i started with http://developerlife.com/tutorials/?p=343

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


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

PostPosted: Fri Jan 23, 2009 1:32 pm    Post subject: Reply with quote

hi pskink,

well, I used my own fading out animation. thats nice so far.

but I've got the problem that after the animation everything is as it was before the animation.

I need to change something AFTER the animation, but I dont know which event?

can u please help me on this?

lets say I have got a button.

when its pressed (onclicklistener) the animation (fadeout) is startet.

then the button has to be visibility = gone.

greetings,
darolla

ps: sorry for using this thread, but u dont read your pms, do you? Wink
Back to top
View user's profile Send private message
Emmanuel7
Senior Developer
Senior Developer


Joined: 12 Dec 2008
Posts: 161
Location: Paris

PostPosted: Fri Jan 23, 2009 1:40 pm    Post subject: Reply with quote

Hi,

You have to implement a 'animationListener', which own an onAnimationEnd method.
And you add this animationListener to your animation with the 'setAnimationListener' Animation method.

I have a sample here :
http://androidblogger.blogspot.com/2009/01/chaining-two-animations-or-how-to.html


( I think I really have to work on the layout of my blog, it is hardly readable !! )

_________________
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: 326

PostPosted: Fri Jan 23, 2009 1:57 pm    Post subject: Reply with quote

darolla wrote:
hi pskink,

well, I used my own fading out animation. thats nice so far.

but I've got the problem that after the animation everything is as it was before the animation.

I need to change something AFTER the animation, but I dont know which event?

can u please help me on this?

lets say I have got a button.

when its pressed (onclicklistener) the animation (fadeout) is startet.

then the button has to be visibility = gone.

greetings,
darolla

ps: sorry for using this thread, but u dont read your pms, do you? ;)


pms? sorry i always forget to check it...

for animations: they DONT change any view's attribute - position, visibility, alpha etc.

all you need to do is: set the view state as it would look after animation finishes and then start animation - eg setVisibility(GONE); startAnimation(fade-out)

sometimes you could use animation listener and its methods: start, finish, repeat.

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


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

PostPosted: Fri Jan 23, 2009 4:04 pm    Post subject: Reply with quote

well, mate, thanks for the response, but you are wrong.

the animation is concurrent, so only in case of a very fast animation you can do both steps after each other (setVisibility(GONE); startAnimation(fade-out))

it took me some time to find out, but the Animation object has a setAnimationListener, so this way it works nicely.

Java:

     protected class MyAnimationListener implements AnimationListener {

          private LinearLayout ll;
          
          public AusblendenAnimationListener( LinearLayout ll ) {
               this.ll = ll;
          }
               
          public void onAnimationEnd(Animation animation) {
               ll.setVisibility( View.GONE );
          }

          public void onAnimationRepeat(Animation animation) {
          }

          public void onAnimationStart(Animation animation) {
          }         
     }


and the button (onclicklistener), which starts all, looks like this:

Java:

     protected class LoeschenListener implements OnClickListener {

          private int id;
          
          public LoeschenListener( int id ) {
               this.id = id;
          }
          
          public void onClick(View v) {
               
               LinearLayout ll = (LinearLayout) findViewById( id );
               
               Animation anim = AnimationUtils.loadAnimation(MyClass.this, R.anim.fade_away);
               anim.setAnimationListener( new MyAnimationListener( ll ) );           
               ll.startAnimation(anim);

               // this definitly doesn't work here !!!
//             ll.setVisibility( View.GONE );
          }
     }   


greetings,
darolla
Back to top
View user's profile Send private message
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 3 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.