Align workspace and hotseat icons in landscape
Fix: 311381639 Test: Verified on device Flag: NONE Change-Id: I4e2c74f59e8492042c3c7f8eccc98921d92d685f
This commit is contained in:
@@ -213,6 +213,7 @@ public class BubbleTextView extends TextView implements ItemInfoUpdateReceiver,
|
||||
mIsRtl = (getResources().getConfiguration().getLayoutDirection()
|
||||
== View.LAYOUT_DIRECTION_RTL);
|
||||
mDeviceProfile = mActivity.getDeviceProfile();
|
||||
mCenterVertically = a.getBoolean(R.styleable.BubbleTextView_centerVertically, false);
|
||||
|
||||
mDisplay = a.getInteger(R.styleable.BubbleTextView_iconDisplay, DISPLAY_WORKSPACE);
|
||||
final int defaultIconSize;
|
||||
@@ -243,7 +244,6 @@ public class BubbleTextView extends TextView implements ItemInfoUpdateReceiver,
|
||||
defaultIconSize = mDeviceProfile.iconSizePx;
|
||||
}
|
||||
|
||||
mCenterVertically = a.getBoolean(R.styleable.BubbleTextView_centerVertically, false);
|
||||
|
||||
mIconSize = a.getDimensionPixelSize(R.styleable.BubbleTextView_iconSizeOverride,
|
||||
defaultIconSize);
|
||||
|
||||
@@ -1010,7 +1010,7 @@ public class DeviceProfile {
|
||||
* Returns the amount of extra (or unused) vertical space.
|
||||
*/
|
||||
private int updateAvailableDimensions(Resources res) {
|
||||
iconCenterVertically = mIsScalableGrid || mIsResponsiveGrid;
|
||||
iconCenterVertically = (mIsScalableGrid || mIsResponsiveGrid) && isVerticalBarLayout();
|
||||
|
||||
if (mIsResponsiveGrid) {
|
||||
iconSizePx = mResponsiveWorkspaceCellSpec.getIconSize();
|
||||
@@ -1738,15 +1738,8 @@ public class DeviceProfile {
|
||||
// The hotseat icons will be placed in the middle of the hotseat cells.
|
||||
// Changing the hotseatCellHeightPx is not affecting hotseat icon positions
|
||||
// in vertical bar layout.
|
||||
// Workspace icons are moved up by a small factor. The variable diffOverlapFactor
|
||||
// is set to account for that difference.
|
||||
float diffOverlapFactor = mIsResponsiveGrid ? 0
|
||||
: iconSizePx * (ICON_OVERLAP_FACTOR - 1) / 2;
|
||||
|
||||
int paddingTop = Math.max((int) (mInsets.top + cellLayoutPaddingPx.top
|
||||
- diffOverlapFactor), 0);
|
||||
int paddingBottom = Math.max((int) (mInsets.bottom + cellLayoutPaddingPx.bottom
|
||||
+ diffOverlapFactor), 0);
|
||||
int paddingTop = Math.max((int) (mInsets.top + cellLayoutPaddingPx.top), 0);
|
||||
int paddingBottom = Math.max((int) (mInsets.bottom + cellLayoutPaddingPx.bottom), 0);
|
||||
|
||||
if (isSeascape()) {
|
||||
hotseatBarPadding.set(mInsets.left + mHotseatBarEdgePaddingPx, paddingTop,
|
||||
|
||||
@@ -29,6 +29,7 @@ import android.animation.AnimatorListenerAdapter;
|
||||
import android.animation.ObjectAnimator;
|
||||
import android.content.Context;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Paint;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.util.AttributeSet;
|
||||
@@ -633,6 +634,20 @@ public class FolderIcon extends FrameLayout implements FolderListener, IconLabel
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
|
||||
boolean shouldCenterIcon = mActivity.getDeviceProfile().iconCenterVertically;
|
||||
if (shouldCenterIcon) {
|
||||
int iconSize = mActivity.getDeviceProfile().iconSizePx;
|
||||
Paint.FontMetrics fm = mFolderName.getPaint().getFontMetrics();
|
||||
int cellHeightPx = iconSize + mFolderName.getCompoundDrawablePadding()
|
||||
+ (int) Math.ceil(fm.bottom - fm.top);
|
||||
setPadding(getPaddingLeft(), (MeasureSpec.getSize(heightMeasureSpec)
|
||||
- cellHeightPx) / 2, getPaddingRight(), getPaddingBottom());
|
||||
}
|
||||
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
|
||||
}
|
||||
|
||||
/** Sets the visibility of the icon's title text */
|
||||
public void setTextVisible(boolean visible) {
|
||||
if (visible) {
|
||||
|
||||
Reference in New Issue
Block a user