use of com.android.resources.LayoutDirection in project platform_frameworks_base by android.
the class CustomBar method loadIcon.
protected void loadIcon(int index, String iconName, Density density, boolean isRtl) {
View child = getChildAt(index);
if (child instanceof ImageView) {
ImageView imageView = (ImageView) child;
LayoutDirection dir = isRtl ? LayoutDirection.RTL : null;
IconLoader iconLoader = new IconLoader(iconName, density, mSimulatedPlatformVersion, dir);
InputStream stream = iconLoader.getIcon();
if (stream != null) {
density = iconLoader.getDensity();
String path = iconLoader.getPath();
// look for a cached bitmap
Bitmap bitmap = Bridge.getCachedBitmap(path, Boolean.TRUE);
if (bitmap == null) {
try {
bitmap = Bitmap_Delegate.createBitmap(stream, false, /*isMutable*/
density);
Bridge.setCachedBitmap(path, bitmap, Boolean.TRUE);
} catch (IOException e) {
return;
}
}
if (bitmap != null) {
BitmapDrawable drawable = new BitmapDrawable(getContext().getResources(), bitmap);
imageView.setImageDrawable(drawable);
}
}
}
}
use of com.android.resources.LayoutDirection in project android_frameworks_base by DirtyUnicorns.
the class CustomBar method loadIcon.
protected void loadIcon(int index, String iconName, Density density, boolean isRtl) {
View child = getChildAt(index);
if (child instanceof ImageView) {
ImageView imageView = (ImageView) child;
LayoutDirection dir = isRtl ? LayoutDirection.RTL : null;
IconLoader iconLoader = new IconLoader(iconName, density, mSimulatedPlatformVersion, dir);
InputStream stream = iconLoader.getIcon();
if (stream != null) {
density = iconLoader.getDensity();
String path = iconLoader.getPath();
// look for a cached bitmap
Bitmap bitmap = Bridge.getCachedBitmap(path, Boolean.TRUE);
if (bitmap == null) {
try {
bitmap = Bitmap_Delegate.createBitmap(stream, false, /*isMutable*/
density);
Bridge.setCachedBitmap(path, bitmap, Boolean.TRUE);
} catch (IOException e) {
return;
}
}
if (bitmap != null) {
BitmapDrawable drawable = new BitmapDrawable(getContext().getResources(), bitmap);
imageView.setImageDrawable(drawable);
}
}
}
}
use of com.android.resources.LayoutDirection in project android_frameworks_base by crdroidandroid.
the class CustomBar method loadIcon.
protected void loadIcon(int index, String iconName, Density density, boolean isRtl) {
View child = getChildAt(index);
if (child instanceof ImageView) {
ImageView imageView = (ImageView) child;
LayoutDirection dir = isRtl ? LayoutDirection.RTL : null;
IconLoader iconLoader = new IconLoader(iconName, density, mSimulatedPlatformVersion, dir);
InputStream stream = iconLoader.getIcon();
if (stream != null) {
density = iconLoader.getDensity();
String path = iconLoader.getPath();
// look for a cached bitmap
Bitmap bitmap = Bridge.getCachedBitmap(path, Boolean.TRUE);
if (bitmap == null) {
try {
bitmap = Bitmap_Delegate.createBitmap(stream, false, /*isMutable*/
density);
Bridge.setCachedBitmap(path, bitmap, Boolean.TRUE);
} catch (IOException e) {
return;
}
}
if (bitmap != null) {
BitmapDrawable drawable = new BitmapDrawable(getContext().getResources(), bitmap);
imageView.setImageDrawable(drawable);
}
}
}
}
use of com.android.resources.LayoutDirection in project android_frameworks_base by AOSPA.
the class CustomBar method loadIcon.
protected void loadIcon(int index, String iconName, Density density, boolean isRtl) {
View child = getChildAt(index);
if (child instanceof ImageView) {
ImageView imageView = (ImageView) child;
LayoutDirection dir = isRtl ? LayoutDirection.RTL : null;
IconLoader iconLoader = new IconLoader(iconName, density, mSimulatedPlatformVersion, dir);
InputStream stream = iconLoader.getIcon();
if (stream != null) {
density = iconLoader.getDensity();
String path = iconLoader.getPath();
// look for a cached bitmap
Bitmap bitmap = Bridge.getCachedBitmap(path, Boolean.TRUE);
if (bitmap == null) {
try {
bitmap = Bitmap_Delegate.createBitmap(stream, false, /*isMutable*/
density);
Bridge.setCachedBitmap(path, bitmap, Boolean.TRUE);
} catch (IOException e) {
return;
}
}
if (bitmap != null) {
BitmapDrawable drawable = new BitmapDrawable(getContext().getResources(), bitmap);
imageView.setImageDrawable(drawable);
}
}
}
}
use of com.android.resources.LayoutDirection in project android_frameworks_base by ResurrectionRemix.
the class CustomBar method loadIcon.
protected void loadIcon(int index, String iconName, Density density, boolean isRtl) {
View child = getChildAt(index);
if (child instanceof ImageView) {
ImageView imageView = (ImageView) child;
LayoutDirection dir = isRtl ? LayoutDirection.RTL : null;
IconLoader iconLoader = new IconLoader(iconName, density, mSimulatedPlatformVersion, dir);
InputStream stream = iconLoader.getIcon();
if (stream != null) {
density = iconLoader.getDensity();
String path = iconLoader.getPath();
// look for a cached bitmap
Bitmap bitmap = Bridge.getCachedBitmap(path, Boolean.TRUE);
if (bitmap == null) {
try {
bitmap = Bitmap_Delegate.createBitmap(stream, false, /*isMutable*/
density);
Bridge.setCachedBitmap(path, bitmap, Boolean.TRUE);
} catch (IOException e) {
return;
}
}
if (bitmap != null) {
BitmapDrawable drawable = new BitmapDrawable(getContext().getResources(), bitmap);
imageView.setImageDrawable(drawable);
}
}
}
}
Aggregations