Merge "Merge "Fix DemoMode icon spacing" into pi-dev am: ee18fb2112" into pi-dev-plus-aosp
This commit is contained in:
committed by
Android (Google) Code Review
commit
f5f2c674d9
@@ -28,8 +28,8 @@
|
||||
android:id="@+id/wifi_group"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:paddingStart="2dp"
|
||||
android:gravity="center_vertical"
|
||||
android:layout_marginStart="2.5dp"
|
||||
>
|
||||
<FrameLayout
|
||||
android:id="@+id/inout_container"
|
||||
|
||||
@@ -24,6 +24,7 @@ import android.util.Log;
|
||||
import android.view.Gravity;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.ViewGroup.LayoutParams;
|
||||
import android.widget.LinearLayout;
|
||||
|
||||
import com.android.internal.statusbar.StatusBarIcon;
|
||||
@@ -56,7 +57,14 @@ public class DemoStatusIcons extends StatusIconContainer implements DemoMode, Da
|
||||
mIconSize = iconSize;
|
||||
mColor = DarkIconDispatcher.DEFAULT_ICON_TINT;
|
||||
|
||||
if (statusIcons instanceof StatusIconContainer) {
|
||||
setShouldRestrictIcons(((StatusIconContainer) statusIcons).isRestrictingIcons());
|
||||
} else {
|
||||
setShouldRestrictIcons(false);
|
||||
}
|
||||
setLayoutParams(mStatusIcons.getLayoutParams());
|
||||
setPadding(mStatusIcons.getPaddingLeft(),mStatusIcons.getPaddingTop(),
|
||||
mStatusIcons.getPaddingRight(), mStatusIcons.getPaddingBottom());
|
||||
setOrientation(mStatusIcons.getOrientation());
|
||||
setGravity(Gravity.CENTER_VERTICAL); // no LL.getGravity()
|
||||
ViewGroup p = (ViewGroup) mStatusIcons.getParent();
|
||||
@@ -77,6 +85,7 @@ public class DemoStatusIcons extends StatusIconContainer implements DemoMode, Da
|
||||
for (int i = 0; i < getChildCount(); i++) {
|
||||
StatusIconDisplayable child = (StatusIconDisplayable) getChildAt(i);
|
||||
child.setStaticDrawableColor(mColor);
|
||||
child.setDecorColor(mColor);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -189,11 +198,12 @@ public class DemoStatusIcons extends StatusIconContainer implements DemoMode, Da
|
||||
}
|
||||
StatusBarIcon icon = new StatusBarIcon(iconPkg, UserHandle.SYSTEM, iconId, 0, 0, "Demo");
|
||||
icon.visible = true;
|
||||
StatusBarIconView v = new StatusBarIconView(getContext(), null, null);
|
||||
StatusBarIconView v = new StatusBarIconView(getContext(), slot, null, false);
|
||||
v.setTag(slot);
|
||||
v.set(icon);
|
||||
v.setStaticDrawableColor(mColor);
|
||||
addView(v, 0, new LinearLayout.LayoutParams(mIconSize, mIconSize));
|
||||
v.setDecorColor(mColor);
|
||||
addView(v, 0, new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, mIconSize));
|
||||
}
|
||||
|
||||
public void addDemoWifiView(WifiIconState state) {
|
||||
|
||||
@@ -73,19 +73,23 @@ public class StatusIconContainer extends AlphaOptimizedLinearLayout {
|
||||
|
||||
public StatusIconContainer(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
initDimens();
|
||||
setWillNotDraw(!DEBUG_OVERFLOW);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onFinishInflate() {
|
||||
super.onFinishInflate();
|
||||
setWillNotDraw(!DEBUG_OVERFLOW);
|
||||
initDimens();
|
||||
}
|
||||
|
||||
public void setShouldRestrictIcons(boolean should) {
|
||||
mShouldRestrictIcons = should;
|
||||
}
|
||||
|
||||
public boolean isRestrictingIcons() {
|
||||
return mShouldRestrictIcons;
|
||||
}
|
||||
|
||||
private void initDimens() {
|
||||
// This is the same value that StatusBarIconView uses
|
||||
mIconDotFrameWidth = getResources().getDimensionPixelSize(
|
||||
@@ -209,8 +213,8 @@ public class StatusIconContainer extends AlphaOptimizedLinearLayout {
|
||||
int childCount = getChildCount();
|
||||
// Underflow === don't show content until that index
|
||||
int firstUnderflowIndex = -1;
|
||||
if (DEBUG) android.util.Log.d(TAG, "calculateIconTransitions: start=" + translationX
|
||||
+ " width=" + width);
|
||||
if (DEBUG) android.util.Log.d(TAG, "calculateIconTranslations: start=" + translationX
|
||||
+ " width=" + width + " underflow=" + mNeedsUnderflow);
|
||||
|
||||
// Collect all of the states which want to be visible
|
||||
for (int i = childCount - 1; i >= 0; i--) {
|
||||
|
||||
Reference in New Issue
Block a user