diff options
8 files changed, 201 insertions, 7 deletions
diff --git a/packages/SystemUI/res/drawable-mdpi/ic_sysbar_quicksettings.png b/packages/SystemUI/res/drawable-mdpi/ic_sysbar_quicksettings.png Binary files differnew file mode 100644 index 000000000000..4434b5cd9954 --- /dev/null +++ b/packages/SystemUI/res/drawable-mdpi/ic_sysbar_quicksettings.png diff --git a/packages/SystemUI/res/layout-xlarge/sysbar_panel_notification_peek.xml b/packages/SystemUI/res/layout-xlarge/sysbar_panel_notification_peek.xml index a7c91f57e50a..02f9a90c1b01 100644 --- a/packages/SystemUI/res/layout-xlarge/sysbar_panel_notification_peek.xml +++ b/packages/SystemUI/res/layout-xlarge/sysbar_panel_notification_peek.xml @@ -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> diff --git a/packages/SystemUI/res/layout-xlarge/sysbar_panel_notifications.xml b/packages/SystemUI/res/layout-xlarge/sysbar_panel_notifications.xml index 6a8ae40ea0e3..884a473b0468 100644 --- a/packages/SystemUI/res/layout-xlarge/sysbar_panel_notifications.xml +++ b/packages/SystemUI/res/layout-xlarge/sysbar_panel_notifications.xml @@ -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" diff --git a/packages/SystemUI/res/layout-xlarge/sysbar_panel_settings.xml b/packages/SystemUI/res/layout-xlarge/sysbar_panel_settings.xml new file mode 100644 index 000000000000..c6ddfed8ae5d --- /dev/null +++ b/packages/SystemUI/res/layout-xlarge/sysbar_panel_settings.xml @@ -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> + diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/NotificationPanel.java b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/NotificationPanel.java index 1a08f2229b49..ce81fdc005b0 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/NotificationPanel.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/NotificationPanel.java @@ -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); +    }  } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/NotificationPeekPanel.java b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/NotificationPeekPanel.java new file mode 100644 index 000000000000..744f6675b92c --- /dev/null +++ b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/NotificationPeekPanel.java @@ -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; +    } + +} + diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/SettingsPanel.java b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/SettingsPanel.java new file mode 100644 index 000000000000..9013f5ca567d --- /dev/null +++ b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/SettingsPanel.java @@ -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); +    } +} + diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java index 2efdf960ec3d..983215efe48b 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java @@ -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);  |