summaryrefslogtreecommitdiffstats
path: root/packages/SystemUI
diff options
context:
space:
mode:
authorAdnan Begovic <adnan@cyngn.com>2015-12-02 15:43:28 -0800
committerAdnan Begovic <adnan@cyngn.com>2015-12-07 15:24:07 -0800
commitd10e52b5754ed3b89d1ae737d512383b37cf55ed (patch)
tree3ff69a581b71b8db8492ceaeda312d0dbc7b2c9f /packages/SystemUI
parentd0199cf86871823d510d35890ab6ae1a891b2cbf (diff)
downloadframeworks_base-d10e52b5754ed3b89d1ae737d512383b37cf55ed.zip
frameworks_base-d10e52b5754ed3b89d1ae737d512383b37cf55ed.tar.gz
frameworks_base-d10e52b5754ed3b89d1ae737d512383b37cf55ed.tar.bz2
SystemUI: Move remove button impl to QSDragPanel.
Expose a few methods to make attaching listeners to objects in the detail adapter possible. Change-Id: Ic72f27f7db4323de4a7b45643230bd20f8c8b4b5
Diffstat (limited to 'packages/SystemUI')
-rw-r--r--packages/SystemUI/src/com/android/systemui/qs/QSDragPanel.java36
-rw-r--r--packages/SystemUI/src/com/android/systemui/qs/QSPanel.java19
2 files changed, 40 insertions, 15 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSDragPanel.java b/packages/SystemUI/src/com/android/systemui/qs/QSDragPanel.java
index 3376726..5e62858 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/QSDragPanel.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/QSDragPanel.java
@@ -24,6 +24,7 @@ import android.content.ContentResolver;
import android.content.Context;
import android.content.DialogInterface;
import android.content.res.Resources;
+import android.content.res.Configuration;
import android.graphics.Canvas;
import android.graphics.PointF;
import android.graphics.drawable.Drawable;
@@ -42,6 +43,7 @@ import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;
import com.android.internal.logging.MetricsLogger;
+import com.android.systemui.FontSizeUtils;
import com.android.systemui.R;
import com.android.systemui.cm.UserContentObserver;
import com.android.systemui.qs.tiles.EditTile;
@@ -52,9 +54,13 @@ import com.android.systemui.statusbar.phone.QSTileHost;
import com.android.systemui.statusbar.phone.SystemUIDialog;
import com.android.systemui.statusbar.policy.BrightnessMirrorController;
import com.android.systemui.tuner.QsTuner;
+
import com.viewpagerindicator.CirclePageIndicator;
import cyanogenmod.providers.CMSettings;
+import cyanogenmod.app.StatusBarPanelCustomTile;
+import cyanogenmod.providers.CMSettings;
+
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
@@ -76,6 +82,7 @@ public class QSDragPanel extends QSPanel implements View.OnDragListener, View.On
QSPanelTopView mQsPanelTop;
CirclePageIndicator mPageIndicator;
+ private TextView mDetailRemoveButton;
private DragTileRecord mDraggingRecord;
private boolean mEditing;
private boolean mDragging;
@@ -109,6 +116,7 @@ public class QSDragPanel extends QSPanel implements View.OnDragListener, View.On
mDetail = LayoutInflater.from(mContext).inflate(R.layout.qs_detail, this, false);
mDetailContent = (ViewGroup) mDetail.findViewById(android.R.id.content);
+ mDetailRemoveButton = (TextView) mDetail.findViewById(android.R.id.button3);
mDetailSettingsButton = (TextView) mDetail.findViewById(android.R.id.button2);
mDetailDoneButton = (TextView) mDetail.findViewById(android.R.id.button1);
updateDetailText();
@@ -420,6 +428,12 @@ public class QSDragPanel extends QSPanel implements View.OnDragListener, View.On
return getPagesForCount(initialSize);
}
+ @Override
+ protected void updateDetailText() {
+ super.updateDetailText();
+ mDetailRemoveButton.setText(R.string.quick_settings_remove);
+ }
+
/**
* @return returns the number of pages that has at least 1 visible tile
*/
@@ -1454,6 +1468,22 @@ public class QSDragPanel extends QSPanel implements View.OnDragListener, View.On
}
}
+ @Override
+ protected void handleShowDetailImpl(Record r, boolean show, int x, int y) {
+ super.handleShowDetailImpl(r, show, x, y);
+ if (show) {
+ final StatusBarPanelCustomTile customTile = r.detailAdapter.getCustomTile();
+ mDetailRemoveButton.setVisibility(customTile != null ? VISIBLE : GONE);
+ mDetailRemoveButton.setOnClickListener(new OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ mHost.collapsePanels();
+ mHost.removeCustomTile(customTile);
+ }
+ });
+ }
+ }
+
public int getDesiredColumnCount(int page, int row) {
if (page == 0 && row == 0) {
return 2; // TODO change if large tiles are disabled
@@ -1463,6 +1493,12 @@ public class QSDragPanel extends QSPanel implements View.OnDragListener, View.On
}
@Override
+ protected void onConfigurationChanged(Configuration newConfig) {
+ super.onConfigurationChanged(newConfig);
+ FontSizeUtils.updateFontSize(mDetailRemoveButton, R.dimen.qs_detail_button_text_size);
+ }
+
+ @Override
public void setExpanded(boolean expanded) {
super.setExpanded(expanded);
if (!expanded) {
diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java b/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java
index 7d9b48b..1e6867d 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java
@@ -57,7 +57,6 @@ public class QSPanel extends ViewGroup {
protected final ArrayList<TileRecord> mRecords = new ArrayList<>();
protected View mDetail;
protected ViewGroup mDetailContent;
- protected TextView mDetailRemoveButton;
protected TextView mDetailSettingsButton;
protected TextView mDetailDoneButton;
protected View mBrightnessView;
@@ -95,10 +94,12 @@ public class QSPanel extends ViewGroup {
setupViews();
}
+ /**
+ * THIS IS OVERRIDDEN in QSDragPanel
+ */
protected void setupViews() {
mDetail = LayoutInflater.from(mContext).inflate(R.layout.qs_detail, this, false);
mDetailContent = (ViewGroup) mDetail.findViewById(android.R.id.content);
- mDetailRemoveButton = (TextView) mDetail.findViewById(android.R.id.button3);
mDetailSettingsButton = (TextView) mDetail.findViewById(android.R.id.button2);
mDetailDoneButton = (TextView) mDetail.findViewById(android.R.id.button1);
updateDetailText();
@@ -149,7 +150,6 @@ public class QSPanel extends ViewGroup {
protected void updateDetailText() {
mDetailDoneButton.setText(R.string.quick_settings_done);
mDetailSettingsButton.setText(R.string.quick_settings_more_settings);
- mDetailRemoveButton.setText(R.string.quick_settings_remove);
}
public void setBrightnessMirror(BrightnessMirrorController c) {
@@ -201,7 +201,6 @@ public class QSPanel extends ViewGroup {
super.onConfigurationChanged(newConfig);
FontSizeUtils.updateFontSize(mDetailDoneButton, R.dimen.qs_detail_button_text_size);
FontSizeUtils.updateFontSize(mDetailSettingsButton, R.dimen.qs_detail_button_text_size);
- FontSizeUtils.updateFontSize(mDetailRemoveButton, R.dimen.qs_detail_button_text_size);
// We need to poke the detail views as well as they might not be attached to the view
// hierarchy but reused at a later point.
@@ -408,7 +407,7 @@ public class QSPanel extends ViewGroup {
handleShowDetailImpl(r, show, x, y);
}
- protected final void handleShowDetailImpl(Record r, boolean show, int x, int y) {
+ protected void handleShowDetailImpl(Record r, boolean show, int x, int y) {
boolean visibleDiff = (mDetailRecord != null) != show;
if (!visibleDiff && mDetailRecord == r) return; // already in right state
DetailAdapter detailAdapter = null;
@@ -427,16 +426,6 @@ public class QSPanel extends ViewGroup {
}
});
- final StatusBarPanelCustomTile customTile = detailAdapter.getCustomTile();
- mDetailRemoveButton.setVisibility(customTile != null ? VISIBLE : GONE);
- mDetailRemoveButton.setOnClickListener(new OnClickListener() {
- @Override
- public void onClick(View v) {
- mHost.collapsePanels();
- mHost.removeCustomTile(customTile);
- }
- });
-
mDetailContent.removeAllViews();
mDetail.bringToFront();
mDetailContent.addView(r.detailView);