summaryrefslogtreecommitdiffstats
path: root/ui/src
diff options
context:
space:
mode:
authorJeff Sharkey <jsharkey@android.com>2013-03-21 14:57:07 -0700
committerJeff Sharkey <jsharkey@android.com>2013-03-21 14:57:18 -0700
commita9c9eea93af0aebbdace4ce39acde8085186403e (patch)
treecc50fb149f3074adab37f76dfa10ed2a5719cc29 /ui/src
parent11787c02ad60f681af2cf4ef5d0fbf89efdbc4c2 (diff)
downloadandroid_packages_providers_DownloadProvider-a9c9eea93af0aebbdace4ce39acde8085186403e.tar.gz
android_packages_providers_DownloadProvider-a9c9eea93af0aebbdace4ce39acde8085186403e.tar.bz2
android_packages_providers_DownloadProvider-a9c9eea93af0aebbdace4ce39acde8085186403e.zip
Finish RTL work in Downloads.
Clean up some padding, and handle checkbox clicks based on RTL mode. Bug: 8133419 Change-Id: I9c0f54218eb1c182fbe6f3f4eeb3e83e7ebc6ea9
Diffstat (limited to 'ui/src')
-rw-r--r--ui/src/com/android/providers/downloads/ui/DateSortedExpandableListAdapter.java2
-rw-r--r--ui/src/com/android/providers/downloads/ui/DownloadItem.java15
2 files changed, 12 insertions, 5 deletions
diff --git a/ui/src/com/android/providers/downloads/ui/DateSortedExpandableListAdapter.java b/ui/src/com/android/providers/downloads/ui/DateSortedExpandableListAdapter.java
index 19132a11..f5d70770 100644
--- a/ui/src/com/android/providers/downloads/ui/DateSortedExpandableListAdapter.java
+++ b/ui/src/com/android/providers/downloads/ui/DateSortedExpandableListAdapter.java
@@ -273,7 +273,7 @@ public class DateSortedExpandableListAdapter implements ExpandableListAdapter {
TextView item;
if (null == convertView || !(convertView instanceof TextView)) {
LayoutInflater factory = LayoutInflater.from(mContext);
- item = (TextView) factory.inflate(R.layout.list_group_header, null);
+ item = (TextView) factory.inflate(R.layout.list_group_header, parent, false);
} else {
item = (TextView) convertView;
}
diff --git a/ui/src/com/android/providers/downloads/ui/DownloadItem.java b/ui/src/com/android/providers/downloads/ui/DownloadItem.java
index e24ac4a4..0562cd05 100644
--- a/ui/src/com/android/providers/downloads/ui/DownloadItem.java
+++ b/ui/src/com/android/providers/downloads/ui/DownloadItem.java
@@ -18,12 +18,11 @@ package com.android.providers.downloads.ui;
import android.content.Context;
import android.util.AttributeSet;
-import android.view.accessibility.AccessibilityEvent;
import android.view.MotionEvent;
+import android.view.accessibility.AccessibilityEvent;
import android.widget.CheckBox;
import android.widget.Checkable;
import android.widget.GridLayout;
-import android.widget.RelativeLayout;
/**
* This class customizes RelativeLayout to directly handle clicks on the left part of the view and
@@ -83,12 +82,20 @@ public class DownloadItem extends GridLayout implements Checkable {
mDownloadList = downloadList;
}
+ private boolean inCheckArea(MotionEvent event) {
+ if (isLayoutRtl()) {
+ return event.getX() > getWidth() - CHECKMARK_AREA;
+ } else {
+ return event.getX() < CHECKMARK_AREA;
+ }
+ }
+
@Override
public boolean onTouchEvent(MotionEvent event) {
boolean handled = false;
switch(event.getAction()) {
case MotionEvent.ACTION_DOWN:
- if (event.getX() < CHECKMARK_AREA) {
+ if (inCheckArea(event)) {
mIsInDownEvent = true;
handled = true;
}
@@ -99,7 +106,7 @@ public class DownloadItem extends GridLayout implements Checkable {
break;
case MotionEvent.ACTION_UP:
- if (mIsInDownEvent && event.getX() < CHECKMARK_AREA) {
+ if (mIsInDownEvent && inCheckArea(event)) {
toggle();
sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_CLICKED);
handled = true;