use of android.graphics.drawable.LevelListDrawable in project AndroidChromium by JackyAndroid.
the class RecentTabsGroupView method onFinishInflate.
@Override
public void onFinishInflate() {
super.onFinishInflate();
mDeviceIcon = (ImageView) findViewById(R.id.device_icon);
mTimeLabel = (TextView) findViewById(R.id.time_label);
mDeviceLabel = (TextView) findViewById(R.id.device_label);
mExpandCollapseIcon = (ImageView) findViewById(R.id.expand_collapse_icon);
// Create drawable for expand/collapse arrow.
LevelListDrawable collapseIcon = new LevelListDrawable();
collapseIcon.addLevel(DRAWABLE_LEVEL_COLLAPSED, DRAWABLE_LEVEL_COLLAPSED, TintedDrawable.constructTintedDrawable(getResources(), R.drawable.ic_expanded));
TintedDrawable collapse = TintedDrawable.constructTintedDrawable(getResources(), R.drawable.ic_collapsed);
collapse.setTint(ApiCompatibilityUtils.getColorStateList(getResources(), R.color.blue_mode_tint));
collapseIcon.addLevel(DRAWABLE_LEVEL_EXPANDED, DRAWABLE_LEVEL_EXPANDED, collapse);
mExpandCollapseIcon.setImageDrawable(collapseIcon);
}
use of android.graphics.drawable.LevelListDrawable in project apps-android-wikipedia by wikimedia.
the class AudioUrlSpan method drawable.
@NonNull
private static Drawable drawable(Context context) {
LevelListDrawable levels = new AppLevelListDrawable();
levels.addLevel(PLAY_ICON_LEVEL, PLAY_ICON_LEVEL, spinnerDrawable(context));
levels.addLevel(STOP_ICON_LEVEL, STOP_ICON_LEVEL, speakerDrawable(context));
int radius = getDimensionPixelSize(context, R.dimen.audio_url_span_loading_spinner_radius);
levels.setBounds(0, 0, radius * 2, radius * 2);
return levels;
}
use of android.graphics.drawable.LevelListDrawable in project XposedInstaller by rovo89.
the class RepoParser method parseSimpleHtml.
public static Spanned parseSimpleHtml(final Context c, String source, final TextView textView) {
source = source.replaceAll("<li>", "\t\u0095 ");
source = source.replaceAll("</li>", "<br>");
Spanned html = Html.fromHtml(source, new Html.ImageGetter() {
@Override
public Drawable getDrawable(String source) {
LevelListDrawable d = new LevelListDrawable();
@SuppressWarnings("deprecation") Drawable empty = c.getResources().getDrawable(R.drawable.ic_no_image);
d.addLevel(0, 0, empty);
assert empty != null;
d.setBounds(0, 0, empty.getIntrinsicWidth(), empty.getIntrinsicHeight());
new ImageGetterAsyncTask(c, source, d).execute(textView);
return d;
}
}, null);
// trim trailing newlines
int len = html.length();
int end = len;
for (int i = len - 1; i >= 0; i--) {
if (html.charAt(i) != '\n')
break;
end = i;
}
if (end == len)
return html;
else
return new SpannableStringBuilder(html, 0, end);
}
Aggregations