Skip to content
Browse files

oops, wrong initialization order

  • Loading branch information...
1 parent 662de99 commit d9aaa82cbfc1300cf9aefda7b0feaa94507fda24 @ghk committed Jul 5, 2011
Showing with 29 additions and 28 deletions.
  1. +29 −28 src/com/kaulahcintaku/comicshelf/SeriesActivity.java
View
57 src/com/kaulahcintaku/comicshelf/SeriesActivity.java
@@ -26,34 +26,7 @@
private Item selectedItem;
private CoverFlow coverFlow;
- private ScaleGestureDetector scaleDetector = new ScaleGestureDetector(this,
-
- new ScaleGestureDetector.OnScaleGestureListener() {
-
- float minZoom = -400;
- float maxZoom = -200;
-
- @Override
- public void onScaleEnd(ScaleGestureDetector detector) {
- }
-
- @Override
- public boolean onScaleBegin(ScaleGestureDetector detector) {
- return true;
- }
-
- @Override
- public boolean onScale(ScaleGestureDetector detector) {
- float newZoom = coverFlow.getZoom()*detector.getScaleFactor();
- if(newZoom > maxZoom)
- newZoom = maxZoom;
- if(newZoom < minZoom)
- newZoom = minZoom;
- coverFlow.setZoom(newZoom);
- coverFlow.setSelection(coverFlow.getSelectedItemPosition());
- return true;
- }
- });
+ private ScaleGestureDetector scaleDetector;
/** Called when the activity is first created. */
@Override
@@ -116,6 +89,34 @@ public void onItemClick(AdapterView<?> arg0, View arg1, int position,
openSelectedItem();
}
});
+
+ scaleDetector = new ScaleGestureDetector(this,
+ new ScaleGestureDetector.OnScaleGestureListener() {
+
+ float minZoom = -400;
+ float maxZoom = -200;
+
+ @Override
+ public void onScaleEnd(ScaleGestureDetector detector) {
+ }
+
+ @Override
+ public boolean onScaleBegin(ScaleGestureDetector detector) {
+ return true;
+ }
+
+ @Override
+ public boolean onScale(ScaleGestureDetector detector) {
+ float newZoom = coverFlow.getZoom()*detector.getScaleFactor();
+ if(newZoom > maxZoom)
+ newZoom = maxZoom;
+ if(newZoom < minZoom)
+ newZoom = minZoom;
+ coverFlow.setZoom(newZoom);
+ coverFlow.setSelection(coverFlow.getSelectedItemPosition());
+ return true;
+ }
+ });
}
private boolean openSelectedItem(){

0 comments on commit d9aaa82

Please sign in to comment.
Something went wrong with that request. Please try again.