Merge "Adapted the measuring of notification content view" into nyc-dev
am: 79fa406933
* commit '79fa406933c5ec65e2d48279dc9e0011809512b3':
Adapted the measuring of notification content view
This commit is contained in:
@@ -58,7 +58,7 @@
|
|||||||
<item name="status_bar_icon_scale_factor" format="float" type="dimen">1.0</item>
|
<item name="status_bar_icon_scale_factor" format="float" type="dimen">1.0</item>
|
||||||
|
|
||||||
<!-- Height of a small notification in the status bar-->
|
<!-- Height of a small notification in the status bar-->
|
||||||
<dimen name="notification_min_height">84dp</dimen>
|
<dimen name="notification_min_height">86dp</dimen>
|
||||||
|
|
||||||
<!-- Height of a small notification in the status bar which was used before android N -->
|
<!-- Height of a small notification in the status bar which was used before android N -->
|
||||||
<dimen name="notification_min_height_legacy">64dp</dimen>
|
<dimen name="notification_min_height_legacy">64dp</dimen>
|
||||||
|
|||||||
@@ -251,7 +251,6 @@ public class ExpandableNotificationRow extends ActivatableNotificationView {
|
|||||||
!= com.android.internal.R.id.status_bar_latest_event_content;
|
!= com.android.internal.R.id.status_bar_latest_event_content;
|
||||||
int headsUpheight = headsUpCustom && beforeN ? mMaxHeadsUpHeightLegacy
|
int headsUpheight = headsUpCustom && beforeN ? mMaxHeadsUpHeightLegacy
|
||||||
: mMaxHeadsUpHeight;
|
: mMaxHeadsUpHeight;
|
||||||
mMaxViewHeight = mNotificationMaxHeight;
|
|
||||||
mPrivateLayout.setHeights(minHeight, headsUpheight, mNotificationMaxHeight);
|
mPrivateLayout.setHeights(minHeight, headsUpheight, mNotificationMaxHeight);
|
||||||
mPublicLayout.setHeights(minHeight, headsUpheight, mNotificationMaxHeight);
|
mPublicLayout.setHeights(minHeight, headsUpheight, mNotificationMaxHeight);
|
||||||
}
|
}
|
||||||
@@ -573,16 +572,23 @@ public class ExpandableNotificationRow extends ActivatableNotificationView {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void initDimens() {
|
private void initDimens() {
|
||||||
mNotificationMinHeightLegacy = getResources().getDimensionPixelSize(
|
mNotificationMinHeightLegacy = getFontScaledHeight(R.dimen.notification_min_height_legacy);
|
||||||
R.dimen.notification_min_height_legacy);
|
mNotificationMinHeight = getFontScaledHeight(R.dimen.notification_min_height);
|
||||||
mNotificationMinHeight = getResources().getDimensionPixelSize(
|
mNotificationMaxHeight = getFontScaledHeight(R.dimen.notification_max_height);
|
||||||
R.dimen.notification_min_height);
|
mMaxHeadsUpHeightLegacy = getFontScaledHeight(
|
||||||
mNotificationMaxHeight = getResources().getDimensionPixelSize(
|
|
||||||
R.dimen.notification_max_height);
|
|
||||||
mMaxHeadsUpHeightLegacy = getResources().getDimensionPixelSize(
|
|
||||||
R.dimen.notification_max_heads_up_height_legacy);
|
R.dimen.notification_max_heads_up_height_legacy);
|
||||||
mMaxHeadsUpHeight = getResources().getDimensionPixelSize(
|
mMaxHeadsUpHeight = getFontScaledHeight(R.dimen.notification_max_heads_up_height);
|
||||||
R.dimen.notification_max_heads_up_height);
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param dimenId the dimen to look up
|
||||||
|
* @return the font scaled dimen as if it were in sp but doesn't shrink sizes below dp
|
||||||
|
*/
|
||||||
|
private int getFontScaledHeight(int dimenId) {
|
||||||
|
int dimensionPixelSize = getResources().getDimensionPixelSize(dimenId);
|
||||||
|
float factor = Math.max(1.0f, getResources().getDisplayMetrics().scaledDensity /
|
||||||
|
getResources().getDisplayMetrics().density);
|
||||||
|
return (int) (dimensionPixelSize * factor);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -592,7 +598,6 @@ public class ExpandableNotificationRow extends ActivatableNotificationView {
|
|||||||
public void reset() {
|
public void reset() {
|
||||||
super.reset();
|
super.reset();
|
||||||
final boolean wasExpanded = isExpanded();
|
final boolean wasExpanded = isExpanded();
|
||||||
mMaxViewHeight = 0;
|
|
||||||
mExpandable = false;
|
mExpandable = false;
|
||||||
mHasUserChangedExpansion = false;
|
mHasUserChangedExpansion = false;
|
||||||
mUserLocked = false;
|
mUserLocked = false;
|
||||||
|
|||||||
@@ -24,7 +24,6 @@ import android.view.View;
|
|||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.FrameLayout;
|
import android.widget.FrameLayout;
|
||||||
|
|
||||||
import com.android.systemui.R;
|
|
||||||
import com.android.systemui.statusbar.stack.NotificationStackScrollLayout;
|
import com.android.systemui.statusbar.stack.NotificationStackScrollLayout;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@@ -35,7 +34,6 @@ import java.util.ArrayList;
|
|||||||
public abstract class ExpandableView extends FrameLayout {
|
public abstract class ExpandableView extends FrameLayout {
|
||||||
|
|
||||||
protected OnHeightChangedListener mOnHeightChangedListener;
|
protected OnHeightChangedListener mOnHeightChangedListener;
|
||||||
protected int mMaxViewHeight;
|
|
||||||
private int mActualHeight;
|
private int mActualHeight;
|
||||||
protected int mClipTopAmount;
|
protected int mClipTopAmount;
|
||||||
private boolean mActualHeightInitialized;
|
private boolean mActualHeightInitialized;
|
||||||
@@ -49,8 +47,6 @@ public abstract class ExpandableView extends FrameLayout {
|
|||||||
|
|
||||||
public ExpandableView(Context context, AttributeSet attrs) {
|
public ExpandableView(Context context, AttributeSet attrs) {
|
||||||
super(context, attrs);
|
super(context, attrs);
|
||||||
mMaxViewHeight = getResources().getDimensionPixelSize(
|
|
||||||
R.dimen.notification_max_height);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -144,11 +144,11 @@ public class NotificationContentView extends FrameLayout {
|
|||||||
}
|
}
|
||||||
if (mContractedChild != null) {
|
if (mContractedChild != null) {
|
||||||
int heightSpec;
|
int heightSpec;
|
||||||
|
int size = Math.min(maxSize, mSmallHeight);
|
||||||
if (shouldContractedBeFixedSize()) {
|
if (shouldContractedBeFixedSize()) {
|
||||||
int size = Math.min(maxSize, mSmallHeight);
|
|
||||||
heightSpec = MeasureSpec.makeMeasureSpec(size, MeasureSpec.EXACTLY);
|
heightSpec = MeasureSpec.makeMeasureSpec(size, MeasureSpec.EXACTLY);
|
||||||
} else {
|
} else {
|
||||||
heightSpec = MeasureSpec.makeMeasureSpec(maxSize, MeasureSpec.AT_MOST);
|
heightSpec = MeasureSpec.makeMeasureSpec(size, MeasureSpec.AT_MOST);
|
||||||
}
|
}
|
||||||
mContractedChild.measure(widthMeasureSpec, heightSpec);
|
mContractedChild.measure(widthMeasureSpec, heightSpec);
|
||||||
int measuredHeight = mContractedChild.getMeasuredHeight();
|
int measuredHeight = mContractedChild.getMeasuredHeight();
|
||||||
|
|||||||
Reference in New Issue
Block a user