OSDN Git Service

Set proper height of the widget tray container for preloading.
authorHyunyoung Song <hyunyoungs@google.com>
Wed, 13 May 2015 19:00:23 +0000 (12:00 -0700)
committerHyunyoung Song <hyunyoungs@google.com>
Wed, 13 May 2015 19:00:23 +0000 (12:00 -0700)
- previous height value was 0 before, now set it to proper height.
However, getExtraLayoutSpace still worked because the super method set
extra space (1 screen worth) only when ScrollState is non idle.

Change-Id: Ifbaa6a105fe392735e106996d1f08276e678ebcb

src/com/android/launcher3/widget/WidgetsContainerView.java

index f8d7d92..00fb225 100644 (file)
@@ -33,6 +33,7 @@ import android.widget.Toast;
 import com.android.launcher3.BaseContainerView;
 import com.android.launcher3.CellLayout;
 import com.android.launcher3.DeleteDropTarget;
+import com.android.launcher3.DeviceProfile;
 import com.android.launcher3.DragController;
 import com.android.launcher3.DragSource;
 import com.android.launcher3.DropTarget.DragObject;
@@ -122,8 +123,9 @@ public class WidgetsContainerView extends BaseContainerView
         mView.setLayoutManager(new LinearLayoutManager(getContext()) {
             @Override
             protected int getExtraLayoutSpace(State state) {
+                DeviceProfile grid = LauncherAppState.getInstance().getDynamicGrid().getDeviceProfile();
                 return super.getExtraLayoutSpace(state)
-                        + WidgetsContainerView.this.getHeight() * PRELOAD_SCREEN_HEIGHT_MULTIPLE;
+                        + grid.availableHeightPx * PRELOAD_SCREEN_HEIGHT_MULTIPLE;
             }
         });
         mPadding.set(getPaddingLeft(), getPaddingTop(), getPaddingRight(),