summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnnie Chin <afchin@google.com>2014-10-30 23:37:23 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2014-10-30 23:37:23 +0000
commit4998d1efcee8e5bf0f0914675769a74e1a18c346 (patch)
treed003d4bcc563d8b38ea0942c7dc4746884a2a791
parent35fabe1dcc8b0099f8ad3e88c0e535e84c554402 (diff)
parent5d4bedeeed94ca808e9450fcc2933bd874a3b40a (diff)
downloadandroid_packages_apps_DeskClock-4998d1efcee8e5bf0f0914675769a74e1a18c346.tar.gz
android_packages_apps_DeskClock-4998d1efcee8e5bf0f0914675769a74e1a18c346.tar.bz2
android_packages_apps_DeskClock-4998d1efcee8e5bf0f0914675769a74e1a18c346.zip
am 5d4bedee: am b90d84c3: Merge "Move description from framelayout to new clicklistener on arrow." into lmp-mr1-dev
* commit '5d4bedeeed94ca808e9450fcc2933bd874a3b40a': Move description from framelayout to new clicklistener on arrow.
-rw-r--r--res/layout/alarm_time.xml15
-rw-r--r--res/values/dimens.xml3
-rw-r--r--src/com/android/deskclock/AlarmClockFragment.java20
3 files changed, 30 insertions, 8 deletions
diff --git a/res/layout/alarm_time.xml b/res/layout/alarm_time.xml
index e245e255c..83dd8550a 100644
--- a/res/layout/alarm_time.xml
+++ b/res/layout/alarm_time.xml
@@ -159,19 +159,19 @@
android:id="@+id/collapse_expand"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:layout_gravity="bottom"
- android:contentDescription="@string/collapse_alarm">
+ android:layout_gravity="bottom">
<ImageButton
android:id="@+id/delete"
- android:layout_width="wrap_content"
- android:layout_height="48dip"
+ android:layout_width="@dimen/touch_target_min_size"
+ android:layout_height="@dimen/touch_target_min_size"
+ android:layout_gravity="center_vertical|start"
android:layout_marginTop="@dimen/alarm_clock_vertical_margin"
android:layout_marginBottom="@dimen/alarm_clock_vertical_margin"
android:layout_marginStart="4dip"
- android:layout_gravity="start"
android:background="?android:attr/selectableItemBackgroundBorderless"
android:contentDescription="@string/delete_alarm"
+ android:scaleType="center"
android:src="@drawable/ic_delete_small" />
<View
@@ -224,12 +224,13 @@
<ImageView
android:id="@+id/arrow"
- android:layout_width="wrap_content"
- android:layout_height="48dip"
+ android:layout_width="@dimen/touch_target_min_size"
+ android:layout_height="@dimen/touch_target_min_size"
android:layout_gravity="center_vertical|end"
android:layout_marginTop="@dimen/alarm_clock_vertical_margin"
android:layout_marginBottom="@dimen/alarm_clock_vertical_margin"
android:contentDescription="@string/expand_alarm"
+ android:scaleType="center"
android:src="@drawable/ic_expand_down" />
</FrameLayout>
</FrameLayout>
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index 3cb8d5865..613df1113 100644
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -174,4 +174,7 @@
<!-- Divider height -->
<dimen name="hairline_height">1dip</dimen>
+ <!-- The minimum height/width of any touch target -->
+ <dimen name="touch_target_min_size">48dip</dimen>
+
</resources>
diff --git a/src/com/android/deskclock/AlarmClockFragment.java b/src/com/android/deskclock/AlarmClockFragment.java
index 1f6ebf6c0..0c7357328 100644
--- a/src/com/android/deskclock/AlarmClockFragment.java
+++ b/src/com/android/deskclock/AlarmClockFragment.java
@@ -50,7 +50,6 @@ import android.transition.TransitionSet;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
-import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.view.ViewGroup.LayoutParams;
import android.view.ViewTreeObserver;
@@ -754,6 +753,21 @@ public class AlarmClockFragment extends DeskClockFragment implements
itemHolder.hairLine.setVisibility(expanded ? View.GONE : View.VISIBLE);
itemHolder.arrow.setRotation(expanded ? ROTATE_180_DEGREE : 0);
+ // Add listener on the arrow to enable proper talkback functionality.
+ // Avoid setting content description on the entire card.
+ itemHolder.arrow.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ if (isAlarmExpanded(alarm)) {
+ // Is expanded, make collapse call.
+ collapseAlarm(itemHolder, true);
+ } else {
+ // Is collapsed, make expand call.
+ expandAlarm(itemHolder, true);
+ }
+ }
+ });
+
// Set the repeat text or leave it blank if it does not repeat.
final String daysOfWeekStr =
alarm.daysOfWeek.toString(AlarmClockFragment.this.getActivity(), false);
@@ -1087,6 +1101,8 @@ public class AlarmClockFragment extends DeskClockFragment implements
itemHolder.expandArea.setVisibility(View.VISIBLE);
itemHolder.delete.setVisibility(View.VISIBLE);
+ itemHolder.arrow.setContentDescription(getString(R.string.collapse_alarm));
+
if (!animate) {
// Set the "end" layout and don't do the animation.
itemHolder.arrow.setRotation(ROTATE_180_DEGREE);
@@ -1199,6 +1215,8 @@ public class AlarmClockFragment extends DeskClockFragment implements
setAlarmItemBackgroundAndElevation(itemHolder.alarmItem, false /* expanded */);
itemHolder.expandArea.setVisibility(View.GONE);
+ itemHolder.arrow.setContentDescription(getString(R.string.expand_alarm));
+
if (!animate) {
// Set the "end" layout and don't do the animation.
itemHolder.arrow.setRotation(0);