Merge "Fixed the padding of quick settings" into sc-v2-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
cb2a580046
@@ -55,7 +55,7 @@
|
|||||||
android:clipChildren="false"
|
android:clipChildren="false"
|
||||||
android:clipToPadding="false"
|
android:clipToPadding="false"
|
||||||
android:focusable="true"
|
android:focusable="true"
|
||||||
android:paddingBottom="10dp"
|
android:paddingBottom="24dp"
|
||||||
android:importantForAccessibility="yes" />
|
android:importantForAccessibility="yes" />
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|
||||||
|
|||||||
@@ -55,6 +55,8 @@ public class QSPanel extends LinearLayout implements Tunable {
|
|||||||
private static final String TAG = "QSPanel";
|
private static final String TAG = "QSPanel";
|
||||||
|
|
||||||
protected final Context mContext;
|
protected final Context mContext;
|
||||||
|
private final int mMediaTopMargin;
|
||||||
|
private final int mMediaTotalBottomMargin;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The index where the content starts that needs to be moved between parents
|
* The index where the content starts that needs to be moved between parents
|
||||||
@@ -98,13 +100,14 @@ public class QSPanel extends LinearLayout implements Tunable {
|
|||||||
protected LinearLayout mHorizontalContentContainer;
|
protected LinearLayout mHorizontalContentContainer;
|
||||||
|
|
||||||
protected QSTileLayout mTileLayout;
|
protected QSTileLayout mTileLayout;
|
||||||
private int mMediaTotalBottomMargin;
|
|
||||||
|
|
||||||
public QSPanel(Context context, AttributeSet attrs) {
|
public QSPanel(Context context, AttributeSet attrs) {
|
||||||
super(context, attrs);
|
super(context, attrs);
|
||||||
mUsingMediaPlayer = useQsMediaPlayer(context);
|
mUsingMediaPlayer = useQsMediaPlayer(context);
|
||||||
mMediaTotalBottomMargin = getResources().getDimensionPixelSize(
|
mMediaTotalBottomMargin = getResources().getDimensionPixelSize(
|
||||||
R.dimen.quick_settings_bottom_margin_media);
|
R.dimen.quick_settings_bottom_margin_media);
|
||||||
|
mMediaTopMargin = getResources().getDimensionPixelSize(
|
||||||
|
R.dimen.qs_tile_margin_vertical);
|
||||||
mContext = context;
|
mContext = context;
|
||||||
|
|
||||||
setOrientation(VERTICAL);
|
setOrientation(VERTICAL);
|
||||||
@@ -326,7 +329,7 @@ public class QSPanel extends LinearLayout implements Tunable {
|
|||||||
private void updateHorizontalLinearLayoutMargins() {
|
private void updateHorizontalLinearLayoutMargins() {
|
||||||
if (mHorizontalLinearLayout != null && !displayMediaMarginsOnMedia()) {
|
if (mHorizontalLinearLayout != null && !displayMediaMarginsOnMedia()) {
|
||||||
LayoutParams lp = (LayoutParams) mHorizontalLinearLayout.getLayoutParams();
|
LayoutParams lp = (LayoutParams) mHorizontalLinearLayout.getLayoutParams();
|
||||||
lp.bottomMargin = mMediaTotalBottomMargin - getPaddingBottom();
|
lp.bottomMargin = Math.max(mMediaTotalBottomMargin - getPaddingBottom(), 0);
|
||||||
mHorizontalLinearLayout.setLayoutParams(lp);
|
mHorizontalLinearLayout.setLayoutParams(lp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -341,6 +344,13 @@ public class QSPanel extends LinearLayout implements Tunable {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return true if the media view needs margin on the top to separate it from the qs tiles
|
||||||
|
*/
|
||||||
|
protected boolean mediaNeedsTopMargin() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
private boolean needsDynamicRowsAndColumns() {
|
private boolean needsDynamicRowsAndColumns() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -405,7 +415,9 @@ public class QSPanel extends LinearLayout implements Tunable {
|
|||||||
// necessary if the view isn't horizontal, since otherwise the padding is
|
// necessary if the view isn't horizontal, since otherwise the padding is
|
||||||
// carried in the parent of this view (to ensure correct vertical alignment)
|
// carried in the parent of this view (to ensure correct vertical alignment)
|
||||||
layoutParams.bottomMargin = !horizontal || displayMediaMarginsOnMedia()
|
layoutParams.bottomMargin = !horizontal || displayMediaMarginsOnMedia()
|
||||||
? mMediaTotalBottomMargin - getPaddingBottom() : 0;
|
? Math.max(mMediaTotalBottomMargin - getPaddingBottom(), 0) : 0;
|
||||||
|
layoutParams.topMargin = mediaNeedsTopMargin() && !horizontal
|
||||||
|
? mMediaTopMargin : 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -673,6 +685,7 @@ public class QSPanel extends LinearLayout implements Tunable {
|
|||||||
mTileLayout.setMaxColumns(horizontal ? 2 : 4);
|
mTileLayout.setMaxColumns(horizontal ? 2 : 4);
|
||||||
}
|
}
|
||||||
updateMargins(mediaHostView);
|
updateMargins(mediaHostView);
|
||||||
|
mHorizontalLinearLayout.setVisibility(horizontal ? View.VISIBLE : View.GONE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -65,6 +65,11 @@ public class QuickQSPanel extends QSPanel {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected boolean mediaNeedsTopMargin() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void updatePadding() {
|
protected void updatePadding() {
|
||||||
// QS Panel is setting a top padding by default, which we don't need.
|
// QS Panel is setting a top padding by default, which we don't need.
|
||||||
@@ -174,7 +179,6 @@ public class QuickQSPanel extends QSPanel {
|
|||||||
LayoutParams.WRAP_CONTENT);
|
LayoutParams.WRAP_CONTENT);
|
||||||
setLayoutParams(lp);
|
setLayoutParams(lp);
|
||||||
setMaxColumns(4);
|
setMaxColumns(4);
|
||||||
mLastRowPadding = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -31,7 +31,6 @@ public class TileLayout extends ViewGroup implements QSTileLayout {
|
|||||||
protected int mCellMarginVertical;
|
protected int mCellMarginVertical;
|
||||||
protected int mSidePadding;
|
protected int mSidePadding;
|
||||||
protected int mRows = 1;
|
protected int mRows = 1;
|
||||||
protected boolean mLastRowPadding = false;
|
|
||||||
|
|
||||||
protected final ArrayList<TileRecord> mRecords = new ArrayList<>();
|
protected final ArrayList<TileRecord> mRecords = new ArrayList<>();
|
||||||
protected boolean mListening;
|
protected boolean mListening;
|
||||||
@@ -168,9 +167,7 @@ public class TileLayout extends ViewGroup implements QSTileLayout {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int height = (mCellHeight + mCellMarginVertical) * mRows;
|
int height = (mCellHeight + mCellMarginVertical) * mRows;
|
||||||
if (!mLastRowPadding) {
|
height -= mCellMarginVertical;
|
||||||
height -= mCellMarginVertical;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (height < 0) height = 0;
|
if (height < 0) height = 0;
|
||||||
|
|
||||||
|
|||||||
@@ -274,7 +274,9 @@ public class StackScrollAlgorithm {
|
|||||||
// expanded. Consider updating these states in updateContentView instead so that we don't
|
// expanded. Consider updating these states in updateContentView instead so that we don't
|
||||||
// have to recalculate in every frame.
|
// have to recalculate in every frame.
|
||||||
float currentY = -ambientState.getScrollY();
|
float currentY = -ambientState.getScrollY();
|
||||||
if (!ambientState.isOnKeyguard()) {
|
if (!ambientState.isOnKeyguard()
|
||||||
|
|| (ambientState.isBypassEnabled() && ambientState.isPulseExpanding())) {
|
||||||
|
// add top padding at the start as long as we're not on the lock screen
|
||||||
currentY += mNotificationScrimPadding;
|
currentY += mNotificationScrimPadding;
|
||||||
}
|
}
|
||||||
state.firstViewInShelf = null;
|
state.firstViewInShelf = null;
|
||||||
@@ -324,7 +326,8 @@ public class StackScrollAlgorithm {
|
|||||||
*/
|
*/
|
||||||
private void updatePositionsForState(StackScrollAlgorithmState algorithmState,
|
private void updatePositionsForState(StackScrollAlgorithmState algorithmState,
|
||||||
AmbientState ambientState) {
|
AmbientState ambientState) {
|
||||||
if (!ambientState.isOnKeyguard()) {
|
if (!ambientState.isOnKeyguard()
|
||||||
|
|| (ambientState.isBypassEnabled() && ambientState.isPulseExpanding())) {
|
||||||
algorithmState.mCurrentYPosition += mNotificationScrimPadding;
|
algorithmState.mCurrentYPosition += mNotificationScrimPadding;
|
||||||
algorithmState.mCurrentExpandedYPosition += mNotificationScrimPadding;
|
algorithmState.mCurrentExpandedYPosition += mNotificationScrimPadding;
|
||||||
}
|
}
|
||||||
@@ -355,7 +358,9 @@ public class StackScrollAlgorithm {
|
|||||||
&& algorithmState.firstViewInShelf != null;
|
&& algorithmState.firstViewInShelf != null;
|
||||||
|
|
||||||
final float shelfHeight = showingShelf ? ambientState.getShelf().getIntrinsicHeight() : 0f;
|
final float shelfHeight = showingShelf ? ambientState.getShelf().getIntrinsicHeight() : 0f;
|
||||||
final float scrimPadding = ambientState.isOnKeyguard() ? 0 : mNotificationScrimPadding;
|
final float scrimPadding = ambientState.isOnKeyguard()
|
||||||
|
&& (!ambientState.isBypassEnabled() || !ambientState.isPulseExpanding())
|
||||||
|
? 0 : mNotificationScrimPadding;
|
||||||
|
|
||||||
final float stackHeight = ambientState.getStackHeight() - shelfHeight - scrimPadding;
|
final float stackHeight = ambientState.getStackHeight() - shelfHeight - scrimPadding;
|
||||||
final float stackEndHeight = ambientState.getStackEndHeight() - shelfHeight - scrimPadding;
|
final float stackEndHeight = ambientState.getStackEndHeight() - shelfHeight - scrimPadding;
|
||||||
|
|||||||
@@ -945,8 +945,6 @@ public class NotificationPanelViewController extends PanelViewController {
|
|||||||
R.dimen.notification_panel_min_side_margin);
|
R.dimen.notification_panel_min_side_margin);
|
||||||
mIndicationBottomPadding = mResources.getDimensionPixelSize(
|
mIndicationBottomPadding = mResources.getDimensionPixelSize(
|
||||||
R.dimen.keyguard_indication_bottom_padding);
|
R.dimen.keyguard_indication_bottom_padding);
|
||||||
mQsNotificationTopPadding = mResources.getDimensionPixelSize(
|
|
||||||
R.dimen.qs_notification_padding);
|
|
||||||
mShelfHeight = mResources.getDimensionPixelSize(R.dimen.notification_shelf_height);
|
mShelfHeight = mResources.getDimensionPixelSize(R.dimen.notification_shelf_height);
|
||||||
mDarkIconSize = mResources.getDimensionPixelSize(R.dimen.status_bar_icon_drawing_size_dark);
|
mDarkIconSize = mResources.getDimensionPixelSize(R.dimen.status_bar_icon_drawing_size_dark);
|
||||||
int statusbarHeight = mResources.getDimensionPixelSize(
|
int statusbarHeight = mResources.getDimensionPixelSize(
|
||||||
@@ -1385,8 +1383,7 @@ public class NotificationPanelViewController extends PanelViewController {
|
|||||||
* @return the padding of the stackscroller when unlocked
|
* @return the padding of the stackscroller when unlocked
|
||||||
*/
|
*/
|
||||||
private int getUnlockedStackScrollerPadding() {
|
private int getUnlockedStackScrollerPadding() {
|
||||||
return (mQs != null ? mQs.getHeader().getHeight() : 0) + mQsPeekHeight
|
return (mQs != null ? mQs.getHeader().getHeight() : 0) + mQsPeekHeight;
|
||||||
+ mQsNotificationTopPadding;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -2503,7 +2500,7 @@ public class NotificationPanelViewController extends PanelViewController {
|
|||||||
// panel. We need to take the maximum and linearly interpolate with the panel expansion
|
// panel. We need to take the maximum and linearly interpolate with the panel expansion
|
||||||
// for a nice motion.
|
// for a nice motion.
|
||||||
int maxNotificationPadding = getKeyguardNotificationStaticPadding();
|
int maxNotificationPadding = getKeyguardNotificationStaticPadding();
|
||||||
int maxQsPadding = mQsMaxExpansionHeight + mQsNotificationTopPadding;
|
int maxQsPadding = mQsMaxExpansionHeight;
|
||||||
int max = mBarState == KEYGUARD ? Math.max(
|
int max = mBarState == KEYGUARD ? Math.max(
|
||||||
maxNotificationPadding, maxQsPadding) : maxQsPadding;
|
maxNotificationPadding, maxQsPadding) : maxQsPadding;
|
||||||
return (int) MathUtils.lerp((float) mQsMinExpansionHeight, (float) max,
|
return (int) MathUtils.lerp((float) mQsMinExpansionHeight, (float) max,
|
||||||
@@ -2516,10 +2513,10 @@ public class NotificationPanelViewController extends PanelViewController {
|
|||||||
// We can only do the smoother transition on Keyguard when we also are not collapsing
|
// We can only do the smoother transition on Keyguard when we also are not collapsing
|
||||||
// from a scrolled quick settings.
|
// from a scrolled quick settings.
|
||||||
return MathUtils.lerp((float) getKeyguardNotificationStaticPadding(),
|
return MathUtils.lerp((float) getKeyguardNotificationStaticPadding(),
|
||||||
(float) (mQsMaxExpansionHeight + mQsNotificationTopPadding),
|
(float) (mQsMaxExpansionHeight),
|
||||||
computeQsExpansionFraction());
|
computeQsExpansionFraction());
|
||||||
} else {
|
} else {
|
||||||
return mQsExpansionHeight + mQsNotificationTopPadding;
|
return mQsExpansionHeight;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2905,10 +2902,6 @@ public class NotificationPanelViewController extends PanelViewController {
|
|||||||
}
|
}
|
||||||
int maxQsHeight = mQsMaxExpansionHeight;
|
int maxQsHeight = mQsMaxExpansionHeight;
|
||||||
|
|
||||||
if (mKeyguardShowing) {
|
|
||||||
maxQsHeight += mQsNotificationTopPadding;
|
|
||||||
}
|
|
||||||
|
|
||||||
// If an animation is changing the size of the QS panel, take the animated value.
|
// If an animation is changing the size of the QS panel, take the animated value.
|
||||||
if (mQsSizeChangeAnimator != null) {
|
if (mQsSizeChangeAnimator != null) {
|
||||||
maxQsHeight = (int) mQsSizeChangeAnimator.getAnimatedValue();
|
maxQsHeight = (int) mQsSizeChangeAnimator.getAnimatedValue();
|
||||||
@@ -4351,8 +4344,7 @@ public class NotificationPanelViewController extends PanelViewController {
|
|||||||
if (mAccessibilityManager.isEnabled()) {
|
if (mAccessibilityManager.isEnabled()) {
|
||||||
mView.setAccessibilityPaneTitle(determineAccessibilityPaneTitle());
|
mView.setAccessibilityPaneTitle(determineAccessibilityPaneTitle());
|
||||||
}
|
}
|
||||||
mNotificationStackScrollLayoutController.setMaxTopPadding(
|
mNotificationStackScrollLayoutController.setMaxTopPadding(mQsMaxExpansionHeight);
|
||||||
mQsMaxExpansionHeight + mQsNotificationTopPadding);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4561,8 +4553,7 @@ public class NotificationPanelViewController extends PanelViewController {
|
|||||||
if (mQs != null) {
|
if (mQs != null) {
|
||||||
updateQSMinHeight();
|
updateQSMinHeight();
|
||||||
mQsMaxExpansionHeight = mQs.getDesiredHeight();
|
mQsMaxExpansionHeight = mQs.getDesiredHeight();
|
||||||
mNotificationStackScrollLayoutController.setMaxTopPadding(
|
mNotificationStackScrollLayoutController.setMaxTopPadding(mQsMaxExpansionHeight);
|
||||||
mQsMaxExpansionHeight + mQsNotificationTopPadding);
|
|
||||||
}
|
}
|
||||||
positionClockAndNotifications();
|
positionClockAndNotifications();
|
||||||
if (mQsExpanded && mQsFullyExpanded) {
|
if (mQsExpanded && mQsFullyExpanded) {
|
||||||
|
|||||||
Reference in New Issue
Block a user