summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrzej J.R. Hunt <andrzej@ahunt.org>2012-08-15 18:54:08 +0200
committerAndrzej J.R. Hunt <andrzej@ahunt.org>2012-08-15 18:56:27 +0200
commit5308c3d6a6df36d27969e9a9b66e40bd9d2ecc5a (patch)
tree89f351d4f84ba10b10eaa8e2dddd822822046a0f
parent6c70bd9e2748b375b53eea4454a5b4f922c439ae (diff)
Fixed image updating in Presentation View.
This is done by removing caching in the AbstractCoverFlowImageAdapter. Change-Id: Ib6df57a73545f8a98b4104a6e2917121e9d7afa8
-rw-r--r--android/sdremote/src/org/libreoffice/impressremote/PresentationActivity.java5
-rw-r--r--android/sdremote/src/org/libreoffice/impressremote/PresentationFragment.java11
-rw-r--r--android/sdremote/src/org/libreoffice/impressremote/SettingsActivity.java1
-rw-r--r--android/sdremote/src/org/libreoffice/impressremote/StartPresentationActivity.java2
-rw-r--r--android/sdremote/src/pl/polidea/coverflow/AbstractCoverFlowImageAdapter.java170
5 files changed, 79 insertions, 110 deletions
diff --git a/android/sdremote/src/org/libreoffice/impressremote/PresentationActivity.java b/android/sdremote/src/org/libreoffice/impressremote/PresentationActivity.java
index c96235b1a8f6..13bff685ecb9 100644
--- a/android/sdremote/src/org/libreoffice/impressremote/PresentationActivity.java
+++ b/android/sdremote/src/org/libreoffice/impressremote/PresentationActivity.java
@@ -177,9 +177,6 @@ public class PresentationActivity extends FragmentActivity {
private ToggleButton mTimeLabel;
private ToggleButton mThumbnailButton;
- private View mDropdownOptions;
- private View mDropdownBlank;
-
// ------- CLOCKBAR
private View mClockBar;
private ToggleButton mClockBar_clockButton;
@@ -338,7 +335,6 @@ public class PresentationActivity extends FragmentActivity {
@Override
public void run() {
- //invalidateOptionsMenu();
CharSequence aTimeString;
long aTime = mCommunicationService.getSlideShow().getTimer()
.getTimeMillis();
@@ -349,7 +345,6 @@ public class PresentationActivity extends FragmentActivity {
System.currentTimeMillis());
}
mTimeLabel.setText(aTimeString);
- // TODO: set the string
timerHandler.postDelayed(this, 50);
}
diff --git a/android/sdremote/src/org/libreoffice/impressremote/PresentationFragment.java b/android/sdremote/src/org/libreoffice/impressremote/PresentationFragment.java
index 27d0f7e1e953..21aeb4912b04 100644
--- a/android/sdremote/src/org/libreoffice/impressremote/PresentationFragment.java
+++ b/android/sdremote/src/org/libreoffice/impressremote/PresentationFragment.java
@@ -23,7 +23,6 @@ import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnTouchListener;
import android.view.ViewGroup;
-import android.view.ViewGroup.LayoutParams;
import android.webkit.WebView;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemSelectedListener;
@@ -128,7 +127,6 @@ public class PresentationFragment extends Fragment {
mHandle.setImageResource(R.drawable.handle_default);
break;
case MotionEvent.ACTION_MOVE:
- LayoutParams aParams = mTopView.getLayoutParams();
final int DRAG_MARGIN = 120;
@@ -188,7 +186,6 @@ public class PresentationFragment extends Fragment {
break;
}
- // TODO Auto-generated method stub
return true;
}
}
@@ -237,10 +234,10 @@ public class PresentationFragment extends Fragment {
updateSlideNumberDisplay();
} else if (aIntent.getAction().equals(
CommunicationService.MSG_SLIDE_PREVIEW)) {
- int aNSlide = aIntent.getExtras().getInt("slide_number");
- if (mTopView.getSelectedItemPosition() == aNSlide) {
- mTopView.setSelection(aNSlide);
- }
+ // int aNSlide = aIntent.getExtras().getInt("slide_number");
+ ((ThumbnailAdapter) mTopView.getAdapter())
+ .notifyDataSetChanged();
+ // mTopView.requestLayout();
} else if (aIntent.getAction().equals(
CommunicationService.MSG_SLIDE_NOTES)) {
// TODO: update me
diff --git a/android/sdremote/src/org/libreoffice/impressremote/SettingsActivity.java b/android/sdremote/src/org/libreoffice/impressremote/SettingsActivity.java
index 16c456e63d00..b11f789d020e 100644
--- a/android/sdremote/src/org/libreoffice/impressremote/SettingsActivity.java
+++ b/android/sdremote/src/org/libreoffice/impressremote/SettingsActivity.java
@@ -7,6 +7,7 @@ import com.actionbarsherlock.app.SherlockPreferenceActivity;
public class SettingsActivity extends SherlockPreferenceActivity {
// We use addPreferencesFromResource as we need sdk-9 compatibility
+ // but build with sdk 15
@SuppressWarnings("deprecation")
@Override
protected void onCreate(Bundle savedInstanceState) {
diff --git a/android/sdremote/src/org/libreoffice/impressremote/StartPresentationActivity.java b/android/sdremote/src/org/libreoffice/impressremote/StartPresentationActivity.java
index 6868d933db55..77e1d5775022 100644
--- a/android/sdremote/src/org/libreoffice/impressremote/StartPresentationActivity.java
+++ b/android/sdremote/src/org/libreoffice/impressremote/StartPresentationActivity.java
@@ -47,7 +47,6 @@ public class StartPresentationActivity extends Activity {
@Override
public void onServiceConnected(ComponentName aClassName,
IBinder aService) {
-
mCommunicationService = ((CommunicationService.CBinder) aService)
.getService();
@@ -62,6 +61,7 @@ public class StartPresentationActivity extends Activity {
@Override
public void onServiceDisconnected(ComponentName aClassName) {
mCommunicationService = null;
+ mIsBound = false;
}
};
diff --git a/android/sdremote/src/pl/polidea/coverflow/AbstractCoverFlowImageAdapter.java b/android/sdremote/src/pl/polidea/coverflow/AbstractCoverFlowImageAdapter.java
index f60975fa156a..514176e769bd 100644
--- a/android/sdremote/src/pl/polidea/coverflow/AbstractCoverFlowImageAdapter.java
+++ b/android/sdremote/src/pl/polidea/coverflow/AbstractCoverFlowImageAdapter.java
@@ -1,9 +1,5 @@
package pl.polidea.coverflow;
-import java.lang.ref.WeakReference;
-import java.util.HashMap;
-import java.util.Map;
-
import android.content.Context;
import android.graphics.Bitmap;
import android.util.Log;
@@ -19,107 +15,87 @@ import android.widget.ImageView;
*/
public abstract class AbstractCoverFlowImageAdapter extends BaseAdapter {
- /** The Constant TAG. */
- private static final String TAG = AbstractCoverFlowImageAdapter.class
- .getSimpleName();
-
- /** The width. */
- private float width = 0;
+ /** The Constant TAG. */
+ private static final String TAG = AbstractCoverFlowImageAdapter.class
+ .getSimpleName();
- /** The height. */
- private float height = 0;
+ /** The width. */
+ private float width = 0;
- /** The bitmap map. */
- private final Map<Integer, WeakReference<Bitmap>> bitmapMap = new HashMap<Integer, WeakReference<Bitmap>>();
+ /** The height. */
+ private float height = 0;
- public AbstractCoverFlowImageAdapter() {
- super();
- }
+ public AbstractCoverFlowImageAdapter() {
+ super();
+ }
- /**
- * Set width for all pictures.
- *
- * @param width
- * picture height
- */
- public synchronized void setWidth(final float width) {
- this.width = width;
- }
+ /**
+ * Set width for all pictures.
+ *
+ * @param width
+ * picture height
+ */
+ public synchronized void setWidth(final float width) {
+ this.width = width;
+ }
- /**
- * Set height for all pictures.
- *
- * @param height
- * picture height
- */
- public synchronized void setHeight(final float height) {
- this.height = height;
- }
+ /**
+ * Set height for all pictures.
+ *
+ * @param height
+ * picture height
+ */
+ public synchronized void setHeight(final float height) {
+ this.height = height;
+ }
- @Override
- public final Bitmap getItem(final int position) {
- final WeakReference<Bitmap> weakBitmapReference = bitmapMap
- .get(position);
- if (weakBitmapReference != null) {
- final Bitmap bitmap = weakBitmapReference.get();
- if (bitmap == null) {
- Log.v(TAG, "Empty bitmap reference at position: " + position
- + ":" + this);
- } else {
- Log.v(TAG, "Reusing bitmap item at position: " + position + ":"
- + this);
- return bitmap;
- }
- }
- Log.v(TAG, "Creating item at position: " + position + ":" + this);
- final Bitmap bitmap = createBitmap(position);
- bitmapMap.put(position, new WeakReference<Bitmap>(bitmap));
- Log.v(TAG, "Created item at position: " + position + ":" + this);
- return bitmap;
- }
+ @Override
+ public final Bitmap getItem(final int position) {
+ return createBitmap(position);
+ }
- /**
- * Creates new bitmap for the position specified.
- *
- * @param position
- * position
- * @return Bitmap created
- */
- protected abstract Bitmap createBitmap(int position);
+ /**
+ * Creates new bitmap for the position specified.
+ *
+ * @param position
+ * position
+ * @return Bitmap created
+ */
+ protected abstract Bitmap createBitmap(int position);
- /*
- * (non-Javadoc)
- *
- * @see android.widget.Adapter#getItemId(int)
- */
- @Override
- public final synchronized long getItemId(final int position) {
- return position;
- }
+ /*
+ * (non-Javadoc)
+ *
+ * @see android.widget.Adapter#getItemId(int)
+ */
+ @Override
+ public final synchronized long getItemId(final int position) {
+ return position;
+ }
- /*
- * (non-Javadoc)
- *
- * @see android.widget.Adapter#getView(int, android.view.View,
- * android.view.ViewGroup)
- */
- @Override
- public final synchronized ImageView getView(final int position,
- final View convertView, final ViewGroup parent) {
- ImageView imageView;
- if (convertView == null) {
- final Context context = parent.getContext();
- Log.v(TAG, "Creating Image view at position: " + position + ":"
- + this);
- imageView = new ImageView(context);
- imageView.setLayoutParams(new CoverFlow.LayoutParams((int) width,
- (int) height));
- } else {
- Log.v(TAG, "Reusing view at position: " + position + ":" + this);
- imageView = (ImageView) convertView;
- }
- imageView.setImageBitmap(getItem(position));
- return imageView;
- }
+ /*
+ * (non-Javadoc)
+ *
+ * @see android.widget.Adapter#getView(int, android.view.View,
+ * android.view.ViewGroup)
+ */
+ @Override
+ public final synchronized ImageView getView(final int position,
+ final View convertView, final ViewGroup parent) {
+ ImageView imageView;
+ if (convertView == null) {
+ final Context context = parent.getContext();
+ Log.v(TAG, "Creating Image view at position: " + position + ":"
+ + this);
+ imageView = new ImageView(context);
+ imageView.setLayoutParams(new CoverFlow.LayoutParams((int) width,
+ (int) height));
+ } else {
+ Log.v(TAG, "Reusing view at position: " + position + ":" + this);
+ imageView = (ImageView) convertView;
+ }
+ imageView.setImageBitmap(getItem(position));
+ return imageView;
+ }
}