Merge "Fixing folders to always show in view, removing old assets and references to LauncherModel count." into jb-ub-gel-agar
Before Width: | Height: | Size: 131 B |
Before Width: | Height: | Size: 162 B |
Before Width: | Height: | Size: 211 B |
Before Width: | Height: | Size: 255 B After Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 133 B |
Before Width: | Height: | Size: 211 B |
Before Width: | Height: | Size: 225 B |
Before Width: | Height: | Size: 159 B |
Before Width: | Height: | Size: 312 B |
Before Width: | Height: | Size: 229 B |
Before Width: | Height: | Size: 129 B |
Before Width: | Height: | Size: 144 B |
Before Width: | Height: | Size: 159 B |
Before Width: | Height: | Size: 206 B After Width: | Height: | Size: 2.8 KiB |
Before Width: | Height: | Size: 199 B |
Before Width: | Height: | Size: 235 B |
Before Width: | Height: | Size: 225 B |
Before Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 199 B |
Before Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 310 B |
Before Width: | Height: | Size: 166 B |
Before Width: | Height: | Size: 229 B |
Before Width: | Height: | Size: 304 B After Width: | Height: | Size: 2.9 KiB |
|
@ -1,21 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<!-- Copyright (C) 2011 The Android Open Source Project
|
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
-->
|
|
||||||
<ImageView
|
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:visibility="gone"
|
|
||||||
android:alpha="0"
|
|
||||||
android:scaleType="fitXY"
|
|
||||||
android:src="@drawable/hotseat_scrubber_holo" />
|
|
|
@ -438,6 +438,9 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onPackagesUpdated(ArrayList<Object> widgetsAndShortcuts) {
|
public void onPackagesUpdated(ArrayList<Object> widgetsAndShortcuts) {
|
||||||
|
LauncherAppState app = LauncherAppState.getInstance();
|
||||||
|
DeviceProfile grid = app.getDynamicGrid().getDeviceProfile();
|
||||||
|
|
||||||
// Get the list of widgets and shortcuts
|
// Get the list of widgets and shortcuts
|
||||||
mWidgets.clear();
|
mWidgets.clear();
|
||||||
for (Object o : widgetsAndShortcuts) {
|
for (Object o : widgetsAndShortcuts) {
|
||||||
|
@ -450,8 +453,8 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen
|
||||||
int[] minSpanXY = Launcher.getMinSpanForWidget(mLauncher, widget);
|
int[] minSpanXY = Launcher.getMinSpanForWidget(mLauncher, widget);
|
||||||
int minSpanX = Math.min(spanXY[0], minSpanXY[0]);
|
int minSpanX = Math.min(spanXY[0], minSpanXY[0]);
|
||||||
int minSpanY = Math.min(spanXY[1], minSpanXY[1]);
|
int minSpanY = Math.min(spanXY[1], minSpanXY[1]);
|
||||||
if (minSpanX <= LauncherModel.getCellCountX() &&
|
if (minSpanX <= (int) grid.numColumns &&
|
||||||
minSpanY <= LauncherModel.getCellCountY()) {
|
minSpanY <= (int) grid.numRows) {
|
||||||
mWidgets.add(widget);
|
mWidgets.add(widget);
|
||||||
} else {
|
} else {
|
||||||
Log.e(TAG, "Widget " + widget.provider + " can not fit on this device (" +
|
Log.e(TAG, "Widget " + widget.provider + " can not fit on this device (" +
|
||||||
|
|
|
@ -189,6 +189,8 @@ public class CellLayout extends ViewGroup {
|
||||||
setClipToPadding(false);
|
setClipToPadding(false);
|
||||||
mLauncher = (Launcher) context;
|
mLauncher = (Launcher) context;
|
||||||
|
|
||||||
|
LauncherAppState app = LauncherAppState.getInstance();
|
||||||
|
DeviceProfile grid = app.getDynamicGrid().getDeviceProfile();
|
||||||
TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.CellLayout, defStyle, 0);
|
TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.CellLayout, defStyle, 0);
|
||||||
|
|
||||||
mCellWidth = -1;
|
mCellWidth = -1;
|
||||||
|
@ -196,8 +198,8 @@ public class CellLayout extends ViewGroup {
|
||||||
mWidthGap = mOriginalWidthGap = 0;
|
mWidthGap = mOriginalWidthGap = 0;
|
||||||
mHeightGap = mOriginalHeightGap = 0;
|
mHeightGap = mOriginalHeightGap = 0;
|
||||||
mMaxGap = Integer.MAX_VALUE;
|
mMaxGap = Integer.MAX_VALUE;
|
||||||
mCountX = LauncherModel.getCellCountX();
|
mCountX = (int) grid.numColumns;
|
||||||
mCountY = LauncherModel.getCellCountY();
|
mCountY = (int) grid.numRows;
|
||||||
mOccupied = new boolean[mCountX][mCountY];
|
mOccupied = new boolean[mCountX][mCountY];
|
||||||
mTmpOccupied = new boolean[mCountX][mCountY];
|
mTmpOccupied = new boolean[mCountX][mCountY];
|
||||||
mPreviousReorderDirection[0] = INVALID_DIRECTION;
|
mPreviousReorderDirection[0] = INVALID_DIRECTION;
|
||||||
|
@ -208,8 +210,6 @@ public class CellLayout extends ViewGroup {
|
||||||
setAlwaysDrawnWithCacheEnabled(false);
|
setAlwaysDrawnWithCacheEnabled(false);
|
||||||
|
|
||||||
final Resources res = getResources();
|
final Resources res = getResources();
|
||||||
LauncherAppState app = LauncherAppState.getInstance();
|
|
||||||
DeviceProfile grid = app.getDynamicGrid().getDeviceProfile();
|
|
||||||
mHotseatScale = (float) grid.hotseatIconSize / grid.iconSize;
|
mHotseatScale = (float) grid.hotseatIconSize / grid.iconSize;
|
||||||
|
|
||||||
mNormalBackground = res.getDrawable(R.drawable.homescreen_blue_normal_holo);
|
mNormalBackground = res.getDrawable(R.drawable.homescreen_blue_normal_holo);
|
||||||
|
@ -1204,6 +1204,11 @@ public class CellLayout extends ViewGroup {
|
||||||
int left = topLeft[0];
|
int left = topLeft[0];
|
||||||
int top = topLeft[1];
|
int top = topLeft[1];
|
||||||
|
|
||||||
|
// Offset icons by their padding
|
||||||
|
if (v instanceof BubbleTextView) {
|
||||||
|
top += v.getPaddingTop();
|
||||||
|
}
|
||||||
|
|
||||||
if (v != null && dragOffset == null) {
|
if (v != null && dragOffset == null) {
|
||||||
// When drawing the drag outline, it did not account for margin offsets
|
// When drawing the drag outline, it did not account for margin offsets
|
||||||
// added by the view's parent.
|
// added by the view's parent.
|
||||||
|
|
|
@ -68,6 +68,8 @@ class DeviceProfile {
|
||||||
|
|
||||||
int widthPx;
|
int widthPx;
|
||||||
int heightPx;
|
int heightPx;
|
||||||
|
int availableWidthPx;
|
||||||
|
int availableHeightPx;
|
||||||
int iconSizePx;
|
int iconSizePx;
|
||||||
int iconTextSizePx;
|
int iconTextSizePx;
|
||||||
int cellWidthPx;
|
int cellWidthPx;
|
||||||
|
@ -100,16 +102,15 @@ class DeviceProfile {
|
||||||
}
|
}
|
||||||
|
|
||||||
DeviceProfile(ArrayList<DeviceProfile> profiles,
|
DeviceProfile(ArrayList<DeviceProfile> profiles,
|
||||||
float minWidth, int minWidthPx,
|
float minWidth, float minHeight,
|
||||||
float minHeight, int minHeightPx,
|
|
||||||
int wPx, int hPx,
|
int wPx, int hPx,
|
||||||
|
int awPx, int ahPx,
|
||||||
Resources resources) {
|
Resources resources) {
|
||||||
DisplayMetrics dm = resources.getDisplayMetrics();
|
DisplayMetrics dm = resources.getDisplayMetrics();
|
||||||
ArrayList<DeviceProfileQuery> points =
|
ArrayList<DeviceProfileQuery> points =
|
||||||
new ArrayList<DeviceProfileQuery>();
|
new ArrayList<DeviceProfileQuery>();
|
||||||
transposeLayoutWithOrientation =
|
transposeLayoutWithOrientation =
|
||||||
resources.getBoolean(R.bool.hotseat_transpose_layout_with_orientation);
|
resources.getBoolean(R.bool.hotseat_transpose_layout_with_orientation);
|
||||||
updateFromConfiguration(resources, wPx, hPx);
|
|
||||||
minWidthDps = minWidth;
|
minWidthDps = minWidth;
|
||||||
minHeightDps = minHeight;
|
minHeightDps = minHeight;
|
||||||
|
|
||||||
|
@ -133,16 +134,16 @@ class DeviceProfile {
|
||||||
points.add(new DeviceProfileQuery(p.minWidthDps, p.minHeightDps, p.iconSize));
|
points.add(new DeviceProfileQuery(p.minWidthDps, p.minHeightDps, p.iconSize));
|
||||||
}
|
}
|
||||||
iconSize = invDistWeightedInterpolate(minWidth, minHeight, points);
|
iconSize = invDistWeightedInterpolate(minWidth, minHeight, points);
|
||||||
iconSizePx = (int) Math.round(TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP,
|
iconSizePx = DynamicGrid.pxFromDp(iconSize, dm);
|
||||||
iconSize, dm));
|
|
||||||
// Interpolate the icon text size
|
// Interpolate the icon text size
|
||||||
points.clear();
|
points.clear();
|
||||||
for (DeviceProfile p : profiles) {
|
for (DeviceProfile p : profiles) {
|
||||||
points.add(new DeviceProfileQuery(p.minWidthDps, p.minHeightDps, p.iconTextSize));
|
points.add(new DeviceProfileQuery(p.minWidthDps, p.minHeightDps, p.iconTextSize));
|
||||||
}
|
}
|
||||||
iconTextSize = invDistWeightedInterpolate(minWidth, minHeight, points);
|
iconTextSize = invDistWeightedInterpolate(minWidth, minHeight, points);
|
||||||
iconTextSizePx = (int) Math.round(TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP,
|
iconTextSizePx = DynamicGrid.pxFromSp(iconTextSize, dm);
|
||||||
iconTextSize, dm));
|
|
||||||
// Interpolate the hotseat size
|
// Interpolate the hotseat size
|
||||||
points.clear();
|
points.clear();
|
||||||
for (DeviceProfile p : profiles) {
|
for (DeviceProfile p : profiles) {
|
||||||
|
@ -154,14 +155,12 @@ class DeviceProfile {
|
||||||
for (DeviceProfile p : profiles) {
|
for (DeviceProfile p : profiles) {
|
||||||
points.add(new DeviceProfileQuery(p.minWidthDps, p.minHeightDps, p.hotseatIconSize));
|
points.add(new DeviceProfileQuery(p.minWidthDps, p.minHeightDps, p.hotseatIconSize));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Hotseat
|
// Hotseat
|
||||||
hotseatIconSize = invDistWeightedInterpolate(minWidth, minHeight, points);
|
hotseatIconSize = invDistWeightedInterpolate(minWidth, minHeight, points);
|
||||||
hotseatIconSizePx = (int) Math.round(TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP,
|
hotseatIconSizePx = DynamicGrid.pxFromDp(hotseatIconSize, dm);
|
||||||
hotseatIconSize, dm));
|
|
||||||
hotseatBarHeightPx = iconSizePx + 4 * edgeMarginPx;
|
// Calculate other vars based on Configuration
|
||||||
hotseatCellWidthPx = iconSizePx;
|
updateFromConfiguration(resources, wPx, hPx, awPx, ahPx);
|
||||||
hotseatCellHeightPx = iconSizePx;
|
|
||||||
|
|
||||||
// Search Bar
|
// Search Bar
|
||||||
searchBarSpaceMaxWidthPx = resources.getDimensionPixelSize(R.dimen.dynamic_grid_search_bar_max_width);
|
searchBarSpaceMaxWidthPx = resources.getDimensionPixelSize(R.dimen.dynamic_grid_search_bar_max_width);
|
||||||
|
@ -176,6 +175,27 @@ class DeviceProfile {
|
||||||
cellWidthPx = iconSizePx;
|
cellWidthPx = iconSizePx;
|
||||||
cellHeightPx = iconSizePx + (int) Math.ceil(fm.bottom - fm.top);
|
cellHeightPx = iconSizePx + (int) Math.ceil(fm.bottom - fm.top);
|
||||||
|
|
||||||
|
// At this point, if the cells do not fit into the available height, then we need
|
||||||
|
// to shrink the icon size
|
||||||
|
/*
|
||||||
|
Rect padding = getWorkspacePadding(isLandscape ?
|
||||||
|
CellLayout.LANDSCAPE : CellLayout.PORTRAIT);
|
||||||
|
int h = (int) (numRows * cellHeightPx) + padding.top + padding.bottom;
|
||||||
|
if (h > availableHeightPx) {
|
||||||
|
float delta = h - availableHeightPx;
|
||||||
|
int deltaPx = (int) Math.ceil(delta / numRows);
|
||||||
|
iconSizePx -= deltaPx;
|
||||||
|
iconSize = DynamicGrid.dpiFromPx(iconSizePx, dm);
|
||||||
|
cellWidthPx = iconSizePx;
|
||||||
|
cellHeightPx = iconSizePx + (int) Math.ceil(fm.bottom - fm.top);
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Hotseat
|
||||||
|
hotseatBarHeightPx = iconSizePx + 4 * edgeMarginPx;
|
||||||
|
hotseatCellWidthPx = iconSizePx;
|
||||||
|
hotseatCellHeightPx = iconSizePx;
|
||||||
|
|
||||||
// Folder
|
// Folder
|
||||||
folderCellWidthPx = cellWidthPx + 3 * edgeMarginPx;
|
folderCellWidthPx = cellWidthPx + 3 * edgeMarginPx;
|
||||||
folderCellHeightPx = cellHeightPx + edgeMarginPx;
|
folderCellHeightPx = cellHeightPx + edgeMarginPx;
|
||||||
|
@ -183,13 +203,17 @@ class DeviceProfile {
|
||||||
folderIconSizePx = iconSizePx + 2 * -folderBackgroundOffset;
|
folderIconSizePx = iconSizePx + 2 * -folderBackgroundOffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
void updateFromConfiguration(Resources resources, int wPx, int hPx) {
|
void updateFromConfiguration(Resources resources, int wPx, int hPx,
|
||||||
|
int awPx, int ahPx) {
|
||||||
|
DisplayMetrics dm = resources.getDisplayMetrics();
|
||||||
isLandscape = (resources.getConfiguration().orientation ==
|
isLandscape = (resources.getConfiguration().orientation ==
|
||||||
Configuration.ORIENTATION_LANDSCAPE);
|
Configuration.ORIENTATION_LANDSCAPE);
|
||||||
isTablet = resources.getBoolean(R.bool.is_tablet);
|
isTablet = resources.getBoolean(R.bool.is_tablet);
|
||||||
isLargeTablet = resources.getBoolean(R.bool.is_large_tablet);
|
isLargeTablet = resources.getBoolean(R.bool.is_large_tablet);
|
||||||
widthPx = wPx;
|
widthPx = wPx;
|
||||||
heightPx = hPx;
|
heightPx = hPx;
|
||||||
|
availableWidthPx = awPx;
|
||||||
|
availableHeightPx = ahPx;
|
||||||
}
|
}
|
||||||
|
|
||||||
private float dist(PointF p0, PointF p1) {
|
private float dist(PointF p0, PointF p1) {
|
||||||
|
@ -415,13 +439,22 @@ public class DynamicGrid {
|
||||||
private float mMinWidth;
|
private float mMinWidth;
|
||||||
private float mMinHeight;
|
private float mMinHeight;
|
||||||
|
|
||||||
public static int dpiFromPx(int size, DisplayMetrics metrics){
|
public static float dpiFromPx(int size, DisplayMetrics metrics){
|
||||||
float densityRatio = (float) metrics.densityDpi / DisplayMetrics.DENSITY_DEFAULT;
|
float densityRatio = (float) metrics.densityDpi / DisplayMetrics.DENSITY_DEFAULT;
|
||||||
return (int) Math.round(size / densityRatio);
|
return (size / densityRatio);
|
||||||
|
}
|
||||||
|
public static int pxFromDp(float size, DisplayMetrics metrics) {
|
||||||
|
return (int) Math.round(TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP,
|
||||||
|
size, metrics));
|
||||||
|
}
|
||||||
|
public static int pxFromSp(float size, DisplayMetrics metrics) {
|
||||||
|
return (int) Math.round(TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP,
|
||||||
|
size, metrics));
|
||||||
}
|
}
|
||||||
|
|
||||||
public DynamicGrid(Resources resources, int minWidthPx, int minHeightPx,
|
public DynamicGrid(Resources resources, int minWidthPx, int minHeightPx,
|
||||||
int widthPx, int heightPx) {
|
int widthPx, int heightPx,
|
||||||
|
int awPx, int ahPx) {
|
||||||
DisplayMetrics dm = resources.getDisplayMetrics();
|
DisplayMetrics dm = resources.getDisplayMetrics();
|
||||||
ArrayList<DeviceProfile> deviceProfiles =
|
ArrayList<DeviceProfile> deviceProfiles =
|
||||||
new ArrayList<DeviceProfile>();
|
new ArrayList<DeviceProfile>();
|
||||||
|
@ -456,9 +489,9 @@ public class DynamicGrid {
|
||||||
mMinWidth = dpiFromPx(minWidthPx, dm);
|
mMinWidth = dpiFromPx(minWidthPx, dm);
|
||||||
mMinHeight = dpiFromPx(minHeightPx, dm);
|
mMinHeight = dpiFromPx(minHeightPx, dm);
|
||||||
mProfile = new DeviceProfile(deviceProfiles,
|
mProfile = new DeviceProfile(deviceProfiles,
|
||||||
mMinWidth, minWidthPx,
|
mMinWidth, mMinHeight,
|
||||||
mMinHeight, minHeightPx,
|
|
||||||
widthPx, heightPx,
|
widthPx, heightPx,
|
||||||
|
awPx, ahPx,
|
||||||
resources);
|
resources);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,9 @@ import android.text.InputType;
|
||||||
import android.text.Selection;
|
import android.text.Selection;
|
||||||
import android.text.Spannable;
|
import android.text.Spannable;
|
||||||
import android.util.AttributeSet;
|
import android.util.AttributeSet;
|
||||||
|
import android.util.DisplayMetrics;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
import android.util.TypedValue;
|
||||||
import android.view.ActionMode;
|
import android.view.ActionMode;
|
||||||
import android.view.KeyEvent;
|
import android.view.KeyEvent;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
|
@ -85,7 +87,6 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList
|
||||||
private int mMaxCountY;
|
private int mMaxCountY;
|
||||||
private int mMaxVisibleX;
|
private int mMaxVisibleX;
|
||||||
private int mMaxVisibleY;
|
private int mMaxVisibleY;
|
||||||
private int mMaxContentAreaHeight = 0;
|
|
||||||
private int mMaxNumItems;
|
private int mMaxNumItems;
|
||||||
private ArrayList<View> mItemsInReadingOrder = new ArrayList<View>();
|
private ArrayList<View> mItemsInReadingOrder = new ArrayList<View>();
|
||||||
private Drawable mIconDrawable;
|
private Drawable mIconDrawable;
|
||||||
|
@ -108,8 +109,6 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList
|
||||||
private float mFolderIconPivotX;
|
private float mFolderIconPivotX;
|
||||||
private float mFolderIconPivotY;
|
private float mFolderIconPivotY;
|
||||||
|
|
||||||
private static final int SCROLL_CUT_OFF_AMOUNT = 60;
|
|
||||||
|
|
||||||
private static final float MAX_SCROLL_VELOCITY = 1500f;
|
private static final float MAX_SCROLL_VELOCITY = 1500f;
|
||||||
|
|
||||||
private boolean mIsEditingName = false;
|
private boolean mIsEditingName = false;
|
||||||
|
@ -146,7 +145,8 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList
|
||||||
mIconCache = app.getIconCache();
|
mIconCache = app.getIconCache();
|
||||||
|
|
||||||
Resources res = getResources();
|
Resources res = getResources();
|
||||||
mMaxCountX = mMaxVisibleX = mMaxVisibleY = (int) (grid.numColumns);
|
mMaxCountX = mMaxVisibleX = (int) grid.numColumns;
|
||||||
|
mMaxVisibleY = (int) grid.numRows;
|
||||||
mMaxCountY = mMaxNumItems = Integer.MAX_VALUE;
|
mMaxCountY = mMaxNumItems = Integer.MAX_VALUE;
|
||||||
|
|
||||||
mInputMethodManager = (InputMethodManager)
|
mInputMethodManager = (InputMethodManager)
|
||||||
|
@ -175,11 +175,11 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList
|
||||||
|
|
||||||
LauncherAppState app = LauncherAppState.getInstance();
|
LauncherAppState app = LauncherAppState.getInstance();
|
||||||
DeviceProfile grid = app.getDynamicGrid().getDeviceProfile();
|
DeviceProfile grid = app.getDynamicGrid().getDeviceProfile();
|
||||||
|
Rect padding = grid.getWorkspacePadding(grid.isLandscape ?
|
||||||
|
CellLayout.LANDSCAPE : CellLayout.PORTRAIT);
|
||||||
|
DisplayMetrics dm = getResources().getDisplayMetrics();
|
||||||
|
|
||||||
// Beyond this height, the area scrolls
|
|
||||||
mContent.setCellDimensions(grid.folderCellWidthPx, grid.folderCellHeightPx);
|
mContent.setCellDimensions(grid.folderCellWidthPx, grid.folderCellHeightPx);
|
||||||
mContent.setGridSize(mMaxVisibleX, mMaxVisibleY);
|
|
||||||
mMaxContentAreaHeight = mContent.getDesiredHeight() - SCROLL_CUT_OFF_AMOUNT;
|
|
||||||
mContent.setGridSize(0, 0);
|
mContent.setGridSize(0, 0);
|
||||||
mContent.getShortcutsAndWidgets().setMotionEventSplittingEnabled(false);
|
mContent.getShortcutsAndWidgets().setMotionEventSplittingEnabled(false);
|
||||||
mContent.setInvertIfRtl(true);
|
mContent.setInvertIfRtl(true);
|
||||||
|
@ -875,9 +875,9 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList
|
||||||
private void centerAboutIcon() {
|
private void centerAboutIcon() {
|
||||||
DragLayer.LayoutParams lp = (DragLayer.LayoutParams) getLayoutParams();
|
DragLayer.LayoutParams lp = (DragLayer.LayoutParams) getLayoutParams();
|
||||||
|
|
||||||
|
DragLayer parent = (DragLayer) mLauncher.findViewById(R.id.drag_layer);
|
||||||
int width = getPaddingLeft() + getPaddingRight() + mContent.getDesiredWidth();
|
int width = getPaddingLeft() + getPaddingRight() + mContent.getDesiredWidth();
|
||||||
int height = getFolderHeight();
|
int height = getFolderHeight();
|
||||||
DragLayer parent = (DragLayer) mLauncher.findViewById(R.id.drag_layer);
|
|
||||||
|
|
||||||
float scale = parent.getDescendantRectRelativeToSelf(mFolderIcon, mTempRect);
|
float scale = parent.getDescendantRectRelativeToSelf(mFolderIcon, mTempRect);
|
||||||
|
|
||||||
|
@ -945,31 +945,33 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList
|
||||||
centerAboutIcon();
|
centerAboutIcon();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private int getContentAreaHeight() {
|
||||||
|
LauncherAppState app = LauncherAppState.getInstance();
|
||||||
|
DeviceProfile grid = app.getDynamicGrid().getDeviceProfile();
|
||||||
|
Rect workspacePadding = grid.getWorkspacePadding(grid.isLandscape ?
|
||||||
|
CellLayout.LANDSCAPE : CellLayout.PORTRAIT);
|
||||||
|
int maxContentAreaHeight = grid.availableHeightPx -
|
||||||
|
4 * grid.edgeMarginPx -
|
||||||
|
workspacePadding.top - workspacePadding.bottom -
|
||||||
|
getPaddingTop() - getPaddingBottom() -
|
||||||
|
mFolderNameHeight;
|
||||||
|
return Math.min(maxContentAreaHeight,
|
||||||
|
mContent.getDesiredHeight());
|
||||||
|
}
|
||||||
|
|
||||||
private int getFolderHeight() {
|
private int getFolderHeight() {
|
||||||
int contentAreaHeight = mContent.getDesiredHeight();
|
int height = getPaddingTop() + getPaddingBottom()
|
||||||
if (contentAreaHeight >= mMaxContentAreaHeight) {
|
+ getContentAreaHeight() + mFolderNameHeight;
|
||||||
// Subtract a bit so the user can see that it's scrollable.
|
|
||||||
contentAreaHeight = mMaxContentAreaHeight;
|
|
||||||
}
|
|
||||||
int height = getPaddingTop() + getPaddingBottom() + contentAreaHeight
|
|
||||||
+ mFolderNameHeight;
|
|
||||||
return height;
|
return height;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
|
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
|
||||||
int contentAreaHeight = mContent.getDesiredHeight();
|
|
||||||
if (contentAreaHeight >= mMaxContentAreaHeight) {
|
|
||||||
// Subtract a bit so the user can see that it's scrollable.
|
|
||||||
contentAreaHeight = mMaxContentAreaHeight;
|
|
||||||
}
|
|
||||||
|
|
||||||
int width = getPaddingLeft() + getPaddingRight() + mContent.getDesiredWidth();
|
int width = getPaddingLeft() + getPaddingRight() + mContent.getDesiredWidth();
|
||||||
int height = getFolderHeight();
|
int height = getFolderHeight();
|
||||||
int contentAreaWidthSpec = MeasureSpec.makeMeasureSpec(mContent.getDesiredWidth(),
|
int contentAreaWidthSpec = MeasureSpec.makeMeasureSpec(mContent.getDesiredWidth(),
|
||||||
MeasureSpec.EXACTLY);
|
MeasureSpec.EXACTLY);
|
||||||
int contentAreaHeightSpec = MeasureSpec.makeMeasureSpec(contentAreaHeight,
|
int contentAreaHeightSpec = MeasureSpec.makeMeasureSpec(getContentAreaHeight(),
|
||||||
MeasureSpec.EXACTLY);
|
MeasureSpec.EXACTLY);
|
||||||
|
|
||||||
mContent.setFixedSize(mContent.getDesiredWidth(), mContent.getDesiredHeight());
|
mContent.setFixedSize(mContent.getDesiredWidth(), mContent.getDesiredHeight());
|
||||||
mScrollView.measure(contentAreaWidthSpec, contentAreaHeightSpec);
|
mScrollView.measure(contentAreaWidthSpec, contentAreaHeightSpec);
|
||||||
mFolderName.measure(contentAreaWidthSpec,
|
mFolderName.measure(contentAreaWidthSpec,
|
||||||
|
|
|
@ -192,8 +192,8 @@ public class InstallShortcutReceiver extends BroadcastReceiver {
|
||||||
data.getParcelableExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE);
|
data.getParcelableExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE);
|
||||||
|
|
||||||
// Queue the item up for adding if launcher has not loaded properly yet
|
// Queue the item up for adding if launcher has not loaded properly yet
|
||||||
boolean launcherNotLoaded = LauncherModel.getCellCountX() <= 0 ||
|
LauncherAppState app = LauncherAppState.getInstance();
|
||||||
LauncherModel.getCellCountY() <= 0;
|
boolean launcherNotLoaded = (app.getDynamicGrid() == null);
|
||||||
|
|
||||||
PendingInstallShortcutInfo info = new PendingInstallShortcutInfo(data, name, intent);
|
PendingInstallShortcutInfo info = new PendingInstallShortcutInfo(data, name, intent);
|
||||||
info.icon = icon;
|
info.icon = icon;
|
||||||
|
|
|
@ -68,6 +68,7 @@ import android.text.Selection;
|
||||||
import android.text.SpannableStringBuilder;
|
import android.text.SpannableStringBuilder;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.text.method.TextKeyListener;
|
import android.text.method.TextKeyListener;
|
||||||
|
import android.util.DisplayMetrics;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.Display;
|
import android.view.Display;
|
||||||
import android.view.Gravity;
|
import android.view.Gravity;
|
||||||
|
@ -377,11 +378,14 @@ public class Launcher extends Activity
|
||||||
Display display = getWindowManager().getDefaultDisplay();
|
Display display = getWindowManager().getDefaultDisplay();
|
||||||
display.getCurrentSizeRange(smallestSize, largestSize);
|
display.getCurrentSizeRange(smallestSize, largestSize);
|
||||||
display.getRealSize(realSize);
|
display.getRealSize(realSize);
|
||||||
|
DisplayMetrics dm = new DisplayMetrics();
|
||||||
|
display.getMetrics(dm);
|
||||||
// Lazy-initialize the dynamic grid
|
// Lazy-initialize the dynamic grid
|
||||||
DeviceProfile grid = app.initDynamicGrid(this,
|
DeviceProfile grid = app.initDynamicGrid(this,
|
||||||
Math.min(smallestSize.x, smallestSize.y),
|
Math.min(smallestSize.x, smallestSize.y),
|
||||||
Math.min(largestSize.x, largestSize.y),
|
Math.min(largestSize.x, largestSize.y),
|
||||||
realSize.x, realSize.y);
|
realSize.x, realSize.y,
|
||||||
|
dm.widthPixels, dm.heightPixels);
|
||||||
|
|
||||||
// the LauncherApplication should call this, but in case of Instrumentation it might not be present yet
|
// the LauncherApplication should call this, but in case of Instrumentation it might not be present yet
|
||||||
mSharedPrefs = getSharedPreferences(LauncherAppState.getSharedPreferencesKey(),
|
mSharedPrefs = getSharedPreferences(LauncherAppState.getSharedPreferencesKey(),
|
||||||
|
|
|
@ -164,21 +164,22 @@ public class LauncherAppState {
|
||||||
return SHARED_PREFERENCES_KEY;
|
return SHARED_PREFERENCES_KEY;
|
||||||
}
|
}
|
||||||
|
|
||||||
DeviceProfile initDynamicGrid(Context context, int minWidth, int minHeight, int width, int height) {
|
DeviceProfile initDynamicGrid(Context context, int minWidth, int minHeight,
|
||||||
|
int width, int height,
|
||||||
|
int availableWidth, int availableHeight) {
|
||||||
boolean created = false;
|
boolean created = false;
|
||||||
if (mDynamicGrid == null) {
|
if (mDynamicGrid == null) {
|
||||||
mDynamicGrid = new DynamicGrid(context.getResources(),
|
mDynamicGrid = new DynamicGrid(context.getResources(),
|
||||||
minWidth, minHeight, width, height);
|
minWidth, minHeight, width, height,
|
||||||
|
availableWidth, availableHeight);
|
||||||
created = true;
|
created = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
DeviceProfile grid = mDynamicGrid.getDeviceProfile();
|
|
||||||
if (created) {
|
|
||||||
LauncherModel.updateWorkspaceLayoutCells((int) grid.numColumns, (int) grid.numRows);
|
|
||||||
}
|
|
||||||
// Update the icon size
|
// Update the icon size
|
||||||
|
DeviceProfile grid = mDynamicGrid.getDeviceProfile();
|
||||||
Utilities.setIconSize(grid.iconSizePx);
|
Utilities.setIconSize(grid.iconSizePx);
|
||||||
grid.updateFromConfiguration(context.getResources(), width, height);
|
grid.updateFromConfiguration(context.getResources(), width, height,
|
||||||
|
availableWidth, availableHeight);
|
||||||
return grid;
|
return grid;
|
||||||
}
|
}
|
||||||
DynamicGrid getDynamicGrid() {
|
DynamicGrid getDynamicGrid() {
|
||||||
|
|
|
@ -143,9 +143,6 @@ public class LauncherModel extends BroadcastReceiver {
|
||||||
private IconCache mIconCache;
|
private IconCache mIconCache;
|
||||||
private Bitmap mDefaultIcon;
|
private Bitmap mDefaultIcon;
|
||||||
|
|
||||||
private static int mCellCountX;
|
|
||||||
private static int mCellCountY;
|
|
||||||
|
|
||||||
protected int mPreviousConfigMcc;
|
protected int mPreviousConfigMcc;
|
||||||
|
|
||||||
public interface Callbacks {
|
public interface Callbacks {
|
||||||
|
@ -219,8 +216,10 @@ public class LauncherModel extends BroadcastReceiver {
|
||||||
|
|
||||||
static boolean findNextAvailableIconSpaceInScreen(ArrayList<ItemInfo> items, int[] xy,
|
static boolean findNextAvailableIconSpaceInScreen(ArrayList<ItemInfo> items, int[] xy,
|
||||||
long screen) {
|
long screen) {
|
||||||
final int xCount = LauncherModel.getCellCountX();
|
LauncherAppState app = LauncherAppState.getInstance();
|
||||||
final int yCount = LauncherModel.getCellCountY();
|
DeviceProfile grid = app.getDynamicGrid().getDeviceProfile();
|
||||||
|
final int xCount = (int) grid.numColumns;
|
||||||
|
final int yCount = (int) grid.numRows;
|
||||||
boolean[][] occupied = new boolean[xCount][yCount];
|
boolean[][] occupied = new boolean[xCount][yCount];
|
||||||
|
|
||||||
int cellX, cellY, spanX, spanY;
|
int cellX, cellY, spanX, spanY;
|
||||||
|
@ -923,23 +922,6 @@ public class LauncherModel extends BroadcastReceiver {
|
||||||
| ((int) screen & 0xFF) << 16 | (localCellX & 0xFF) << 8 | (localCellY & 0xFF);
|
| ((int) screen & 0xFF) << 16 | (localCellX & 0xFF) << 8 | (localCellY & 0xFF);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int getCellCountX() {
|
|
||||||
return mCellCountX;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int getCellCountY() {
|
|
||||||
return mCellCountY;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Updates the model orientation helper to take into account the current layout dimensions
|
|
||||||
* when performing local/canonical coordinate transformations.
|
|
||||||
*/
|
|
||||||
static void updateWorkspaceLayoutCells(int shortAxisCellCount, int longAxisCellCount) {
|
|
||||||
mCellCountX = shortAxisCellCount;
|
|
||||||
mCellCountY = longAxisCellCount;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Removes the specified item from the database
|
* Removes the specified item from the database
|
||||||
* @param context
|
* @param context
|
||||||
|
@ -1558,12 +1540,19 @@ public class LauncherModel extends BroadcastReceiver {
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean checkItemDimensions(ItemInfo info) {
|
private boolean checkItemDimensions(ItemInfo info) {
|
||||||
return (info.cellX + info.spanX) > mCellCountX ||
|
LauncherAppState app = LauncherAppState.getInstance();
|
||||||
(info.cellY + info.spanY) > mCellCountY;
|
DeviceProfile grid = app.getDynamicGrid().getDeviceProfile();
|
||||||
|
return (info.cellX + info.spanX) > (int) grid.numColumns ||
|
||||||
|
(info.cellY + info.spanY) > (int) grid.numRows;
|
||||||
}
|
}
|
||||||
|
|
||||||
// check & update map of what's occupied; used to discard overlapping/invalid items
|
// check & update map of what's occupied; used to discard overlapping/invalid items
|
||||||
private boolean checkItemPlacement(HashMap<Long, ItemInfo[][]> occupied, ItemInfo item) {
|
private boolean checkItemPlacement(HashMap<Long, ItemInfo[][]> occupied, ItemInfo item) {
|
||||||
|
LauncherAppState app = LauncherAppState.getInstance();
|
||||||
|
DeviceProfile grid = app.getDynamicGrid().getDeviceProfile();
|
||||||
|
int countX = (int) grid.numColumns;
|
||||||
|
int countY = (int) grid.numRows;
|
||||||
|
|
||||||
long containerIndex = item.screenId;
|
long containerIndex = item.screenId;
|
||||||
if (item.container == LauncherSettings.Favorites.CONTAINER_HOTSEAT) {
|
if (item.container == LauncherSettings.Favorites.CONTAINER_HOTSEAT) {
|
||||||
if (occupied.containsKey(LauncherSettings.Favorites.CONTAINER_HOTSEAT)) {
|
if (occupied.containsKey(LauncherSettings.Favorites.CONTAINER_HOTSEAT)) {
|
||||||
|
@ -1577,7 +1566,7 @@ public class LauncherModel extends BroadcastReceiver {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
ItemInfo[][] items = new ItemInfo[mCellCountX + 1][mCellCountY + 1];
|
ItemInfo[][] items = new ItemInfo[countX + 1][countY + 1];
|
||||||
items[(int) item.screenId][0] = item;
|
items[(int) item.screenId][0] = item;
|
||||||
occupied.put((long) LauncherSettings.Favorites.CONTAINER_HOTSEAT, items);
|
occupied.put((long) LauncherSettings.Favorites.CONTAINER_HOTSEAT, items);
|
||||||
return true;
|
return true;
|
||||||
|
@ -1588,7 +1577,7 @@ public class LauncherModel extends BroadcastReceiver {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!occupied.containsKey(item.screenId)) {
|
if (!occupied.containsKey(item.screenId)) {
|
||||||
ItemInfo[][] items = new ItemInfo[mCellCountX + 1][mCellCountY + 1];
|
ItemInfo[][] items = new ItemInfo[countX + 1][countY + 1];
|
||||||
occupied.put(item.screenId, items);
|
occupied.put(item.screenId, items);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1625,6 +1614,11 @@ public class LauncherModel extends BroadcastReceiver {
|
||||||
final AppWidgetManager widgets = AppWidgetManager.getInstance(context);
|
final AppWidgetManager widgets = AppWidgetManager.getInstance(context);
|
||||||
final boolean isSafeMode = manager.isSafeMode();
|
final boolean isSafeMode = manager.isSafeMode();
|
||||||
|
|
||||||
|
LauncherAppState app = LauncherAppState.getInstance();
|
||||||
|
DeviceProfile grid = app.getDynamicGrid().getDeviceProfile();
|
||||||
|
int countX = (int) grid.numColumns;
|
||||||
|
int countY = (int) grid.numRows;
|
||||||
|
|
||||||
// Make sure the default workspace is loaded, if needed
|
// Make sure the default workspace is loaded, if needed
|
||||||
mApp.getLauncherProvider().loadDefaultFavoritesIfNecessary(0);
|
mApp.getLauncherProvider().loadDefaultFavoritesIfNecessary(0);
|
||||||
|
|
||||||
|
@ -1930,7 +1924,6 @@ public class LauncherModel extends BroadcastReceiver {
|
||||||
for (ItemInfo item: sBgItemsIdMap.values()) {
|
for (ItemInfo item: sBgItemsIdMap.values()) {
|
||||||
maxItemId = Math.max(maxItemId, item.id);
|
maxItemId = Math.max(maxItemId, item.id);
|
||||||
}
|
}
|
||||||
LauncherAppState app = LauncherAppState.getInstance();
|
|
||||||
app.getLauncherProvider().updateMaxItemId(maxItemId);
|
app.getLauncherProvider().updateMaxItemId(maxItemId);
|
||||||
} else {
|
} else {
|
||||||
Log.w(TAG, "10249126 - loadWorkspace - !loadedOldDb");
|
Log.w(TAG, "10249126 - loadWorkspace - !loadedOldDb");
|
||||||
|
@ -1963,7 +1956,7 @@ public class LauncherModel extends BroadcastReceiver {
|
||||||
Log.d(TAG, "loaded workspace in " + (SystemClock.uptimeMillis()-t) + "ms");
|
Log.d(TAG, "loaded workspace in " + (SystemClock.uptimeMillis()-t) + "ms");
|
||||||
Log.d(TAG, "workspace layout: ");
|
Log.d(TAG, "workspace layout: ");
|
||||||
int nScreens = occupied.size();
|
int nScreens = occupied.size();
|
||||||
for (int y = 0; y < mCellCountY; y++) {
|
for (int y = 0; y < countY; y++) {
|
||||||
String line = "";
|
String line = "";
|
||||||
|
|
||||||
Iterator<Long> iter = occupied.keySet().iterator();
|
Iterator<Long> iter = occupied.keySet().iterator();
|
||||||
|
@ -1972,7 +1965,7 @@ public class LauncherModel extends BroadcastReceiver {
|
||||||
if (screenId > 0) {
|
if (screenId > 0) {
|
||||||
line += " | ";
|
line += " | ";
|
||||||
}
|
}
|
||||||
for (int x = 0; x < mCellCountX; x++) {
|
for (int x = 0; x < countX; x++) {
|
||||||
line += ((occupied.get(screenId)[x][y] != null) ? "#" : ".");
|
line += ((occupied.get(screenId)[x][y] != null) ? "#" : ".");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2086,12 +2079,14 @@ public class LauncherModel extends BroadcastReceiver {
|
||||||
/** Sorts the set of items by hotseat, workspace (spatially from top to bottom, left to
|
/** Sorts the set of items by hotseat, workspace (spatially from top to bottom, left to
|
||||||
* right) */
|
* right) */
|
||||||
private void sortWorkspaceItemsSpatially(ArrayList<ItemInfo> workspaceItems) {
|
private void sortWorkspaceItemsSpatially(ArrayList<ItemInfo> workspaceItems) {
|
||||||
|
final LauncherAppState app = LauncherAppState.getInstance();
|
||||||
|
final DeviceProfile grid = app.getDynamicGrid().getDeviceProfile();
|
||||||
// XXX: review this
|
// XXX: review this
|
||||||
Collections.sort(workspaceItems, new Comparator<ItemInfo>() {
|
Collections.sort(workspaceItems, new Comparator<ItemInfo>() {
|
||||||
@Override
|
@Override
|
||||||
public int compare(ItemInfo lhs, ItemInfo rhs) {
|
public int compare(ItemInfo lhs, ItemInfo rhs) {
|
||||||
int cellCountX = LauncherModel.getCellCountX();
|
int cellCountX = (int) grid.numColumns;
|
||||||
int cellCountY = LauncherModel.getCellCountY();
|
int cellCountY = (int) grid.numRows;
|
||||||
int screenOffset = cellCountX * cellCountY;
|
int screenOffset = cellCountX * cellCountY;
|
||||||
int containerOffset = screenOffset * (Launcher.SCREEN_COUNT + 1); // +1 hotseat
|
int containerOffset = screenOffset * (Launcher.SCREEN_COUNT + 1); // +1 hotseat
|
||||||
long lr = (lhs.container * containerOffset + lhs.screenId * screenOffset +
|
long lr = (lhs.container * containerOffset + lhs.screenId * screenOffset +
|
||||||
|
|
|
@ -64,8 +64,8 @@ public class PagedViewCellLayout extends ViewGroup implements Page {
|
||||||
Resources resources = context.getResources();
|
Resources resources = context.getResources();
|
||||||
mOriginalCellWidth = mCellWidth = grid.cellWidthPx;
|
mOriginalCellWidth = mCellWidth = grid.cellWidthPx;
|
||||||
mOriginalCellHeight = mCellHeight = grid.cellHeightPx;
|
mOriginalCellHeight = mCellHeight = grid.cellHeightPx;
|
||||||
mCellCountX = LauncherModel.getCellCountX();
|
mCellCountX = (int) grid.numColumns;
|
||||||
mCellCountY = LauncherModel.getCellCountY();
|
mCellCountY = (int) grid.numRows;
|
||||||
mOriginalWidthGap = mOriginalHeightGap = mWidthGap = mHeightGap = -1;
|
mOriginalWidthGap = mOriginalHeightGap = mWidthGap = mHeightGap = -1;
|
||||||
mMaxGap = resources.getDimensionPixelSize(R.dimen.apps_customize_max_gap);
|
mMaxGap = resources.getDimensionPixelSize(R.dimen.apps_customize_max_gap);
|
||||||
|
|
||||||
|
|
|
@ -106,6 +106,9 @@ public class PagedViewWidget extends LinearLayout {
|
||||||
|
|
||||||
public void applyFromAppWidgetProviderInfo(AppWidgetProviderInfo info,
|
public void applyFromAppWidgetProviderInfo(AppWidgetProviderInfo info,
|
||||||
int maxWidth, int[] cellSpan, WidgetPreviewLoader loader) {
|
int maxWidth, int[] cellSpan, WidgetPreviewLoader loader) {
|
||||||
|
LauncherAppState app = LauncherAppState.getInstance();
|
||||||
|
DeviceProfile grid = app.getDynamicGrid().getDeviceProfile();
|
||||||
|
|
||||||
mIsAppWidget = true;
|
mIsAppWidget = true;
|
||||||
mInfo = info;
|
mInfo = info;
|
||||||
final ImageView image = (ImageView) findViewById(R.id.widget_preview);
|
final ImageView image = (ImageView) findViewById(R.id.widget_preview);
|
||||||
|
@ -116,8 +119,8 @@ public class PagedViewWidget extends LinearLayout {
|
||||||
name.setText(info.label);
|
name.setText(info.label);
|
||||||
final TextView dims = (TextView) findViewById(R.id.widget_dims);
|
final TextView dims = (TextView) findViewById(R.id.widget_dims);
|
||||||
if (dims != null) {
|
if (dims != null) {
|
||||||
int hSpan = Math.min(cellSpan[0], LauncherModel.getCellCountX());
|
int hSpan = Math.min(cellSpan[0], (int) grid.numColumns);
|
||||||
int vSpan = Math.min(cellSpan[1], LauncherModel.getCellCountY());
|
int vSpan = Math.min(cellSpan[1], (int) grid.numRows);
|
||||||
dims.setText(String.format(mDimensionsFormatString, hSpan, vSpan));
|
dims.setText(String.format(mDimensionsFormatString, hSpan, vSpan));
|
||||||
}
|
}
|
||||||
mWidgetPreviewLoader = loader;
|
mWidgetPreviewLoader = loader;
|
||||||
|
|
|
@ -2532,6 +2532,8 @@ public class Workspace extends SmoothPagedView
|
||||||
Point smallestSize = new Point();
|
Point smallestSize = new Point();
|
||||||
Point largestSize = new Point();
|
Point largestSize = new Point();
|
||||||
display.getCurrentSizeRange(smallestSize, largestSize);
|
display.getCurrentSizeRange(smallestSize, largestSize);
|
||||||
|
int countX = (int) grid.numColumns;
|
||||||
|
int countY = (int) grid.numRows;
|
||||||
if (orientation == CellLayout.LANDSCAPE) {
|
if (orientation == CellLayout.LANDSCAPE) {
|
||||||
if (mLandscapeCellLayoutMetrics == null) {
|
if (mLandscapeCellLayoutMetrics == null) {
|
||||||
Rect padding = grid.getWorkspacePadding(CellLayout.LANDSCAPE);
|
Rect padding = grid.getWorkspacePadding(CellLayout.LANDSCAPE);
|
||||||
|
@ -2539,7 +2541,7 @@ public class Workspace extends SmoothPagedView
|
||||||
int height = smallestSize.y - padding.top - padding.bottom;
|
int height = smallestSize.y - padding.top - padding.bottom;
|
||||||
mLandscapeCellLayoutMetrics = new Rect();
|
mLandscapeCellLayoutMetrics = new Rect();
|
||||||
CellLayout.getMetrics(mLandscapeCellLayoutMetrics, width, height,
|
CellLayout.getMetrics(mLandscapeCellLayoutMetrics, width, height,
|
||||||
LauncherModel.getCellCountX(), LauncherModel.getCellCountY());
|
countX, countY);
|
||||||
}
|
}
|
||||||
return mLandscapeCellLayoutMetrics;
|
return mLandscapeCellLayoutMetrics;
|
||||||
} else if (orientation == CellLayout.PORTRAIT) {
|
} else if (orientation == CellLayout.PORTRAIT) {
|
||||||
|
@ -2549,7 +2551,7 @@ public class Workspace extends SmoothPagedView
|
||||||
int height = largestSize.y - padding.top - padding.bottom;
|
int height = largestSize.y - padding.top - padding.bottom;
|
||||||
mPortraitCellLayoutMetrics = new Rect();
|
mPortraitCellLayoutMetrics = new Rect();
|
||||||
CellLayout.getMetrics(mPortraitCellLayoutMetrics, width, height,
|
CellLayout.getMetrics(mPortraitCellLayoutMetrics, width, height,
|
||||||
LauncherModel.getCellCountX(), LauncherModel.getCellCountY());
|
countX, countY);
|
||||||
}
|
}
|
||||||
return mPortraitCellLayoutMetrics;
|
return mPortraitCellLayoutMetrics;
|
||||||
}
|
}
|
||||||
|
|