new widget - Panel

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

Postby pskink » Wed Jan 21, 2009 11:24 am

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

into
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. if (calculatedDuration == 0 && mIsShrinking) {
  2.  
  3.  
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 )


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

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. if (calculatedDuration == 0) {
  2.         mState = State.READY;
  3.         if (mIsShrinking) {
  4.                 mContent.setVisibility(GONE);
  5.         }
  6.         return;
  7. }
  8.  
Parsed in 0.034 seconds, using GeSHi 1.0.8.4


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

Top

Postby pskink » Wed Jan 21, 2009 11:29 am

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

Postby pskink » Thu Jan 22, 2009 11:11 am

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 ;)
Attachments
Panel.tar.gz
v 0.12 single tap works better when panel is closed, added option for linear interpolator when in flying mode
(75.05 KiB) Downloaded 130 times
pskink
pskink
Master Developer
Master Developer
 
Posts: 719
Joined: Mon Nov 24, 2008 3:49 pm

Postby pskink » Thu Jan 22, 2009 9:49 pm

FYI:

added short movie in the first post of this thread
pskink
pskink
Master Developer
Master Developer
 
Posts: 719
Joined: Mon Nov 24, 2008 3:49 pm

Postby MrSnowflake » Thu Jan 22, 2009 10:31 pm

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 :)
User avatar
MrSnowflake
Moderator
Moderator
 
Posts: 1439
Joined: Sat Feb 16, 2008 3:11 pm
Location: Flanders, Belgium

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

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

Top

Postby darolla » Fri Jan 23, 2009 12:03 am

movie is a funny idea ;)
User avatar
darolla
Master Developer
Master Developer
 
Posts: 273
Joined: Thu Sep 25, 2008 5:16 pm
Location: Dortmund, Germany

Postby avolovoy » Fri Jan 23, 2009 5:23 am

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
User avatar
avolovoy
Experienced Developer
Experienced Developer
 
Posts: 68
Joined: Mon Nov 03, 2008 10:32 pm
Location: kansas

Postby pskink » Fri Jan 23, 2009 9:26 am

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

Postby darolla » Fri Jan 23, 2009 9:56 am

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

Postby pskink » Fri Jan 23, 2009 11:48 am

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

Postby darolla » Fri Jan 23, 2009 1:32 pm

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

Postby Emmanuel7 » Fri Jan 23, 2009 1:40 pm

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

Postby pskink » Fri Jan 23, 2009 1:57 pm

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

Postby darolla » Fri Jan 23, 2009 4:04 pm

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.

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.  
  2.         protected class MyAnimationListener implements AnimationListener {
  3.  
  4.  
  5.  
  6.                 private LinearLayout ll;
  7.  
  8.                
  9.  
  10.                 public AusblendenAnimationListener( LinearLayout ll ) {
  11.  
  12.                         this.ll = ll;
  13.  
  14.                 }
  15.  
  16.                        
  17.  
  18.                 public void onAnimationEnd(Animation animation) {
  19.  
  20.                         ll.setVisibility( View.GONE );
  21.  
  22.                 }
  23.  
  24.  
  25.  
  26.                 public void onAnimationRepeat(Animation animation) {
  27.  
  28.                 }
  29.  
  30.  
  31.  
  32.                 public void onAnimationStart(Animation animation) {
  33.  
  34.                 }              
  35.  
  36.         }
  37.  
  38.  
Parsed in 0.037 seconds, using GeSHi 1.0.8.4


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

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.  
  2.         protected class LoeschenListener implements OnClickListener {
  3.  
  4.  
  5.  
  6.                 private int id;
  7.  
  8.                
  9.  
  10.                 public LoeschenListener( int id ) {
  11.  
  12.                         this.id = id;
  13.  
  14.                 }
  15.  
  16.                
  17.  
  18.                 public void onClick(View v) {
  19.  
  20.                        
  21.  
  22.                         LinearLayout ll = (LinearLayout) findViewById( id );
  23.  
  24.                        
  25.  
  26.                         Animation anim = AnimationUtils.loadAnimation(MyClass.this, R.anim.fade_away);
  27.  
  28.                         anim.setAnimationListener( new MyAnimationListener( ll ) );                    
  29.  
  30.                         ll.startAnimation(anim);
  31.  
  32.  
  33.  
  34.                         // this definitly doesn't work here !!!
  35.  
  36. //                      ll.setVisibility( View.GONE );
  37.  
  38.                 }
  39.  
  40.         }      
  41.  
  42.  
Parsed in 0.038 seconds, using GeSHi 1.0.8.4


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

Top
PreviousNext

Return to View, Layout & Resource Problems

Who is online

Users browsing this forum: No registered users and 4 guests