Merge "Add the quick settings panel. There's currently nothing in it."
This commit is contained in:
BIN
packages/SystemUI/res/drawable-mdpi/ic_sysbar_quicksettings.png
Normal file
BIN
packages/SystemUI/res/drawable-mdpi/ic_sysbar_quicksettings.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 954 B |
@@ -19,7 +19,7 @@
|
||||
-->
|
||||
|
||||
<!-- android:background="@drawable/status_bar_closed_default_background" -->
|
||||
<com.android.systemui.statusbar.tablet.NotificationPanel
|
||||
<com.android.systemui.statusbar.tablet.NotificationPeekPanel
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="match_parent"
|
||||
@@ -40,4 +40,4 @@
|
||||
android:descendantFocusability="afterDescendants"
|
||||
>
|
||||
</FrameLayout>
|
||||
</com.android.systemui.statusbar.tablet.NotificationPanel>
|
||||
</com.android.systemui.statusbar.tablet.NotificationPeekPanel>
|
||||
|
||||
@@ -44,13 +44,27 @@
|
||||
android:gravity="right"
|
||||
/>
|
||||
|
||||
<Button
|
||||
<ImageView
|
||||
android:id="@+id/settings_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/date"
|
||||
android:layout_alignParentRight="true"
|
||||
android:text="@string/system_panel_settings_button"
|
||||
android:paddingRight="10dp"
|
||||
android:src="@drawable/ic_sysbar_quicksettings"
|
||||
android:baseline="17dp"
|
||||
/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/notification_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignBaseline="@id/settings_button"
|
||||
android:layout_alignParentRight="true"
|
||||
android:paddingRight="10dp"
|
||||
android:visibility="invisible"
|
||||
android:src="@drawable/status_bar_veto"
|
||||
android:baseline="17dp"
|
||||
/>
|
||||
|
||||
<ImageView
|
||||
@@ -93,6 +107,13 @@
|
||||
android:text="@string/system_panel_settings_button"
|
||||
/>
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/settings_frame"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_below="@id/settings_button"
|
||||
/>
|
||||
|
||||
<ScrollView
|
||||
android:id="@+id/notificationScroller"
|
||||
android:layout_height="wrap_content"
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
* Copyright (C) 2010 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.
|
||||
-->
|
||||
|
||||
<com.android.systemui.statusbar.tablet.SettingsPanel
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="200dip"
|
||||
>
|
||||
</com.android.systemui.statusbar.tablet.SettingsPanel>
|
||||
|
||||
@@ -18,13 +18,25 @@ package com.android.systemui.statusbar.tablet;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.Slog;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
import android.view.View;
|
||||
import android.widget.FrameLayout;
|
||||
|
||||
import com.android.systemui.R;
|
||||
|
||||
public class NotificationPanel extends RelativeLayout implements StatusBarPanel {
|
||||
public class NotificationPanel extends RelativeLayout implements StatusBarPanel,
|
||||
View.OnClickListener {
|
||||
static final String TAG = "NotificationPanel";
|
||||
|
||||
View mSettingsButton;
|
||||
View mNotificationButton;
|
||||
View mNotificationScroller;
|
||||
FrameLayout mSettingsFrame;
|
||||
View mSettingsPanel;
|
||||
|
||||
public NotificationPanel(Context context, AttributeSet attrs) {
|
||||
this(context, attrs, 0);
|
||||
}
|
||||
@@ -33,6 +45,51 @@ public class NotificationPanel extends RelativeLayout implements StatusBarPanel
|
||||
super(context, attrs, defStyle);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFinishInflate() {
|
||||
super.onFinishInflate();
|
||||
|
||||
mSettingsButton = (ImageView)findViewById(R.id.settings_button);
|
||||
mSettingsButton.setOnClickListener(this);
|
||||
mNotificationButton = (ImageView)findViewById(R.id.notification_button);
|
||||
mNotificationButton.setOnClickListener(this);
|
||||
|
||||
mNotificationScroller = findViewById(R.id.notificationScroller);
|
||||
mSettingsFrame = (FrameLayout)findViewById(R.id.settings_frame);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onVisibilityChanged(View v, int vis) {
|
||||
super.onVisibilityChanged(v, vis);
|
||||
// when we hide, put back the notifications
|
||||
if (!isShown()) {
|
||||
switchToNotificationMode();
|
||||
}
|
||||
}
|
||||
|
||||
public void onClick(View v) {
|
||||
if (v == mSettingsButton) {
|
||||
switchToSettingsMode();
|
||||
} else if (v == mNotificationButton) {
|
||||
switchToNotificationMode();
|
||||
}
|
||||
}
|
||||
|
||||
public void switchToSettingsMode() {
|
||||
removeSettingsPanel();
|
||||
addSettingsPanel();
|
||||
mSettingsButton.setVisibility(View.INVISIBLE);
|
||||
mNotificationScroller.setVisibility(View.GONE);
|
||||
mNotificationButton.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
public void switchToNotificationMode() {
|
||||
removeSettingsPanel();
|
||||
mSettingsButton.setVisibility(View.VISIBLE);
|
||||
mNotificationScroller.setVisibility(View.VISIBLE);
|
||||
mNotificationButton.setVisibility(View.INVISIBLE);
|
||||
}
|
||||
|
||||
public boolean isInContentArea(int x, int y) {
|
||||
final int l = getPaddingLeft();
|
||||
final int r = getWidth() - getPaddingRight();
|
||||
@@ -40,5 +97,16 @@ public class NotificationPanel extends RelativeLayout implements StatusBarPanel
|
||||
final int b = getHeight() - getPaddingBottom();
|
||||
return x >= l && x < r && y >= t && y < b;
|
||||
}
|
||||
|
||||
void removeSettingsPanel() {
|
||||
if (mSettingsPanel != null) {
|
||||
mSettingsFrame.removeViewAt(0);
|
||||
mSettingsPanel = null;
|
||||
}
|
||||
}
|
||||
|
||||
void addSettingsPanel() {
|
||||
mSettingsPanel = View.inflate(getContext(), R.layout.sysbar_panel_settings, mSettingsFrame);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
* Copyright (C) 2010 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.tablet;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.AttributeSet;
|
||||
import android.widget.RelativeLayout;
|
||||
|
||||
import com.android.systemui.R;
|
||||
|
||||
public class NotificationPeekPanel extends RelativeLayout implements StatusBarPanel {
|
||||
public NotificationPeekPanel(Context context, AttributeSet attrs) {
|
||||
this(context, attrs, 0);
|
||||
}
|
||||
|
||||
public NotificationPeekPanel(Context context, AttributeSet attrs, int defStyle) {
|
||||
super(context, attrs, defStyle);
|
||||
}
|
||||
|
||||
public boolean isInContentArea(int x, int y) {
|
||||
final int l = getPaddingLeft();
|
||||
final int r = getWidth() - getPaddingRight();
|
||||
final int t = getPaddingTop();
|
||||
final int b = getHeight() - getPaddingBottom();
|
||||
return x >= l && x < r && y >= t && y < b;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
* Copyright (C) 2010 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.tablet;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.Slog;
|
||||
import android.widget.LinearLayout;
|
||||
import android.view.View;
|
||||
|
||||
import com.android.systemui.R;
|
||||
|
||||
public class SettingsPanel extends LinearLayout {
|
||||
static final String TAG = "SettingsPanel";
|
||||
|
||||
public SettingsPanel(Context context, AttributeSet attrs) {
|
||||
this(context, attrs, 0);
|
||||
}
|
||||
|
||||
public SettingsPanel(Context context, AttributeSet attrs, int defStyle) {
|
||||
super(context, attrs, defStyle);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -99,7 +99,7 @@ public class TabletStatusBar extends StatusBar {
|
||||
InputMethodButton mInputMethodButton;
|
||||
|
||||
NotificationPanel mNotificationPanel;
|
||||
NotificationPanel mNotificationPeekWindow;
|
||||
NotificationPeekPanel mNotificationPeekWindow;
|
||||
ViewGroup mNotificationPeekRow;
|
||||
int mNotificationPeekIndex;
|
||||
LayoutTransition mNotificationPeekScrubLeft, mNotificationPeekScrubRight;
|
||||
@@ -166,7 +166,7 @@ public class TabletStatusBar extends StatusBar {
|
||||
WindowManagerImpl.getDefault().addView(mNotificationPanel, lp);
|
||||
|
||||
// Notification preview window
|
||||
mNotificationPeekWindow = (NotificationPanel) View.inflate(context,
|
||||
mNotificationPeekWindow = (NotificationPeekPanel) View.inflate(context,
|
||||
R.layout.sysbar_panel_notification_peek, null);
|
||||
mNotificationPeekRow = (ViewGroup) mNotificationPeekWindow.findViewById(R.id.content);
|
||||
mNotificationPeekWindow.setVisibility(View.GONE);
|
||||
|
||||
Reference in New Issue
Block a user