Loading packages/SystemUI/res/layout/status_bar_expanded.xml +0 −6 Original line number Diff line number Diff line Loading @@ -58,12 +58,6 @@ android:layout_height="@dimen/notification_panel_header_height" /> <com.android.systemui.statusbar.phone.ZenModeView android:id="@+id/zenmode" android:layout_width="match_parent" android:layout_height="wrap_content" /> <TextView android:id="@+id/emergency_calls_only" android:textAppearance="@style/TextAppearance.StatusBar.Expanded.Network.EmergencyOnly" Loading packages/SystemUI/res/layout/status_bar_expanded_header.xml +2 −2 Original line number Diff line number Diff line Loading @@ -15,7 +15,7 @@ ** limitations under the License. --> <com.android.systemui.statusbar.phone.PanelHeaderView <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:systemui="http://schemas.android.com/apk/res/com.android.systemui" android:id="@+id/header" Loading Loading @@ -106,4 +106,4 @@ android:contentDescription="@string/accessibility_notifications_button" /> </FrameLayout> </com.android.systemui.statusbar.phone.PanelHeaderView> </LinearLayout> packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java +0 −12 Original line number Diff line number Diff line Loading @@ -20,7 +20,6 @@ import android.content.Context; import android.content.res.Resources; import android.graphics.Canvas; import android.graphics.drawable.Drawable; import android.provider.Settings; import android.util.AttributeSet; import android.util.EventLog; import android.view.MotionEvent; Loading Loading @@ -57,17 +56,6 @@ public class NotificationPanelView extends PanelView { mHandleBar = resources.getDrawable(R.drawable.status_bar_close); mHandleBarHeight = resources.getDimensionPixelSize(R.dimen.close_handle_height); mHandleView = findViewById(R.id.handle); PanelHeaderView header = (PanelHeaderView) findViewById(R.id.header); ZenModeView zenModeView = (ZenModeView) findViewById(R.id.zenmode); zenModeView.setAdapter(new ZenModeViewAdapter(mContext) { @Override public void configure() { if (mStatusBar != null) { mStatusBar.startSettingsActivity(Settings.ACTION_ZEN_MODE_SETTINGS); } } }); header.setZenModeView(zenModeView); } @Override Loading packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelHeaderView.javadeleted 100644 → 0 +0 −70 Original line number Diff line number Diff line /* * Copyright (C) 2014 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. */ package com.android.systemui.statusbar.phone; import android.content.Context; import android.util.AttributeSet; import android.util.Log; import android.view.MotionEvent; import android.widget.LinearLayout; public class PanelHeaderView extends LinearLayout { private static final String TAG = "PanelHeaderView"; private static final boolean DEBUG = false; private ZenModeView mZenModeView; public PanelHeaderView(Context context) { super(context); } public PanelHeaderView(Context context, AttributeSet attrs) { super(context, attrs); } public void setZenModeView(ZenModeView zmv) { mZenModeView = zmv; } @Override public boolean dispatchTouchEvent(MotionEvent ev) { final boolean rt = super.dispatchTouchEvent(ev); if (DEBUG) logTouchEvent("dispatchTouchEvent", rt, ev); if (mZenModeView != null) { mZenModeView.dispatchExternalTouchEvent(ev); } return rt; } @Override public boolean onInterceptTouchEvent(MotionEvent ev) { final boolean rt = super.onInterceptTouchEvent(ev); if (DEBUG) logTouchEvent("onInterceptTouchEvent", rt, ev); return rt; } @Override public boolean onTouchEvent(MotionEvent event) { boolean rt = super.onTouchEvent(event); if (DEBUG) logTouchEvent("onTouchEvent", rt, event); return true; } private void logTouchEvent(String method, boolean rt, MotionEvent ev) { Log.d(TAG, method + " " + (rt ? "TRUE" : "FALSE") + " " + ev); } } packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickSettings.java +53 −0 Original line number Diff line number Diff line Loading @@ -52,13 +52,16 @@ import android.provider.ContactsContract.CommonDataKinds.Phone; import android.provider.ContactsContract.Profile; import android.provider.Settings; import android.security.KeyChain; import android.text.TextUtils.TruncateAt; import android.util.Log; import android.util.Pair; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.view.Window; import android.view.WindowManager; import android.view.WindowManagerGlobal; import android.widget.Button; import android.widget.ImageView; import android.widget.TextView; Loading Loading @@ -586,6 +589,31 @@ class QuickSettings { }); parent.addView(airplaneTile); // Zen Mode final QuickSettingsBasicTile zenModeTile = new QuickSettingsBasicTile(mContext); zenModeTile.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { showZenModeDialog(); } }); mModel.addZenModeTile(zenModeTile, new QuickSettingsModel.RefreshCallback() { @Override public void refreshView(QuickSettingsTileView unused, State state) { zenModeTile.setImageResource(state.iconId); // TODO cut new assets zenModeTile.getImageView().setAlpha(state.enabled ? 1 : .2f); zenModeTile.getImageView().setScaleX(1.5f); zenModeTile.getImageView().setScaleY(1.5f); // for landscape version zenModeTile.getTextView().setMaxLines(2); zenModeTile.getTextView().setEllipsize(TruncateAt.END); // TODO content description zenModeTile.setText(state.label); } }); parent.addView(zenModeTile); // Bluetooth if (mModel.deviceSupportsBluetooth() || DEBUG_GONE_TILES) { Loading Loading @@ -864,6 +892,31 @@ class QuickSettings { dialog.show(); } private void showZenModeDialog() { final Dialog d = new Dialog(mContext); d.requestWindowFeature(Window.FEATURE_NO_TITLE); d.setCancelable(true); d.setCanceledOnTouchOutside(true); final ZenModeView v = new ZenModeView(mContext); v.setAdapter(new ZenModeViewAdapter(mContext) { @Override public void configure() { if (mStatusBarService != null) { mStatusBarService.startSettingsActivity(Settings.ACTION_ZEN_MODE_SETTINGS); } d.dismiss(); } @Override public void close() { d.dismiss(); } }); d.setContentView(v); d.create(); d.getWindow().setType(WindowManager.LayoutParams.TYPE_VOLUME_OVERLAY); d.show(); } private void applyBluetoothStatus() { mModel.onBluetoothStateChange(mBluetoothState); } Loading Loading
packages/SystemUI/res/layout/status_bar_expanded.xml +0 −6 Original line number Diff line number Diff line Loading @@ -58,12 +58,6 @@ android:layout_height="@dimen/notification_panel_header_height" /> <com.android.systemui.statusbar.phone.ZenModeView android:id="@+id/zenmode" android:layout_width="match_parent" android:layout_height="wrap_content" /> <TextView android:id="@+id/emergency_calls_only" android:textAppearance="@style/TextAppearance.StatusBar.Expanded.Network.EmergencyOnly" Loading
packages/SystemUI/res/layout/status_bar_expanded_header.xml +2 −2 Original line number Diff line number Diff line Loading @@ -15,7 +15,7 @@ ** limitations under the License. --> <com.android.systemui.statusbar.phone.PanelHeaderView <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:systemui="http://schemas.android.com/apk/res/com.android.systemui" android:id="@+id/header" Loading Loading @@ -106,4 +106,4 @@ android:contentDescription="@string/accessibility_notifications_button" /> </FrameLayout> </com.android.systemui.statusbar.phone.PanelHeaderView> </LinearLayout>
packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java +0 −12 Original line number Diff line number Diff line Loading @@ -20,7 +20,6 @@ import android.content.Context; import android.content.res.Resources; import android.graphics.Canvas; import android.graphics.drawable.Drawable; import android.provider.Settings; import android.util.AttributeSet; import android.util.EventLog; import android.view.MotionEvent; Loading Loading @@ -57,17 +56,6 @@ public class NotificationPanelView extends PanelView { mHandleBar = resources.getDrawable(R.drawable.status_bar_close); mHandleBarHeight = resources.getDimensionPixelSize(R.dimen.close_handle_height); mHandleView = findViewById(R.id.handle); PanelHeaderView header = (PanelHeaderView) findViewById(R.id.header); ZenModeView zenModeView = (ZenModeView) findViewById(R.id.zenmode); zenModeView.setAdapter(new ZenModeViewAdapter(mContext) { @Override public void configure() { if (mStatusBar != null) { mStatusBar.startSettingsActivity(Settings.ACTION_ZEN_MODE_SETTINGS); } } }); header.setZenModeView(zenModeView); } @Override Loading
packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelHeaderView.javadeleted 100644 → 0 +0 −70 Original line number Diff line number Diff line /* * Copyright (C) 2014 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. */ package com.android.systemui.statusbar.phone; import android.content.Context; import android.util.AttributeSet; import android.util.Log; import android.view.MotionEvent; import android.widget.LinearLayout; public class PanelHeaderView extends LinearLayout { private static final String TAG = "PanelHeaderView"; private static final boolean DEBUG = false; private ZenModeView mZenModeView; public PanelHeaderView(Context context) { super(context); } public PanelHeaderView(Context context, AttributeSet attrs) { super(context, attrs); } public void setZenModeView(ZenModeView zmv) { mZenModeView = zmv; } @Override public boolean dispatchTouchEvent(MotionEvent ev) { final boolean rt = super.dispatchTouchEvent(ev); if (DEBUG) logTouchEvent("dispatchTouchEvent", rt, ev); if (mZenModeView != null) { mZenModeView.dispatchExternalTouchEvent(ev); } return rt; } @Override public boolean onInterceptTouchEvent(MotionEvent ev) { final boolean rt = super.onInterceptTouchEvent(ev); if (DEBUG) logTouchEvent("onInterceptTouchEvent", rt, ev); return rt; } @Override public boolean onTouchEvent(MotionEvent event) { boolean rt = super.onTouchEvent(event); if (DEBUG) logTouchEvent("onTouchEvent", rt, event); return true; } private void logTouchEvent(String method, boolean rt, MotionEvent ev) { Log.d(TAG, method + " " + (rt ? "TRUE" : "FALSE") + " " + ev); } }
packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickSettings.java +53 −0 Original line number Diff line number Diff line Loading @@ -52,13 +52,16 @@ import android.provider.ContactsContract.CommonDataKinds.Phone; import android.provider.ContactsContract.Profile; import android.provider.Settings; import android.security.KeyChain; import android.text.TextUtils.TruncateAt; import android.util.Log; import android.util.Pair; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.view.Window; import android.view.WindowManager; import android.view.WindowManagerGlobal; import android.widget.Button; import android.widget.ImageView; import android.widget.TextView; Loading Loading @@ -586,6 +589,31 @@ class QuickSettings { }); parent.addView(airplaneTile); // Zen Mode final QuickSettingsBasicTile zenModeTile = new QuickSettingsBasicTile(mContext); zenModeTile.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { showZenModeDialog(); } }); mModel.addZenModeTile(zenModeTile, new QuickSettingsModel.RefreshCallback() { @Override public void refreshView(QuickSettingsTileView unused, State state) { zenModeTile.setImageResource(state.iconId); // TODO cut new assets zenModeTile.getImageView().setAlpha(state.enabled ? 1 : .2f); zenModeTile.getImageView().setScaleX(1.5f); zenModeTile.getImageView().setScaleY(1.5f); // for landscape version zenModeTile.getTextView().setMaxLines(2); zenModeTile.getTextView().setEllipsize(TruncateAt.END); // TODO content description zenModeTile.setText(state.label); } }); parent.addView(zenModeTile); // Bluetooth if (mModel.deviceSupportsBluetooth() || DEBUG_GONE_TILES) { Loading Loading @@ -864,6 +892,31 @@ class QuickSettings { dialog.show(); } private void showZenModeDialog() { final Dialog d = new Dialog(mContext); d.requestWindowFeature(Window.FEATURE_NO_TITLE); d.setCancelable(true); d.setCanceledOnTouchOutside(true); final ZenModeView v = new ZenModeView(mContext); v.setAdapter(new ZenModeViewAdapter(mContext) { @Override public void configure() { if (mStatusBarService != null) { mStatusBarService.startSettingsActivity(Settings.ACTION_ZEN_MODE_SETTINGS); } d.dismiss(); } @Override public void close() { d.dismiss(); } }); d.setContentView(v); d.create(); d.getWindow().setType(WindowManager.LayoutParams.TYPE_VOLUME_OVERLAY); d.show(); } private void applyBluetoothStatus() { mModel.onBluetoothStateChange(mBluetoothState); } Loading