Skip to content

Commit bebefaa

Browse files
Adam CohenAndroid (Google) Code Review
authored andcommitted
Merge "Fixing up keyguard widget pager layouts" into jb-mr1-dev
2 parents b531c81 + 7ffa8c0 commit bebefaa

File tree

8 files changed

+50
-37
lines changed

8 files changed

+50
-37
lines changed

core/res/res/layout-land/keyguard_host_view.xml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,17 +28,16 @@
2828
android:orientation="horizontal">
2929

3030
<include layout="@layout/keyguard_widget_region"
31-
android:layout_width="0dip"
32-
android:layout_height="230dip"
33-
android:layout_weight=".45"/>
31+
android:layout_width="0dp"
32+
android:layout_weight=".45" />
3433

3534
<com.android.internal.policy.impl.keyguard.KeyguardSecurityViewFlipper
3635
android:id="@+id/view_flipper"
37-
android:layout_width="0dip"
36+
android:layout_width="0dp"
3837
android:layout_height="match_parent"
3938
android:layout_weight="0.55"
40-
android:layout_marginLeft="8dip"
41-
android:layout_marginRight="8dip"
39+
android:layout_marginLeft="8dp"
40+
android:layout_marginRight="8dp"
4241
android:gravity="center">
4342

4443
<!-- SelectorView is always used, so add it here. The rest are loaded dynamically -->

core/res/res/layout/keyguard_multi_user_avatar.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,4 @@
3737
android:textSize="12sp"
3838
android:background="#99FFFFFF"
3939
android:textColor="#ff000000"/>
40-
</com.android.internal.policy.impl.keyguard.KeyguardMultiUserAvatar>
40+
</com.android.internal.policy.impl.keyguard.KeyguardMultiUserAvatar>

core/res/res/layout/keyguard_selector_view.xml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,7 @@
2929
<include layout="@layout/keyguard_widget_region"
3030
android:layout_width="match_parent"
3131
android:layout_height="0dip"
32-
android:layout_weight="0.45"
33-
android:layout_marginTop="35dip"
34-
android:layout_marginLeft="33dip"
35-
android:layout_marginRight="33dip"/>
32+
android:layout_weight="0.45" />
3633

3734
<RelativeLayout
3835
android:layout_width="wrap_content"

core/res/res/layout/keyguard_status_view.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@
2020
<!-- This is a view that shows general status information in Keyguard. -->
2121
<com.android.internal.policy.impl.keyguard.KeyguardWidgetFrame
2222
xmlns:android="http://schemas.android.com/apk/res/android"
23+
android:id="@+id/keyguard_status_view"
2324
android:layout_width="wrap_content"
2425
android:layout_height="wrap_content"
25-
android:id="@+id/keyguard_status_view"
2626
android:gravity="center_horizontal">
2727

2828
<com.android.internal.policy.impl.keyguard.KeyguardStatusView

core/res/res/layout/keyguard_widget_region.xml

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -25,43 +25,47 @@
2525
android:visibility="gone"
2626
android:gravity="center"
2727
android:orientation="vertical">
28-
<Space
29-
android:layout_width="match_parent"
30-
android:layout_height="0dip"
31-
android:layout_weight="1" />
3228
<com.android.internal.policy.impl.keyguard.KeyguardWidgetPager
3329
android:id="@+id/app_widget_container"
3430
android:layout_width="match_parent"
35-
android:layout_height="@dimen/kg_widget_container_height">
31+
android:layout_height="0dp"
32+
android:layout_weight="1"
33+
android:clipChildren="false"
34+
android:clipToPadding="false">
3635
<!-- TODO: Remove this when supported as a widget -->
3736
<include layout="@layout/keyguard_status_view"/>
3837
<include layout="@layout/keyguard_transport_control_view"/>
3938
</com.android.internal.policy.impl.keyguard.KeyguardWidgetPager>
4039
<LinearLayout
4140
android:layout_width="match_parent"
42-
android:layout_height="0dip"
43-
android:layout_weight="1"
44-
android:orientation="horizontal">
41+
android:layout_height="10dp"
42+
android:orientation="horizontal"
43+
android:paddingLeft="@dimen/kg_widget_pager_horizontal_padding"
44+
android:paddingRight="@dimen/kg_widget_pager_horizontal_padding">
4545
<com.android.internal.policy.impl.keyguard.KeyguardGlowStripView
4646
android:id="@+id/left_strip"
47-
android:layout_width="0dip"
47+
android:paddingTop="@dimen/kg_runway_lights_vertical_padding"
48+
android:paddingBottom="@dimen/kg_runway_lights_vertical_padding"
49+
android:layout_width="0dp"
4850
android:layout_height="match_parent"
4951
android:layout_weight="1"
5052
prvandroid:numDots="5"
51-
prvandroid:dotSize="7dip"
53+
prvandroid:dotSize="@dimen/kg_runway_lights_height"
5254
prvandroid:leftToRight="false"
5355
prvandroid:glowDot="@*android:drawable/ic_lockscreen_glowdot" />
5456
<Space
55-
android:layout_width="0dip"
57+
android:layout_width="0dp"
5658
android:layout_height="match_parent"
5759
android:layout_weight="1.6"/>
5860
<com.android.internal.policy.impl.keyguard.KeyguardGlowStripView
5961
android:id="@+id/right_strip"
60-
android:layout_width="0dip"
62+
android:paddingTop="@dimen/kg_runway_lights_vertical_padding"
63+
android:paddingBottom="@dimen/kg_runway_lights_vertical_padding"
64+
android:layout_width="0dp"
6165
android:layout_height="match_parent"
6266
android:layout_weight="1"
6367
prvandroid:numDots="5"
64-
prvandroid:dotSize="7dip"
68+
prvandroid:dotSize="@dimen/kg_runway_lights_height"
6569
prvandroid:leftToRight="true"
6670
prvandroid:glowDot="@*android:drawable/ic_lockscreen_glowdot" />
6771
</LinearLayout>

core/res/res/values/dimens.xml

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -254,9 +254,6 @@
254254
<!-- Height of widget view in keyguard. -->
255255
<dimen name="kg_widget_view_height">0dp</dimen>
256256

257-
<!-- Padding surrounding each widget page -->
258-
<dimen name="kg_widget_page_padding">10dp</dimen>
259-
260257
<!-- Size of the clock font in keyguard's status view -->
261258
<dimen name="kg_status_clock_font_size">94dp</dimen>
262259

@@ -285,8 +282,20 @@
285282
<!-- Space reserved at the bottom of secure views (pin/pattern/password/SIM pin/SIM puk) -->
286283
<dimen name="kg_secure_padding_height">46dp</dimen>
287284

288-
<!-- The height of the widget container -->
289-
<dimen name="kg_widget_container_height">200dp</dimen>
285+
<!-- The height of the runway lights strip -->
286+
<dimen name="kg_runway_lights_height">7dp</dimen>
287+
288+
<!-- The height of the runway lights strip -->
289+
<dimen name="kg_runway_lights_vertical_padding">3dp</dimen>
290+
291+
<!-- Horizontal padding for the widget pager -->
292+
<dimen name="kg_widget_pager_horizontal_padding">16dp</dimen>
293+
294+
<!-- Top padding for the widget pager -->
295+
<dimen name="kg_widget_pager_top_padding">16dp</dimen>
296+
297+
<!-- Bottom padding for the widget pager -->
298+
<dimen name="kg_widget_pager_bottom_padding">6dp</dimen>
290299

291300
<!-- Touch slop for the global toggle accessibility gesture -->
292301
<dimen name="accessibility_touch_slop">80dip</dimen>

core/res/res/values/symbols.xml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1185,7 +1185,9 @@
11851185
<java-symbol type="dimen" name="navigation_bar_height_landscape" />
11861186
<java-symbol type="dimen" name="navigation_bar_width" />
11871187
<java-symbol type="dimen" name="status_bar_height" />
1188-
<java-symbol type="dimen" name="kg_widget_page_padding" />
1188+
<java-symbol type="dimen" name="kg_widget_pager_horizontal_padding" />
1189+
<java-symbol type="dimen" name="kg_widget_pager_top_padding" />
1190+
<java-symbol type="dimen" name="kg_widget_pager_bottom_padding" />
11891191
<java-symbol type="drawable" name="ic_jog_dial_sound_off" />
11901192
<java-symbol type="drawable" name="ic_jog_dial_sound_on" />
11911193
<java-symbol type="drawable" name="ic_jog_dial_unlock" />

policy/src/com/android/internal/policy/impl/keyguard/KeyguardWidgetFrame.java

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333
public class KeyguardWidgetFrame extends FrameLayout {
3434
private final static PorterDuffXfermode sAddBlendMode =
3535
new PorterDuffXfermode(PorterDuff.Mode.ADD);
36-
private static int sWidgetPagePadding;
3736
private static Drawable sLeftOverscrollDrawable;
3837
private static Drawable sRightOverscrollDrawable;
3938

@@ -52,13 +51,16 @@ public KeyguardWidgetFrame(Context context, AttributeSet attrs) {
5251

5352
public KeyguardWidgetFrame(Context context, AttributeSet attrs, int defStyle) {
5453
super(context, attrs, defStyle);
54+
Resources res = context.getResources();
5555
if (sLeftOverscrollDrawable == null) {
56-
Resources res = context.getResources();
5756
sLeftOverscrollDrawable = res.getDrawable(R.drawable.kg_widget_overscroll_layer_left);
5857
sRightOverscrollDrawable = res.getDrawable(R.drawable.kg_widget_overscroll_layer_right);
59-
sWidgetPagePadding = res.getDimensionPixelSize(R.dimen.kg_widget_page_padding);
6058
}
61-
setPadding(sWidgetPagePadding, sWidgetPagePadding, sWidgetPagePadding, sWidgetPagePadding);
59+
60+
int hPadding = res.getDimensionPixelSize(R.dimen.kg_widget_pager_horizontal_padding);
61+
int topPadding = res.getDimensionPixelSize(R.dimen.kg_widget_pager_top_padding);
62+
int bottomPadding = res.getDimensionPixelSize(R.dimen.kg_widget_pager_bottom_padding);
63+
setPadding(hPadding, topPadding, hPadding, bottomPadding);
6264
}
6365

6466
@Override
@@ -76,8 +78,8 @@ protected void dispatchDraw(Canvas canvas) {
7678
@Override
7779
protected void onSizeChanged(int w, int h, int oldw, int oldh) {
7880
super.onSizeChanged(w, h, oldw, oldh);
79-
mForegroundRect.set(sWidgetPagePadding, sWidgetPagePadding,
80-
w - sWidgetPagePadding, h - sWidgetPagePadding);
81+
mForegroundRect.set(getPaddingLeft(), getPaddingTop(),
82+
w - getPaddingRight(), h - getPaddingBottom());
8183
}
8284

8385
void setOverScrollAmount(float r, boolean left) {

0 commit comments

Comments
 (0)