summaryrefslogtreecommitdiff
path: root/android
diff options
context:
space:
mode:
authorAndrzej J.R. Hunt <andrzej@ahunt.org>2012-09-14 16:25:04 +0200
committerAndrzej J.R. Hunt <andrzej@ahunt.org>2012-09-14 16:27:00 +0200
commit76c5f6fdaf3f1d046a7c46e8fe92ebea55ebdd64 (patch)
tree6234ef3c2c00c95930b6fc70134d806e5a8cfd0e /android
parent61c94cbe2cbbbcaa1e44edecc4add60eb6d7937d (diff)
More 2.3 styling + fix for flickering bug on multi-slide change.
Change-Id: Iae19e9d44f1a437737c943c06356a99957c6991e
Diffstat (limited to 'android')
-rw-r--r--android/sdremote/res/layout/dialog_about.xml18
-rw-r--r--android/sdremote/res/values/strings.xml5
-rw-r--r--android/sdremote/res/values/styles.xml19
-rw-r--r--android/sdremote/src/org/libreoffice/impressremote/AboutDialogBuilder.java2
-rw-r--r--android/sdremote/src/org/libreoffice/impressremote/PresentationFragment.java24
-rw-r--r--android/sdremote/src/pl/polidea/coverflow/AbstractCoverFlowImageAdapter.java19
-rw-r--r--android/sdremote/src/pl/polidea/coverflow/ReflectingImageAdapter.java215
-rw-r--r--android/sdremote/src/pl/polidea/coverflow/ResourceImageAdapter.java139
8 files changed, 271 insertions, 170 deletions
diff --git a/android/sdremote/res/layout/dialog_about.xml b/android/sdremote/res/layout/dialog_about.xml
index 8ff6dd4ebb7e..ce30a255d058 100644
--- a/android/sdremote/res/layout/dialog_about.xml
+++ b/android/sdremote/res/layout/dialog_about.xml
@@ -51,4 +51,22 @@
android:text="www.libreoffice.org"
tools:ignore="HardcodedText" />
+ <TextView
+ android:id="@+id/about_licence"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center_horizontal"
+ android:layout_margin="10dip"
+ android:gravity="center_horizontal"
+ android:text="@string/about_licence" />
+
+ <TextView
+ android:id="@+id/about_libraries"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center_horizontal"
+ android:layout_margin="10dip"
+
+ android:text="@string/about_libraries" />
+
</LinearLayout> \ No newline at end of file
diff --git a/android/sdremote/res/values/strings.xml b/android/sdremote/res/values/strings.xml
index 811dac4185e0..8e2f62938844 100644
--- a/android/sdremote/res/values/strings.xml
+++ b/android/sdremote/res/values/strings.xml
@@ -33,6 +33,8 @@
<string name="about_close">Close</string>
<string name="about_versionstring">Version: {0} (Build ID: {1})</string>
<string name="about_copyright">Copyright \u00A9 2012 LibreOffice Contributors and/or their affiliates.</string>
+ <string name="about_licence">This app is release under the Mozilla Public License, v. 2.0.</string>
+ <string name="about_libraries">This app uses android-coverflow\n\tCopyright © 2011, Polidea\n\tAll rights reserved.\n\nThis app uses ActionBarSherlock:\n\tCopyright 2012 Jake Wharton\n\tLicensed under the Apache License, Version 2.0 (the "License")</string>
<string name="addserver">Add Server</string>
<string name="addserver_entername">Server name:</string>
<string name="addserver_enteraddress">Server address as IP or hostname:</string>
@@ -40,5 +42,6 @@
<string name="addserver_add">Add</string>
<string name="addserver_cancel">Cancel</string>
<string name="reconnect_description1">Your connection has been dropped.</string>
-<string name="reconnect_description2">Attempting to reconnect…</string>
+ <string name="reconnect_description2">Attempting to reconnect…</string>
+
</resources> \ No newline at end of file
diff --git a/android/sdremote/res/values/styles.xml b/android/sdremote/res/values/styles.xml
index 73d2209746b2..eb71393becd3 100644
--- a/android/sdremote/res/values/styles.xml
+++ b/android/sdremote/res/values/styles.xml
@@ -25,7 +25,7 @@
<item name="android:titleTextStyle">@style/Theme.ImpressRemote.ActionBar.Title</item>
<item name="titleTextStyle">@style/Theme.ImpressRemote.ActionBar.Title</item>
<item name="backgroundSplit">@color/text_grey</item>
- <item name="android:backgroundSplit">@color/text_grey</item>
+ <item name="android:backgroundSplit">@color/text_grey</item>
</style>
<style name="Theme.ImpressRemote.ActionBarWidget" parent="android:style/Widget.Holo.Light">
@@ -41,11 +41,24 @@
<style name="Theme.ImpressRemote.ActionBarMenuItem" parent="Widget.Sherlock.Light.Spinner.DropDown.ActionBar">
<item name="android:background">@color/grey</item>
-
<item name="android:textColor">@color/white</item>
<item name="android:textSize">16dp</item>
</style>
+ <style name="Theme.ImpressRemote.Dialog" parent="@android:style/Theme.Dialog">
+ <item name="android:windowBackground">@color/light_grey</item>
+ <item name="android:fullDark">@color/light_grey</item>
+ <item name="android:topDark">@color/light_grey</item>
+ <item name="android:centerDark">@color/light_grey</item>
+ <item name="android:bottomDark">@color/light_grey</item>
+ <item name="android:fullBright">@color/light_grey</item>
+ <item name="android:centerBright">@color/light_grey</item>
+ <item name="android:bottomBright">@color/light_grey</item>
+ <item name="android:bottomMedium">@color/light_grey</item>
+ <item name="android:centerMedium">@color/light_grey</item>
+ <item name="android:textColor">@color/grey</item>
+ </style>
+
<style name="Theme.ImpressRemote" parent="Theme.Sherlock.Light.DarkActionBar">
<item name="android:actionBarStyle">@style/Theme.ImpressRemote.ActionBar</item>
<item name="actionBarStyle">@style/Theme.ImpressRemote.ActionBar</item>
@@ -56,7 +69,7 @@
<item name="android:windowBackground">@color/light_grey</item>
<item name="android:homeAsUpIndicator">@drawable/up_indicator_white</item>
<item name="android:textColor">@color/text_grey</item>
-
+ <item name="android:alertDialogStyle">@style/Theme.ImpressRemote.Dialog</item>
</style>
</resources> \ No newline at end of file
diff --git a/android/sdremote/src/org/libreoffice/impressremote/AboutDialogBuilder.java b/android/sdremote/src/org/libreoffice/impressremote/AboutDialogBuilder.java
index e05ef48bcb18..7b6a31bcd7e6 100644
--- a/android/sdremote/src/org/libreoffice/impressremote/AboutDialogBuilder.java
+++ b/android/sdremote/src/org/libreoffice/impressremote/AboutDialogBuilder.java
@@ -39,7 +39,7 @@ public class AboutDialogBuilder extends AlertDialog.Builder {
PackageInfo aInfo = aContext.getPackageManager().getPackageInfo(
aContext.getPackageName(), 0);
String aVersionString = MessageFormat.format(
- getContext().getResources().getString(
+ aContext.getResources().getString(
R.string.about_versionstring),
aInfo.versionName, aInfo.versionCode);
mVersionLabel.setText(aVersionString);
diff --git a/android/sdremote/src/org/libreoffice/impressremote/PresentationFragment.java b/android/sdremote/src/org/libreoffice/impressremote/PresentationFragment.java
index 2304e4332568..fe510db4f8f7 100644
--- a/android/sdremote/src/org/libreoffice/impressremote/PresentationFragment.java
+++ b/android/sdremote/src/org/libreoffice/impressremote/PresentationFragment.java
@@ -49,6 +49,8 @@ public class PresentationFragment extends SherlockFragment {
private float mNewCoverflowWidth = 0;
private float mNewCoverflowHeight = 0;
+ private long lastUpdateTime = 0;
+
private ServiceConnection mConnection = new ServiceConnection() {
@Override
public void onServiceConnected(ComponentName aClassName,
@@ -64,7 +66,8 @@ public class PresentationFragment extends SherlockFragment {
mTopView.setOnItemSelectedListener(new ClickListener());
}
- updateSlideNumberDisplay();
+ updateSlideNumberDisplay(mCommunicationService.getSlideShow()
+ .getCurrentSlide());
}
@@ -138,12 +141,12 @@ public class PresentationFragment extends SherlockFragment {
}
- private void updateSlideNumberDisplay() {
- int aSlide = mCommunicationService.getSlideShow().getCurrentSlide();
- mNumberText.setText((aSlide + 1) + "/"
+ private void updateSlideNumberDisplay(int aPosition) {
+ // int aSlide = mCommunicationService.getSlideShow().getCurrentSlide();
+ mNumberText.setText((aPosition + 1) + "/"
+ mCommunicationService.getSlideShow().getSize());
- mNotes.loadData(mCommunicationService.getSlideShow().getNotes(aSlide),
- "text/html", null);
+ mNotes.loadData(mCommunicationService.getSlideShow()
+ .getNotes(aPosition), "text/html", null);
}
// -------------------------------------------------- RESIZING LISTENER ----
@@ -232,6 +235,8 @@ public class PresentationFragment extends SherlockFragment {
int aPosition, long arg3) {
if (mCommunicationService != null)
mCommunicationService.getTransmitter().gotoSlide(aPosition);
+ lastUpdateTime = System.currentTimeMillis();
+ updateSlideNumberDisplay(aPosition);
}
@Override
@@ -247,8 +252,13 @@ public class PresentationFragment extends SherlockFragment {
if (aIntent.getAction().equals(
CommunicationService.MSG_SLIDE_CHANGED)) {
int aSlide = aIntent.getExtras().getInt("slide_number");
+
+ if (aSlide == mTopView.getSelectedItemPosition())
+ return;
+ if ((System.currentTimeMillis() - lastUpdateTime) < 5000) {
+ return;
+ }
mTopView.setSelection(aSlide, true);
- updateSlideNumberDisplay();
} else if (aIntent.getAction().equals(
CommunicationService.MSG_SLIDE_PREVIEW)) {
// int aNSlide = aIntent.getExtras().getInt("slide_number");
diff --git a/android/sdremote/src/pl/polidea/coverflow/AbstractCoverFlowImageAdapter.java b/android/sdremote/src/pl/polidea/coverflow/AbstractCoverFlowImageAdapter.java
index 514176e769bd..bf6ed09a6f33 100644
--- a/android/sdremote/src/pl/polidea/coverflow/AbstractCoverFlowImageAdapter.java
+++ b/android/sdremote/src/pl/polidea/coverflow/AbstractCoverFlowImageAdapter.java
@@ -1,3 +1,22 @@
+/*
+ * Copyright (c) 2011, Polidea
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the distribution.
+ * Neither the name of the Polidea nor the names of its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
+ * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+ * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
package pl.polidea.coverflow;
import android.content.Context;
diff --git a/android/sdremote/src/pl/polidea/coverflow/ReflectingImageAdapter.java b/android/sdremote/src/pl/polidea/coverflow/ReflectingImageAdapter.java
index ff044753039f..f16c11259da4 100644
--- a/android/sdremote/src/pl/polidea/coverflow/ReflectingImageAdapter.java
+++ b/android/sdremote/src/pl/polidea/coverflow/ReflectingImageAdapter.java
@@ -1,3 +1,22 @@
+/*
+ * Copyright (c) 2011, Polidea
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the distribution.
+ * Neither the name of the Polidea nor the names of its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
+ * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+ * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
package pl.polidea.coverflow;
import android.R.color;
@@ -19,111 +38,111 @@ import android.graphics.Shader.TileMode;
*/
public class ReflectingImageAdapter extends AbstractCoverFlowImageAdapter {
- /** The linked adapter. */
- private final AbstractCoverFlowImageAdapter linkedAdapter;
- /**
- * Gap between the image and its reflection.
- */
- private float reflectionGap;
+ /** The linked adapter. */
+ private final AbstractCoverFlowImageAdapter linkedAdapter;
+ /**
+ * Gap between the image and its reflection.
+ */
+ private float reflectionGap;
- /** The image reflection ratio. */
- private float imageReflectionRatio;
+ /** The image reflection ratio. */
+ private float imageReflectionRatio;
- /**
- * Sets the width ratio.
- *
- * @param imageReflectionRatio
- * the new width ratio
- */
- public void setWidthRatio(final float imageReflectionRatio) {
- this.imageReflectionRatio = imageReflectionRatio;
- }
+ /**
+ * Sets the width ratio.
+ *
+ * @param imageReflectionRatio
+ * the new width ratio
+ */
+ public void setWidthRatio(final float imageReflectionRatio) {
+ this.imageReflectionRatio = imageReflectionRatio;
+ }
- /**
- * Creates reflecting adapter.
- *
- * @param linkedAdapter
- * adapter that provides images to get reflections
- */
- public ReflectingImageAdapter(
- final AbstractCoverFlowImageAdapter linkedAdapter) {
- super();
- this.linkedAdapter = linkedAdapter;
- }
+ /**
+ * Creates reflecting adapter.
+ *
+ * @param linkedAdapter
+ * adapter that provides images to get reflections
+ */
+ public ReflectingImageAdapter(
+ final AbstractCoverFlowImageAdapter linkedAdapter) {
+ super();
+ this.linkedAdapter = linkedAdapter;
+ }
- /**
- * Sets the reflection gap.
- *
- * @param reflectionGap
- * the new reflection gap
- */
- public void setReflectionGap(final float reflectionGap) {
- this.reflectionGap = reflectionGap;
- }
+ /**
+ * Sets the reflection gap.
+ *
+ * @param reflectionGap
+ * the new reflection gap
+ */
+ public void setReflectionGap(final float reflectionGap) {
+ this.reflectionGap = reflectionGap;
+ }
- /**
- * Gets the reflection gap.
- *
- * @return the reflection gap
- */
- public float getReflectionGap() {
- return reflectionGap;
- }
+ /**
+ * Gets the reflection gap.
+ *
+ * @return the reflection gap
+ */
+ public float getReflectionGap() {
+ return reflectionGap;
+ }
- /*
- * (non-Javadoc)
- *
- * @see pl.polidea.coverflow.AbstractCoverFlowImageAdapter#createBitmap(int)
- */
- @Override
- protected Bitmap createBitmap(final int position) {
- return createReflectedImages(linkedAdapter.getItem(position));
- }
+ /*
+ * (non-Javadoc)
+ *
+ * @see pl.polidea.coverflow.AbstractCoverFlowImageAdapter#createBitmap(int)
+ */
+ @Override
+ protected Bitmap createBitmap(final int position) {
+ return createReflectedImages(linkedAdapter.getItem(position));
+ }
- /**
- * Creates the reflected images.
- *
- * @param originalImage
- * the original image
- * @return true, if successful
- */
- public Bitmap createReflectedImages(final Bitmap originalImage) {
- final int width = originalImage.getWidth();
- final int height = originalImage.getHeight();
- final Matrix matrix = new Matrix();
- matrix.preScale(1, -1);
- final Bitmap reflectionImage = Bitmap.createBitmap(originalImage, 0,
- (int) (height * imageReflectionRatio), width,
- (int) (height - height * imageReflectionRatio), matrix,
- false);
- final Bitmap bitmapWithReflection = Bitmap.createBitmap(width,
- (int) (height + height * imageReflectionRatio),
- Config.ARGB_8888);
- final Canvas canvas = new Canvas(bitmapWithReflection);
- canvas.drawBitmap(originalImage, 0, 0, null);
- final Paint deafaultPaint = new Paint();
- deafaultPaint.setColor(color.transparent);
- canvas.drawBitmap(reflectionImage, 0, height + reflectionGap, null);
- final Paint paint = new Paint();
- final LinearGradient shader = new LinearGradient(0,
- originalImage.getHeight(), 0,
- bitmapWithReflection.getHeight() + reflectionGap,
- 0x70ffffff, 0x00ffffff, TileMode.CLAMP);
- paint.setShader(shader);
- paint.setXfermode(new PorterDuffXfermode(Mode.DST_IN));
- canvas.drawRect(0, height, width, bitmapWithReflection.getHeight()
- + reflectionGap, paint);
- return bitmapWithReflection;
- }
+ /**
+ * Creates the reflected images.
+ *
+ * @param originalImage
+ * the original image
+ * @return true, if successful
+ */
+ public Bitmap createReflectedImages(final Bitmap originalImage) {
+ final int width = originalImage.getWidth();
+ final int height = originalImage.getHeight();
+ final Matrix matrix = new Matrix();
+ matrix.preScale(1, -1);
+ final Bitmap reflectionImage = Bitmap.createBitmap(originalImage, 0,
+ (int) (height * imageReflectionRatio), width,
+ (int) (height - height * imageReflectionRatio), matrix,
+ false);
+ final Bitmap bitmapWithReflection = Bitmap.createBitmap(width,
+ (int) (height + height * imageReflectionRatio),
+ Config.ARGB_8888);
+ final Canvas canvas = new Canvas(bitmapWithReflection);
+ canvas.drawBitmap(originalImage, 0, 0, null);
+ final Paint deafaultPaint = new Paint();
+ deafaultPaint.setColor(color.transparent);
+ canvas.drawBitmap(reflectionImage, 0, height + reflectionGap, null);
+ final Paint paint = new Paint();
+ final LinearGradient shader = new LinearGradient(0,
+ originalImage.getHeight(), 0,
+ bitmapWithReflection.getHeight() + reflectionGap,
+ 0x70ffffff, 0x00ffffff, TileMode.CLAMP);
+ paint.setShader(shader);
+ paint.setXfermode(new PorterDuffXfermode(Mode.DST_IN));
+ canvas.drawRect(0, height, width, bitmapWithReflection.getHeight()
+ + reflectionGap, paint);
+ return bitmapWithReflection;
+ }
- /*
- * (non-Javadoc)
- *
- * @see android.widget.Adapter#getCount()
- */
- @Override
- public int getCount() {
- return linkedAdapter.getCount();
- }
+ /*
+ * (non-Javadoc)
+ *
+ * @see android.widget.Adapter#getCount()
+ */
+ @Override
+ public int getCount() {
+ return linkedAdapter.getCount();
+ }
}
diff --git a/android/sdremote/src/pl/polidea/coverflow/ResourceImageAdapter.java b/android/sdremote/src/pl/polidea/coverflow/ResourceImageAdapter.java
index 469d0d165b0b..494a04d1987c 100644
--- a/android/sdremote/src/pl/polidea/coverflow/ResourceImageAdapter.java
+++ b/android/sdremote/src/pl/polidea/coverflow/ResourceImageAdapter.java
@@ -1,3 +1,22 @@
+/*
+ * Copyright (c) 2011, Polidea
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the distribution.
+ * Neither the name of the Polidea nor the names of its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
+ * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+ * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
package pl.polidea.coverflow;
import java.lang.ref.WeakReference;
@@ -19,72 +38,72 @@ import android.util.Log;
*/
public class ResourceImageAdapter extends AbstractCoverFlowImageAdapter {
- /** The Constant TAG. */
- private static final String TAG = ResourceImageAdapter.class
- .getSimpleName();
+ /** The Constant TAG. */
+ private static final String TAG = ResourceImageAdapter.class
+ .getSimpleName();
- /** The Constant DEFAULT_LIST_SIZE. */
- private static final int DEFAULT_LIST_SIZE = 20;
+ /** The Constant DEFAULT_LIST_SIZE. */
+ private static final int DEFAULT_LIST_SIZE = 20;
- /** The Constant IMAGE_RESOURCE_IDS. */
- private static final List<Integer> IMAGE_RESOURCE_IDS = new ArrayList<Integer>(
- DEFAULT_LIST_SIZE);
+ /** The Constant IMAGE_RESOURCE_IDS. */
+ private static final List<Integer> IMAGE_RESOURCE_IDS = new ArrayList<Integer>(
+ DEFAULT_LIST_SIZE);
- /** The Constant DEFAULT_RESOURCE_LIST. */
- private static final int[] DEFAULT_RESOURCE_LIST = {};
- /** The bitmap map. */
- private final Map<Integer, WeakReference<Bitmap>> bitmapMap = new HashMap<Integer, WeakReference<Bitmap>>();
+ /** The Constant DEFAULT_RESOURCE_LIST. */
+ private static final int[] DEFAULT_RESOURCE_LIST = {};
+ /** The bitmap map. */
+ private final Map<Integer, WeakReference<Bitmap>> bitmapMap = new HashMap<Integer, WeakReference<Bitmap>>();
- private final Context context;
+ private final Context context;
- /**
- * Creates the adapter with default set of resource images.
- *
- * @param context
- * context
- */
- public ResourceImageAdapter(final Context context) {
- super();
- this.context = context;
- setResources(DEFAULT_RESOURCE_LIST);
- }
+ /**
+ * Creates the adapter with default set of resource images.
+ *
+ * @param context
+ * context
+ */
+ public ResourceImageAdapter(final Context context) {
+ super();
+ this.context = context;
+ setResources(DEFAULT_RESOURCE_LIST);
+ }
- /**
- * Replaces resources with those specified.
- *
- * @param resourceIds
- * array of ids of resources.
- */
- public final synchronized void setResources(final int[] resourceIds) {
- IMAGE_RESOURCE_IDS.clear();
- for (final int resourceId : resourceIds) {
- IMAGE_RESOURCE_IDS.add(resourceId);
- }
- notifyDataSetChanged();
- }
+ /**
+ * Replaces resources with those specified.
+ *
+ * @param resourceIds
+ * array of ids of resources.
+ */
+ public final synchronized void setResources(final int[] resourceIds) {
+ IMAGE_RESOURCE_IDS.clear();
+ for (final int resourceId : resourceIds) {
+ IMAGE_RESOURCE_IDS.add(resourceId);
+ }
+ notifyDataSetChanged();
+ }
- /*
- * (non-Javadoc)
- *
- * @see android.widget.Adapter#getCount()
- */
- @Override
- public synchronized int getCount() {
- return IMAGE_RESOURCE_IDS.size();
- }
+ /*
+ * (non-Javadoc)
+ *
+ * @see android.widget.Adapter#getCount()
+ */
+ @Override
+ public synchronized int getCount() {
+ return IMAGE_RESOURCE_IDS.size();
+ }
- /*
- * (non-Javadoc)
- *
- * @see pl.polidea.coverflow.AbstractCoverFlowImageAdapter#createBitmap(int)
- */
- @Override
- protected Bitmap createBitmap(final int position) {
- Log.v(TAG, "creating item " + position);
- final Bitmap bitmap = ((BitmapDrawable) context.getResources()
- .getDrawable(IMAGE_RESOURCE_IDS.get(position)))
- .getBitmap();
- bitmapMap.put(position, new WeakReference<Bitmap>(bitmap));
- return bitmap;
- }
+ /*
+ * (non-Javadoc)
+ *
+ * @see pl.polidea.coverflow.AbstractCoverFlowImageAdapter#createBitmap(int)
+ */
+ @Override
+ protected Bitmap createBitmap(final int position) {
+ Log.v(TAG, "creating item " + position);
+ final Bitmap bitmap = ((BitmapDrawable) context.getResources()
+ .getDrawable(IMAGE_RESOURCE_IDS.get(position)))
+ .getBitmap();
+ bitmapMap.put(position, new WeakReference<Bitmap>(bitmap));
+ return bitmap;
+ }
} \ No newline at end of file