Loading packages/SystemUI/res/layout/status_bar_expanded.xml +3 −2 Original line number Diff line number Diff line Loading @@ -39,8 +39,9 @@ android:clipToPadding="false" android:clipChildren="false"> <include layout="@layout/qs_panel" <com.android.systemui.DensityContainer android:id="@+id/qs_density_container" android:layout="@layout/qs_panel" android:layout_width="@dimen/notification_panel_width" android:layout_height="wrap_content" android:layout_gravity="@integer/notification_panel_layout_gravity" /> Loading packages/SystemUI/res/values/attrs.xml +4 −0 Original line number Diff line number Diff line Loading @@ -93,5 +93,9 @@ <attr name="defValue" format="boolean" /> <attr name="metricsAction" format="integer" /> </declare-styleable> <declare-styleable name="DensityContainer"> <attr name="android:layout" /> </declare-styleable> </resources> packages/SystemUI/src/com/android/systemui/DensityContainer.java 0 → 100644 +78 −0 Original line number Diff line number Diff line /* * Copyright (C) 2016 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file * except in compliance with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software distributed under the * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the specific language governing * permissions and limitations under the License. */ package com.android.systemui; import android.annotation.Nullable; import android.content.Context; import android.content.res.Configuration; import android.content.res.TypedArray; import android.util.AttributeSet; import android.view.LayoutInflater; import android.view.View; import android.widget.FrameLayout; import java.util.ArrayList; import java.util.List; public class DensityContainer extends FrameLayout { private final List<InflateListener> mInflateListeners = new ArrayList<>(); private final int mLayout; private int mDensity; public DensityContainer(Context context, @Nullable AttributeSet attrs) { super(context, attrs); mDensity = context.getResources().getConfiguration().densityDpi; TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.DensityContainer); if (!a.hasValue(R.styleable.DensityContainer_android_layout)) { throw new IllegalArgumentException("DensityContainer must contain a layout"); } mLayout = a.getResourceId(R.styleable.DensityContainer_android_layout, 0); inflateLayout(); } @Override protected void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); int density = newConfig.densityDpi; if (density != mDensity) { mDensity = density; inflateLayout(); } } private void inflateLayout() { removeAllViews(); LayoutInflater.from(getContext()).inflate(mLayout, this); final int N = mInflateListeners.size(); for (int i = 0; i < N; i++) { mInflateListeners.get(i).onInflated(getChildAt(0)); } } public void addInflateListener(InflateListener listener) { mInflateListeners.add(listener); listener.onInflated(getChildAt(0)); } public interface InflateListener { /** * Called whenever a new view is inflated. */ void onInflated(View v); } } packages/SystemUI/src/com/android/systemui/qs/QSPanel.java +10 −1 Original line number Diff line number Diff line Loading @@ -31,6 +31,7 @@ import com.android.internal.logging.MetricsLogger; import com.android.internal.logging.MetricsProto.MetricsEvent; import com.android.systemui.R; import com.android.systemui.qs.QSTile.DetailAdapter; import com.android.systemui.qs.QSTile.Host.Callback; import com.android.systemui.qs.customize.QSCustomizer; import com.android.systemui.qs.external.CustomTile; import com.android.systemui.settings.BrightnessController; Loading @@ -44,7 +45,7 @@ import java.util.ArrayList; import java.util.Collection; /** View that represents the quick settings tile panel. **/ public class QSPanel extends LinearLayout implements Tunable { public class QSPanel extends LinearLayout implements Tunable, Callback { public static final String QS_SHOW_BRIGHTNESS = "qs_show_brightness"; Loading Loading @@ -123,9 +124,15 @@ public class QSPanel extends LinearLayout implements Tunable { @Override protected void onDetachedFromWindow() { TunerService.get(mContext).removeTunable(this); mHost.removeCallback(this); super.onDetachedFromWindow(); } @Override public void onTilesChanged() { setTiles(mHost.getTiles()); } @Override public void onTuningChanged(String key, String newValue) { if (QS_SHOW_BRIGHTNESS.equals(key)) { Loading Loading @@ -168,6 +175,8 @@ public class QSPanel extends LinearLayout implements Tunable { public void setHost(QSTileHost host) { mHost = host; mHost.addCallback(this); setTiles(mHost.getTiles()); mFooter.setHost(host); createCustomizePanel(); } Loading packages/SystemUI/src/com/android/systemui/qs/QSTile.java +1 −0 Original line number Diff line number Diff line Loading @@ -390,6 +390,7 @@ public abstract class QSTile<TState extends State> implements Listenable { Context getContext(); Collection<QSTile<?>> getTiles(); void addCallback(Callback callback); void removeCallback(Callback callback); BluetoothController getBluetoothController(); LocationController getLocationController(); RotationLockController getRotationLockController(); Loading Loading
packages/SystemUI/res/layout/status_bar_expanded.xml +3 −2 Original line number Diff line number Diff line Loading @@ -39,8 +39,9 @@ android:clipToPadding="false" android:clipChildren="false"> <include layout="@layout/qs_panel" <com.android.systemui.DensityContainer android:id="@+id/qs_density_container" android:layout="@layout/qs_panel" android:layout_width="@dimen/notification_panel_width" android:layout_height="wrap_content" android:layout_gravity="@integer/notification_panel_layout_gravity" /> Loading
packages/SystemUI/res/values/attrs.xml +4 −0 Original line number Diff line number Diff line Loading @@ -93,5 +93,9 @@ <attr name="defValue" format="boolean" /> <attr name="metricsAction" format="integer" /> </declare-styleable> <declare-styleable name="DensityContainer"> <attr name="android:layout" /> </declare-styleable> </resources>
packages/SystemUI/src/com/android/systemui/DensityContainer.java 0 → 100644 +78 −0 Original line number Diff line number Diff line /* * Copyright (C) 2016 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file * except in compliance with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software distributed under the * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the specific language governing * permissions and limitations under the License. */ package com.android.systemui; import android.annotation.Nullable; import android.content.Context; import android.content.res.Configuration; import android.content.res.TypedArray; import android.util.AttributeSet; import android.view.LayoutInflater; import android.view.View; import android.widget.FrameLayout; import java.util.ArrayList; import java.util.List; public class DensityContainer extends FrameLayout { private final List<InflateListener> mInflateListeners = new ArrayList<>(); private final int mLayout; private int mDensity; public DensityContainer(Context context, @Nullable AttributeSet attrs) { super(context, attrs); mDensity = context.getResources().getConfiguration().densityDpi; TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.DensityContainer); if (!a.hasValue(R.styleable.DensityContainer_android_layout)) { throw new IllegalArgumentException("DensityContainer must contain a layout"); } mLayout = a.getResourceId(R.styleable.DensityContainer_android_layout, 0); inflateLayout(); } @Override protected void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); int density = newConfig.densityDpi; if (density != mDensity) { mDensity = density; inflateLayout(); } } private void inflateLayout() { removeAllViews(); LayoutInflater.from(getContext()).inflate(mLayout, this); final int N = mInflateListeners.size(); for (int i = 0; i < N; i++) { mInflateListeners.get(i).onInflated(getChildAt(0)); } } public void addInflateListener(InflateListener listener) { mInflateListeners.add(listener); listener.onInflated(getChildAt(0)); } public interface InflateListener { /** * Called whenever a new view is inflated. */ void onInflated(View v); } }
packages/SystemUI/src/com/android/systemui/qs/QSPanel.java +10 −1 Original line number Diff line number Diff line Loading @@ -31,6 +31,7 @@ import com.android.internal.logging.MetricsLogger; import com.android.internal.logging.MetricsProto.MetricsEvent; import com.android.systemui.R; import com.android.systemui.qs.QSTile.DetailAdapter; import com.android.systemui.qs.QSTile.Host.Callback; import com.android.systemui.qs.customize.QSCustomizer; import com.android.systemui.qs.external.CustomTile; import com.android.systemui.settings.BrightnessController; Loading @@ -44,7 +45,7 @@ import java.util.ArrayList; import java.util.Collection; /** View that represents the quick settings tile panel. **/ public class QSPanel extends LinearLayout implements Tunable { public class QSPanel extends LinearLayout implements Tunable, Callback { public static final String QS_SHOW_BRIGHTNESS = "qs_show_brightness"; Loading Loading @@ -123,9 +124,15 @@ public class QSPanel extends LinearLayout implements Tunable { @Override protected void onDetachedFromWindow() { TunerService.get(mContext).removeTunable(this); mHost.removeCallback(this); super.onDetachedFromWindow(); } @Override public void onTilesChanged() { setTiles(mHost.getTiles()); } @Override public void onTuningChanged(String key, String newValue) { if (QS_SHOW_BRIGHTNESS.equals(key)) { Loading Loading @@ -168,6 +175,8 @@ public class QSPanel extends LinearLayout implements Tunable { public void setHost(QSTileHost host) { mHost = host; mHost.addCallback(this); setTiles(mHost.getTiles()); mFooter.setHost(host); createCustomizePanel(); } Loading
packages/SystemUI/src/com/android/systemui/qs/QSTile.java +1 −0 Original line number Diff line number Diff line Loading @@ -390,6 +390,7 @@ public abstract class QSTile<TState extends State> implements Listenable { Context getContext(); Collection<QSTile<?>> getTiles(); void addCallback(Callback callback); void removeCallback(Callback callback); BluetoothController getBluetoothController(); LocationController getLocationController(); RotationLockController getRotationLockController(); Loading