Android Open Source - webimageloader Numbers Activity






From Project

Back to project page webimageloader.

License

The source code is released under:

Apache License

If you think the Android project webimageloader listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.webimageloader.sample.numbers;
//from  w ww  . j a v  a  2s. co m
import android.app.ListActivity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.TextView;

import com.webimageloader.ImageLoader;
import com.webimageloader.ext.ImageHelper;
import com.webimageloader.ext.ImageLoaderApplication;
import com.webimageloader.sample.R;

public class NumbersActivity extends ListActivity {
    private static final int NUM_IMAGES = 100;

    private ImageLoader imageLoader;
    private ImageHelper imageHelper;

    private Adapter adapter;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        ImageLoader.Logger.logAll();

        imageLoader = ImageLoaderApplication.getLoader(this);

        imageHelper = new ImageHelper(this, imageLoader);
        imageHelper.setFadeIn(true);
        imageHelper.setLoadingResource(android.R.drawable.sym_def_app_icon);

        adapter = new Adapter(this);
        setListAdapter(adapter);
    }

    @Override
    protected void onListItemClick(ListView l, View v, int position, long id) {
        String url = adapter.getItem(position);
        Intent intent = new Intent(this, NumberDetailsActivity.class)
                .putExtra(NumberDetailsActivity.ARG_URL, url);

        startActivity(intent);
    }

    private class Adapter extends BaseAdapter {
        private LayoutInflater inflater;

        public Adapter(Context context) {
            inflater = LayoutInflater.from(context);
        }

        @Override
        public int getCount() {
            return NUM_IMAGES;
        }

        @Override
        public String getItem(int position) {
            return "https://raw.github.com/lexs/webimageloader/develop/extras/numbers/" + position + ".png";
        }

        @Override
        public long getItemId(int position) {
            return position;
        }

        @Override
        public View getView(int position, View v, ViewGroup parent) {
            if (v == null) {
                v = inflater.inflate(R.layout.numbers_list_item, parent, false);
            }

            ImageView imageView = (ImageView) v.findViewById(R.id.image);
            TextView textView = (TextView) v.findViewById(R.id.text);

            imageHelper.load(imageView, getItem(position));
            textView.setText("Image #" + position);

            return v;
        }
    }
}




Java Source Code List

com.webimageloader.ConnectionFactory.java
com.webimageloader.ConnectionHandler.java
com.webimageloader.Constants.java
com.webimageloader.ImageLoaderImpl.java
com.webimageloader.ImageLoader.java
com.webimageloader.Request.java
com.webimageloader.content.ContentURLConnection.java
com.webimageloader.content.ContentURLStreamHandler.java
com.webimageloader.ext.ImageHelper.java
com.webimageloader.ext.ImageLoaderApplication.java
com.webimageloader.loader.BackgroundLoader.java
com.webimageloader.loader.DiskLoader.java
com.webimageloader.loader.LoaderManager.java
com.webimageloader.loader.LoaderRequest.java
com.webimageloader.loader.LoaderWork.java
com.webimageloader.loader.Loader.java
com.webimageloader.loader.MemoryCache.java
com.webimageloader.loader.MemoryLoader.java
com.webimageloader.loader.Metadata.java
com.webimageloader.loader.NetworkLoader.java
com.webimageloader.loader.PendingRequests.java
com.webimageloader.loader.SimpleBackgroundLoader.java
com.webimageloader.loader.TransformingLoader.java
com.webimageloader.sample.AsyncLoader.java
com.webimageloader.sample.ExampleApplication.java
com.webimageloader.sample.FastImageView.java
com.webimageloader.sample.MainActivity.java
com.webimageloader.sample.numbers.NumberDetailsActivity.java
com.webimageloader.sample.numbers.NumbersActivity.java
com.webimageloader.sample.patterns.PatternDetailsActivity.java
com.webimageloader.sample.patterns.PatternsActivity.java
com.webimageloader.sample.patterns.PatternsListFragment.java
com.webimageloader.sample.progress.ProgressActivity.java
com.webimageloader.transformation.ScaleTransformation.java
com.webimageloader.transformation.SimpleTransformation.java
com.webimageloader.transformation.Transformation.java
com.webimageloader.util.AbstractImageLoader.java
com.webimageloader.util.Android.java
com.webimageloader.util.BitmapUtils.java
com.webimageloader.util.FlushedInputStream.java
com.webimageloader.util.Hasher.java
com.webimageloader.util.HeaderParser.java
com.webimageloader.util.IOUtil.java
com.webimageloader.util.InputSupplier.java
com.webimageloader.util.ListenerFuture.java
com.webimageloader.util.LruCache.java
com.webimageloader.util.PriorityThreadFactory.java
com.webimageloader.util.WaitFuture.java