Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8a576713 authored by Joe Onorato's avatar Joe Onorato
Browse files

Add the quick settings panel. There's currently nothing in it.

Change-Id: I71195c7b0bd2b902da1c60527b6e23964b1ea4fc
parent 09f686ec
Loading
Loading
Loading
Loading
+954 B
Loading image diff...
+2 −2
Original line number Diff line number Diff line
@@ -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>
+23 −2
Original line number Diff line number Diff line
@@ -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"
+24 −0
Original line number Diff line number Diff line
<?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>
+69 −1
Original line number Diff line number Diff line
@@ -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);
    }
}
Loading