From 3f5a90b2fbba2a83a8a2c5babd5d466a5e0ad2aa Mon Sep 17 00:00:00 2001 From: Fabrice Di Meglio Date: Mon, 24 Jun 2013 19:22:25 -0700 Subject: Add automatic Drawable mirroring capability when in RTL layout direction - default value is "no mirroring" - introduce android:autoMirrored as a new attribute for Drawable, BitmapDrawable, LayerDrawable, StateListDrawable and NinePatchDrawable - setting android:autoMirrored="true" means that the drawable will be mirrored when the layout direction is RTL (right-to-left) - also fix an issue with ImageView drawable layout direction not updated correctly when RTL properties were changed See bug #7034321 Need Drawable RTL support Change-Id: If595ee5106c786f38e786d3a032e182f784a9d97 --- core/java/android/util/LayoutDirection.java | 44 +++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 core/java/android/util/LayoutDirection.java (limited to 'core/java/android/util/LayoutDirection.java') diff --git a/core/java/android/util/LayoutDirection.java b/core/java/android/util/LayoutDirection.java new file mode 100644 index 000000000000..e37d2f22f45e --- /dev/null +++ b/core/java/android/util/LayoutDirection.java @@ -0,0 +1,44 @@ +/* + * 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. + */ + +package android.util; + +/** + * An interface for defining layout directions. A layout direction can be left-to-right (LTR) + * or right-to-left (RTL). It can also be inherited (from a parent) or deduced from the default + * language script of a locale. + */ +public interface LayoutDirection { + /** + * Horizontal layout direction is from Left to Right. + */ + public static final int LTR = 0; + + /** + * Horizontal layout direction is from Right to Left. + */ + public static final int RTL = 1; + + /** + * Horizontal layout direction is inherited. + */ + public static final int INHERIT = 2; + + /** + * Horizontal layout direction is deduced from the default language script for the locale. + */ + public static final int LOCALE = 3; +} -- cgit v1.2.3 From 253fb7f6c3c026f92f0698f59e013e38085f7662 Mon Sep 17 00:00:00 2001 From: Fabrice Di Meglio Date: Thu, 29 Aug 2013 18:05:02 -0700 Subject: Fix bug #10549094 KLP API Review: android.util.LayoutDirection - use constant class instead of an interface - make it final Change-Id: I1bde76eb84cd92427e4e1fc2483cdecec429ae99 --- core/java/android/util/LayoutDirection.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'core/java/android/util/LayoutDirection.java') diff --git a/core/java/android/util/LayoutDirection.java b/core/java/android/util/LayoutDirection.java index e37d2f22f45e..20af20b65009 100644 --- a/core/java/android/util/LayoutDirection.java +++ b/core/java/android/util/LayoutDirection.java @@ -17,11 +17,15 @@ package android.util; /** - * An interface for defining layout directions. A layout direction can be left-to-right (LTR) + * A class for defining layout directions. A layout direction can be left-to-right (LTR) * or right-to-left (RTL). It can also be inherited (from a parent) or deduced from the default * language script of a locale. */ -public interface LayoutDirection { +public final class LayoutDirection { + + // No instantiation + private LayoutDirection() {} + /** * Horizontal layout direction is from Left to Right. */ -- cgit v1.2.3