am bc239a15: Scale icons down for sw600dp-land mode.
* commit 'bc239a15464f543a41b960b946aa77258454efaf': Scale icons down for sw600dp-land mode.
This commit is contained in:
@@ -15,8 +15,9 @@
|
|||||||
-->
|
-->
|
||||||
|
|
||||||
<resources>
|
<resources>
|
||||||
<dimen name="app_icon_size">65dp</dimen>
|
<dimen name="app_icon_padding_top">0dp</dimen>
|
||||||
<dimen name="app_icon_padding_top">2dp</dimen>
|
<dimen name="app_icon_drawable_padding_land">0dp</dimen>
|
||||||
|
<integer name="app_icon_scale_percent">90</integer>
|
||||||
|
|
||||||
<!-- Hotseat -->
|
<!-- Hotseat -->
|
||||||
<dimen name="hotseat_cell_width">75dp</dimen>
|
<dimen name="hotseat_cell_width">75dp</dimen>
|
||||||
@@ -27,6 +28,7 @@
|
|||||||
<dimen name="workspace_cell_height">86dp</dimen>
|
<dimen name="workspace_cell_height">86dp</dimen>
|
||||||
<dimen name="workspace_width_gap">32dp</dimen>
|
<dimen name="workspace_width_gap">32dp</dimen>
|
||||||
<dimen name="workspace_height_gap">0dp</dimen>
|
<dimen name="workspace_height_gap">0dp</dimen>
|
||||||
|
<dimen name="workspace_icon_text_size">11sp</dimen>
|
||||||
|
|
||||||
<!-- Folders -->
|
<!-- Folders -->
|
||||||
<!-- The size of the image which sits behind the preview of the folder contents -->
|
<!-- The size of the image which sits behind the preview of the folder contents -->
|
||||||
|
|||||||
@@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
<resources>
|
<resources>
|
||||||
<!-- Workspace -->
|
<!-- Workspace -->
|
||||||
|
<integer name="app_icon_scale_percent">-1</integer>
|
||||||
<dimen name="workspace_width_gap">0dp</dimen>
|
<dimen name="workspace_width_gap">0dp</dimen>
|
||||||
<dimen name="workspace_height_gap">32dp</dimen>
|
<dimen name="workspace_height_gap">32dp</dimen>
|
||||||
|
|
||||||
|
|||||||
@@ -37,7 +37,7 @@
|
|||||||
<dimen name="external_drop_icon_rect_radius">10dp</dimen>
|
<dimen name="external_drop_icon_rect_radius">10dp</dimen>
|
||||||
|
|
||||||
<!-- Size of icons in workspace -->
|
<!-- Size of icons in workspace -->
|
||||||
<dimen name="app_icon_size">72dp</dimen>
|
<integer name="app_icon_scale_percent">-1</integer>
|
||||||
<integer name="app_icon_hotseat_scale_percent">-1</integer>
|
<integer name="app_icon_hotseat_scale_percent">-1</integer>
|
||||||
|
|
||||||
<!-- extra horizontal spacing between mini screen thumbnails ie. in all
|
<!-- extra horizontal spacing between mini screen thumbnails ie. in all
|
||||||
|
|||||||
@@ -47,8 +47,10 @@
|
|||||||
<dimen name="hotseat_width_gap">-1dp</dimen>
|
<dimen name="hotseat_width_gap">-1dp</dimen>
|
||||||
<dimen name="hotseat_height_gap">-1dp</dimen>
|
<dimen name="hotseat_height_gap">-1dp</dimen>
|
||||||
<dimen name="workspace_overscroll_drawable_padding">0dp</dimen>
|
<dimen name="workspace_overscroll_drawable_padding">0dp</dimen>
|
||||||
|
<dimen name="workspace_icon_text_size">12sp</dimen>
|
||||||
|
|
||||||
<dimen name="app_icon_drawable_padding">6dp</dimen>
|
<dimen name="app_icon_drawable_padding">6dp</dimen>
|
||||||
|
<dimen name="app_icon_drawable_padding_land">2dp</dimen>
|
||||||
<dimen name="app_icon_padding_top">8dp</dimen>
|
<dimen name="app_icon_padding_top">8dp</dimen>
|
||||||
|
|
||||||
<!-- QSB -->
|
<!-- QSB -->
|
||||||
@@ -66,6 +68,7 @@
|
|||||||
<dimen name="apps_customize_tab_bar_height">52dp</dimen>
|
<dimen name="apps_customize_tab_bar_height">52dp</dimen>
|
||||||
<dimen name="apps_customize_tab_bar_margin_top">0dp</dimen>
|
<dimen name="apps_customize_tab_bar_margin_top">0dp</dimen>
|
||||||
<dimen name="app_icon_size">48dp</dimen>
|
<dimen name="app_icon_size">48dp</dimen>
|
||||||
|
<integer name="app_icon_scale_percent">-1</integer>
|
||||||
<integer name="app_icon_hotseat_scale_percent">-1</integer>
|
<integer name="app_icon_hotseat_scale_percent">-1</integer>
|
||||||
<!-- The width can be 72dp because we don't have L/R padding -->
|
<!-- The width can be 72dp because we don't have L/R padding -->
|
||||||
<dimen name="apps_customize_cell_width">74dp</dimen>
|
<dimen name="apps_customize_cell_width">74dp</dimen>
|
||||||
|
|||||||
@@ -62,7 +62,7 @@
|
|||||||
<item name="android:gravity">center_horizontal</item>
|
<item name="android:gravity">center_horizontal</item>
|
||||||
<item name="android:singleLine">true</item>
|
<item name="android:singleLine">true</item>
|
||||||
<item name="android:ellipsize">marquee</item>
|
<item name="android:ellipsize">marquee</item>
|
||||||
<item name="android:textSize">12sp</item>
|
<item name="android:textSize">@dimen/workspace_icon_text_size</item>
|
||||||
<item name="android:textColor">@color/workspace_icon_text_color</item>
|
<item name="android:textColor">@color/workspace_icon_text_color</item>
|
||||||
<item name="android:shadowRadius">2.0</item>
|
<item name="android:shadowRadius">2.0</item>
|
||||||
<item name="android:shadowColor">#B0000000</item>
|
<item name="android:shadowColor">#B0000000</item>
|
||||||
@@ -77,7 +77,7 @@
|
|||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style name="WorkspaceIcon.Landscape">
|
<style name="WorkspaceIcon.Landscape">
|
||||||
<item name="android:drawablePadding">2dp</item>
|
<item name="android:drawablePadding">@dimen/app_icon_drawable_padding_land</item>
|
||||||
<item name="android:paddingLeft">4dp</item>
|
<item name="android:paddingLeft">4dp</item>
|
||||||
<item name="android:paddingRight">4dp</item>
|
<item name="android:paddingRight">4dp</item>
|
||||||
<item name="android:paddingTop">@dimen/app_icon_padding_top</item>
|
<item name="android:paddingTop">@dimen/app_icon_padding_top</item>
|
||||||
|
|||||||
@@ -289,7 +289,7 @@ public class BubbleTextView extends TextView {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// If text is transparent, don't draw any shadow
|
// If text is transparent, don't draw any shadow
|
||||||
if (getCurrentTextColor() == android.R.color.transparent) {
|
if (getCurrentTextColor() == getResources().getColor(android.R.color.transparent)) {
|
||||||
getPaint().clearShadowLayer();
|
getPaint().clearShadowLayer();
|
||||||
super.draw(canvas);
|
super.draw(canvas);
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -138,6 +138,7 @@ public class CellLayout extends ViewGroup {
|
|||||||
|
|
||||||
private boolean mIsHotseat = false;
|
private boolean mIsHotseat = false;
|
||||||
private final int mBubbleScalePercent;
|
private final int mBubbleScalePercent;
|
||||||
|
private final int mBubbleHotseatScalePercent;
|
||||||
|
|
||||||
public CellLayout(Context context) {
|
public CellLayout(Context context) {
|
||||||
this(context, null);
|
this(context, null);
|
||||||
@@ -184,7 +185,8 @@ public class CellLayout extends ViewGroup {
|
|||||||
mNormalBackground.setFilterBitmap(true);
|
mNormalBackground.setFilterBitmap(true);
|
||||||
mActiveGlowBackground.setFilterBitmap(true);
|
mActiveGlowBackground.setFilterBitmap(true);
|
||||||
|
|
||||||
mBubbleScalePercent = res.getInteger(R.integer.app_icon_hotseat_scale_percent);
|
mBubbleScalePercent = res.getInteger(R.integer.app_icon_scale_percent);
|
||||||
|
mBubbleHotseatScalePercent = res.getInteger(R.integer.app_icon_hotseat_scale_percent);
|
||||||
|
|
||||||
// Initialize the data structures used for the drag visualization.
|
// Initialize the data structures used for the drag visualization.
|
||||||
|
|
||||||
@@ -588,6 +590,34 @@ public class CellLayout extends ViewGroup {
|
|||||||
return addViewToCellLayout(child, index, childId, params, markCells, false);
|
return addViewToCellLayout(child, index, childId, params, markCells, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void scaleChild(BubbleTextView bubbleChild, float pivot, int scalePercent) {
|
||||||
|
// If we haven't measured the child yet, do it now
|
||||||
|
// (this happens if we're being dropped from all-apps
|
||||||
|
if (bubbleChild.getLayoutParams() instanceof LayoutParams &&
|
||||||
|
(bubbleChild.getMeasuredWidth() | bubbleChild.getMeasuredHeight()) == 0) {
|
||||||
|
getChildrenLayout().measureChild(bubbleChild);
|
||||||
|
}
|
||||||
|
int measuredWidth = bubbleChild.getMeasuredWidth();
|
||||||
|
int measuredHeight = bubbleChild.getMeasuredHeight();
|
||||||
|
|
||||||
|
float scale = scalePercent / 100f;
|
||||||
|
bubbleChild.setPivotX(pivot);
|
||||||
|
bubbleChild.setPivotY(pivot);
|
||||||
|
bubbleChild.setScaleX(scale);
|
||||||
|
bubbleChild.setScaleY(scale);
|
||||||
|
bubbleChild.setTranslationX(measuredWidth * (1 - scale) / 2);
|
||||||
|
bubbleChild.setTranslationY(measuredHeight * (1 - scale) / 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void resetChild(BubbleTextView bubbleChild) {
|
||||||
|
bubbleChild.setScaleX(1f);
|
||||||
|
bubbleChild.setScaleY(1f);
|
||||||
|
bubbleChild.setTranslationX(0f);
|
||||||
|
bubbleChild.setTranslationY(0f);
|
||||||
|
|
||||||
|
bubbleChild.setTextColor(getResources().getColor(R.color.workspace_icon_text_color));
|
||||||
|
}
|
||||||
|
|
||||||
public boolean addViewToCellLayout(View child, int index, int childId, LayoutParams params,
|
public boolean addViewToCellLayout(View child, int index, int childId, LayoutParams params,
|
||||||
boolean markCells, boolean allApps) {
|
boolean markCells, boolean allApps) {
|
||||||
final LayoutParams lp = params;
|
final LayoutParams lp = params;
|
||||||
@@ -599,32 +629,17 @@ public class CellLayout extends ViewGroup {
|
|||||||
if (child instanceof BubbleTextView) {
|
if (child instanceof BubbleTextView) {
|
||||||
BubbleTextView bubbleChild = (BubbleTextView) child;
|
BubbleTextView bubbleChild = (BubbleTextView) child;
|
||||||
|
|
||||||
if (mIsHotseat && !allApps && mBubbleScalePercent >= 0) {
|
// Start the child with 100% scale and visible text
|
||||||
// If we haven't measured the child yet, do it now
|
resetChild(bubbleChild);
|
||||||
// (this happens if we're being dropped from all-apps
|
|
||||||
if ((bubbleChild.getMeasuredWidth() | bubbleChild.getMeasuredHeight()) == 0) {
|
|
||||||
getChildrenLayout().measureChild(bubbleChild);
|
|
||||||
}
|
|
||||||
int measuredWidth = bubbleChild.getMeasuredWidth();
|
|
||||||
int measuredHeight = bubbleChild.getMeasuredHeight();
|
|
||||||
|
|
||||||
float bubbleScale = mBubbleScalePercent / 100f;
|
if (mIsHotseat && !allApps && mBubbleHotseatScalePercent >= 0) {
|
||||||
bubbleChild.setPivotX(0);
|
// Scale/make transparent for a hotseat
|
||||||
bubbleChild.setPivotY(0);
|
scaleChild(bubbleChild, 0f, mBubbleHotseatScalePercent);
|
||||||
bubbleChild.setScaleX(bubbleScale);
|
|
||||||
bubbleChild.setScaleY(bubbleScale);
|
|
||||||
bubbleChild.setTranslationX(measuredWidth * (1 - bubbleScale) / 2);
|
|
||||||
bubbleChild.setTranslationY(measuredHeight * (1 - bubbleScale) / 2);
|
|
||||||
|
|
||||||
bubbleChild.setTextColor(android.R.color.transparent);
|
bubbleChild.setTextColor(getResources().getColor(android.R.color.transparent));
|
||||||
} else {
|
} else if (mBubbleScalePercent >= 0) {
|
||||||
bubbleChild.setScaleX(1f);
|
// Else possibly still scale it if we need to for smaller icons
|
||||||
bubbleChild.setScaleY(1f);
|
scaleChild(bubbleChild, 0f, mBubbleScalePercent);
|
||||||
bubbleChild.setTranslationX(0f);
|
|
||||||
bubbleChild.setTranslationY(0f);
|
|
||||||
|
|
||||||
bubbleChild.setTextColor(
|
|
||||||
getResources().getColor(R.color.workspace_icon_text_color));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user