Dismantle remove labels prototype
Test: manual Bug: 171319433 Change-Id: I1ea97cec5c0d9b559213ca2adb9ddf7af60229a6
This commit is contained in:
@@ -50,6 +50,4 @@ public abstract class QSTileView extends LinearLayout {
|
||||
public abstract void onStateChanged(State state);
|
||||
|
||||
public abstract int getDetailY();
|
||||
|
||||
public void setShowLabels(boolean show) {}
|
||||
}
|
||||
|
||||
@@ -71,7 +71,6 @@ public class PagedTileLayout extends ViewPager implements QSTileLayout {
|
||||
private int mMinRows = 1;
|
||||
private int mMaxColumns = TileLayout.NO_MAX_COLUMNS;
|
||||
|
||||
private boolean mShowLabels = true;
|
||||
private final boolean mSideLabels;
|
||||
|
||||
public PagedTileLayout(Context context, AttributeSet attrs) {
|
||||
@@ -91,16 +90,6 @@ public class PagedTileLayout extends ViewPager implements QSTileLayout {
|
||||
}
|
||||
private int mLastMaxHeight = -1;
|
||||
|
||||
@Override
|
||||
public void setShowLabels(boolean show) {
|
||||
mShowLabels = show;
|
||||
for (TileLayout p : mPages) {
|
||||
p.setShowLabels(show);
|
||||
}
|
||||
mDistributeTiles = true;
|
||||
requestLayout();
|
||||
}
|
||||
|
||||
public void saveInstanceState(Bundle outState) {
|
||||
outState.putInt(CURRENT_PAGE, getCurrentItem());
|
||||
}
|
||||
@@ -239,7 +228,6 @@ public class PagedTileLayout extends ViewPager implements QSTileLayout {
|
||||
: R.layout.qs_paged_page, this, false);
|
||||
page.setMinRows(mMinRows);
|
||||
page.setMaxColumns(mMaxColumns);
|
||||
page.setShowLabels(mShowLabels);
|
||||
return page;
|
||||
}
|
||||
|
||||
|
||||
@@ -847,8 +847,6 @@ public class QSPanel extends LinearLayout implements Tunable {
|
||||
default void setExpansion(float expansion) {}
|
||||
|
||||
int getNumVisibleTiles();
|
||||
|
||||
default void setShowLabels(boolean show) {}
|
||||
}
|
||||
|
||||
interface OnConfigurationChangedListener {
|
||||
|
||||
@@ -124,7 +124,6 @@ public class QSPanelController extends QSPanelControllerBase<QSPanel> {
|
||||
updateMediaDisappearParameters();
|
||||
|
||||
mTunerService.addTunable(mView, QS_SHOW_BRIGHTNESS);
|
||||
mTunerService.addTunable(mTunable, QS_REMOVE_LABELS);
|
||||
mView.updateResources();
|
||||
if (mView.isListening()) {
|
||||
refreshAllTiles();
|
||||
@@ -137,13 +136,6 @@ public class QSPanelController extends QSPanelControllerBase<QSPanel> {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
boolean switchTileLayout(boolean force) {
|
||||
boolean result = super.switchTileLayout(force);
|
||||
getTileLayout().setShowLabels(mShowLabels);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected QSTileRevealController createTileRevealController() {
|
||||
return mQsTileRevealControllerFactory.create(
|
||||
@@ -152,7 +144,6 @@ public class QSPanelController extends QSPanelControllerBase<QSPanel> {
|
||||
|
||||
@Override
|
||||
protected void onViewDetached() {
|
||||
mTunerService.removeTunable(mTunable);
|
||||
mTunerService.removeTunable(mView);
|
||||
mView.removeOnConfigurationChangedListener(mOnConfigurationChangedListener);
|
||||
if (mBrightnessMirrorController != null) {
|
||||
@@ -318,22 +309,5 @@ public class QSPanelController extends QSPanelControllerBase<QSPanel> {
|
||||
public boolean isExpanded() {
|
||||
return mView.isExpanded();
|
||||
}
|
||||
|
||||
private TunerService.Tunable mTunable = new TunerService.Tunable() {
|
||||
@Override
|
||||
public void onTuningChanged(String key, String newValue) {
|
||||
if (QS_REMOVE_LABELS.equals(key)) {
|
||||
if (!mQSLabelFlag) return;
|
||||
boolean newShowLabels = newValue == null || "0".equals(newValue);
|
||||
if (mShowLabels == newShowLabels) return;
|
||||
mShowLabels = newShowLabels;
|
||||
for (TileRecord t : mRecords) {
|
||||
t.tileView.setShowLabels(mShowLabels);
|
||||
}
|
||||
getTileLayout().setShowLabels(mShowLabels);
|
||||
mView.requestLayout();
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -198,7 +198,6 @@ public abstract class QSPanelControllerBase<T extends QSPanel> extends ViewContr
|
||||
final TileRecord r = new TileRecord();
|
||||
r.tile = tile;
|
||||
r.tileView = mHost.createTileView(tile, collapsedView);
|
||||
r.tileView.setShowLabels(mShowLabels);
|
||||
mView.addTile(r);
|
||||
mRecords.add(r);
|
||||
mCachedSpecs = getTilesSpecs();
|
||||
|
||||
@@ -34,8 +34,6 @@ open class SideLabelTileLayout(
|
||||
}
|
||||
}
|
||||
|
||||
override fun setShowLabels(show: Boolean) { }
|
||||
|
||||
override fun isFull(): Boolean {
|
||||
return mRecords.size >= maxTiles()
|
||||
}
|
||||
|
||||
@@ -36,7 +36,6 @@ public class TileLayout extends ViewGroup implements QSTileLayout {
|
||||
private int mCellMarginTop;
|
||||
protected boolean mListening;
|
||||
protected int mMaxAllowedRows = 3;
|
||||
private boolean mShowLabels = true;
|
||||
|
||||
// Prototyping with less rows
|
||||
private final boolean mLessRows;
|
||||
@@ -56,12 +55,6 @@ public class TileLayout extends ViewGroup implements QSTileLayout {
|
||||
updateResources();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setShowLabels(boolean show) {
|
||||
mShowLabels = show;
|
||||
updateResources();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getOffsetTop(TileRecord tile) {
|
||||
return getTop();
|
||||
@@ -128,12 +121,9 @@ public class TileLayout extends ViewGroup implements QSTileLayout {
|
||||
mMaxCellHeight = mContext.getResources().getDimensionPixelSize(R.dimen.qs_tile_height);
|
||||
mCellMarginHorizontal = res.getDimensionPixelSize(R.dimen.qs_tile_margin_horizontal);
|
||||
mCellMarginVertical= res.getDimensionPixelSize(R.dimen.qs_tile_margin_vertical);
|
||||
if (!mShowLabels && mCellMarginVertical == 0) {
|
||||
mCellMarginVertical = mCellMarginHorizontal;
|
||||
}
|
||||
mCellMarginTop = res.getDimensionPixelSize(R.dimen.qs_tile_margin_top);
|
||||
mMaxAllowedRows = Math.max(1, getResources().getInteger(R.integer.quick_settings_max_rows));
|
||||
if (mLessRows && mShowLabels) mMaxAllowedRows = Math.max(mMinRows, mMaxAllowedRows - 1);
|
||||
if (mLessRows) mMaxAllowedRows = Math.max(mMinRows, mMaxAllowedRows - 1);
|
||||
if (updateColumns()) {
|
||||
requestLayout();
|
||||
return true;
|
||||
@@ -194,9 +184,8 @@ public class TileLayout extends ViewGroup implements QSTileLayout {
|
||||
+ mCellMarginVertical;
|
||||
final int previousRows = mRows;
|
||||
mRows = availableHeight / (getCellHeight() + mCellMarginVertical);
|
||||
final int minRows = mShowLabels ? mMinRows : mMinRows + 1;
|
||||
if (mRows < minRows) {
|
||||
mRows = minRows;
|
||||
if (mRows < mMinRows) {
|
||||
mRows = mMinRows;
|
||||
} else if (mRows >= mMaxAllowedRows) {
|
||||
mRows = mMaxAllowedRows;
|
||||
}
|
||||
@@ -216,7 +205,7 @@ public class TileLayout extends ViewGroup implements QSTileLayout {
|
||||
}
|
||||
|
||||
protected int getCellHeight() {
|
||||
return mShowLabels ? mMaxCellHeight : mMaxCellHeight / 2;
|
||||
return mMaxCellHeight;
|
||||
}
|
||||
|
||||
protected void layoutTileRecords(int numRecords) {
|
||||
|
||||
@@ -25,7 +25,6 @@ import android.util.TypedValue;
|
||||
import android.view.ContextThemeWrapper;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.Toolbar;
|
||||
@@ -48,7 +47,6 @@ import com.android.systemui.statusbar.phone.NotificationsQuickSettingsContainer;
|
||||
public class QSCustomizer extends LinearLayout {
|
||||
|
||||
static final int MENU_RESET = Menu.FIRST;
|
||||
static final int MENU_REMOVE_LABELS = Menu.FIRST + 1;
|
||||
static final String EXTRA_QS_CUSTOMIZING = "qs_customizing";
|
||||
|
||||
private final QSDetailClipper mClipper;
|
||||
@@ -77,10 +75,6 @@ public class QSCustomizer extends LinearLayout {
|
||||
|
||||
toolbar.getMenu().add(Menu.NONE, MENU_RESET, 0,
|
||||
mContext.getString(com.android.internal.R.string.reset));
|
||||
// Prototype menu item
|
||||
toolbar.getMenu()
|
||||
.add(Menu.NONE, MENU_REMOVE_LABELS, Menu.NONE, R.string.qs_remove_labels)
|
||||
.setCheckable(true);
|
||||
toolbar.setTitle(R.string.qs_edit);
|
||||
mRecyclerView = findViewById(android.R.id.list);
|
||||
mTransparentView = findViewById(R.id.customizer_transparent_view);
|
||||
@@ -89,11 +83,6 @@ public class QSCustomizer extends LinearLayout {
|
||||
mRecyclerView.setItemAnimator(animator);
|
||||
}
|
||||
|
||||
MenuItem getRemoveItem() {
|
||||
return ((Toolbar) findViewById(com.android.internal.R.id.action_bar))
|
||||
.getMenu().findItem(MENU_REMOVE_LABELS);
|
||||
}
|
||||
|
||||
void updateResources() {
|
||||
LayoutParams lp = (LayoutParams) mTransparentView.getLayoutParams();
|
||||
lp.height = mContext.getResources().getDimensionPixelSize(
|
||||
|
||||
@@ -17,9 +17,7 @@
|
||||
package com.android.systemui.qs.customize;
|
||||
|
||||
import static com.android.systemui.qs.customize.QSCustomizer.EXTRA_QS_CUSTOMIZING;
|
||||
import static com.android.systemui.qs.customize.QSCustomizer.MENU_REMOVE_LABELS;
|
||||
import static com.android.systemui.qs.customize.QSCustomizer.MENU_RESET;
|
||||
import static com.android.systemui.qs.dagger.QSFlagsModule.QS_LABELS_FLAG;
|
||||
|
||||
import android.content.res.Configuration;
|
||||
import android.os.Bundle;
|
||||
@@ -38,7 +36,6 @@ import com.android.systemui.keyguard.ScreenLifecycle;
|
||||
import com.android.systemui.plugins.qs.QSTile;
|
||||
import com.android.systemui.qs.QSEditEvent;
|
||||
import com.android.systemui.qs.QSFragment;
|
||||
import com.android.systemui.qs.QSPanelController;
|
||||
import com.android.systemui.qs.QSTileHost;
|
||||
import com.android.systemui.qs.dagger.QSScope;
|
||||
import com.android.systemui.statusbar.phone.LightBarController;
|
||||
@@ -46,14 +43,12 @@ import com.android.systemui.statusbar.phone.NotificationsQuickSettingsContainer;
|
||||
import com.android.systemui.statusbar.policy.ConfigurationController;
|
||||
import com.android.systemui.statusbar.policy.ConfigurationController.ConfigurationListener;
|
||||
import com.android.systemui.statusbar.policy.KeyguardStateController;
|
||||
import com.android.systemui.tuner.TunerService;
|
||||
import com.android.systemui.util.ViewController;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Named;
|
||||
|
||||
/** {@link ViewController} for {@link QSCustomizer}. */
|
||||
@QSScope
|
||||
@@ -67,8 +62,6 @@ public class QSCustomizerController extends ViewController<QSCustomizer> {
|
||||
private final ConfigurationController mConfigurationController;
|
||||
private final UiEventLogger mUiEventLogger;
|
||||
private final Toolbar mToolbar;
|
||||
private final TunerService mTunerService;
|
||||
private final boolean mQsLabelsFlag;
|
||||
|
||||
private final OnMenuItemClickListener mOnMenuItemClickListener = new OnMenuItemClickListener() {
|
||||
@Override
|
||||
@@ -76,11 +69,6 @@ public class QSCustomizerController extends ViewController<QSCustomizer> {
|
||||
if (item.getItemId() == MENU_RESET) {
|
||||
mUiEventLogger.log(QSEditEvent.QS_EDIT_RESET);
|
||||
reset();
|
||||
} else if (item.getItemId() == MENU_REMOVE_LABELS) {
|
||||
item.setChecked(!item.isChecked());
|
||||
mTunerService.setValue(
|
||||
QSPanelController.QS_REMOVE_LABELS, item.isChecked() ? "1" : "0");
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -111,20 +99,11 @@ public class QSCustomizerController extends ViewController<QSCustomizer> {
|
||||
}
|
||||
};
|
||||
|
||||
private final TunerService.Tunable mTunable = new TunerService.Tunable() {
|
||||
@Override
|
||||
public void onTuningChanged(String key, String newValue) {
|
||||
mToolbar.getMenu().findItem(MENU_REMOVE_LABELS)
|
||||
.setChecked(newValue != null && !("0".equals(newValue)));
|
||||
}
|
||||
};
|
||||
|
||||
@Inject
|
||||
protected QSCustomizerController(QSCustomizer view, TileQueryHelper tileQueryHelper,
|
||||
QSTileHost qsTileHost, TileAdapter tileAdapter, ScreenLifecycle screenLifecycle,
|
||||
KeyguardStateController keyguardStateController, LightBarController lightBarController,
|
||||
ConfigurationController configurationController, UiEventLogger uiEventLogger,
|
||||
TunerService tunerService, @Named(QS_LABELS_FLAG) boolean qsLabelsFlag) {
|
||||
ConfigurationController configurationController, UiEventLogger uiEventLogger) {
|
||||
super(view);
|
||||
mTileQueryHelper = tileQueryHelper;
|
||||
mQsTileHost = qsTileHost;
|
||||
@@ -136,21 +115,12 @@ public class QSCustomizerController extends ViewController<QSCustomizer> {
|
||||
mUiEventLogger = uiEventLogger;
|
||||
|
||||
mToolbar = mView.findViewById(com.android.internal.R.id.action_bar);
|
||||
mQsLabelsFlag = qsLabelsFlag;
|
||||
|
||||
mTunerService = tunerService;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onInit() {
|
||||
super.onInit();
|
||||
mView.getRemoveItem().setVisible(mQsLabelsFlag);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onViewAttached() {
|
||||
mView.updateNavBackDrop(getResources().getConfiguration(), mLightBarController);
|
||||
mTunerService.addTunable(mTunable, QSPanelController.QS_REMOVE_LABELS);
|
||||
|
||||
mConfigurationController.addCallback(mConfigurationListener);
|
||||
|
||||
@@ -181,7 +151,6 @@ public class QSCustomizerController extends ViewController<QSCustomizer> {
|
||||
|
||||
@Override
|
||||
protected void onViewDetached() {
|
||||
mTunerService.removeTunable(mTunable);
|
||||
mTileQueryHelper.setListener(null);
|
||||
mToolbar.setOnMenuItemClickListener(null);
|
||||
mConfigurationController.removeCallback(mConfigurationListener);
|
||||
|
||||
@@ -174,9 +174,4 @@ public class QSTileView extends QSTileBaseView {
|
||||
mLabelContainer.setClickable(false);
|
||||
mLabelContainer.setLongClickable(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setShowLabels(boolean show) {
|
||||
mHandler.post(() -> mLabelContainer.setVisibility(show ? VISIBLE : GONE));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user