Tecnologia do Blogger.
RSS

Re: [androidbrasil-dev] Paginação Endless

Isso que me fez não usar este projeto:

Limitations

EndlessAdapter does not work well as a child of other decorating adapters, notably theHeaderListViewAdapter that ListView creates if you use header or footer views.



Em 21 de janeiro de 2014 15:23, Diego Ampessan <ampessann@gmail.com> escreveu:


Em 21 de janeiro de 2014 10:55, Gink Labrev <gink.labrev@gmail.com> escreveu:

Há uma variável isLoading (primeiro código que postei) que controla esse status.

Ela assume o valor true em onPreExecute() e false em onPostExecute().


Em 17 de janeiro de 2014 17:05, Erick Couto <erickcouto79@gmail.com> escreveu:

isso pode dar problema.. dependendo de como esteja o código, qualquer mudança de página para frente chamaria novamente a asynctask..


Em 17 de janeiro de 2014 17:01, Gink Labrev <gink.labrev@gmail.com> escreveu:

Ah é faz sentido. Vlw mais uma vez.
O código  está como falou, pegando nos dois ultimos itens  (totalItemCount - 2) e não mais no meio.

boolean startTask = (firstVisibleItem + visibleItemCount) >= (totalItemCount - 2); // considerando cada item uma linha

Agora só testar


Em 17 de janeiro de 2014 15:43, Marcelo Alves <marcelo.alves@gmail.com> escreveu:

acho que tem que ser >= , pq se ele passou da metade, você ativa a task. Se for == só vai fazer isso quando estiver "exatamente" no meio.


2014/1/17 Gink Labrev <gink.labrev@gmail.com>
Show Marcel.
Agora entendi este trecho view.getChildAt(visibleItemCount-1).getBottom() <= view.getHeight();. Valeu.

Gostei da dica tb.
talvez fique melhor assim (sem testar ainda):

boolean startTask = (firstVisibleItem + visibleItemCount) == (totalItemCount - 2); // considerando cada item uma linha


Em 17 de janeiro de 2014 14:13, Marcelo Alves <marcelo.alves@gmail.com> escreveu:
Olhando o código (mas sem testar, longe de um Eclipse agora) eu acho que ele tenta fazer o seguinte :

- firstVisibleItem é o primeiro item visível da lista;
- visibleItemCount é a quantidade de itens que podem ser vistos atualmente;
- totalItemCount é a quantidade total de elementos na lista. 

Ele tenta descobrir se o último da lista (firstVisibleItem + visibleItemCount) está nos visíveis, e se ele está completamente visível (o view.getChildAt(visibleItemCount-1).getBottom() <= view.getHeight()).

Acho que pra você verificar se está no meio da lista, basta fazer algo assim :

boolean pastMiddle = (firstVisibleItem + visibleItemCount) > (totalItemCount / 2);


Mas eu particularmente não acho uma boa ideia iniciar uma AsyncTask só por que o usuário chegou na metade da lista. Pode ser que ele pare com 3/4, ou se a lista tiver 5000 elementos, ele comece a carregar novos com 2500 pra ver ainda, o que é um desperdício de memória, energia e provavelmente banda. Eu tentaria fazer algo como só ativar a tarefa quando faltasse uma ou duas páginas pro final, algo assim.


--
You received this message because you are subscribed to the Google Groups "Android Brasil - Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to androidbrasil-dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google Groups "Android Brasil - Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to androidbrasil-dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.



--
:: marcelo.alves

--
You received this message because you are subscribed to the Google Groups "Android Brasil - Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to androidbrasil-dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google Groups "Android Brasil - Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to androidbrasil-dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.



--
-----------------------------------------------------------------
Erick Couto
Java | Android | PHP

--
You received this message because you are subscribed to the Google Groups "Android Brasil - Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to androidbrasil-dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google Groups "Android Brasil - Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to androidbrasil-dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.



--
Att.
Diego Ampessan
Microsoft MTA

www.diegoampessan.com.br


Os computadores são incrivelmente rápidos, precisos e burros; Os homens são incrivelmente lentos, imprecisos e brilhantes; Juntos, seu poder ultrapassa os limites da imaginação  - "Albert Einstein "

--
You received this message because you are subscribed to the Google Groups "Android Brasil - Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to androidbrasil-dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google Groups "Android Brasil - Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to androidbrasil-dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

  • Digg
  • Del.icio.us
  • StumbleUpon
  • Reddit
  • RSS

0 comentários:

Postar um comentário