Loading packages/SystemUI/res/values/styles.xml +5 −0 Original line number Diff line number Diff line Loading @@ -193,4 +193,9 @@ </style> <style name="QSBorderless" parent="@android:style/Widget.Quantum.Button.Borderless" /> <style name="QSBorderless.Tiny"> <item name="android:minHeight">12dip</item> <item name="android:minWidth">12dip</item> </style> </resources> packages/SystemUI/src/com/android/systemui/qs/QSTile.java +1 −1 Original line number Diff line number Diff line Loading @@ -19,7 +19,6 @@ package com.android.systemui.qs; import android.content.Context; import android.content.Intent; import android.graphics.drawable.Drawable; import android.graphics.drawable.VectorDrawable; import android.os.Handler; import android.os.Looper; import android.os.Message; Loading Loading @@ -50,6 +49,7 @@ import java.util.Objects; public abstract class QSTile<TState extends State> implements Listenable { protected final String TAG = "QSTile." + getClass().getSimpleName(); protected static final boolean DEBUG = false; public static final int FEEDBACK_START_DELAY = 400; protected final Host mHost; protected final Context mContext; Loading packages/SystemUI/src/com/android/systemui/qs/QSTileView.java +30 −10 Original line number Diff line number Diff line Loading @@ -25,6 +25,7 @@ import android.os.Handler; import android.os.Looper; import android.os.Message; import android.util.TypedValue; import android.view.ContextThemeWrapper; import android.view.Gravity; import android.view.View; import android.view.ViewGroup; Loading @@ -44,9 +45,9 @@ public class QSTileView extends ViewGroup { protected final Context mContext; private final View mIcon; private final View mDivider; private final TextView mLabel; private final H mHandler = new H(); private TextView mLabel; private boolean mDual; private OnClickListener mClickPrimary; private OnClickListener mClickSecondary; Loading @@ -56,14 +57,7 @@ public class QSTileView extends ViewGroup { mContext = context; final Resources res = context.getResources(); mLabel = new TextView(mContext); mLabel.setId(android.R.id.title); mLabel.setTextColor(res.getColor(R.color.quick_settings_tile_text)); mLabel.setGravity(Gravity.CENTER); mLabel.setTypeface(CONDENSED); mLabel.setTextSize(TypedValue.COMPLEX_UNIT_PX, res.getDimensionPixelSize(R.dimen.quick_settings_tile_text_size)); addView(mLabel); recreateLabel(); setClipChildren(false); mIcon = createIcon(); Loading @@ -79,8 +73,33 @@ public class QSTileView extends ViewGroup { setBackground(getSelectableBackground()); } private void recreateLabel() { CharSequence labelText = null; if (mLabel != null) { labelText = mLabel.getText(); removeView(mLabel); } final Resources res = mContext.getResources(); mLabel = new TextView(mDual ? new ContextThemeWrapper(mContext, R.style.QSBorderless_Tiny) : mContext); mLabel.setId(android.R.id.title); mLabel.setTextColor(res.getColor(R.color.quick_settings_tile_text)); mLabel.setGravity(Gravity.CENTER); mLabel.setTypeface(CONDENSED); mLabel.setTextSize(TypedValue.COMPLEX_UNIT_PX, res.getDimensionPixelSize(R.dimen.quick_settings_tile_text_size)); if (labelText != null) { mLabel.setText(labelText); } addView(mLabel); } public void setDual(boolean dual) { final boolean changed = dual != mDual; mDual = dual; if (changed) { recreateLabel(); } if (mDual) { setOnClickListener(mClickPrimary); mLabel.setClickable(true); Loading Loading @@ -121,9 +140,10 @@ public class QSTileView extends ViewGroup { final int iconSpec = exactly((int)mLabel.getTextSize() * 2); mIcon.measure(iconSpec, iconSpec); mLabel.measure(widthMeasureSpec, MeasureSpec.makeMeasureSpec(h, MeasureSpec.AT_MOST)); mLabel.measure(widthMeasureSpec, exactly(mLabel.getMeasuredHeight() + p * 2)); if (mDual) { mDivider.measure(widthMeasureSpec, exactly(mDivider.getLayoutParams().height)); } else { mLabel.measure(widthMeasureSpec, exactly(mLabel.getMeasuredHeight() + p * 2)); } setMeasuredDimension(w, h); } Loading packages/SystemUI/src/com/android/systemui/qs/tiles/BugreportTile.java +7 −2 Original line number Diff line number Diff line Loading @@ -57,9 +57,14 @@ public class BugreportTile extends QSTile<QSTile.State> { @Override protected void handleClick() { mHandler.postDelayed(new Runnable() { @Override public void run() { mHost.collapsePanels(); mUiHandler.post(mShowDialog); } }, FEEDBACK_START_DELAY); } @Override protected void handleUpdateState(State state, Object pushArg) { Loading packages/SystemUI/src/com/android/systemui/qs/tiles/CastTile.java +6 −2 Original line number Diff line number Diff line Loading @@ -65,9 +65,13 @@ public class CastTile extends QSTile<QSTile.BooleanState> { @Override protected void handleClick() { mHandler.postDelayed(new Runnable() { public void run() { mHost.collapsePanels(); mUiHandler.post(mShowDialog); } }, FEEDBACK_START_DELAY); } @Override protected void handleUpdateState(BooleanState state, Object arg) { Loading Loading
packages/SystemUI/res/values/styles.xml +5 −0 Original line number Diff line number Diff line Loading @@ -193,4 +193,9 @@ </style> <style name="QSBorderless" parent="@android:style/Widget.Quantum.Button.Borderless" /> <style name="QSBorderless.Tiny"> <item name="android:minHeight">12dip</item> <item name="android:minWidth">12dip</item> </style> </resources>
packages/SystemUI/src/com/android/systemui/qs/QSTile.java +1 −1 Original line number Diff line number Diff line Loading @@ -19,7 +19,6 @@ package com.android.systemui.qs; import android.content.Context; import android.content.Intent; import android.graphics.drawable.Drawable; import android.graphics.drawable.VectorDrawable; import android.os.Handler; import android.os.Looper; import android.os.Message; Loading Loading @@ -50,6 +49,7 @@ import java.util.Objects; public abstract class QSTile<TState extends State> implements Listenable { protected final String TAG = "QSTile." + getClass().getSimpleName(); protected static final boolean DEBUG = false; public static final int FEEDBACK_START_DELAY = 400; protected final Host mHost; protected final Context mContext; Loading
packages/SystemUI/src/com/android/systemui/qs/QSTileView.java +30 −10 Original line number Diff line number Diff line Loading @@ -25,6 +25,7 @@ import android.os.Handler; import android.os.Looper; import android.os.Message; import android.util.TypedValue; import android.view.ContextThemeWrapper; import android.view.Gravity; import android.view.View; import android.view.ViewGroup; Loading @@ -44,9 +45,9 @@ public class QSTileView extends ViewGroup { protected final Context mContext; private final View mIcon; private final View mDivider; private final TextView mLabel; private final H mHandler = new H(); private TextView mLabel; private boolean mDual; private OnClickListener mClickPrimary; private OnClickListener mClickSecondary; Loading @@ -56,14 +57,7 @@ public class QSTileView extends ViewGroup { mContext = context; final Resources res = context.getResources(); mLabel = new TextView(mContext); mLabel.setId(android.R.id.title); mLabel.setTextColor(res.getColor(R.color.quick_settings_tile_text)); mLabel.setGravity(Gravity.CENTER); mLabel.setTypeface(CONDENSED); mLabel.setTextSize(TypedValue.COMPLEX_UNIT_PX, res.getDimensionPixelSize(R.dimen.quick_settings_tile_text_size)); addView(mLabel); recreateLabel(); setClipChildren(false); mIcon = createIcon(); Loading @@ -79,8 +73,33 @@ public class QSTileView extends ViewGroup { setBackground(getSelectableBackground()); } private void recreateLabel() { CharSequence labelText = null; if (mLabel != null) { labelText = mLabel.getText(); removeView(mLabel); } final Resources res = mContext.getResources(); mLabel = new TextView(mDual ? new ContextThemeWrapper(mContext, R.style.QSBorderless_Tiny) : mContext); mLabel.setId(android.R.id.title); mLabel.setTextColor(res.getColor(R.color.quick_settings_tile_text)); mLabel.setGravity(Gravity.CENTER); mLabel.setTypeface(CONDENSED); mLabel.setTextSize(TypedValue.COMPLEX_UNIT_PX, res.getDimensionPixelSize(R.dimen.quick_settings_tile_text_size)); if (labelText != null) { mLabel.setText(labelText); } addView(mLabel); } public void setDual(boolean dual) { final boolean changed = dual != mDual; mDual = dual; if (changed) { recreateLabel(); } if (mDual) { setOnClickListener(mClickPrimary); mLabel.setClickable(true); Loading Loading @@ -121,9 +140,10 @@ public class QSTileView extends ViewGroup { final int iconSpec = exactly((int)mLabel.getTextSize() * 2); mIcon.measure(iconSpec, iconSpec); mLabel.measure(widthMeasureSpec, MeasureSpec.makeMeasureSpec(h, MeasureSpec.AT_MOST)); mLabel.measure(widthMeasureSpec, exactly(mLabel.getMeasuredHeight() + p * 2)); if (mDual) { mDivider.measure(widthMeasureSpec, exactly(mDivider.getLayoutParams().height)); } else { mLabel.measure(widthMeasureSpec, exactly(mLabel.getMeasuredHeight() + p * 2)); } setMeasuredDimension(w, h); } Loading
packages/SystemUI/src/com/android/systemui/qs/tiles/BugreportTile.java +7 −2 Original line number Diff line number Diff line Loading @@ -57,9 +57,14 @@ public class BugreportTile extends QSTile<QSTile.State> { @Override protected void handleClick() { mHandler.postDelayed(new Runnable() { @Override public void run() { mHost.collapsePanels(); mUiHandler.post(mShowDialog); } }, FEEDBACK_START_DELAY); } @Override protected void handleUpdateState(State state, Object pushArg) { Loading
packages/SystemUI/src/com/android/systemui/qs/tiles/CastTile.java +6 −2 Original line number Diff line number Diff line Loading @@ -65,9 +65,13 @@ public class CastTile extends QSTile<QSTile.BooleanState> { @Override protected void handleClick() { mHandler.postDelayed(new Runnable() { public void run() { mHost.collapsePanels(); mUiHandler.post(mShowDialog); } }, FEEDBACK_START_DELAY); } @Override protected void handleUpdateState(BooleanState state, Object arg) { Loading