Search in sources :

Example 16 with ImageLoaderConfiguration

use of com.nostra13.universalimageloader.core.ImageLoaderConfiguration in project ABPlayer by winkstu.

the class HomePageFragment method initImageLoader.

private void initImageLoader() {
    File cacheDir = com.nostra13.universalimageloader.utils.StorageUtils.getOwnCacheDirectory(this.getActivity().getApplicationContext(), IMAGE_CACHE_PATH);
    DisplayImageOptions defaultOptions = new DisplayImageOptions.Builder().cacheInMemory(true).cacheOnDisc(true).build();
    ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(this.getActivity()).defaultDisplayImageOptions(defaultOptions).memoryCache(new LruMemoryCache(12 * 1024 * 1024)).memoryCacheSize(12 * 1024 * 1024).discCacheSize(32 * 1024 * 1024).discCacheFileCount(100).discCache(new UnlimitedDiscCache(cacheDir)).threadPriority(Thread.NORM_PRIORITY - 2).tasksProcessingOrder(QueueProcessingType.LIFO).build();
    ImageLoader.getInstance().init(config);
}
Also used : UnlimitedDiscCache(com.nostra13.universalimageloader.cache.disc.impl.UnlimitedDiscCache) LruMemoryCache(com.nostra13.universalimageloader.cache.memory.impl.LruMemoryCache) File(java.io.File) ImageLoaderConfiguration(com.nostra13.universalimageloader.core.ImageLoaderConfiguration) DisplayImageOptions(com.nostra13.universalimageloader.core.DisplayImageOptions)

Example 17 with ImageLoaderConfiguration

use of com.nostra13.universalimageloader.core.ImageLoaderConfiguration in project V2HOT by djyde.

the class ContentActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    ActionBar actionBar = getSupportActionBar();
    if (actionBar != null) {
        actionBar.setDisplayHomeAsUpEnabled(true);
        actionBar.setDisplayShowHomeEnabled(false);
    }
    setContentView(R.layout.activity_content);
    ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(this).build();
    ImageLoader.getInstance().init(config);
    Intent intent = getIntent();
    String id = intent.getStringExtra("id");
    String content = intent.getStringExtra("content");
    String username = intent.getStringExtra("username");
    title = intent.getStringExtra("title");
    url = intent.getStringExtra("url");
    final RepliesAdapter repliesAdapter = new RepliesAdapter(this, username);
    ListView repliesView = (ListView) findViewById(R.id.replies);
    View headerView = getLayoutInflater().inflate(R.layout.topic_header, repliesView, false);
    ((TextView) headerView.findViewById(R.id.header_title)).setText(title);
    ((TextView) headerView.findViewById(R.id.header_content)).setText(content);
    ((TextView) headerView.findViewById(R.id.header_username)).setText(username);
    repliesView.addHeaderView(headerView);
    repliesView.setAdapter(repliesAdapter);
    RequestQueue queue = Volley.newRequestQueue(ContentActivity.this);
    // 获取回复
    queue.add(new GsonRequest<ReplyList>(Request.Method.GET, "https://www.v2ex.com/api/replies/show.json?topic_id=" + id, ReplyList.class, new Response.Listener<ReplyList>() {

        @Override
        public void onResponse(ReplyList response) {
            repliesAdapter.addAll(response);
            repliesAdapter.notifyDataSetChanged();
        }
    }, new Response.ErrorListener() {

        @Override
        public void onErrorResponse(VolleyError error) {
            Toast.makeText(ContentActivity.this, "请检查网络", Toast.LENGTH_LONG).show();
        }
    }));
}
Also used : VolleyError(com.android.volley.VolleyError) Intent(android.content.Intent) TextView(android.widget.TextView) View(android.view.View) ListView(android.widget.ListView) ListView(android.widget.ListView) RequestQueue(com.android.volley.RequestQueue) TextView(android.widget.TextView) ReplyList(com.v2ex.api.ReplyList) ImageLoaderConfiguration(com.nostra13.universalimageloader.core.ImageLoaderConfiguration) ActionBar(android.support.v7.app.ActionBar)

Example 18 with ImageLoaderConfiguration

use of com.nostra13.universalimageloader.core.ImageLoaderConfiguration in project ImagePicker by jeasonlzy.

the class GApp method onCreate.

@Override
public void onCreate() {
    super.onCreate();
    ImageLoaderConfiguration config = ImageLoaderConfiguration.createDefault(this);
    //UniversalImageLoader初始化
    ImageLoader.getInstance().init(config);
    //xUtils3初始化
    x.Ext.init(this);
}
Also used : ImageLoaderConfiguration(com.nostra13.universalimageloader.core.ImageLoaderConfiguration)

Example 19 with ImageLoaderConfiguration

use of com.nostra13.universalimageloader.core.ImageLoaderConfiguration in project fresco by facebook.

the class SampleUilFactory method getImageLoader.

public static ImageLoader getImageLoader(Context context) {
    if (sImageLoader == null) {
        DisplayImageOptions displayImageOptions = new DisplayImageOptions.Builder().showImageOnLoading(Drawables.sPlaceholderDrawable).showImageOnFail(Drawables.sErrorDrawable).cacheInMemory(true).cacheOnDisk(true).build();
        ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(context).defaultDisplayImageOptions(displayImageOptions).diskCacheSize(ConfigConstants.MAX_DISK_CACHE_SIZE).memoryCacheSize(ConfigConstants.MAX_MEMORY_CACHE_SIZE).build();
        sImageLoader = ImageLoader.getInstance();
        sImageLoader.init(config);
    }
    return sImageLoader;
}
Also used : ImageLoaderConfiguration(com.nostra13.universalimageloader.core.ImageLoaderConfiguration) DisplayImageOptions(com.nostra13.universalimageloader.core.DisplayImageOptions)

Example 20 with ImageLoaderConfiguration

use of com.nostra13.universalimageloader.core.ImageLoaderConfiguration in project ZhihuDailyPurify by izzyleung.

the class ZhihuDailyPurifyApplication method initImageLoader.

public static void initImageLoader(Context context) {
    ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(context).denyCacheImageMultipleSizesInMemory().threadPriority(Thread.NORM_PRIORITY - 2).diskCacheFileNameGenerator(new Md5FileNameGenerator()).tasksProcessingOrder(QueueProcessingType.LIFO).build();
    ImageLoader.getInstance().init(config);
}
Also used : Md5FileNameGenerator(com.nostra13.universalimageloader.cache.disc.naming.Md5FileNameGenerator) ImageLoaderConfiguration(com.nostra13.universalimageloader.core.ImageLoaderConfiguration)

Aggregations

ImageLoaderConfiguration (com.nostra13.universalimageloader.core.ImageLoaderConfiguration)33 DisplayImageOptions (com.nostra13.universalimageloader.core.DisplayImageOptions)16 LruMemoryCache (com.nostra13.universalimageloader.cache.memory.impl.LruMemoryCache)12 Md5FileNameGenerator (com.nostra13.universalimageloader.cache.disc.naming.Md5FileNameGenerator)10 File (java.io.File)8 FadeInBitmapDisplayer (com.nostra13.universalimageloader.core.display.FadeInBitmapDisplayer)6 UnlimitedDiscCache (com.nostra13.universalimageloader.cache.disc.impl.UnlimitedDiscCache)4 HashCodeFileNameGenerator (com.nostra13.universalimageloader.cache.disc.naming.HashCodeFileNameGenerator)4 BaseImageDownloader (com.nostra13.universalimageloader.core.download.BaseImageDownloader)4 UnlimitedDiskCache (com.nostra13.universalimageloader.cache.disc.impl.UnlimitedDiskCache)3 Intent (android.content.Intent)2 ImageLoader (com.nostra13.universalimageloader.core.ImageLoader)2 BaseImageDecoder (com.nostra13.universalimageloader.core.decode.BaseImageDecoder)2 SimpleBitmapDisplayer (com.nostra13.universalimageloader.core.display.SimpleBitmapDisplayer)2 SharedPreferences (android.content.SharedPreferences)1 Handler (android.os.Handler)1 ActionBar (android.support.v7.app.ActionBar)1 SpannableStringBuilder (android.text.SpannableStringBuilder)1 View (android.view.View)1 ListView (android.widget.ListView)1