am 5cf72e11: Merge "Accessibility support for the widgets switcher of the lock screen." into jb-mr1-dev

* commit '5cf72e11b6ec38c09e810611ec57bff9ff40ce9d':
  Accessibility support for the widgets switcher of the lock screen.
This commit is contained in:
Svetoslav Ganov
2012-10-02 17:02:56 -07:00
committed by Android Git Automerger
6 changed files with 40 additions and 3 deletions

View File

@@ -21,7 +21,8 @@
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center">
android:layout_gravity="center"
android:contentDescription="@string/keyguard_accessibility_user_selector">
<com.android.internal.policy.impl.keyguard.KeyguardSubdivisionLayout
android:id="@+id/keyguard_users_grid"

View File

@@ -29,7 +29,8 @@
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center_horizontal">
android:gravity="center_horizontal"
android:contentDescription="@string/keyguard_accessibility_status">
<com.android.internal.policy.impl.keyguard.ClockView
android:id="@+id/clock_view"

View File

@@ -26,7 +26,8 @@
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:foreground="@drawable/ic_lockscreen_player_background">
android:foreground="@drawable/ic_lockscreen_player_background"
android:contentDescription="@string/keygaurd_accessibility_media_controls">
<!-- Use ImageView for its cropping features; otherwise could be android:background -->
<ImageView
android:id="@+id/albumart"

View File

@@ -2272,6 +2272,15 @@
<!-- Accessibility description sent when user completes drawing a pattern. [CHAR LIMIT=NONE] -->
<string name="lockscreen_access_pattern_detected">Pattern completed</string>
<!-- Accessibility description sent when user changes the current lock screen widget. [CHAR_LIMIT=none] -->
<string name="keyguard_accessibility_widget_changed">%1$s. Widget %2$d of %3$d.</string>
<!-- Accessibility description of the lock screen user selector widget. [CHAR_LIMIT=none] -->
<string name="keyguard_accessibility_user_selector">User selector</string>
<!-- Accessibility description of the lock screen status widget. [CHAR_LIMIT=none] -->
<string name="keyguard_accessibility_status">Status</string>
<!-- Accessibility description of the lock media control widget. [CHAR_LIMIT=none] -->
<string name="keygaurd_accessibility_media_controls">Media controls</string>
<!-- Password keyboard strings. Used by LockScreen and Settings --><skip />
<!-- Label for "switch to symbols" key. Must be short to fit on key! -->
<string name="password_keyboard_label_symbol_key">\?123</string>

View File

@@ -549,6 +549,10 @@
<java-symbol type="string" name="keyboardview_keycode_enter" />
<java-symbol type="string" name="keyboardview_keycode_mode_change" />
<java-symbol type="string" name="keyboardview_keycode_shift" />
<java-symbol type="string" name="keygaurd_accessibility_media_controls" />
<java-symbol type="string" name="keyguard_accessibility_status" />
<java-symbol type="string" name="keyguard_accessibility_user_selector" />
<java-symbol type="string" name="keyguard_accessibility_widget_changed" />
<java-symbol type="string" name="kilobyteShort" />
<java-symbol type="string" name="last_month" />
<java-symbol type="string" name="launchBrowserDefault" />

View File

@@ -27,6 +27,8 @@ import android.view.animation.DecelerateInterpolator;
import android.widget.FrameLayout;
import com.android.internal.R;
public class KeyguardWidgetPager extends PagedView {
ZInterpolator mZInterpolator = new ZInterpolator(0.5f);
private static float CAMERA_DISTANCE = 10000;
@@ -47,6 +49,9 @@ public class KeyguardWidgetPager extends PagedView {
public KeyguardWidgetPager(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
if (getImportantForAccessibility() == View.IMPORTANT_FOR_ACCESSIBILITY_AUTO) {
setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_YES);
}
}
/*
@@ -60,6 +65,7 @@ public class KeyguardWidgetPager extends PagedView {
// The framework adds a default padding to AppWidgetHostView. We don't need this padding
// for the Keyguard, so we override it to be 0.
widget.setPadding(0, 0, 0, 0);
widget.setContentDescription(widget.getAppWidgetInfo().label);
frame.addView(widget, lp);
addView(frame);
}
@@ -89,6 +95,21 @@ public class KeyguardWidgetPager extends PagedView {
}
}
@Override
public String getCurrentPageDescription() {
final int nextPageIndex = getNextPage();
if (nextPageIndex >= 0 && nextPageIndex < getChildCount()) {
KeyguardWidgetFrame frame = (KeyguardWidgetFrame) getChildAt(nextPageIndex);
CharSequence title = frame.getChildAt(0).getContentDescription();
if (title == null) {
title = "";
}
return mContext.getString(R.string.keyguard_accessibility_widget_changed,
title, nextPageIndex + 1, getChildCount());
}
return super.getCurrentPageDescription();
}
@Override
protected void overScroll(float amount) {
acceleratedOverScroll(amount);