OSDN Git Service

T28354
authorYuji Konishi <yuji.k64613@gmail.com>
Sat, 12 May 2012 03:51:52 +0000 (12:51 +0900)
committerYuji Konishi <yuji.k64613@gmail.com>
Sat, 12 May 2012 03:51:52 +0000 (12:51 +0900)
source/workspace/EverFolder/src/com/yuji/ef/EverFolderActivity.java
source/workspace/EverFolder/src/com/yuji/ef/IconFrameLayout.java

index 22ade45..549c8d2 100644 (file)
@@ -78,10 +78,10 @@ public class EverFolderActivity extends Activity /*implements OnTouchListener,
 
                        int x;
                        int y;
-                       int N = 160;
+                       int N = 200;
 
                        x = 100;
-                       y = 10;
+                       y = 0;
                        for (int i = 0; i < 4; i++) {
                                Bitmap bmp = (i % 2 == 0) ? bmp1 : bmp2;
                                createIconImageView(bmp, x, y);
index 839fb2f..0225c64 100644 (file)
@@ -144,6 +144,31 @@ public class IconFrameLayout extends FrameLayout implements OnLongClickListener
                                }
                                obj = target;
                                
+                               int sh = scrollView.getHeight();
+                               int lh = this.getHeight();
+                               int maxY = lh - sh;
+                               int py = scrollView.getScrollY();
+                               int sdy = 10;
+                               int N = 100;
+                               if (y < N){
+                                       if (py > 0){
+                                               if (py < sdy){
+                                                       sdy = py;
+                                               }
+                                               scrollView.smoothScrollTo(0, py - sdy);
+                                               currentY -= sdy;
+                                       }
+                               }
+                               else if (sh - y < N){
+                                       if (py < maxY){
+                                               if (maxY - py < sdy){
+                                                       sdy = maxY - py;
+                                               }
+                                               scrollView.smoothScrollTo(0, py + sdy);
+                                               currentY += sdy;
+                                       }
+                               }
+
                                int diffX = offsetX - x;
                                int diffY = offsetY - y;