[Overview Actions] Adjust the select mode taskview UI. am: dc48fc4f84
Change-Id: Ie3b94689faf8f0110b0130e46743989316b4eb24
This commit is contained in:
commit
3e1001247d
|
@ -21,7 +21,6 @@ import android.graphics.Rect;
|
|||
|
||||
import com.android.launcher3.BaseDraggingActivity;
|
||||
import com.android.launcher3.Launcher;
|
||||
import com.android.launcher3.R;
|
||||
import com.android.launcher3.userevent.nano.LauncherLogProto.ContainerType;
|
||||
import com.android.quickstep.views.RecentsView;
|
||||
|
||||
|
@ -64,10 +63,10 @@ public class OverviewModalTaskState extends OverviewState {
|
|||
Rect out = new Rect();
|
||||
activity.<RecentsView>getOverviewPanel().getTaskSize(out);
|
||||
int taskHeight = out.height();
|
||||
float topMargin = res.getDimension(R.dimen.task_thumbnail_top_margin);
|
||||
float bottomMargin = res.getDimension(R.dimen.overview_actions_top_margin);
|
||||
float newHeight = taskHeight + topMargin + bottomMargin;
|
||||
float scale = newHeight / taskHeight;
|
||||
activity.<RecentsView>getOverviewPanel().getModalTaskSize(out);
|
||||
int newHeight = out.height();
|
||||
|
||||
float scale = (float) newHeight / taskHeight;
|
||||
|
||||
return new float[] {scale, NO_OFFSET};
|
||||
}
|
||||
|
|
|
@ -145,8 +145,6 @@ public class OverviewActionsView<T extends OverlayUICallbacks> extends FrameLayo
|
|||
|
||||
/** Updates vertical margins for different navigation mode. */
|
||||
public void updateVerticalMarginForNavModeChange(Mode mode) {
|
||||
int topMargin = getResources()
|
||||
.getDimensionPixelSize(R.dimen.overview_actions_top_margin);
|
||||
int bottomMargin = 0;
|
||||
if (mode == Mode.THREE_BUTTONS) {
|
||||
bottomMargin = getResources()
|
||||
|
@ -157,6 +155,6 @@ public class OverviewActionsView<T extends OverlayUICallbacks> extends FrameLayo
|
|||
}
|
||||
LayoutParams params = (LayoutParams) getLayoutParams();
|
||||
params.setMargins(
|
||||
params.leftMargin, topMargin, params.rightMargin, bottomMargin);
|
||||
params.leftMargin, params.topMargin, params.rightMargin, bottomMargin);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -839,6 +839,11 @@ public abstract class RecentsView<T extends BaseActivity> extends PagedView impl
|
|||
mSizeStrategy.calculateTaskSize(mActivity, mActivity.getDeviceProfile(), outRect);
|
||||
}
|
||||
|
||||
/** Gets the task size for modal state. */
|
||||
public void getModalTaskSize(Rect outRect) {
|
||||
mSizeStrategy.calculateModalTaskSize(mActivity, mActivity.getDeviceProfile(), outRect);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean computeScrollHelper() {
|
||||
boolean scrolling = super.computeScrollHelper();
|
||||
|
@ -2155,18 +2160,6 @@ public abstract class RecentsView<T extends BaseActivity> extends PagedView impl
|
|||
updatePageOffsets();
|
||||
if (getCurrentPageTaskView() != null) {
|
||||
getCurrentPageTaskView().setModalness(modalness);
|
||||
TaskView tv = getCurrentPageTaskView();
|
||||
|
||||
// Move the task view up as it scales...
|
||||
// ...the icon on taskview is hidden in modal state, so consider the top of the task
|
||||
mTempFloatPoint[0] = 0;
|
||||
mTempFloatPoint[1] = tv.getTop() + mTaskTopMargin;
|
||||
// ...find the top after the transformation
|
||||
getMatrix().mapPoints(mTempFloatPoint);
|
||||
|
||||
// ...make it match the top inset
|
||||
float calcOffset = (mInsets.top - mTempFloatPoint[1]) * mTaskModalness;
|
||||
tv.setTranslationY(calcOffset);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -24,7 +24,6 @@
|
|||
|
||||
<!-- Overrideable in overlay that provides the Overview Actions. -->
|
||||
<dimen name="overview_actions_height">66dp</dimen>
|
||||
<dimen name="overview_actions_top_margin">44dp</dimen>
|
||||
<dimen name="overview_actions_bottom_margin_gesture">16dp</dimen>
|
||||
<dimen name="overview_actions_bottom_margin_three_button">8dp</dimen>
|
||||
<dimen name="overview_actions_horizontal_margin">16dp</dimen>
|
||||
|
@ -64,6 +63,7 @@
|
|||
<dimen name="task_card_menu_horizontal_padding">0dp</dimen>
|
||||
<dimen name="portrait_task_card_horz_space">136dp</dimen>
|
||||
<dimen name="portrait_task_card_horz_space_big_overview">96dp</dimen>
|
||||
<dimen name="portrait_modal_task_card_horz_space">60dp</dimen>
|
||||
<dimen name="landscape_task_card_horz_space">200dp</dimen>
|
||||
<dimen name="multi_window_task_card_horz_space">100dp</dimen>
|
||||
<!-- Copied from framework resource:
|
||||
|
|
|
@ -109,6 +109,68 @@ public abstract class WindowSizeStrategy {
|
|||
Math.round(x) + Math.round(outWidth), Math.round(y) + Math.round(outHeight));
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculates the modal taskView size for the provided device configuration
|
||||
*/
|
||||
public void calculateModalTaskSize(Context context, DeviceProfile dp, Rect outRect) {
|
||||
float taskWidth, taskHeight, paddingHorz;
|
||||
Resources res = context.getResources();
|
||||
Rect insets = dp.getInsets();
|
||||
|
||||
if (dp.isMultiWindowMode) {
|
||||
getMultiWindowSize(context, dp, mTempPoint);
|
||||
taskWidth = mTempPoint.x;
|
||||
taskHeight = mTempPoint.y;
|
||||
paddingHorz = res.getDimension(R.dimen.multi_window_task_card_horz_space);
|
||||
} else {
|
||||
taskWidth = dp.availableWidthPx;
|
||||
taskHeight = dp.availableHeightPx;
|
||||
|
||||
final int paddingResId;
|
||||
if (dp.isVerticalBarLayout()) {
|
||||
paddingResId = R.dimen.landscape_task_card_horz_space;
|
||||
} else {
|
||||
paddingResId = R.dimen.portrait_modal_task_card_horz_space;
|
||||
}
|
||||
paddingHorz = res.getDimension(paddingResId);
|
||||
}
|
||||
|
||||
// Note this should be same as dp.availableWidthPx and dp.availableHeightPx unless
|
||||
// we override the insets ourselves.
|
||||
int launcherVisibleWidth = dp.widthPx - insets.left - insets.right;
|
||||
int launcherVisibleHeight = dp.heightPx - insets.top - insets.bottom;
|
||||
|
||||
// Calculate for the overview height.
|
||||
float overviewActionsHeight = getOverviewActionsHeight(context);
|
||||
float availableHeight = launcherVisibleHeight - overviewActionsHeight;
|
||||
float availableWidth = launcherVisibleWidth - paddingHorz;
|
||||
|
||||
float scale = Math.min(availableWidth / taskWidth, availableHeight / taskHeight);
|
||||
float outWidth = scale * taskWidth;
|
||||
float outHeight = scale * taskHeight;
|
||||
|
||||
// Center in the visible space
|
||||
float x = insets.left + (launcherVisibleWidth - outWidth) / 2;
|
||||
float y = insets.top + (launcherVisibleHeight - overviewActionsHeight - outHeight) / 2;
|
||||
outRect.set(Math.round(x), Math.round(y),
|
||||
Math.round(x) + Math.round(outWidth), Math.round(y) + Math.round(outHeight));
|
||||
}
|
||||
|
||||
/** Gets the space that the overview actions will take, including margins. */
|
||||
public float getOverviewActionsHeight(Context context) {
|
||||
Resources res = context.getResources();
|
||||
float actionsBottomMargin = 0;
|
||||
if (getMode(context) == Mode.THREE_BUTTONS) {
|
||||
actionsBottomMargin = res.getDimensionPixelSize(
|
||||
R.dimen.overview_actions_bottom_margin_three_button);
|
||||
} else {
|
||||
actionsBottomMargin = res.getDimensionPixelSize(
|
||||
R.dimen.overview_actions_bottom_margin_gesture);
|
||||
}
|
||||
float overviewActionsHeight = actionsBottomMargin
|
||||
+ res.getDimensionPixelSize(R.dimen.overview_actions_height);
|
||||
return overviewActionsHeight;
|
||||
}
|
||||
|
||||
public static final WindowSizeStrategy LAUNCHER_ACTIVITY_SIZE_STRATEGY =
|
||||
new WindowSizeStrategy(true) {
|
||||
|
@ -138,17 +200,7 @@ public abstract class WindowSizeStrategy {
|
|||
if (showOverviewActions(context)) {
|
||||
//TODO: this needs to account for the swipe gesture height and accessibility
|
||||
// UI when shown.
|
||||
float actionsBottomMargin = 0;
|
||||
if (getMode(context) == Mode.THREE_BUTTONS) {
|
||||
actionsBottomMargin = res.getDimensionPixelSize(
|
||||
R.dimen.overview_actions_bottom_margin_three_button);
|
||||
} else {
|
||||
actionsBottomMargin = res.getDimensionPixelSize(
|
||||
R.dimen.overview_actions_bottom_margin_gesture);
|
||||
}
|
||||
float actionsHeight = actionsBottomMargin
|
||||
+ res.getDimensionPixelSize(R.dimen.overview_actions_height);
|
||||
return actionsHeight;
|
||||
return getOverviewActionsHeight(context);
|
||||
} else {
|
||||
return getDefaultSwipeHeight(context, dp) + dp.workspacePageIndicatorHeight
|
||||
+ res.getDimensionPixelSize(
|
||||
|
|
Loading…
Reference in New Issue