Adding ability to add to hotseat from spring loaded mode (5064141).
- Fixing regression where folder items had no text in tablet ui and assets - Fixing spring loaded frame sizing (5067335) - Making the cells 80x80 for testing again on the phone ui (5085986) Change-Id: I52a0f5eaf2dcf4adaf57c5a71da3903892c490a8
After Width: | Height: | Size: 14 KiB |
After Width: | Height: | Size: 18 KiB |
Before Width: | Height: | Size: 5.8 KiB |
Before Width: | Height: | Size: 7.1 KiB After Width: | Height: | Size: 7.3 KiB |
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 10 KiB |
After Width: | Height: | Size: 22 KiB |
After Width: | Height: | Size: 30 KiB |
|
@ -15,11 +15,11 @@
|
|||
-->
|
||||
|
||||
<!-- The workspace contains 5 screens of cells -->
|
||||
|
||||
<com.android.launcher2.Workspace
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:launcher="http://schemas.android.com/apk/res/com.android.launcher"
|
||||
android:paddingTop="?android:attr/actionBarSize"
|
||||
android:paddingBottom="10dp"
|
||||
android:paddingTop="@dimen/workspace_content_large_only_top_margin"
|
||||
launcher:defaultScreen="2"
|
||||
launcher:pageSpacing="@dimen/workspace_page_spacing">
|
||||
<include android:id="@+id/cell1" layout="@layout/workspace_screen" />
|
||||
|
|
|
@ -51,6 +51,8 @@
|
|||
android:id="@+id/workspace"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:paddingTop="@dimen/qsb_bar_height"
|
||||
android:paddingBottom="@dimen/button_bar_height"
|
||||
launcher:defaultScreen="2"
|
||||
launcher:cellCountX="4"
|
||||
launcher:cellCountY="4"
|
||||
|
|
|
@ -17,9 +17,8 @@
|
|||
<com.android.launcher2.CellLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:launcher="http://schemas.android.com/apk/res/com.android.launcher"
|
||||
style="@style/WorkspaceScreen"
|
||||
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:paddingLeft="@dimen/workspace_left_padding"
|
||||
android:paddingRight="@dimen/workspace_right_padding"
|
||||
android:paddingTop="@dimen/workspace_top_padding"
|
||||
|
|
|
@ -20,8 +20,11 @@
|
|||
<dimen name="toolbar_button_horizontal_padding">10dip</dimen>
|
||||
|
||||
<!-- Workspace -->
|
||||
<dimen name="workspace_left_padding">@dimen/qsb_bar_height</dimen>
|
||||
<dimen name="workspace_right_padding">@dimen/button_bar_height</dimen>
|
||||
<!-- Block spacing on each side of the screen -->
|
||||
<dimen name="workspace_left_padding">12dp</dimen>
|
||||
<dimen name="workspace_right_padding">12dp</dimen>
|
||||
<!-- We need top/bottom padding for portals to look right, but
|
||||
really only in spring loaded mode... -->
|
||||
<dimen name="workspace_top_padding">0dp</dimen>
|
||||
<dimen name="workspace_bottom_padding">0dp</dimen>
|
||||
<dimen name="workspace_page_spacing">8dp</dimen>
|
||||
|
|
|
@ -18,6 +18,11 @@
|
|||
-->
|
||||
|
||||
<resources>
|
||||
<!-- Workspace -->
|
||||
<style name="WorkspaceScreen">
|
||||
<item name="android:layout_width">wrap_content</item>
|
||||
<item name="android:layout_height">match_parent</item>
|
||||
</style>
|
||||
<!-- Search Bar -->
|
||||
<style name="SearchDropTargetBar">
|
||||
<item name="android:orientation">vertical</item>
|
||||
|
|
|
@ -16,10 +16,11 @@
|
|||
|
||||
<resources>
|
||||
<!-- Workspace -->
|
||||
<dimen name="workspace_left_padding">25dip</dimen>
|
||||
<dimen name="workspace_right_padding">25dip</dimen>
|
||||
<dimen name="workspace_top_padding">15dip</dimen>
|
||||
<dimen name="workspace_bottom_padding">15dip</dimen>
|
||||
<dimen name="workspace_left_padding">24dip</dimen>
|
||||
<dimen name="workspace_right_padding">24dip</dimen>
|
||||
<!-- We need padding on the screens for portals to look right -->
|
||||
<dimen name="workspace_top_padding">12dip</dimen>
|
||||
<dimen name="workspace_bottom_padding">12dip</dimen>
|
||||
<dimen name="workspace_width_gap">32dp</dimen>
|
||||
<dimen name="workspace_height_gap">2dp</dimen>
|
||||
<dimen name="workspace_page_spacing">50dp</dimen>
|
||||
|
|
|
@ -21,9 +21,13 @@
|
|||
|
||||
<!-- Workspace -->
|
||||
<dimen name="qsb_bar_height">56dp</dimen>
|
||||
|
||||
<!-- This should be @dimen/qsb_bar_height - @dimen/workspace_top_padding
|
||||
to fix the extra space given to draw portals -->
|
||||
<dimen name="workspace_content_large_only_top_margin">36dp</dimen>
|
||||
<dimen name="workspace_cell_width">96dip</dimen>
|
||||
<dimen name="workspace_cell_height">96dip</dimen>
|
||||
<dimen name="folder_cell_width">96dp</dimen>
|
||||
<dimen name="folder_cell_height">96dp</dimen>
|
||||
|
||||
<!-- AppsCustomize -->
|
||||
<dimen name="apps_customize_tab_bar_height">56dp</dimen>
|
||||
|
|
|
@ -18,10 +18,10 @@
|
|||
<!-- Workspace -->
|
||||
<dimen name="workspace_left_padding">0dp</dimen>
|
||||
<dimen name="workspace_right_padding">0dp</dimen>
|
||||
<!-- We use the qsb_bar_height (48dp) + 12dp extra padding -->
|
||||
<dimen name="workspace_top_padding">60dp</dimen>
|
||||
<!-- We use the button_bar_height (80dp) + 12dp extra padding -->
|
||||
<dimen name="workspace_bottom_padding">96dp</dimen>
|
||||
<!-- Block spacing on each side of the screen. And also padding
|
||||
for the portals to look right. -->
|
||||
<dimen name="workspace_top_padding">12dp</dimen>
|
||||
<dimen name="workspace_bottom_padding">12dp</dimen>
|
||||
<dimen name="workspace_page_spacing">8dp</dimen>
|
||||
|
||||
<integer name="apps_customize_cellCountX">4</integer>
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
<?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.
|
||||
*/
|
||||
-->
|
||||
|
||||
<resources>
|
||||
<!-- Workspace -->
|
||||
<style name="WorkspaceScreen">
|
||||
<item name="android:layout_width">match_parent</item>
|
||||
<item name="android:layout_height">wrap_content</item>
|
||||
</style>
|
||||
</resources>
|
|
@ -21,7 +21,7 @@
|
|||
<dimen name="workspace_cell_height">80dp</dimen>
|
||||
<dimen name="workspace_width_gap">-1dp</dimen>
|
||||
<dimen name="workspace_height_gap">-1dp</dimen>
|
||||
<dimen name="workspace_max_gap">8dp</dimen>
|
||||
<dimen name="workspace_max_gap">16dp</dimen>
|
||||
<dimen name="folder_cell_width">74dp</dimen>
|
||||
<dimen name="folder_cell_height">80dp</dimen>
|
||||
<dimen name="workspace_divider_padding_left">12dp</dimen>
|
||||
|
|
|
@ -183,7 +183,9 @@ public class AppsCustomizeTabHost extends TabHost implements LauncherTransitiona
|
|||
anim.addListener(new AnimatorListenerAdapter() {
|
||||
@Override
|
||||
public void onAnimationEnd(android.animation.Animator animation) {
|
||||
mAppsCustomizePane.flashScrollingIndicator();
|
||||
if (!LauncherApplication.isScreenLarge()) {
|
||||
mAppsCustomizePane.flashScrollingIndicator();
|
||||
}
|
||||
}
|
||||
});
|
||||
anim.start();
|
||||
|
@ -250,7 +252,7 @@ public class AppsCustomizeTabHost extends TabHost implements LauncherTransitiona
|
|||
setLayerType(LAYER_TYPE_NONE, null);
|
||||
}
|
||||
|
||||
if (!toWorkspace) {
|
||||
if (!toWorkspace && !LauncherApplication.isScreenLarge()) {
|
||||
mAppsCustomizePane.flashScrollingIndicator();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -906,11 +906,6 @@ public class CellLayout extends ViewGroup {
|
|||
int vFreeSpace = vSpace - (mCountY * mOriginalCellHeight);
|
||||
mWidthGap = Math.min(mMaxGap, numWidthGaps > 0 ? (hFreeSpace / numWidthGaps) : 0);
|
||||
mHeightGap = Math.min(mMaxGap,numHeightGaps > 0 ? (vFreeSpace / numHeightGaps) : 0);
|
||||
int remainingHSpace = hFreeSpace - (numWidthGaps * mWidthGap);
|
||||
int remainingVSpace = vFreeSpace - (numHeightGaps * mHeightGap);
|
||||
mCellWidth = mOriginalCellWidth + remainingHSpace / mCountX;
|
||||
mCellHeight = mOriginalCellHeight + remainingVSpace / mCountY;
|
||||
|
||||
mChildren.setCellDimensions(mCellWidth, mCellHeight, mWidthGap, mHeightGap);
|
||||
} else {
|
||||
mWidthGap = mOriginalWidthGap;
|
||||
|
|
|
@ -2040,6 +2040,7 @@ public final class Launcher extends Activity
|
|||
|
||||
// Shrink workspaces away if going to AppsCustomize from workspace
|
||||
mWorkspace.shrink(Workspace.State.SMALL, animated);
|
||||
hideHotseat(animated);
|
||||
|
||||
if (animated) {
|
||||
final ValueAnimator scaleAnim = ValueAnimator.ofFloat(0f, 1f).setDuration(duration);
|
||||
|
@ -2141,6 +2142,7 @@ public final class Launcher extends Activity
|
|||
if (!springLoaded) {
|
||||
mWorkspace.unshrink(animated);
|
||||
}
|
||||
showHotseat(animated);
|
||||
if (animated) {
|
||||
if (mStateAnimation != null) mStateAnimation.cancel();
|
||||
mStateAnimation = new AnimatorSet();
|
||||
|
@ -2297,7 +2299,6 @@ public final class Launcher extends Activity
|
|||
|
||||
// Hide the search bar and hotseat
|
||||
mSearchDeleteBar.hideSearchBar(animated);
|
||||
hideHotseat(animated);
|
||||
|
||||
// Change the state *after* we've called all the transition code
|
||||
mState = State.APPS_CUSTOMIZE;
|
||||
|
@ -2357,7 +2358,6 @@ public final class Launcher extends Activity
|
|||
|
||||
// Show the search bar and hotseat
|
||||
mSearchDeleteBar.showSearchBar(animated);
|
||||
showHotseat(animated);
|
||||
|
||||
// Set focus to the AppsCustomize button
|
||||
if (mAllAppsButton != null) {
|
||||
|
|
|
@ -19,6 +19,7 @@ package com.android.launcher2;
|
|||
import android.app.Application;
|
||||
import android.app.SearchManager;
|
||||
import android.content.ContentResolver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.content.res.Configuration;
|
||||
|
@ -116,6 +117,11 @@ public class LauncherApplication extends Application {
|
|||
return sIsScreenLarge;
|
||||
}
|
||||
|
||||
public static boolean isScreenLandscape(Context context) {
|
||||
return context.getResources().getConfiguration().orientation ==
|
||||
Configuration.ORIENTATION_LANDSCAPE;
|
||||
}
|
||||
|
||||
public static float getScreenDensity() {
|
||||
return sScreenDensity;
|
||||
}
|
||||
|
|
|
@ -578,9 +578,9 @@ public abstract class PagedView extends ViewGroup {
|
|||
protected void updateAdjacentPagesAlpha() {
|
||||
if (mFadeInAdjacentScreens) {
|
||||
if (mDirtyPageAlpha || (mTouchState == TOUCH_STATE_SCROLLING) || !mScroller.isFinished()) {
|
||||
int screenWidth = getMeasuredWidth();
|
||||
int screenWidth = getMeasuredWidth() - mPaddingLeft - mPaddingRight;
|
||||
int halfScreenSize = screenWidth / 2;
|
||||
int screenCenter = mScrollX + halfScreenSize;
|
||||
int screenCenter = mScrollX + halfScreenSize + mPaddingLeft;
|
||||
final int childCount = getChildCount();
|
||||
for (int i = 0; i < childCount; ++i) {
|
||||
View layout = (View) getChildAt(i);
|
||||
|
@ -1265,11 +1265,13 @@ public abstract class PagedView extends ViewGroup {
|
|||
}
|
||||
|
||||
protected int getRelativeChildOffset(int index) {
|
||||
return (getMeasuredWidth() - getChildWidth(index)) / 2;
|
||||
int padding = mPaddingLeft + mPaddingRight;
|
||||
return mPaddingLeft + (getMeasuredWidth() - padding - getChildWidth(index)) / 2;
|
||||
}
|
||||
|
||||
protected int getScaledRelativeChildOffset(int index) {
|
||||
return (getMeasuredWidth() - getScaledMeasuredWidth(getChildAt(index))) / 2;
|
||||
int padding = mPaddingLeft + mPaddingRight;
|
||||
return mPaddingLeft + (getMeasuredWidth() - padding -
|
||||
getScaledMeasuredWidth(getChildAt(index))) / 2;
|
||||
}
|
||||
|
||||
protected int getChildOffset(int index) {
|
||||
|
@ -1762,7 +1764,7 @@ public abstract class PagedView extends ViewGroup {
|
|||
|
||||
int numPages = getChildCount();
|
||||
int pageWidth = getMeasuredWidth();
|
||||
int maxPageWidth = (numPages * getMeasuredWidth()) + ((numPages - 1) * mPageSpacing);
|
||||
int maxPageWidth = (numPages * getChildWidth(0)) + ((numPages - 1) * mPageSpacing);
|
||||
int trackWidth = pageWidth - mScrollIndicatorPaddingLeft - mScrollIndicatorPaddingRight;
|
||||
int indicatorWidth = mScrollIndicator.getMeasuredWidth() -
|
||||
mScrollIndicator.getPaddingLeft() - mScrollIndicator.getPaddingRight();
|
||||
|
|
|
@ -261,7 +261,10 @@ public class Workspace extends SmoothPagedView
|
|||
setDataIsReady();
|
||||
|
||||
if (!LauncherApplication.isScreenLarge()) {
|
||||
mFadeInAdjacentScreens = false;
|
||||
mCenterPagesVertically = false;
|
||||
if (!LauncherApplication.isScreenLandscape(context)) {
|
||||
mFadeInAdjacentScreens = false;
|
||||
}
|
||||
}
|
||||
|
||||
mWallpaperManager = WallpaperManager.getInstance(context);
|
||||
|
@ -1335,7 +1338,7 @@ public class Workspace extends SmoothPagedView
|
|||
}
|
||||
|
||||
// we use this to shrink the workspace for the all apps view and the customize view
|
||||
public void shrink(State shrinkState, boolean animated) {
|
||||
public void shrink(final State shrinkState, boolean animated) {
|
||||
if (mFirstLayout) {
|
||||
// (mFirstLayout == "first layout has not happened yet")
|
||||
// if we get a call to shrink() as part of our initialization (for example, if
|
||||
|
@ -1527,6 +1530,14 @@ public class Workspace extends SmoothPagedView
|
|||
cl.setFastAlpha(a * mOldAlphas[i] + b * mNewAlphas[i]);
|
||||
cl.setFastRotationY(a * mOldRotationYs[i] + b * mNewRotationYs[i]);
|
||||
}
|
||||
|
||||
// Shrink the hotset the same amount we are shrinking the screens
|
||||
if (shrinkState == State.SPRING_LOADED && mLauncher.getHotseat() != null) {
|
||||
View hotseat = mLauncher.getHotseat().getLayout();
|
||||
hotseat.fastInvalidate();
|
||||
hotseat.setFastScaleX(a * mOldScaleXs[0] + b * mNewScaleXs[0]);
|
||||
hotseat.setFastScaleY(a * mOldScaleXs[0] + b * mNewScaleXs[0]);
|
||||
}
|
||||
}
|
||||
});
|
||||
mAnimator.playTogether(animWithInterpolator);
|
||||
|
@ -1705,7 +1716,7 @@ public class Workspace extends SmoothPagedView
|
|||
mNewRotationYs = new float[childCount];
|
||||
}
|
||||
|
||||
void unshrink(boolean animated, boolean springLoaded) {
|
||||
void unshrink(boolean animated, final boolean springLoaded) {
|
||||
if (mFirstLayout) {
|
||||
// (mFirstLayout == "first layout has not happened yet")
|
||||
// cancel any pending shrinks that were set earlier
|
||||
|
@ -1742,18 +1753,22 @@ public class Workspace extends SmoothPagedView
|
|||
final CellLayout cl = (CellLayout)getChildAt(i);
|
||||
float finalAlphaValue = 0f;
|
||||
float rotation = 0f;
|
||||
if (LauncherApplication.isScreenLarge()) {
|
||||
finalAlphaValue = (i == mCurrentPage) ? 1.0f : 0.0f;
|
||||
|
||||
// Set the final alpha depending on whether we are fading side pages. On phone ui,
|
||||
// we don't do any of the rotation, or the fading alpha in portrait. See the
|
||||
// ctor and screenScrolled().
|
||||
if (mFadeInAdjacentScreens) {
|
||||
finalAlphaValue = (i == mCurrentPage) ? 1f : 0f;
|
||||
} else {
|
||||
finalAlphaValue = 1f;
|
||||
}
|
||||
|
||||
if (LauncherApplication.isScreenLarge()) {
|
||||
if (i < mCurrentPage) {
|
||||
rotation = WORKSPACE_ROTATION;
|
||||
} else if (i > mCurrentPage) {
|
||||
rotation = -WORKSPACE_ROTATION;
|
||||
}
|
||||
} else {
|
||||
// Don't hide the side panes on the phone if we don't also update the side pages
|
||||
// alpha. See screenScrolled().
|
||||
finalAlphaValue = 1f;
|
||||
}
|
||||
float finalAlphaMultiplierValue = 1f;
|
||||
|
||||
|
@ -1864,6 +1879,14 @@ public class Workspace extends SmoothPagedView
|
|||
b * mNewBackgroundAlphaMultipliers[i]);
|
||||
cl.setFastAlpha(a * mOldAlphas[i] + b * mNewAlphas[i]);
|
||||
}
|
||||
|
||||
// Unshrink the hotset the same amount we are unshrinking the screens
|
||||
if (mLauncher.getHotseat() != null) {
|
||||
View hotseat = mLauncher.getHotseat().getLayout();
|
||||
hotseat.fastInvalidate();
|
||||
hotseat.setFastScaleX(a * mOldScaleXs[0] + b * mNewScaleXs[0]);
|
||||
hotseat.setFastScaleY(a * mOldScaleXs[0] + b * mNewScaleXs[0]);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -2259,7 +2282,8 @@ public class Workspace extends SmoothPagedView
|
|||
// new current/default screen, so any subsequent taps add items to that screen
|
||||
if (!mLauncher.isAllAppsVisible()) {
|
||||
int dragTargetIndex = indexOfChild(mDragTargetLayout);
|
||||
if (mCurrentPage != dragTargetIndex && (isSmall() || mIsSwitchingState)) {
|
||||
if (dragTargetIndex > -1 && mCurrentPage != dragTargetIndex &&
|
||||
(isSmall() || mIsSwitchingState)) {
|
||||
scrollToNewPageWithoutMovingPages(dragTargetIndex);
|
||||
}
|
||||
}
|
||||
|
@ -2767,19 +2791,27 @@ public class Workspace extends SmoothPagedView
|
|||
if (mInScrollArea) return;
|
||||
if (mIsSwitchingState) return;
|
||||
|
||||
Rect r = new Rect();
|
||||
CellLayout layout = null;
|
||||
ItemInfo item = (ItemInfo) d.dragInfo;
|
||||
|
||||
// Ensure that we have proper spans for the item that we are dropping
|
||||
if (item.spanX < 0 || item.spanY < 0) throw new RuntimeException("Improper spans found");
|
||||
|
||||
mDragViewVisualCenter = getDragViewVisualCenter(d.x, d.y, d.xOffset, d.yOffset,
|
||||
d.dragView, mDragViewVisualCenter);
|
||||
d.dragView, mDragViewVisualCenter);
|
||||
|
||||
// Identify whether we have dragged over a side page
|
||||
if (isSmall()) {
|
||||
layout = findMatchingPageForDragOver(d.dragView, mDragViewVisualCenter[0],
|
||||
if (mLauncher.getHotseat() != null) {
|
||||
mLauncher.getHotseat().getHitRect(r);
|
||||
if (r.contains(d.x, d.y)) {
|
||||
layout = mLauncher.getHotseat().getLayout();
|
||||
}
|
||||
}
|
||||
if (layout == null) {
|
||||
layout = findMatchingPageForDragOver(d.dragView, mDragViewVisualCenter[0],
|
||||
mDragViewVisualCenter[1], true);
|
||||
}
|
||||
if (layout != mDragTargetLayout) {
|
||||
// Cancel all intermediate folder states
|
||||
cleanupFolderCreation(d);
|
||||
|
@ -2798,12 +2830,15 @@ public class Workspace extends SmoothPagedView
|
|||
|
||||
boolean isInSpringLoadedMode = (mState == State.SPRING_LOADED);
|
||||
if (isInSpringLoadedMode) {
|
||||
mSpringLoadedDragController.setAlarm(mDragTargetLayout);
|
||||
if (mLauncher.isHotseatLayout(layout)) {
|
||||
mSpringLoadedDragController.cancel();
|
||||
} else {
|
||||
mSpringLoadedDragController.setAlarm(mDragTargetLayout);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Test to see if we are over the hotseat otherwise just use the current page
|
||||
Rect r = new Rect();
|
||||
if (mLauncher.getHotseat() != null) {
|
||||
mLauncher.getHotseat().getHitRect(r);
|
||||
if (r.contains(d.x, d.y)) {
|
||||
|
|