am c48aaa75: am 98168ec7: am c82d2622: Dyanmically lay out overview mode across all orientations and form factors.
* commit 'c48aaa75b3e6a90e053f0e1cc8c161b8080fa04b': Dyanmically lay out overview mode across all orientations and form factors.
|
Before Width: | Height: | Size: 2.6 KiB After Width: | Height: | Size: 3.2 KiB |
|
Before Width: | Height: | Size: 3.0 KiB After Width: | Height: | Size: 3.6 KiB |
|
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 2.0 KiB |
|
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 2.1 KiB |
|
Before Width: | Height: | Size: 3.5 KiB After Width: | Height: | Size: 4.4 KiB |
|
Before Width: | Height: | Size: 4.4 KiB After Width: | Height: | Size: 5.2 KiB |
|
Before Width: | Height: | Size: 4.0 KiB After Width: | Height: | Size: 4.4 KiB |
|
Before Width: | Height: | Size: 6.9 KiB After Width: | Height: | Size: 7.4 KiB |
@@ -77,19 +77,6 @@
|
|||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:visibility="gone" />
|
android:visibility="gone" />
|
||||||
|
|
||||||
<!-- TODO: Fix
|
|
||||||
<com.android.launcher3.DrawableStateProxyView
|
|
||||||
android:id="@+id/voice_button_proxy"
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="0dp"
|
|
||||||
android:layout_gravity="top|start"
|
|
||||||
android:layout_marginTop="64dp"
|
|
||||||
android:clickable="true"
|
|
||||||
android:onClick="onClickVoiceButton"
|
|
||||||
android:importantForAccessibility="no"
|
|
||||||
launcher:sourceViewId="@+id/voice_button" />
|
|
||||||
-->
|
|
||||||
|
|
||||||
<include layout="@layout/apps_customize_pane"
|
<include layout="@layout/apps_customize_pane"
|
||||||
android:id="@+id/apps_customize_pane"
|
android:id="@+id/apps_customize_pane"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
|||||||
@@ -13,18 +13,18 @@
|
|||||||
See the License for the specific language governing permissions and
|
See the License for the specific language governing permissions and
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
-->
|
-->
|
||||||
<LinearLayout
|
<FrameLayout
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="horizontal"
|
|
||||||
android:layout_gravity="center_horizontal|bottom"
|
android:layout_gravity="center_horizontal|bottom"
|
||||||
android:paddingBottom="@dimen/overview_panel_bottom_padding">
|
android:orientation="horizontal">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/wallpaper_button"
|
android:id="@+id/wallpaper_button"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="start|top"
|
||||||
android:text="@string/wallpaper_button_text"
|
android:text="@string/wallpaper_button_text"
|
||||||
android:drawablePadding="4dp"
|
android:drawablePadding="4dp"
|
||||||
android:drawableTop="@drawable/wallpaper_button"
|
android:drawableTop="@drawable/wallpaper_button"
|
||||||
@@ -32,13 +32,11 @@
|
|||||||
android:fontFamily="sans-serif-condensed"
|
android:fontFamily="sans-serif-condensed"
|
||||||
android:textAllCaps="true"
|
android:textAllCaps="true"
|
||||||
android:textSize="12sp" />
|
android:textSize="12sp" />
|
||||||
<Space
|
|
||||||
android:layout_width="@dimen/overview_panel_buttonSpacing"
|
|
||||||
android:layout_height="wrap_content"/>
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/widget_button"
|
android:id="@+id/widget_button"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center_horizontal|top"
|
||||||
android:text="@string/widget_button_text"
|
android:text="@string/widget_button_text"
|
||||||
android:drawablePadding="4dp"
|
android:drawablePadding="4dp"
|
||||||
android:gravity="center_horizontal"
|
android:gravity="center_horizontal"
|
||||||
@@ -46,13 +44,11 @@
|
|||||||
android:fontFamily="sans-serif-condensed"
|
android:fontFamily="sans-serif-condensed"
|
||||||
android:textAllCaps="true"
|
android:textAllCaps="true"
|
||||||
android:textSize="12sp"/>
|
android:textSize="12sp"/>
|
||||||
<Space
|
|
||||||
android:layout_width="@dimen/overview_panel_buttonSpacing"
|
|
||||||
android:layout_height="wrap_content"/>
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/settings_button"
|
android:id="@+id/settings_button"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="end|top"
|
||||||
android:text="@string/settings_button_text"
|
android:text="@string/settings_button_text"
|
||||||
android:drawablePadding="4dp"
|
android:drawablePadding="4dp"
|
||||||
android:gravity="center_horizontal"
|
android:gravity="center_horizontal"
|
||||||
@@ -60,4 +56,4 @@
|
|||||||
android:fontFamily="sans-serif-condensed"
|
android:fontFamily="sans-serif-condensed"
|
||||||
android:textAllCaps="true"
|
android:textAllCaps="true"
|
||||||
android:textSize="12sp" />
|
android:textSize="12sp" />
|
||||||
</LinearLayout>
|
</FrameLayout>
|
||||||
|
|||||||
@@ -3,6 +3,10 @@
|
|||||||
<integer name="config_dynamic_grid_max_long_edge_cell_count">6</integer>
|
<integer name="config_dynamic_grid_max_long_edge_cell_count">6</integer>
|
||||||
<integer name="config_dynamic_grid_max_short_edge_cell_count">5</integer>
|
<integer name="config_dynamic_grid_max_short_edge_cell_count">5</integer>
|
||||||
<integer name="config_dynamic_grid_min_edge_cell_count">3</integer>
|
<integer name="config_dynamic_grid_min_edge_cell_count">3</integer>
|
||||||
|
<!-- Out of 100, the percent of space the overview bar should try and take vertically. -->
|
||||||
|
<integer name="config_dynamic_grid_overview_icon_zone_percentage">20</integer>
|
||||||
|
<!-- Out of 100, the percent to shrink the workspace during overview mode. -->
|
||||||
|
<integer name="config_dynamic_grid_overview_scale_percentage">80</integer>
|
||||||
|
|
||||||
<!-- Miscellaneous -->
|
<!-- Miscellaneous -->
|
||||||
<bool name="config_largeHeap">false</bool>
|
<bool name="config_largeHeap">false</bool>
|
||||||
@@ -24,8 +28,6 @@
|
|||||||
|
|
||||||
<!-- Out of 100, the percent to shrink the workspace during spring loaded mode. -->
|
<!-- Out of 100, the percent to shrink the workspace during spring loaded mode. -->
|
||||||
<integer name="config_workspaceSpringLoadShrinkPercentage">80</integer>
|
<integer name="config_workspaceSpringLoadShrinkPercentage">80</integer>
|
||||||
<!-- Out of 100, the percent to shrink the workspace during overview mode. -->
|
|
||||||
<integer name="config_workspaceOverviewShrinkPercentage">58</integer>
|
|
||||||
|
|
||||||
<!-- Fade/zoom in/out duration & scale in the AllApps transition.
|
<!-- Fade/zoom in/out duration & scale in the AllApps transition.
|
||||||
Note: This should be less than the workspaceShrinkTime as they happen together. -->
|
Note: This should be less than the workspaceShrinkTime as they happen together. -->
|
||||||
|
|||||||
@@ -23,6 +23,9 @@
|
|||||||
<dimen name="dynamic_grid_icon_drawable_padding">4dp</dimen>
|
<dimen name="dynamic_grid_icon_drawable_padding">4dp</dimen>
|
||||||
<dimen name="dynamic_grid_all_apps_cell_padding">18dp</dimen>
|
<dimen name="dynamic_grid_all_apps_cell_padding">18dp</dimen>
|
||||||
<dimen name="dynamic_grid_workspace_page_spacing">8dp</dimen>
|
<dimen name="dynamic_grid_workspace_page_spacing">8dp</dimen>
|
||||||
|
<dimen name="dynamic_grid_overview_min_icon_zone_height">80dp</dimen>
|
||||||
|
<dimen name="dynamic_grid_overview_max_icon_zone_height">120dp</dimen>
|
||||||
|
<dimen name="dynamic_grid_overview_bar_max_width">280dp</dimen>
|
||||||
|
|
||||||
<!-- Wallpaper picker -->
|
<!-- Wallpaper picker -->
|
||||||
<dimen name="wallpaperThumbnailWidth">106.5dp</dimen>
|
<dimen name="wallpaperThumbnailWidth">106.5dp</dimen>
|
||||||
@@ -49,9 +52,6 @@
|
|||||||
<!-- Workspace -->
|
<!-- Workspace -->
|
||||||
<dimen name="workspace_max_gap">16dp</dimen>
|
<dimen name="workspace_max_gap">16dp</dimen>
|
||||||
<dimen name="workspace_overscroll_drawable_padding">0dp</dimen>
|
<dimen name="workspace_overscroll_drawable_padding">0dp</dimen>
|
||||||
<dimen name="overview_panel_bottom_padding">50dp</dimen>
|
|
||||||
<dimen name="overview_panel_buttonSpacing">60dp</dimen>
|
|
||||||
<dimen name="overview_mode_page_offset">130dp</dimen>
|
|
||||||
|
|
||||||
<!-- QSB -->
|
<!-- QSB -->
|
||||||
<dimen name="toolbar_button_vertical_padding">4dip</dimen>
|
<dimen name="toolbar_button_vertical_padding">4dip</dimen>
|
||||||
|
|||||||
@@ -86,6 +86,12 @@ class DeviceProfile {
|
|||||||
int availableHeightPx;
|
int availableHeightPx;
|
||||||
int defaultPageSpacingPx;
|
int defaultPageSpacingPx;
|
||||||
|
|
||||||
|
int overviewModeMinIconZoneHeightPx;
|
||||||
|
int overviewModeMaxIconZoneHeightPx;
|
||||||
|
int overviewModeMaxBarWidthPx;
|
||||||
|
float overviewModeIconZoneRatio;
|
||||||
|
float overviewModeScaleFactor;
|
||||||
|
|
||||||
int iconSizePx;
|
int iconSizePx;
|
||||||
int iconTextSizePx;
|
int iconTextSizePx;
|
||||||
int iconDrawablePaddingPx;
|
int iconDrawablePaddingPx;
|
||||||
@@ -158,6 +164,16 @@ class DeviceProfile {
|
|||||||
res.getDimensionPixelSize(R.dimen.dynamic_grid_workspace_page_spacing);
|
res.getDimensionPixelSize(R.dimen.dynamic_grid_workspace_page_spacing);
|
||||||
allAppsCellPaddingPx =
|
allAppsCellPaddingPx =
|
||||||
res.getDimensionPixelSize(R.dimen.dynamic_grid_all_apps_cell_padding);
|
res.getDimensionPixelSize(R.dimen.dynamic_grid_all_apps_cell_padding);
|
||||||
|
overviewModeMinIconZoneHeightPx =
|
||||||
|
res.getDimensionPixelSize(R.dimen.dynamic_grid_overview_min_icon_zone_height);
|
||||||
|
overviewModeMaxIconZoneHeightPx =
|
||||||
|
res.getDimensionPixelSize(R.dimen.dynamic_grid_overview_max_icon_zone_height);
|
||||||
|
overviewModeMaxBarWidthPx =
|
||||||
|
res.getDimensionPixelSize(R.dimen.dynamic_grid_overview_bar_max_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;
|
||||||
|
|
||||||
// Interpolate the rows
|
// Interpolate the rows
|
||||||
for (DeviceProfile p : profiles) {
|
for (DeviceProfile p : profiles) {
|
||||||
@@ -454,6 +470,20 @@ class DeviceProfile {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Rect getOverviewModeButtonBarRect() {
|
||||||
|
int zoneHeight = (int) (overviewModeIconZoneRatio * availableHeightPx);
|
||||||
|
zoneHeight = Math.min(overviewModeMaxIconZoneHeightPx,
|
||||||
|
Math.max(overviewModeMinIconZoneHeightPx, zoneHeight));
|
||||||
|
return new Rect(0, availableHeightPx - zoneHeight, 0, availableHeightPx);
|
||||||
|
}
|
||||||
|
|
||||||
|
float getOverviewModeScale() {
|
||||||
|
Rect workspacePadding = getWorkspacePadding();
|
||||||
|
Rect overviewBar = getOverviewModeButtonBarRect();
|
||||||
|
int pageSpace = availableHeightPx - workspacePadding.top - workspacePadding.bottom;
|
||||||
|
return (overviewModeScaleFactor * (pageSpace - overviewBar.height())) / pageSpace;
|
||||||
|
}
|
||||||
|
|
||||||
// The rect returned will be extended to below the system ui that covers the workspace
|
// The rect returned will be extended to below the system ui that covers the workspace
|
||||||
Rect getHotseatRect() {
|
Rect getHotseatRect() {
|
||||||
if (isVerticalBarLayout()) {
|
if (isVerticalBarLayout()) {
|
||||||
@@ -601,6 +631,7 @@ class DeviceProfile {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Layout AllApps
|
||||||
AppsCustomizeTabHost host = (AppsCustomizeTabHost)
|
AppsCustomizeTabHost host = (AppsCustomizeTabHost)
|
||||||
launcher.findViewById(R.id.apps_customize_pane);
|
launcher.findViewById(R.id.apps_customize_pane);
|
||||||
if (host != null) {
|
if (host != null) {
|
||||||
@@ -639,6 +670,17 @@ class DeviceProfile {
|
|||||||
pagedView.setWidgetsPageIndicatorPadding(pageIndicatorHeight);
|
pagedView.setWidgetsPageIndicatorPadding(pageIndicatorHeight);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Layout the Overview Mode
|
||||||
|
View overviewMode = launcher.getOverviewPanel();
|
||||||
|
if (overviewMode != null) {
|
||||||
|
Rect r = getOverviewModeButtonBarRect();
|
||||||
|
lp = (FrameLayout.LayoutParams) overviewMode.getLayoutParams();
|
||||||
|
lp.gravity = Gravity.CENTER_HORIZONTAL | Gravity.BOTTOM;
|
||||||
|
lp.width = Math.min(availableWidthPx, overviewModeMaxBarWidthPx);
|
||||||
|
lp.height = r.height();
|
||||||
|
overviewMode.setLayoutParams(lp);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -786,14 +786,14 @@ public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarc
|
|||||||
int widthSize = MeasureSpec.getSize(widthMeasureSpec);
|
int widthSize = MeasureSpec.getSize(widthMeasureSpec);
|
||||||
int heightMode = MeasureSpec.getMode(heightMeasureSpec);
|
int heightMode = MeasureSpec.getMode(heightMeasureSpec);
|
||||||
int heightSize = MeasureSpec.getSize(heightMeasureSpec);
|
int heightSize = MeasureSpec.getSize(heightMeasureSpec);
|
||||||
// NOTE: We multiply by 1.5f to account for the fact that depending on the offset of the
|
// NOTE: We multiply by 2f to account for the fact that depending on the offset of the
|
||||||
// viewport, we can be at most one and a half screens offset once we scale down
|
// viewport, we can be at most one and a half screens offset once we scale down
|
||||||
DisplayMetrics dm = getResources().getDisplayMetrics();
|
DisplayMetrics dm = getResources().getDisplayMetrics();
|
||||||
int maxSize = Math.max(dm.widthPixels + mInsets.left + mInsets.right,
|
int maxSize = Math.max(dm.widthPixels + mInsets.left + mInsets.right,
|
||||||
dm.heightPixels + mInsets.top + mInsets.bottom);
|
dm.heightPixels + mInsets.top + mInsets.bottom);
|
||||||
|
|
||||||
int parentWidthSize = (int) (1.5f * maxSize);
|
int parentWidthSize = (int) (2f * maxSize);
|
||||||
int parentHeightSize = maxSize;
|
int parentHeightSize = (int) (2f * maxSize);
|
||||||
int scaledWidthSize, scaledHeightSize;
|
int scaledWidthSize, scaledHeightSize;
|
||||||
if (mUseMinScale) {
|
if (mUseMinScale) {
|
||||||
scaledWidthSize = (int) (parentWidthSize / mMinScale);
|
scaledWidthSize = (int) (parentWidthSize / mMinScale);
|
||||||
|
|||||||
@@ -184,7 +184,6 @@ public class Workspace extends SmoothPagedView
|
|||||||
private SpringLoadedDragController mSpringLoadedDragController;
|
private SpringLoadedDragController mSpringLoadedDragController;
|
||||||
private float mSpringLoadedShrinkFactor;
|
private float mSpringLoadedShrinkFactor;
|
||||||
private float mOverviewModeShrinkFactor;
|
private float mOverviewModeShrinkFactor;
|
||||||
private int mOverviewModePageOffset;
|
|
||||||
|
|
||||||
// State variable that indicates whether the pages are small (ie when you're
|
// State variable that indicates whether the pages are small (ie when you're
|
||||||
// in all apps or customize mode)
|
// in all apps or customize mode)
|
||||||
@@ -315,13 +314,13 @@ public class Workspace extends SmoothPagedView
|
|||||||
mFadeInAdjacentScreens = false;
|
mFadeInAdjacentScreens = false;
|
||||||
mWallpaperManager = WallpaperManager.getInstance(context);
|
mWallpaperManager = WallpaperManager.getInstance(context);
|
||||||
|
|
||||||
|
LauncherAppState app = LauncherAppState.getInstance();
|
||||||
|
DeviceProfile grid = app.getDynamicGrid().getDeviceProfile();
|
||||||
TypedArray a = context.obtainStyledAttributes(attrs,
|
TypedArray a = context.obtainStyledAttributes(attrs,
|
||||||
R.styleable.Workspace, defStyle, 0);
|
R.styleable.Workspace, defStyle, 0);
|
||||||
mSpringLoadedShrinkFactor =
|
mSpringLoadedShrinkFactor =
|
||||||
res.getInteger(R.integer.config_workspaceSpringLoadShrinkPercentage) / 100.0f;
|
res.getInteger(R.integer.config_workspaceSpringLoadShrinkPercentage) / 100.0f;
|
||||||
mOverviewModeShrinkFactor =
|
mOverviewModeShrinkFactor = grid.getOverviewModeScale();
|
||||||
res.getInteger(R.integer.config_workspaceOverviewShrinkPercentage) / 100.0f;
|
|
||||||
mOverviewModePageOffset = res.getDimensionPixelSize(R.dimen.overview_mode_page_offset);
|
|
||||||
mCameraDistance = res.getInteger(R.integer.config_cameraDistance);
|
mCameraDistance = res.getInteger(R.integer.config_cameraDistance);
|
||||||
mOriginalDefaultPage = mDefaultPage = a.getInt(R.styleable.Workspace_defaultScreen, 1);
|
mOriginalDefaultPage = mDefaultPage = a.getInt(R.styleable.Workspace_defaultScreen, 1);
|
||||||
a.recycle();
|
a.recycle();
|
||||||
@@ -418,9 +417,7 @@ public class Workspace extends SmoothPagedView
|
|||||||
setClipToPadding(false);
|
setClipToPadding(false);
|
||||||
setChildrenDrawnWithCacheEnabled(true);
|
setChildrenDrawnWithCacheEnabled(true);
|
||||||
|
|
||||||
// This is a bit of a hack to account for the fact that we translate the workspace
|
setMinScale(mOverviewModeShrinkFactor);
|
||||||
// up a bit, and still need to draw the background covering the whole screen.
|
|
||||||
setMinScale(mOverviewModeShrinkFactor - 0.2f);
|
|
||||||
setupLayoutTransition();
|
setupLayoutTransition();
|
||||||
|
|
||||||
final Resources res = getResources();
|
final Resources res = getResources();
|
||||||
@@ -1998,14 +1995,17 @@ public class Workspace extends SmoothPagedView
|
|||||||
}
|
}
|
||||||
|
|
||||||
int getOverviewModeTranslationY() {
|
int getOverviewModeTranslationY() {
|
||||||
int childHeight = getNormalChildHeight();
|
LauncherAppState app = LauncherAppState.getInstance();
|
||||||
int viewPortHeight = getViewportHeight();
|
DeviceProfile grid = app.getDynamicGrid().getDeviceProfile();
|
||||||
int scaledChildHeight = (int) (mOverviewModeShrinkFactor * childHeight);
|
Rect overviewBar = grid.getOverviewModeButtonBarRect();
|
||||||
|
|
||||||
int offset = (viewPortHeight - scaledChildHeight) / 2;
|
int availableHeight = getViewportHeight();
|
||||||
int offsetDelta = mOverviewModePageOffset - offset + mInsets.top;
|
int scaledHeight = (int) (mOverviewModeShrinkFactor * getNormalChildHeight());
|
||||||
|
int offsetFromTopEdge = (availableHeight - scaledHeight) / 2;
|
||||||
|
int offsetToCenterInOverview = (availableHeight - mInsets.top - overviewBar.height()
|
||||||
|
- scaledHeight) / 2;
|
||||||
|
|
||||||
return offsetDelta;
|
return -offsetFromTopEdge + mInsets.top + offsetToCenterInOverview;
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean shouldVoiceButtonProxyBeVisible() {
|
boolean shouldVoiceButtonProxyBeVisible() {
|
||||||
|
|||||||