Skip to content

Commit 2032a12

Browse files
Adam CohenAndroid (Google) Code Review
authored andcommitted
Merge "Making runway lights appear for correct pages (issue 7232481)" into jb-mr1-dev
2 parents fb42be7 + 1d1fb6c commit 2032a12

File tree

2 files changed

+16
-5
lines changed

2 files changed

+16
-5
lines changed

core/res/res/layout/keyguard_widget_region.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
<Space
5555
android:layout_width="0dip"
5656
android:layout_height="match_parent"
57-
android:layout_weight="1"/>
57+
android:layout_weight="1.6"/>
5858
<com.android.internal.policy.impl.keyguard.KeyguardGlowStripView
5959
android:id="@+id/right_strip"
6060
android:layout_width="0dip"

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

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,16 @@
1818
import android.content.Context;
1919
import android.util.AttributeSet;
2020
import android.view.View;
21-
import android.view.View.OnClickListener;
2221
import android.widget.LinearLayout;
2322

2423
import com.android.internal.R;
24+
import com.android.internal.policy.impl.keyguard.PagedView.PageSwitchListener;
2525

26-
public class KeyguardWidgetRegion extends LinearLayout {
26+
public class KeyguardWidgetRegion extends LinearLayout implements PageSwitchListener {
2727
KeyguardGlowStripView mLeftStrip;
2828
KeyguardGlowStripView mRightStrip;
2929
KeyguardWidgetPager mPager;
30+
private int mPage = 0;
3031

3132
public KeyguardWidgetRegion(Context context) {
3233
this(context, null, 0);
@@ -46,6 +47,7 @@ protected void onFinishInflate() {
4647
mLeftStrip = (KeyguardGlowStripView) findViewById(R.id.left_strip);
4748
mRightStrip = (KeyguardGlowStripView) findViewById(R.id.right_strip);
4849
mPager = (KeyguardWidgetPager) findViewById(R.id.app_widget_container);
50+
mPager.setPageSwitchListener(this);
4951

5052
setSoundEffectsEnabled(false);
5153
setOnClickListener(new OnClickListener() {
@@ -57,7 +59,16 @@ public void onClick(View v) {
5759
}
5860

5961
public void showPagingFeedback() {
60-
mLeftStrip.makeEmGo();
61-
mRightStrip.makeEmGo();
62+
if (mPage < mPager.getPageCount() - 1) {
63+
mLeftStrip.makeEmGo();
64+
}
65+
if (mPage > 0) {
66+
mRightStrip.makeEmGo();
67+
}
68+
}
69+
70+
@Override
71+
public void onPageSwitch(View newPage, int newPageIndex) {
72+
mPage = newPageIndex;
6273
}
6374
}

0 commit comments

Comments
 (0)