Fixing overview mode scale calculations.
- Making the overview scale apply just like the spring loaded scale factor - Tweaking overview scale to make it not so small Change-Id: If93bac08609b0cfd9c9d9f8f6057498957378b56
This commit is contained in:
1 parent
76648c58d5
commit
4f7eb4077e
4 files changed
+21
-26
No files matched your search
@@ -25,6 +25,7 @@ import android.graphics.Paint.FontMetrics;
|
||||
import android.graphics.Point;
|
||||
import android.graphics.Rect;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.util.Size;
|
||||
import android.view.Gravity;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
@@ -56,7 +57,6 @@ public class DeviceProfile {
|
||||
private final int overviewModeBarItemWidthPx;
|
||||
private final int overviewModeBarSpacerWidthPx;
|
||||
private final float overviewModeIconZoneRatio;
|
||||
private final float overviewModeScaleFactor;
|
||||
|
||||
// Workspace
|
||||
private int desiredWorkspaceLeftRightMarginPx;
|
||||
@@ -136,8 +136,6 @@ public class DeviceProfile {
|
||||
res.getDimensionPixelSize(R.dimen.dynamic_grid_overview_bar_spacer_width);
|
||||
overviewModeIconZoneRatio =
|
||||
res.getInteger(R.integer.config_dynamic_grid_overview_icon_zone_percentage) / 100f;
|
||||
overviewModeScaleFactor =
|
||||
res.getInteger(R.integer.config_dynamic_grid_overview_scale_percentage) / 100f;
|
||||
iconDrawablePaddingOriginalPx =
|
||||
res.getDimensionPixelSize(R.dimen.dynamic_grid_icon_drawable_padding);
|
||||
|
||||
@@ -338,18 +336,11 @@ public class DeviceProfile {
|
||||
}
|
||||
}
|
||||
|
||||
Rect getOverviewModeButtonBarRect() {
|
||||
int getOverviewModeButtonBarHeight() {
|
||||
int zoneHeight = (int) (overviewModeIconZoneRatio * availableHeightPx);
|
||||
zoneHeight = Math.min(overviewModeMaxIconZoneHeightPx,
|
||||
Math.max(overviewModeMinIconZoneHeightPx, zoneHeight));
|
||||
return new Rect(0, availableHeightPx - zoneHeight, 0, availableHeightPx);
|
||||
}
|
||||
|
||||
public float getOverviewModeScale(boolean isLayoutRtl) {
|
||||
Rect workspacePadding = getWorkspacePadding(isLayoutRtl);
|
||||
Rect overviewBar = getOverviewModeButtonBarRect();
|
||||
int pageSpace = availableHeightPx - workspacePadding.top - workspacePadding.bottom;
|
||||
return (overviewModeScaleFactor * (pageSpace - overviewBar.height())) / pageSpace;
|
||||
return zoneHeight;
|
||||
}
|
||||
|
||||
// The rect returned will be extended to below the system ui that covers the workspace
|
||||
@@ -480,7 +471,7 @@ public class DeviceProfile {
|
||||
// Layout the Overview Mode
|
||||
ViewGroup overviewMode = launcher.getOverviewPanel();
|
||||
if (overviewMode != null) {
|
||||
Rect r = getOverviewModeButtonBarRect();
|
||||
int overviewButtonBarHeight = getOverviewModeButtonBarHeight();
|
||||
lp = (FrameLayout.LayoutParams) overviewMode.getLayoutParams();
|
||||
lp.gravity = Gravity.CENTER_HORIZONTAL | Gravity.BOTTOM;
|
||||
|
||||
@@ -489,7 +480,7 @@ public class DeviceProfile {
|
||||
int maxWidth = totalItemWidth + (visibleChildCount-1) * overviewModeBarSpacerWidthPx;
|
||||
|
||||
lp.width = Math.min(availableWidthPx, maxWidth);
|
||||
lp.height = r.height();
|
||||
lp.height = overviewButtonBarHeight;
|
||||
overviewMode.setLayoutParams(lp);
|
||||
|
||||
if (lp.width > totalItemWidth && visibleChildCount > 1) {
|
||||
|
||||
Reference in new issue
Block a user