--- /dev/null
+<?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>
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">
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"
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"
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"
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"
<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>
<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>
<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>
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" >
}
}
- setMeasuredDimension(width, getDefaultSize(totalHeight, heightMeasureSpec));
+ setMeasuredDimension(width, resolveSizeAndState(totalHeight, heightMeasureSpec, 0));
}
@Override
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;
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;
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>();
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();
@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
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);
public void setHost(QSTileHost host) {
mHost = host;
mFooter.setHost(host);
+ createCustomizePanel();
}
public QSTileHost getHost() {
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;
- }
}
}
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;
}
}
}
+ @Override
+ protected void createCustomizePanel() {
+ // Already in CustomizePanel.
+ }
+
public void tileSelected(QSTile<?> tile, ClipData currentClip) {
String sourceSpec = getSpec(currentClip);
String destSpec = tile.getTileSpec();
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;
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();
}
@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;
if (cb == null) {
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;
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;
ExpandableView.OnHeightChangedListener, ObservableScrollView.Listener,
View.OnClickListener, NotificationStackScrollLayout.OnOverscrollTopChangedListener,
KeyguardAffordanceHelper.Callback, NotificationStackScrollLayout.OnEmptySpaceClickListener,
- HeadsUpManager.OnHeadsUpChangedListener, TunerService.Tunable {
+ HeadsUpManager.OnHeadsUpChangedListener {
private static final boolean DEBUG = false;
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) {
}
@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);
TunerService.get(mContext).addTunable(this, TILES_SETTING);
}
- PhoneStatusBar getPhoneStatusBar() {
+ public PhoneStatusBar getPhoneStatusBar() {
return mStatusBar;
}
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;
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;
@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();
}
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);
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);
}
}
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
*/
public class StatusBarHeaderView extends BaseStatusBarHeader implements View.OnClickListener,
BatteryController.BatteryStateChangeCallback, NextAlarmController.NextAlarmChangeCallback,
- EmergencyListener, TunerService.Tunable {
+ EmergencyListener {
private boolean mExpanded;
private boolean mListening;
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);