summaryrefslogtreecommitdiffstats
path: root/packages
diff options
context:
space:
mode:
authorJames Sullins <jcsullins@gmail.com>2012-05-07 18:12:32 -0500
committerJames Sullins <jcsullins@gmail.com>2012-05-10 17:27:01 -0500
commit9215b6c2dc8cf86715e9a6eefc6cc4b2e476b9de (patch)
tree9900876a12cdc4c19eac4ebe513147544ad264c1 /packages
parent9bb7a6f1fc8bf86a6b5cba717155cbe913b4b818 (diff)
downloadframeworks_base-9215b6c2dc8cf86715e9a6eefc6cc4b2e476b9de.zip
frameworks_base-9215b6c2dc8cf86715e9a6eefc6cc4b2e476b9de.tar.gz
frameworks_base-9215b6c2dc8cf86715e9a6eefc6cc4b2e476b9de.tar.bz2
SystemUI: calculate height for tablet status_bar_settings_view
Use the minimum height required for no scrolling. If that height will exceed the device's display height, reduce it accordingly. This removes the need for hardcoded height in resource file and the use of overlays to adjust it. Change-Id: I0a85f19c2619dedd70a3e686982e0c483f9e3d32
Diffstat (limited to 'packages')
-rw-r--r--packages/SystemUI/res/layout-sw600dp/status_bar_settings_view.xml2
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/tablet/NotificationPanel.java14
2 files changed, 15 insertions, 1 deletions
diff --git a/packages/SystemUI/res/layout-sw600dp/status_bar_settings_view.xml b/packages/SystemUI/res/layout-sw600dp/status_bar_settings_view.xml
index 8b6b86b..abe01ee 100644
--- a/packages/SystemUI/res/layout-sw600dp/status_bar_settings_view.xml
+++ b/packages/SystemUI/res/layout-sw600dp/status_bar_settings_view.xml
@@ -17,7 +17,7 @@
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_height="380px"
+ android:layout_height="match_parent"
android:layout_width="match_parent">
<com.android.systemui.statusbar.tablet.SettingsView
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 8e58649..435930f 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/NotificationPanel.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/NotificationPanel.java
@@ -24,11 +24,13 @@ import android.content.Context;
import android.graphics.Rect;
import android.util.AttributeSet;
import android.util.Slog;
+import android.view.Display;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewTreeObserver;
+import android.view.WindowManager;
import android.view.animation.AccelerateInterpolator;
import android.view.animation.DecelerateInterpolator;
import android.view.animation.Interpolator;
@@ -345,6 +347,18 @@ public class NotificationPanel extends RelativeLayout implements StatusBarPanel,
void addSettingsView() {
LayoutInflater infl = LayoutInflater.from(getContext());
mSettingsView = infl.inflate(R.layout.status_bar_settings_view, mContentFrame, false);
+
+ // set height
+ mSettingsView.measure(View.MeasureSpec.UNSPECIFIED, View.MeasureSpec.UNSPECIFIED);
+ int currentHeight = mSettingsView.getMeasuredHeight();
+ WindowManager wm = (WindowManager)getContext().getSystemService(Context.WINDOW_SERVICE);
+ Display d = wm.getDefaultDisplay();
+ int maxHeight = d.getHeight() - mTitleArea.getHeight();
+ if (currentHeight > maxHeight) {
+ currentHeight = maxHeight;
+ }
+ mSettingsView.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, currentHeight));
+
mSettingsView.setVisibility(View.GONE);
mContentFrame.addView(mSettingsView);
}