Fix animations, padding in RTL mode.

Show directory animations coming in from left-side when in RTL
language.  Also fix NinePatchDrawable to correctly mirror its padding
when auto-mirrored, and fix InsetDrawable to propagate the layout
direction to the wrapped Drawable.

Bug: 10987190, 11030793
Change-Id: I1213802a07d0c4ced93438df1e6ddf5aed3df677
diff --git a/res/animator-ldrtl/dir_down.xml b/res/animator-ldrtl/dir_down.xml
new file mode 100644
index 0000000..6c7e224
--- /dev/null
+++ b/res/animator-ldrtl/dir_down.xml
@@ -0,0 +1,22 @@
+<!-- Copyright (C) 2013 The Android Open Source Project
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+
+          http://www.apache.org/licenses/LICENSE-2.0
+
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+
+<objectAnimator xmlns:android="http://schemas.android.com/apk/res/android"
+    android:valueFrom="-1"
+    android:valueTo="0"
+    android:propertyName="position"
+    android:valueType="floatType"
+    android:duration="@android:integer/config_mediumAnimTime"
+    android:interpolator="@android:interpolator/decelerate_quad" />
diff --git a/res/animator-ldrtl/dir_up.xml b/res/animator-ldrtl/dir_up.xml
new file mode 100644
index 0000000..8e2925c
--- /dev/null
+++ b/res/animator-ldrtl/dir_up.xml
@@ -0,0 +1,22 @@
+<!-- Copyright (C) 2013 The Android Open Source Project
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+
+          http://www.apache.org/licenses/LICENSE-2.0
+
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+
+<objectAnimator xmlns:android="http://schemas.android.com/apk/res/android"
+    android:valueFrom="0"
+    android:valueTo="-1"
+    android:propertyName="position"
+    android:valueType="floatType"
+    android:duration="@android:integer/config_mediumAnimTime"
+    android:interpolator="@android:interpolator/accelerate_quad" />
diff --git a/res/drawable-hdpi/ic_dir_shadow.9.png b/res/drawable-hdpi/ic_dir_shadow_am.9.png
similarity index 100%
rename from res/drawable-hdpi/ic_dir_shadow.9.png
rename to res/drawable-hdpi/ic_dir_shadow_am.9.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_drawer_shadow_tablet.9.png b/res/drawable-hdpi/ic_drawer_shadow_tablet_am.9.png
similarity index 100%
rename from res/drawable-hdpi/ic_drawer_shadow_tablet.9.png
rename to res/drawable-hdpi/ic_drawer_shadow_tablet_am.9.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_dir_shadow.9.png b/res/drawable-mdpi/ic_dir_shadow_am.9.png
similarity index 100%
rename from res/drawable-mdpi/ic_dir_shadow.9.png
rename to res/drawable-mdpi/ic_dir_shadow_am.9.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_drawer_shadow_tablet.9.png b/res/drawable-mdpi/ic_drawer_shadow_tablet_am.9.png
similarity index 100%
rename from res/drawable-mdpi/ic_drawer_shadow_tablet.9.png
rename to res/drawable-mdpi/ic_drawer_shadow_tablet_am.9.png
Binary files differ
diff --git a/res/drawable-xhdpi/ic_dir_shadow.9.png b/res/drawable-xhdpi/ic_dir_shadow_am.9.png
similarity index 100%
rename from res/drawable-xhdpi/ic_dir_shadow.9.png
rename to res/drawable-xhdpi/ic_dir_shadow_am.9.png
Binary files differ
diff --git a/res/drawable-xhdpi/ic_drawer_shadow_tablet.9.png b/res/drawable-xhdpi/ic_drawer_shadow_tablet_am.9.png
similarity index 100%
rename from res/drawable-xhdpi/ic_drawer_shadow_tablet.9.png
rename to res/drawable-xhdpi/ic_drawer_shadow_tablet_am.9.png
Binary files differ
diff --git a/res/drawable-xxhdpi/ic_dir_shadow.9.png b/res/drawable-xxhdpi/ic_dir_shadow_am.9.png
similarity index 100%
rename from res/drawable-xxhdpi/ic_dir_shadow.9.png
rename to res/drawable-xxhdpi/ic_dir_shadow_am.9.png
Binary files differ
diff --git a/res/drawable-xxhdpi/ic_drawer_shadow_tablet.9.png b/res/drawable-xxhdpi/ic_drawer_shadow_tablet_am.9.png
similarity index 100%
rename from res/drawable-xxhdpi/ic_drawer_shadow_tablet.9.png
rename to res/drawable-xxhdpi/ic_drawer_shadow_tablet_am.9.png
Binary files differ
diff --git a/res/drawable/ic_dir_shadow.xml b/res/drawable/ic_dir_shadow.xml
new file mode 100644
index 0000000..1153e69
--- /dev/null
+++ b/res/drawable/ic_dir_shadow.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+ * Copyright 2013, The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+-->
+
+<nine-patch xmlns:android="http://schemas.android.com/apk/res/android"
+        android:src="@drawable/ic_dir_shadow_am"
+        android:autoMirrored="true">
+</nine-patch>
diff --git a/res/drawable/ic_drawer_shadow_tablet.xml b/res/drawable/ic_drawer_shadow_tablet.xml
new file mode 100644
index 0000000..382ebff
--- /dev/null
+++ b/res/drawable/ic_drawer_shadow_tablet.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+ * Copyright 2013, The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+-->
+
+<nine-patch xmlns:android="http://schemas.android.com/apk/res/android"
+        android:src="@drawable/ic_drawer_shadow_tablet_am"
+        android:autoMirrored="true">
+</nine-patch>
diff --git a/src/com/android/documentsui/DirectoryView.java b/src/com/android/documentsui/DirectoryView.java
index 28e2bd9..b552e5a 100644
--- a/src/com/android/documentsui/DirectoryView.java
+++ b/src/com/android/documentsui/DirectoryView.java
@@ -40,7 +40,7 @@
     public void setBackground(Drawable background) {
         final Rect rect = new Rect();
         background.getPadding(rect);
-        final InsetDrawable inset = new InsetDrawable(background, -rect.left, 0, 0, 0);
+        final InsetDrawable inset = new InsetDrawable(background, -rect.left, 0, -rect.right, 0);
         super.setBackground(inset);
     }