summaryrefslogtreecommitdiff
path: root/src/com/android/bitmap/drawable/BasicBitmapDrawable.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/android/bitmap/drawable/BasicBitmapDrawable.java')
-rw-r--r--src/com/android/bitmap/drawable/BasicBitmapDrawable.java36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/com/android/bitmap/drawable/BasicBitmapDrawable.java b/src/com/android/bitmap/drawable/BasicBitmapDrawable.java
index 67884df..ca429ee 100644
--- a/src/com/android/bitmap/drawable/BasicBitmapDrawable.java
+++ b/src/com/android/bitmap/drawable/BasicBitmapDrawable.java
@@ -73,6 +73,8 @@ public class BasicBitmapDrawable extends Drawable implements DecodeCallback,
private DecodeTask mTask;
private Cancelable mCreateFileDescriptorFactoryTask;
+ private int mLayoutDirection;
+
// based on framework CL:I015d77
private static final int CPU_COUNT = Runtime.getRuntime().availableProcessors();
private static final int CORE_POOL_SIZE = CPU_COUNT + 1;
@@ -128,6 +130,40 @@ public class BasicBitmapDrawable extends Drawable implements DecodeCallback,
}
/**
+ * Set layout direction.
+ * It ends with Local so as not conflict with hidden Drawable.setLayoutDirection.
+ * @param layoutDirection the resolved layout direction for the drawable,
+ * either {@link android.view.View#LAYOUT_DIRECTION_LTR}
+ * or {@link android.view.View#LAYOUT_DIRECTION_RTL}
+ */
+ public void setLayoutDirectionLocal(int layoutDirection) {
+ if (mLayoutDirection != layoutDirection) {
+ mLayoutDirection = layoutDirection;
+ onLayoutDirectionChangeLocal(layoutDirection);
+ }
+ }
+
+ /**
+ * Called when the drawable's resolved layout direction changes.
+ * It ends with Local so as not conflict with hidden Drawable.onLayoutDirectionChange.
+ *
+ * @param layoutDirection the new resolved layout direction
+ */
+ public void onLayoutDirectionChangeLocal(int layoutDirection) {}
+
+ /**
+ * Returns the resolved layout direction for this Drawable.
+ * It ends with Local so as not conflict with hidden Drawable.getLayoutDirection.
+ *
+ * @return One of {@link android.view.View#LAYOUT_DIRECTION_LTR},
+ * {@link android.view.View#LAYOUT_DIRECTION_RTL}
+ * @see #setLayoutDirectionLocal(int)
+ */
+ public int getLayoutDirectionLocal() {
+ return mLayoutDirection;
+ }
+
+ /**
* Binds to the given key and start the decode process. This will first look in the cache, then
* decode from the request key if not found.
*