Search in sources :

Example 1 with LevelListDrawable

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);
}
Also used : LevelListDrawable(android.graphics.drawable.LevelListDrawable) TintedDrawable(org.chromium.chrome.browser.widget.TintedDrawable)

Example 2 with LevelListDrawable

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;
}
Also used : AppLevelListDrawable(org.wikipedia.drawable.AppLevelListDrawable) LevelListDrawable(android.graphics.drawable.LevelListDrawable) AppLevelListDrawable(org.wikipedia.drawable.AppLevelListDrawable) NonNull(android.support.annotation.NonNull)

Example 3 with LevelListDrawable

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);
}
Also used : LevelListDrawable(android.graphics.drawable.LevelListDrawable) LevelListDrawable(android.graphics.drawable.LevelListDrawable) BitmapDrawable(android.graphics.drawable.BitmapDrawable) Drawable(android.graphics.drawable.Drawable) Html(android.text.Html) Spanned(android.text.Spanned) Point(android.graphics.Point) SpannableStringBuilder(android.text.SpannableStringBuilder)

Aggregations

LevelListDrawable (android.graphics.drawable.LevelListDrawable)3 Point (android.graphics.Point)1 BitmapDrawable (android.graphics.drawable.BitmapDrawable)1 Drawable (android.graphics.drawable.Drawable)1 NonNull (android.support.annotation.NonNull)1 Html (android.text.Html)1 SpannableStringBuilder (android.text.SpannableStringBuilder)1 Spanned (android.text.Spanned)1 TintedDrawable (org.chromium.chrome.browser.widget.TintedDrawable)1 AppLevelListDrawable (org.wikipedia.drawable.AppLevelListDrawable)1