Make the new QS the new QS
Some UI updates to the header, then make the new QS the default state for everyone. Change-Id: I82b6bebb0b21a5c9eb926cb1a761cac340a293df
This commit is contained in:
27
packages/SystemUI/res/drawable/header_dot.xml
Normal file
27
packages/SystemUI/res/drawable/header_dot.xml
Normal file
@@ -0,0 +1,27 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
** Copyright 2015, 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.
|
||||
-->
|
||||
<shape
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="oval">
|
||||
|
||||
<solid
|
||||
android:color="#FFFFFF"/>
|
||||
|
||||
<size
|
||||
android:width="3dp"
|
||||
android:height="3dp"/>
|
||||
</shape>
|
||||
@@ -19,7 +19,6 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/qs_background_primary"
|
||||
android:paddingTop="8dp"
|
||||
android:paddingBottom="8dp"
|
||||
android:elevation="2dp">
|
||||
|
||||
|
||||
@@ -33,16 +33,6 @@
|
||||
android:focusable="true"
|
||||
>
|
||||
|
||||
<com.android.systemui.qs.QuickQSPanel
|
||||
android:id="@+id/quick_qs_panel"
|
||||
android:background="#0000"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:clipChildren="false"
|
||||
android:clipToPadding="false"
|
||||
android:layout_marginEnd="12dp" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/expanded_group"
|
||||
android:layout_width="wrap_content"
|
||||
@@ -52,7 +42,8 @@
|
||||
android:clipToPadding="false"
|
||||
android:orientation="horizontal"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_marginEnd="12dp">
|
||||
android:layout_marginTop="30dp"
|
||||
android:layout_marginEnd="16dp">
|
||||
|
||||
<com.android.systemui.statusbar.AlphaOptimizedFrameLayout
|
||||
android:id="@+id/settings_button_container"
|
||||
@@ -87,49 +78,60 @@
|
||||
android:tint="@android:color/white" />
|
||||
</LinearLayout>
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/date_group"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="@dimen/clock_collapsed_bottom_margin"
|
||||
android:layout_alignParentBottom="true">
|
||||
<com.android.systemui.statusbar.policy.DateView android:id="@+id/date_collapsed"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
android:singleLine="true"
|
||||
android:textAppearance="@style/TextAppearance.StatusBar.Expanded.Date"
|
||||
android:layout_below="@id/clock"
|
||||
systemui:datePattern="@string/abbrev_wday_month_day_no_year_alarm"
|
||||
/>
|
||||
</FrameLayout>
|
||||
|
||||
<include layout="@layout/split_clock_view"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_above="@id/date_group"
|
||||
android:layout_marginTop="2dp"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentTop="true"
|
||||
android:id="@+id/clock"
|
||||
/>
|
||||
|
||||
<com.android.systemui.statusbar.AlphaOptimizedButton android:id="@+id/alarm_status"
|
||||
<com.android.systemui.statusbar.policy.DateView
|
||||
android:id="@+id/date"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_toEndOf="@id/date_group"
|
||||
android:layout_marginBottom="4dp"
|
||||
android:layout_marginStart="6dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_toEndOf="@id/clock"
|
||||
android:layout_alignParentTop="true"
|
||||
android:drawableStart="@drawable/header_dot"
|
||||
android:drawablePadding="6dp"
|
||||
android:singleLine="true"
|
||||
android:textAppearance="@style/TextAppearance.StatusBar.Expanded.Clock"
|
||||
android:textSize="@dimen/qs_time_collapsed_size"
|
||||
systemui:datePattern="@string/abbrev_wday_month_day_no_year_alarm"
|
||||
/>
|
||||
|
||||
<com.android.systemui.statusbar.AlphaOptimizedButton
|
||||
android:id="@+id/alarm_status"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_toEndOf="@id/date"
|
||||
android:drawablePadding="6dp"
|
||||
android:drawableStart="@drawable/ic_access_alarms_small"
|
||||
android:textColor="#64ffffff"
|
||||
android:textAppearance="@style/TextAppearance.StatusBar.Expanded.Date"
|
||||
android:paddingEnd="6dp"
|
||||
android:minHeight="36dp"
|
||||
android:paddingStart="6dp"
|
||||
android:paddingTop="16dp"
|
||||
android:paddingBottom="16dp"
|
||||
android:background="?android:attr/selectableItemBackground"
|
||||
android:visibility="gone"
|
||||
/>
|
||||
|
||||
<com.android.systemui.qs.QuickQSPanel
|
||||
android:id="@+id/quick_qs_panel"
|
||||
android:background="#0000"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="30dp"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:clipChildren="false"
|
||||
android:clipToPadding="false" />
|
||||
|
||||
<include
|
||||
android:id="@+id/qs_detail_header"
|
||||
layout="@layout/qs_detail_header"
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:singleLine="true"
|
||||
android:textAppearance="@style/TextAppearance.StatusBar.Expanded.Clock"
|
||||
android:textSize="@dimen/qs_time_collapsed_size"
|
||||
/>
|
||||
<TextClock
|
||||
android:id="@+id/am_pm_view"
|
||||
|
||||
@@ -18,6 +18,6 @@
|
||||
|
||||
<resources>
|
||||
<!-- The maximum number of items to be displayed in quick settings -->
|
||||
<integer name="quick_settings_detail_max_item_count">8</integer>
|
||||
<integer name="quick_settings_detail_max_item_count">6</integer>
|
||||
</resources>
|
||||
|
||||
|
||||
@@ -117,7 +117,7 @@
|
||||
<integer name="quick_settings_brightness_dialog_long_timeout">4000</integer>
|
||||
|
||||
<!-- The maximum number of items to be displayed in quick settings -->
|
||||
<integer name="quick_settings_detail_max_item_count">7</integer>
|
||||
<integer name="quick_settings_detail_max_item_count">5</integer>
|
||||
|
||||
<!-- Should "4G" be shown instead of "LTE" when the network is NETWORK_TYPE_LTE? -->
|
||||
<bool name="config_show4GForLTE">true</bool>
|
||||
|
||||
@@ -107,7 +107,7 @@
|
||||
<dimen name="close_handle_underlap">32dp</dimen>
|
||||
|
||||
<!-- Height of the status bar header bar -->
|
||||
<dimen name="status_bar_header_height">60dp</dimen>
|
||||
<dimen name="status_bar_header_height">90dp</dimen>
|
||||
|
||||
<!-- Height of the status bar header bar when expanded -->
|
||||
<dimen name="status_bar_header_height_expanded">116dp</dimen>
|
||||
|
||||
@@ -18,25 +18,10 @@
|
||||
xmlns:sysui="http://schemas.android.com/apk/res-auto"
|
||||
android:title="@string/system_ui_tuner">
|
||||
|
||||
<PreferenceScreen
|
||||
android:title="@string/quick_settings">
|
||||
|
||||
<PreferenceCategory
|
||||
android:title="@string/experimental">
|
||||
|
||||
<com.android.systemui.tuner.TunerSwitch
|
||||
android:key="qs_show_brightness"
|
||||
android:title="@string/show_brightness"
|
||||
sysui:defValue="true" />
|
||||
|
||||
<com.android.systemui.tuner.QSPagingSwitch
|
||||
android:key="qs_paged_panel"
|
||||
android:title="@string/qs_paging" />
|
||||
|
||||
</PreferenceCategory>
|
||||
|
||||
</PreferenceScreen>
|
||||
|
||||
<com.android.systemui.tuner.TunerSwitch
|
||||
android:key="qs_show_brightness"
|
||||
android:title="@string/show_brightness"
|
||||
sysui:defValue="true" />
|
||||
|
||||
<PreferenceScreen
|
||||
android:title="@string/status_bar" >
|
||||
|
||||
@@ -98,7 +98,7 @@ public class PseudoGridView extends ViewGroup {
|
||||
}
|
||||
}
|
||||
|
||||
setMeasuredDimension(width, getDefaultSize(totalHeight, heightMeasureSpec));
|
||||
setMeasuredDimension(width, resolveSizeAndState(totalHeight, heightMeasureSpec, 0));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -19,14 +19,12 @@ package com.android.systemui.qs;
|
||||
import android.animation.Animator;
|
||||
import android.animation.Animator.AnimatorListener;
|
||||
import android.animation.AnimatorListenerAdapter;
|
||||
import android.app.ActivityManager;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.res.Configuration;
|
||||
import android.content.res.Resources;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import android.provider.Settings;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
@@ -36,7 +34,6 @@ import android.widget.FrameLayout;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.android.internal.logging.MetricsLogger;
|
||||
import com.android.systemui.FontSizeUtils;
|
||||
import com.android.systemui.R;
|
||||
@@ -56,7 +53,6 @@ import java.util.Collection;
|
||||
public class QSPanel extends FrameLayout implements Tunable {
|
||||
|
||||
public static final String QS_SHOW_BRIGHTNESS = "qs_show_brightness";
|
||||
public static final String QS_THE_NEW_QS = "qs_paged_panel";
|
||||
|
||||
protected final Context mContext;
|
||||
protected final ArrayList<TileRecord> mRecords = new ArrayList<TileRecord>();
|
||||
@@ -102,20 +98,25 @@ public class QSPanel extends FrameLayout implements Tunable {
|
||||
updateDetailText();
|
||||
mDetail.setVisibility(GONE);
|
||||
mDetail.setClickable(true);
|
||||
mBrightnessView = LayoutInflater.from(context).inflate(
|
||||
R.layout.quick_settings_brightness_dialog, this, false);
|
||||
mFooter = new QSFooter(this, context);
|
||||
addView(mDetail);
|
||||
|
||||
mQsContainer = new LinearLayout(mContext);
|
||||
mQsContainer.setOrientation(LinearLayout.VERTICAL);
|
||||
mQsContainer.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT,
|
||||
LayoutParams.WRAP_CONTENT));
|
||||
|
||||
addView(mQsContainer);
|
||||
|
||||
mBrightnessView = LayoutInflater.from(context).inflate(
|
||||
R.layout.quick_settings_brightness_dialog, this, false);
|
||||
mQsContainer.addView(mBrightnessView);
|
||||
|
||||
mTileLayout = (QSTileLayout) LayoutInflater.from(mContext).inflate(
|
||||
R.layout.qs_paged_tile_layout, mQsContainer, false);
|
||||
mQsContainer.addView((View) mTileLayout);
|
||||
|
||||
mFooter = new QSFooter(this, context);
|
||||
mQsContainer.addView(mFooter.getView());
|
||||
|
||||
mClipper = new QSDetailClipper(mDetail);
|
||||
updateResources();
|
||||
|
||||
@@ -136,7 +137,7 @@ public class QSPanel extends FrameLayout implements Tunable {
|
||||
@Override
|
||||
protected void onAttachedToWindow() {
|
||||
super.onAttachedToWindow();
|
||||
TunerService.get(mContext).addTunable(this, QS_SHOW_BRIGHTNESS, QS_THE_NEW_QS);
|
||||
TunerService.get(mContext).addTunable(this, QS_SHOW_BRIGHTNESS);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -150,36 +151,15 @@ public class QSPanel extends FrameLayout implements Tunable {
|
||||
if (QS_SHOW_BRIGHTNESS.equals(key)) {
|
||||
mBrightnessView.setVisibility(newValue == null || Integer.parseInt(newValue) != 0
|
||||
? VISIBLE : GONE);
|
||||
} else if (QS_THE_NEW_QS.equals(key)) {
|
||||
boolean theNewQs = newValue != null && Integer.parseInt(newValue) != 0;
|
||||
if (mTileLayout != null) {
|
||||
for (int i = 0; i < mRecords.size(); i++) {
|
||||
mTileLayout.removeTile(mRecords.get(i));
|
||||
}
|
||||
mQsContainer.removeView((View) mTileLayout);
|
||||
}
|
||||
int layout = theNewQs
|
||||
? R.layout.qs_paged_tile_layout : R.layout.qs_tile_layout;
|
||||
mTileLayout =
|
||||
(QSTileLayout) LayoutInflater.from(mContext).inflate(layout, mQsContainer, false);
|
||||
mQsContainer.addView((View) mTileLayout, 1 /* Between brightness and footer */);
|
||||
for (int i = 0; i < mRecords.size(); i++) {
|
||||
mTileLayout.addTile(mRecords.get(i));
|
||||
}
|
||||
if (theNewQs) {
|
||||
mCustomizePanel = (QSCustomizer) LayoutInflater.from(mContext)
|
||||
.inflate(R.layout.qs_customize_panel, null);
|
||||
mCustomizePanel.setHost(mHost);
|
||||
} else {
|
||||
if (mCustomizePanel != null && mCustomizePanel.isCustomizing()) {
|
||||
mCustomizePanel.hide(mCustomizePanel.getWidth() / 2,
|
||||
mCustomizePanel.getHeight() / 2);
|
||||
}
|
||||
mCustomizePanel = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void createCustomizePanel() {
|
||||
mCustomizePanel = (QSCustomizer) LayoutInflater.from(mContext)
|
||||
.inflate(R.layout.qs_customize_panel, null);
|
||||
mCustomizePanel.setHost(mHost);
|
||||
}
|
||||
|
||||
private void updateDetailText() {
|
||||
mDetailDoneButton.setText(R.string.quick_settings_done);
|
||||
mDetailSettingsButton.setText(R.string.quick_settings_more_settings);
|
||||
@@ -200,6 +180,7 @@ public class QSPanel extends FrameLayout implements Tunable {
|
||||
public void setHost(QSTileHost host) {
|
||||
mHost = host;
|
||||
mFooter.setHost(host);
|
||||
createCustomizePanel();
|
||||
}
|
||||
|
||||
public QSTileHost getHost() {
|
||||
@@ -608,9 +589,4 @@ public class QSPanel extends FrameLayout implements Tunable {
|
||||
int getOffsetTop(TileRecord tile);
|
||||
void updateResources();
|
||||
}
|
||||
|
||||
public static boolean isTheNewQS(Context context) {
|
||||
return Settings.Secure.getIntForUser(context.getContentResolver(), QS_THE_NEW_QS,
|
||||
ActivityManager.getCurrentUser(), 0) != 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -128,9 +128,10 @@ public class QuickQSPanel extends QSPanel {
|
||||
}
|
||||
|
||||
private LayoutParams generateLayoutParams() {
|
||||
int size =
|
||||
mContext.getResources().getDimensionPixelSize(R.dimen.qs_quick_tile_size);
|
||||
LayoutParams lp = new LayoutParams(size, size);
|
||||
int size = mContext.getResources().getDimensionPixelSize(R.dimen.qs_quick_tile_size);
|
||||
LayoutParams lp = new LayoutParams(0, size);
|
||||
lp.weight = 1;
|
||||
lp.gravity = Gravity.CENTER;
|
||||
return lp;
|
||||
}
|
||||
|
||||
|
||||
@@ -81,6 +81,11 @@ public class CustomQSPanel extends QSPanel {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void createCustomizePanel() {
|
||||
// Already in CustomizePanel.
|
||||
}
|
||||
|
||||
public void tileSelected(QSTile<?> tile, ClipData currentClip) {
|
||||
String sourceSpec = getSpec(currentClip);
|
||||
String destSpec = tile.getTileSpec();
|
||||
|
||||
@@ -37,9 +37,7 @@ import android.widget.LinearLayout;
|
||||
import android.widget.ListView;
|
||||
import android.widget.Toolbar;
|
||||
import android.widget.Toolbar.OnMenuItemClickListener;
|
||||
|
||||
import com.android.systemui.R;
|
||||
import com.android.systemui.SystemUIApplication;
|
||||
import com.android.systemui.qs.QSDetailClipper;
|
||||
import com.android.systemui.qs.QSTile.Host.Callback;
|
||||
import com.android.systemui.qs.customize.DropButton.OnDropListener;
|
||||
@@ -80,14 +78,13 @@ public class QSCustomizer extends LinearLayout implements OnMenuItemClickListene
|
||||
|
||||
public QSCustomizer(Context context, AttributeSet attrs) {
|
||||
super(new ContextThemeWrapper(context, android.R.style.Theme_Material), attrs);
|
||||
mPhoneStatusBar = ((SystemUIApplication) mContext.getApplicationContext())
|
||||
.getComponent(PhoneStatusBar.class);
|
||||
mClipper = new QSDetailClipper(this);
|
||||
}
|
||||
|
||||
public void setHost(QSTileHost host) {
|
||||
mHost = host;
|
||||
mHost.addCallback(this);
|
||||
mPhoneStatusBar = host.getPhoneStatusBar();
|
||||
mQsPanel.setTiles(mHost.getTiles());
|
||||
mQsPanel.setHost(mHost);
|
||||
mQsPanel.setSavedTiles();
|
||||
|
||||
@@ -85,6 +85,14 @@ public class CellularTile extends QSTile<QSTile.SignalState> {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void handleSecondaryClick() {
|
||||
boolean dataEnabled = mDataController.isMobileDataSupported()
|
||||
&& mDataController.isMobileDataEnabled();
|
||||
MetricsLogger.action(mContext, MetricsLogger.QS_CELLULAR_TOGGLE, !dataEnabled);
|
||||
mDataController.setMobileDataEnabled(!dataEnabled);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void handleUpdateState(SignalState state, Object arg) {
|
||||
CallbackInfo cb = (CallbackInfo) arg;
|
||||
|
||||
@@ -44,7 +44,6 @@ import android.view.animation.Interpolator;
|
||||
import android.view.animation.PathInterpolator;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.android.internal.logging.MetricsLogger;
|
||||
import com.android.keyguard.KeyguardStatusView;
|
||||
import com.android.systemui.DejankUtils;
|
||||
@@ -65,7 +64,6 @@ import com.android.systemui.statusbar.policy.HeadsUpManager;
|
||||
import com.android.systemui.statusbar.policy.KeyguardUserSwitcher;
|
||||
import com.android.systemui.statusbar.stack.NotificationStackScrollLayout;
|
||||
import com.android.systemui.statusbar.stack.StackStateAnimator;
|
||||
import com.android.systemui.tuner.TunerService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -73,7 +71,7 @@ public class NotificationPanelView extends PanelView implements
|
||||
ExpandableView.OnHeightChangedListener, ObservableScrollView.Listener,
|
||||
View.OnClickListener, NotificationStackScrollLayout.OnOverscrollTopChangedListener,
|
||||
KeyguardAffordanceHelper.Callback, NotificationStackScrollLayout.OnEmptySpaceClickListener,
|
||||
HeadsUpManager.OnHeadsUpChangedListener, TunerService.Tunable {
|
||||
HeadsUpManager.OnHeadsUpChangedListener {
|
||||
|
||||
private static final boolean DEBUG = false;
|
||||
|
||||
@@ -221,40 +219,21 @@ public class NotificationPanelView extends PanelView implements
|
||||
private final Interpolator mTouchResponseInterpolator =
|
||||
new PathInterpolator(0.3f, 0f, 0.1f, 1f);
|
||||
|
||||
private boolean mNewQs;
|
||||
|
||||
public NotificationPanelView(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
setWillNotDraw(!DEBUG);
|
||||
mFalsingManager = FalsingManager.getInstance(context);
|
||||
TunerService.get(context).addTunable(this, QSPanel.QS_THE_NEW_QS);
|
||||
}
|
||||
|
||||
public void setStatusBar(PhoneStatusBar bar) {
|
||||
mStatusBar = bar;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTuningChanged(String key, String newValue) {
|
||||
if (QSPanel.QS_THE_NEW_QS.equals(key)) {
|
||||
boolean b = newValue != null && Integer.parseInt(newValue) != 0;
|
||||
if (mNewQs != b) {
|
||||
if (mHeader != null) {
|
||||
// We are too late, no good way to re-initialize yet, just die and come back up.
|
||||
android.os.Process.killProcess(android.os.Process.myPid());
|
||||
} else {
|
||||
mNewQs = b;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onFinishInflate() {
|
||||
super.onFinishInflate();
|
||||
ViewStub stub = (ViewStub) findViewById(R.id.status_bar_header);
|
||||
stub.setLayoutResource(mNewQs
|
||||
? R.layout.quick_status_bar_expanded_header : R.layout.status_bar_expanded_header);
|
||||
stub.setLayoutResource(R.layout.quick_status_bar_expanded_header);
|
||||
mHeader = (BaseStatusBarHeader) stub.inflate();
|
||||
mHeader.setOnClickListener(this);
|
||||
mKeyguardStatusBar = (KeyguardStatusBarView) findViewById(R.id.keyguard_header);
|
||||
|
||||
@@ -133,7 +133,7 @@ public final class QSTileHost extends IQSService.Stub implements QSTile.Host, Tu
|
||||
TunerService.get(mContext).addTunable(this, TILES_SETTING);
|
||||
}
|
||||
|
||||
PhoneStatusBar getPhoneStatusBar() {
|
||||
public PhoneStatusBar getPhoneStatusBar() {
|
||||
return mStatusBar;
|
||||
}
|
||||
|
||||
|
||||
@@ -24,12 +24,14 @@ import android.graphics.Rect;
|
||||
import android.graphics.drawable.Animatable;
|
||||
import android.graphics.drawable.RippleDrawable;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.Switch;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
import com.android.keyguard.KeyguardStatusView;
|
||||
import com.android.systemui.R;
|
||||
import com.android.systemui.qs.QSPanel;
|
||||
import com.android.systemui.qs.QSTile;
|
||||
@@ -42,6 +44,7 @@ import com.android.systemui.tuner.TunerService;
|
||||
public class QuickStatusBarHeader extends BaseStatusBarHeader implements
|
||||
NextAlarmController.NextAlarmChangeCallback, View.OnClickListener {
|
||||
|
||||
private static final String TAG = "QuickStatusBarHeader";
|
||||
private ActivityStarter mActivityStarter;
|
||||
private NextAlarmController mNextAlarmController;
|
||||
private SettingsButton mSettingsButton;
|
||||
@@ -118,14 +121,15 @@ public class QuickStatusBarHeader extends BaseStatusBarHeader implements
|
||||
@Override
|
||||
public void setExpanded(boolean expanded) {
|
||||
mExpanded = expanded;
|
||||
updateEverything();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNextAlarmChanged(AlarmManager.AlarmClockInfo nextAlarm) {
|
||||
mNextAlarm = nextAlarm;
|
||||
Log.d(TAG, "Got alarm update " + (nextAlarm != null));
|
||||
if (nextAlarm != null) {
|
||||
// TODO:...
|
||||
// mAlarmStatus.setText(KeyguardStatusView.formatNextAlarm(getContext(), nextAlarm));
|
||||
mAlarmStatus.setText(KeyguardStatusView.formatNextAlarm(getContext(), nextAlarm));
|
||||
}
|
||||
mAlarmShowing = nextAlarm != null;
|
||||
updateEverything();
|
||||
@@ -154,7 +158,7 @@ public class QuickStatusBarHeader extends BaseStatusBarHeader implements
|
||||
}
|
||||
|
||||
private void updateVisibilities() {
|
||||
mAlarmStatus.setVisibility(mExpanded && mAlarmShowing ? View.VISIBLE : View.GONE);
|
||||
mAlarmStatus.setVisibility(mAlarmShowing ? View.VISIBLE : View.GONE);
|
||||
mQsDetailHeader.setVisibility(mExpanded && mShowingDetail ? View.VISIBLE : View.INVISIBLE);
|
||||
mSettingsContainer.findViewById(R.id.tuner_icon).setVisibility(
|
||||
TunerService.isTunerEnabled(mContext) ? View.VISIBLE : View.INVISIBLE);
|
||||
@@ -162,8 +166,10 @@ public class QuickStatusBarHeader extends BaseStatusBarHeader implements
|
||||
|
||||
private void updateListeners() {
|
||||
if (mListening) {
|
||||
Log.d(TAG, "Listening for Alarms");
|
||||
mNextAlarmController.addStateChangedCallback(this);
|
||||
} else {
|
||||
Log.d(TAG, "Not listening for Alarms");
|
||||
mNextAlarmController.removeStateChangedCallback(this);
|
||||
}
|
||||
}
|
||||
@@ -193,7 +199,7 @@ public class QuickStatusBarHeader extends BaseStatusBarHeader implements
|
||||
host.getBatteryController());
|
||||
mHeaderQsPanel.setQSPanelAndHeader(mQsPanel, this);
|
||||
mHeaderQsPanel.setHost(myHost);
|
||||
mHeaderQsPanel.setMaxTiles(3);
|
||||
mHeaderQsPanel.setMaxTiles(5);
|
||||
mHeaderQsPanel.setTiles(myHost.getTiles());
|
||||
myHost.addCallback(new QSTile.Host.Callback() {
|
||||
@Override
|
||||
|
||||
@@ -59,7 +59,7 @@ import java.text.NumberFormat;
|
||||
*/
|
||||
public class StatusBarHeaderView extends BaseStatusBarHeader implements View.OnClickListener,
|
||||
BatteryController.BatteryStateChangeCallback, NextAlarmController.NextAlarmChangeCallback,
|
||||
EmergencyListener, TunerService.Tunable {
|
||||
EmergencyListener {
|
||||
|
||||
private boolean mExpanded;
|
||||
private boolean mListening;
|
||||
@@ -234,28 +234,6 @@ public class StatusBarHeaderView extends BaseStatusBarHeader implements View.OnC
|
||||
updateClockCollapsedMargin();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onAttachedToWindow() {
|
||||
super.onAttachedToWindow();
|
||||
TunerService.get(mContext).addTunable(this, QSPanel.QS_THE_NEW_QS);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDetachedFromWindow() {
|
||||
super.onDetachedFromWindow();
|
||||
TunerService.get(mContext).removeTunable(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTuningChanged(String key, String newValue) {
|
||||
if (QSPanel.QS_THE_NEW_QS.equals(key)) {
|
||||
mAllowExpand = newValue == null || Integer.parseInt(newValue) == 0;
|
||||
if (!mAllowExpand) {
|
||||
setExpanded(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void updateClockCollapsedMargin() {
|
||||
Resources res = getResources();
|
||||
int padding = res.getDimensionPixelSize(R.dimen.clock_collapsed_bottom_margin);
|
||||
|
||||
Reference in New Issue
Block a user