Search in sources :

Example 76 with ImageView

use of android.widget.ImageView in project androidquery by androidquery.

the class BitmapAjaxCallback method async.

@Override
public void async(Context context) {
    String url = getUrl();
    ImageView v = this.v.get();
    if (url == null) {
        showProgress(false);
        setBitmap(url, v, null, false);
        return;
    }
    Bitmap bm = memGet(url);
    if (bm != null) {
        v.setTag(AQuery.TAG_URL, url);
        status = new AjaxStatus().source(AjaxStatus.MEMORY).done();
        callback(url, bm, status);
        return;
    }
    presetBitmap(url, v);
    if (!queueMap.containsKey(url)) {
        addQueue(url, v);
        super.async(v.getContext());
    } else {
        showProgress(true);
        addQueue(url, v);
    }
}
Also used : Bitmap(android.graphics.Bitmap) ImageView(android.widget.ImageView)

Example 77 with ImageView

use of android.widget.ImageView in project androidquery by androidquery.

the class AQueryImageTest method testImageByCallback2.

public void testImageByCallback2() {
    clearCache();
    AQUtility.post(new Runnable() {

        @Override
        public void run() {
            BitmapAjaxCallback cb = new BitmapAjaxCallback() {

                protected void callback(String url, ImageView iv, Bitmap bm, AjaxStatus status) {
                    iv.setImageBitmap(bm);
                }
            };
            aq.id(R.id.image).image(ICON_URL, true, true, 0, 0, cb);
        }
    });
    waitAsync(2000);
    assertLoaded(aq.getImageView(), true);
    Bitmap bm = aq.getCachedImage(ICON_URL);
    assertNotNull(bm);
}
Also used : BitmapAjaxCallback(com.androidquery.callback.BitmapAjaxCallback) Bitmap(android.graphics.Bitmap) ImageView(android.widget.ImageView) AjaxStatus(com.androidquery.callback.AjaxStatus)

Example 78 with ImageView

use of android.widget.ImageView in project androidquery by androidquery.

the class AQueryImageTest method testImageByCallbackAsync.

public void testImageByCallbackAsync() {
    clearCache();
    AQUtility.post(new Runnable() {

        @Override
        public void run() {
            //aq.id(R.id.image).image(ICON_URL, true, true, 0, 0, null, AQuery.FADE_IN);
            BitmapAjaxCallback cb = new BitmapAjaxCallback();
            cb.url(ICON_URL);
            //aq.id(R.id.image).image(cb);
            ImageView iv = aq.id(R.id.image).getImageView();
            cb.imageView(iv).async(getActivity());
        }
    });
    waitAsync(2000);
    assertLoaded(aq.getImageView(), true);
    Bitmap bm = aq.getCachedImage(ICON_URL);
    assertNotNull(bm);
}
Also used : BitmapAjaxCallback(com.androidquery.callback.BitmapAjaxCallback) Bitmap(android.graphics.Bitmap) ImageView(android.widget.ImageView)

Example 79 with ImageView

use of android.widget.ImageView in project making-apps-beautiful by ankurkotwal.

the class ArticleDetailFragment method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.fragment_article_detail, container, false);
    // Show the dummy content as text in a TextView.
    if (mItem != null) {
        ((TextView) rootView.findViewById(R.id.article_title)).setText(mItem.title);
        ((TextView) rootView.findViewById(R.id.article_byline)).setText(Html.fromHtml(mItem.time.toUpperCase(Locale.getDefault()) + " BY <font color='" + getResources().getString(R.string.author_font_color) + "'>" + mItem.author.toUpperCase(Locale.getDefault()) + "</a>"));
        //            ((TextView) rootView.findViewById(R.id.article_date))
        //                    .setText(mItem.time);
        ((TextView) rootView.findViewById(R.id.article_body)).setText(Html.fromHtml(mItem.content));
        ((TextView) rootView.findViewById(R.id.article_body)).setTypeface(Typeface.createFromAsset(getResources().getAssets(), "Rosario-Regular.ttf"));
        ((ImageView) rootView.findViewById(R.id.photo)).setImageDrawable(getResources().getDrawable(mItem.photoResId));
    }
    return rootView;
}
Also used : TextView(android.widget.TextView) ImageView(android.widget.ImageView) ImageView(android.widget.ImageView) TextView(android.widget.TextView) View(android.view.View)

Example 80 with ImageView

use of android.widget.ImageView in project making-apps-beautiful by ankurkotwal.

the class ArticleDetailFragment method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.fragment_article_detail, container, false);
    // Show the dummy content as text in a TextView.
    if (mItem != null) {
        ((TextView) rootView.findViewById(R.id.article_title)).setText(mItem.title);
        ((TextView) rootView.findViewById(R.id.article_byline)).setText(Html.fromHtml(mItem.time.toUpperCase(Locale.getDefault()) + " BY <font color='" + getResources().getString(R.string.author_font_color) + "'>" + mItem.author.toUpperCase(Locale.getDefault()) + "</a>"));
        ((TextView) rootView.findViewById(R.id.article_byline)).setMovementMethod(new LinkMovementMethod());
        //            ((TextView) rootView.findViewById(R.id.article_date))
        //                    .setText(mItem.time);
        ((TextView) rootView.findViewById(R.id.article_body)).setText(Html.fromHtml(mItem.content));
        ((TextView) rootView.findViewById(R.id.article_body)).setTypeface(Typeface.createFromAsset(getResources().getAssets(), "Rosario-Regular.ttf"));
        ((ImageView) rootView.findViewById(R.id.photo)).setImageDrawable(getResources().getDrawable(mItem.photoResId));
    }
    return rootView;
}
Also used : LinkMovementMethod(android.text.method.LinkMovementMethod) TextView(android.widget.TextView) ImageView(android.widget.ImageView) ImageView(android.widget.ImageView) TextView(android.widget.TextView) View(android.view.View)

Aggregations

ImageView (android.widget.ImageView)2257 View (android.view.View)1144 TextView (android.widget.TextView)1005 Intent (android.content.Intent)200 Drawable (android.graphics.drawable.Drawable)197 LinearLayout (android.widget.LinearLayout)192 Bitmap (android.graphics.Bitmap)178 ViewGroup (android.view.ViewGroup)163 LayoutInflater (android.view.LayoutInflater)159 OnClickListener (android.view.View.OnClickListener)145 AdapterView (android.widget.AdapterView)111 ListView (android.widget.ListView)103 RecyclerView (android.support.v7.widget.RecyclerView)102 FrameLayout (android.widget.FrameLayout)97 Button (android.widget.Button)83 Bundle (android.os.Bundle)81 BitmapDrawable (android.graphics.drawable.BitmapDrawable)80 RelativeLayout (android.widget.RelativeLayout)72 Test (org.junit.Test)70 Context (android.content.Context)69