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

Commit 14770e04 authored by Joe Onorato's avatar Joe Onorato Committed by Android (Google) Code Review
Browse files

Merge "The status bar half of making the status bar resize when hdmi is plugged in." into honeycomb

parents d938e216 dc100305
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -25,7 +25,8 @@
    <FrameLayout
        android:id="@+id/bar_contents_holder"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_height="@*android:dimen/status_bar_height"
        android:layout_gravity="bottom"
        >
        <RelativeLayout
            android:id="@+id/bar_contents"
@@ -93,7 +94,8 @@
    <FrameLayout
        android:id="@+id/bar_shadow_holder"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_height="@*android:dimen/status_bar_height"
        android:layout_gravity="bottom"
        >
        <!-- lights out shade -->
        <RelativeLayout
+2 −2
Original line number Diff line number Diff line
@@ -52,6 +52,7 @@ public abstract class StatusBar extends SystemUI implements CommandQueue.Callbac
    // Up-call methods
    protected abstract View makeStatusBarView();
    protected abstract int getStatusBarGravity();
    public abstract int getStatusBarHeight();

    private DoNotDisturb mDoNotDisturb;

@@ -104,8 +105,7 @@ public abstract class StatusBar extends SystemUI implements CommandQueue.Callbac
        }

        // Put up the view
        final Resources res = mContext.getResources();
        final int height= res.getDimensionPixelSize(com.android.internal.R.dimen.status_bar_height);
        final int height = getStatusBarHeight();

        final WindowManager.LayoutParams lp = new WindowManager.LayoutParams(
                ViewGroup.LayoutParams.MATCH_PARENT,
+6 −2
Original line number Diff line number Diff line
@@ -287,9 +287,13 @@ public class PhoneStatusBar extends StatusBar {
        return Gravity.TOP | Gravity.FILL_HORIZONTAL;
    }

    private void addIntruderView() {
    public int getStatusBarHeight() {
        final Resources res = mContext.getResources();
        final int height= res.getDimensionPixelSize(com.android.internal.R.dimen.status_bar_height);
        return res.getDimensionPixelSize(com.android.internal.R.dimen.status_bar_height);
    }

    private void addIntruderView() {
        final int height = getStatusBarHeight();

        WindowManager.LayoutParams lp = new WindowManager.LayoutParams(
                ViewGroup.LayoutParams.MATCH_PARENT,
+103 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2011 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 java.util.ArrayList;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.res.Resources;
import android.util.DisplayMetrics;
import android.util.Slog;
import android.view.View;
import android.view.WindowManager;
import android.view.WindowManagerImpl;
import android.view.WindowManagerPolicy;

public class HeightReceiver extends BroadcastReceiver {
    private static final String TAG = "StatusBar.HeightReceiver";

    public interface OnBarHeightChangedListener {
        public void onBarHeightChanged(int height);
    }

    Context mContext;
    ArrayList<OnBarHeightChangedListener> mListeners = new ArrayList<OnBarHeightChangedListener>();
    WindowManager mWindowManager;
    int mHeight;

    public HeightReceiver(Context context) {
        mContext = context;
        mWindowManager = WindowManagerImpl.getDefault();
    }

    public void addOnBarHeightChangedListener(OnBarHeightChangedListener l) {
        mListeners.add(l);
        l.onBarHeightChanged(mHeight);
    }

    public void removeOnBarHeightChangedListener(OnBarHeightChangedListener l) {
        mListeners.remove(l);
    }

    @Override
    public void onReceive(Context context, Intent intent) {
        final boolean plugged
                = intent.getBooleanExtra(WindowManagerPolicy.EXTRA_HDMI_PLUGGED_STATE, false);
        setPlugged(plugged);
    }

    public void registerReceiver() {
        final IntentFilter filter = new IntentFilter();
        filter.addAction(WindowManagerPolicy.ACTION_HDMI_PLUGGED);
        final Intent val = mContext.registerReceiver(this, filter);
        onReceive(mContext, val);
    }

    private void setPlugged(boolean plugged) {
        final Resources res = mContext.getResources();

        Slog.d(TAG, "plugged=" + plugged);
        int height = -1;
        if (plugged) {
            final DisplayMetrics metrics = new DisplayMetrics();
            mWindowManager.getDefaultDisplay().getMetrics(metrics);
            Slog.d(TAG, "metrics=" + metrics);
            height = metrics.heightPixels - 720;
        }

        final int minHeight
                = res.getDimensionPixelSize(com.android.internal.R.dimen.status_bar_height);
        if (height < minHeight) {
            height = minHeight;
        }
        Slog.d(TAG, "using height=" + height + " old=" + mHeight);
        mHeight = height;

        final int N = mListeners.size();
        for (int i=0; i<N; i++) {
            mListeners.get(i).onBarHeightChanged(height);
        }
    }

    public int getHeight() {
        return mHeight;
    }
}
+0 −6
Original line number Diff line number Diff line
@@ -58,7 +58,6 @@ public class NotificationPanel extends RelativeLayout implements StatusBarPanel,
    ViewGroup mContentParent;

    Choreographer mChoreo = new Choreographer();
    int mStatusBarHeight;

    public NotificationPanel(Context context, AttributeSet attrs) {
        this(context, attrs, 0);
@@ -66,11 +65,6 @@ public class NotificationPanel extends RelativeLayout implements StatusBarPanel,

    public NotificationPanel(Context context, AttributeSet attrs, int defStyle) {
        super(context, attrs, defStyle);

        final Resources res = context.getResources();

        mStatusBarHeight = res.getDimensionPixelSize(
                com.android.internal.R.dimen.status_bar_height);
    }

    @Override
Loading