I have frame animation on each cell.

On 30 апр, 18:24, Romain Guy <romain...@google.com> wrote:
> Why don't you just use a LayoutAnimation? That's what it's for.
>
> 2009/4/30 Illidane <illid...@gmail.com>:
>
>
>
>
>
> > I did that ( write somewhere in getView ) :
> > if(position == mGameModel.getCount() - 1)
> >                        (new Timer(false)).schedule(new AnimationTimer(), 
> > 10);
>
> > AnimationTimer() just run my animation. Without this timer when I was
> > trying to write if(position == mGameModel.getCount() - 1) my animation
> > was running without last cell. It's because of position. When it's 99,
> > GridView just haven't time to set last cell ( under 99-position
> > number). Timer in 10 ms helps it.
>
> > To Siva Rajaraman:
> > You must use position value ( even if it works not correctly :) ).
> > Than do as I wrote upper.
>
> > On 29 апр, 18:27, Streets Of Boston <flyingdutc...@gmail.com> wrote:
> >> Good to hear!
>
> >> I'm curious: what did you do to get around this problem?
> >> (yarik may want to know as well :-))
>
> >> On Apr 29, 11:13 am, Illidane <illid...@gmail.com> wrote:
>
> >> > No matter.. it's all working now with the GridView, I have fixed that
> >> > bug by the hand.
> >> > Thank you for your help)
>
> >> > On 29 апр, 17:07, Streets Of Boston <flyingdutc...@gmail.com> wrote:
>
> >> > > If you have all 100 cells visible at once at all time, the GridView
> >> > > does not add much functionality (no scrolling necessary), except for
> >> > > selecting cells.
>
> >> > > I'm not familiar with your app, but i think it would be 'easier' than
> >> > > wrestling with GridView to subclass 'View' (or 'ViewGroup' if you need
> >> > > additional child-views) and have this sub-class handle the 100 cells
> >> > > (implement onDraw, dispatchDraw) and draw your cells using Drawables.
> >> > > This also removes the need of having 100 child-views (1 for each
> >> > > cells), which could become more problematic for the Cupcake release
> >> > > (see its note about how it is more finnicky about the depth and width
> >> > > of view-hierarchies). Instead, you have just one view with 100 small
> >> > > bitmaps/drawables.
>
> >> > > On Apr 29, 3:03 am, Illidane <illid...@gmail.com> wrote:
>
> >> > > > Extend the GridView or write my own class which will manipulating 100
> >> > > > cells as drawables?
>
> >> > > > On 29 апр, 00:27, Streets Of Boston <flyingdutc...@gmail.com> wrote:
>
> >> > > > > I have to defend Romain here.
> >> > > > > The gridview and/or listview is just not designed to do this. 
> >> > > > > You're
> >> > > > > trying to put a round peg in a square hole.
>
> >> > > > > Maybe the decision to use a GridView for your purposes is not a 
> >> > > > > good
> >> > > > > idea, because of its design that does not fit what you need.
>
> >> > > > > If all 100 cells are visible at the same time (then there's no
> >> > > > > scrolling needed), why do you need a gridview? Maybe you should
> >> > > > > subclass your own view and draw the 100 cells as 100 drawables 
> >> > > > > (which
> >> > > > > you can animate) yourself in its onDraw or dispatchDraw method.
>
> >> > > > > On Apr 28, 2:53 pm, Illidane <illid...@gmail.com> wrote:
>
> >> > > > > > Ok-ok, I gotcha what you mean.
> >> > > > > > But with such position to developers you will never make android 
> >> > > > > > lead
> >> > > > > > platform.
> >> > > > > > Sory, if I speak the truth boldly.
>
> >> > > > > > On 28 апр, 19:44, Romain Guy <romain...@google.com> wrote:
>
> >> > > > > > > No, you are just making assumptions about how it should work. 
> >> > > > > > > Nowhere
> >> > > > > > > does it say that it should work the way you want it to work, 
> >> > > > > > > that's
> >> > > > > > > not how it works and that's not how it will work.
>
> >> > > > > > > 2009/4/28 Illidane <illid...@gmail.com>:
>
> >> > > > > > > > To Romain Guy:
> >> > > > > > > > Ok, I understood that you think that it's NOT a bug and that 
> >> > > > > > > > you
> >> > > > > > > > implement it how you want it be.
> >> > > > > > > > But I need to say you, that in such situation is very hard, 
> >> > > > > > > > or
> >> > > > > > > > sometimes is impossible to write good, stable, beauty, 
> >> > > > > > > > useful and
> >> > > > > > > > competitive apps for Android, not only for me, but for all 
> >> > > > > > > > Android
> >> > > > > > > > programmers.
> >> > > > > > > > And I think you know that.
>
> >> > > > > > > > On 28 апр, 18:53, Romain Guy <romain...@google.com> wrote:
> >> > > > > > > >> I am from the Google team (and I did implement a lot of 
> >> > > > > > > >> GridView and
> >> > > > > > > >> ListView) and it is NOT a bug. GridView and ListView can 
> >> > > > > > > >> call
> >> > > > > > > >> getView() out of order and more times than the number of 
> >> > > > > > > >> views that
> >> > > > > > > >> will fit on screen, depending how the Grid/ListView is 
> >> > > > > > > >> measured/laid
> >> > > > > > > >> out.
>
> >> > > > > > > >> 2009/4/28 yarik...@gmail.com <yarik...@gmail.com>:
>
> >> > > > > > > >> > I have exactly same problem. Why do we have 102 values of 
> >> > > > > > > >> > position
> >> > > > > > > >> > when there is only 100 cells displayed on screen?
> >> > > > > > > >> > "position is changed like: 0, 0, 1, 2, 3... 99, 0" - what 
> >> > > > > > > >> > is the cause
> >> > > > > > > >> > of that? Can someone from google team answer?
> >> > > > > > > >> > That seems to be a bug, very annoying bug. Answer "It's 
> >> > > > > > > >> > not a bug" is
> >> > > > > > > >> > not answer! How do you generate position?
>
> >> > > > > > > >> > On Apr 27, 9:40 pm, Illidane <illid...@gmail.com> wrote:
> >> > > > > > > >> >> There is a way to make GridView without Adapter ( e.g. 
> >> > > > > > > >> >> something
> >> > > > > > > >> >> like .addView() method ) ?
>
> >> > > > > > > >> >> On 27 апр, 21:38, Illidane <illid...@gmail.com> wrote:
>
> >> > > > > > > >> >> > My GridView shows all 100 cells on the screen ( all 
> >> > > > > > > >> >> > visible at one
> >> > > > > > > >> >> > moment )
> >> > > > > > > >> >> > and all the animation works fine, and pretty fast ( on 
> >> > > > > > > >> >> > all 100
> >> > > > > > > >> >> > elements ),
> >> > > > > > > >> >> > but than begin problems with last cell.
> >> > > > > > > >> >> > Animation not child-view's. Each cell is a imageView 
> >> > > > > > > >> >> > with animation on
> >> > > > > > > >> >> > it.
>
> >> > > > > > > >> >> > On 27 апр, 20:43, Streets Of Boston 
> >> > > > > > > >> >> > <flyingdutc...@gmail.com> wrote:
>
> >> > > > > > > >> >> > > It's not buggy. I use the adapters and 
> >> > > > > > > >> >> > > grid/list-views in my apps and
> >> > > > > > > >> >> > > they work fine. I think they are not designed for 
> >> > > > > > > >> >> > > your purpose.
>
> >> > > > > > > >> >> > > e.g. If your adapter has 100 elements and the 
> >> > > > > > > >> >> > > grid/list-view only
> >> > > > > > > >> >> > > shows about 15 at a time on the screen, the getView 
> >> > > > > > > >> >> > > is called about 15
> >> > > > > > > >> >> > > times. Sometimes more times, depending whether a 
> >> > > > > > > >> >> > > little bit (a few
> >> > > > > > > >> >> > > pixels) of the top or bottom child-view become 
> >> > > > > > > >> >> > > visible or not. Then,
> >> > > > > > > >> >> > > when you start scrolling, getView gets called again 
> >> > > > > > > >> >> > > and again when
> >> > > > > > > >> >> > > child-views become visible and others become 
> >> > > > > > > >> >> > > invisible.
>
> >> > > > > > > >> >> > > Also, seriously consider re-using the convertView 
> >> > > > > > > >> >> > > for your grid- or
> >> > > > > > > >> >> > > list-view. My experience is that it can really slow 
> >> > > > > > > >> >> > > down your app if
> >> > > > > > > >> >> > > you just return new View instances for each 
> >> > > > > > > >> >> > > child-view/cell:
> >> > > > > > > >> >> > > public ... getView(....) {
> >> > > > > > > >> >> > >   View view = convertView != null ? convertView : 
> >> > > > > > > >> >> > > createNewView(...);
> >> > > > > > > >> >> > >   ...
> >> > > > > > > >> >> > >   ...
> >> > > > > > > >> >> > >   return view;
>
> >> > > > > > > >> >> > > }
>
> >> > > > > > > >> >> > > The implementation of the adapter+listviews does not 
> >> > > > > > > >> >> > > need to rely on
> >> > > > > > > >> >> > > the order in which the getView is called. As long as 
> >> > > > > > > >> >> > > it is called for
> >> > > > > > > >> >> > > every child-view that becomes visible.
>
> >> > > > > > > >> >> > > Isn't is possible to start a child-view's (cell's) 
> >> > > > > > > >> >> > > animation when you
> >> > > > > > > >> >> > > handle it the getView(...) method?
>
> >> > > > > > > >> >> > > If you really want at least 100 child-views/cells to 
> >> > > > > > > >> >> > > be created (i
> >> > > > > > > >> >> > > won't recommend it... it's a LOT), you can override 
> >> > > > > > > >> >> > > the Adapter's
> >> > > > > > > >> >> > > getViewTypeCount() and getItemViewType(int pos). 
> >> > > > > > > >> >> > > Even with this, I'm
> >> > > > > > > >> >> > > still not sure if getView would get called in the 
> >> > > > > > > >> >> > > order you want.
>
> >> > > > > > > >> >> > > ...
> >> > > > > > > >> >> > >   private static int EXPECTED_CELL_COUNT = 100;
>
> >> > > > > > > >> >> > >   public int getViewTypeCount() { return 
> >> > > > > > > >> >> > > EXPECTED_CELL_COUNT; }
> >> > > > > > > >> >> > >   public int getItemViewType(int pos) { return pos %
> >> > > > > > > >> >> > > EXPECTED_CELL_COUNT; }
>
> >> > > > > > > >> >> > > On Apr 27, 1:07 pm, Illidane <illid...@gmail.com> 
> >> > > > > > > >> >> > > wrote:
>
> >> > > > > > > >> >> > > > And you think it's not a bug? where is guarantee 
> >> > > > > > > >> >> > > > that it will work in
> >> > > > > > > >> >> > > > general?
> >> > > > > > > >> >> > > > Where adapter takes it's magic number N?
>
> >> > > > > > > >> >> > > > On 27 апр, 19:56, Romain Guy 
> >> > > > > > > >> >> > > > <romain...@google.com> wrote:
>
> >> > > > > > > >> >> > > > > There is no guarantee it's going to be called N 
> >> > > > > > > >> >> > > > > times either.
>
> >> > > > > > > >> >> > > > > 2009/4/27 Illidane <illid...@gmail.com>:
>
> >> > > > > > > >> >> > > > > > Even with convertView problem is still same - 
> >> > > > > > > >> >> > > > > > last cell is not
> >> > > > > > > >> >> > > > > > animating.
> >> > > > > > > >> >> > > > > > And... you said WHEN getView()... I think it's 
> >> > > > > > > >> >> > > > > > no matter, matter HOW
> >> > > > > > > >> >> > > > > > MANY times getView() called.
> >> > > > > > > >> >> > > > > > It calls more than 100 times, whats very 
> >> > > > > > > >> >> > > > > > strange.
> >> > > > > > > >> >> > > > > > For the first time it's called 102 times and 
> >> > > > > > > >> >> > > > > > all animations was
> >> > > > > > > >> >> > > > > > working. For the second and next times it was 
> >> > > > > > > >> >> > > > > > 101, and last animation
> >> > > > > > > >> >> > > > > > was static.
> >> > > > > > > >> >> > > > > > I think where is some bug regularity...
>
> >> > > > > > > >> >> > > > > > On 27 апр, 19:31, Romain Guy 
> >> > > > > > > >> >> > > > > > <romain...@google.com> wrote:
> >> > > > > > > >> >> > > > > >> You should ALWAYS reuse the convertView, 
> >> > > > > > > >> >> > > > > >> oherwise you're gonna eat up
> >> > > > > > > >> >> > > > > >> memory and just slow down your app. And like 
> >> > > > > > > >> >> > > > > >> I said, there is no...
>
> продолжение >>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to