summaryrefslogtreecommitdiffstats
path: root/carousel
diff options
context:
space:
mode:
authorBryan Mawhinney <bryanmawhinney@google.com>2010-11-23 08:27:02 +0000
committerBryan Mawhinney <bryanmawhinney@google.com>2010-11-23 08:27:02 +0000
commit5b54f405b4a1afcf57b5ccee2026a00a1004be20 (patch)
tree11b4a0ee21c7a031b567057d1918ec3ed97faab3 /carousel
parent51dd0196e4f3bd4086545f5bf30038ca9ad9ac27 (diff)
downloadandroid_frameworks_ex-5b54f405b4a1afcf57b5ccee2026a00a1004be20.tar.gz
android_frameworks_ex-5b54f405b4a1afcf57b5ccee2026a00a1004be20.tar.bz2
android_frameworks_ex-5b54f405b4a1afcf57b5ccee2026a00a1004be20.zip
Ensure that card 0 is properly initialized.
Previously, when calling setCardCount(0) followed by setCardCount(n), only cards 1-n would be initialized. This prevented the first card from being drawn correctly. Change-Id: I5697553a6dba12825f546468747220ce67e904ef
Diffstat (limited to 'carousel')
-rw-r--r--carousel/java/com/android/ex/carousel/carousel.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/carousel/java/com/android/ex/carousel/carousel.rs b/carousel/java/com/android/ex/carousel/carousel.rs
index c2a74b2..939cb85 100644
--- a/carousel/java/com/android/ex/carousel/carousel.rs
+++ b/carousel/java/com/android/ex/carousel/carousel.rs
@@ -312,6 +312,12 @@ static void initCard(Card_t* card)
void createCards(int start, int total)
{
+ if (!cardAllocationValid) {
+ // If the allocation is invalid, it contains a single place-holder
+ // card that has not yet been initialized (see CarouselRS.createCards).
+ // Here we ensure that it is initialized when growing the total.
+ start = 0;
+ }
for (int k = start; k < total; k++) {
initCard(cards + k);
}