当前位置: 首页>>代码示例>>Java>>正文


Java ImageLoader类代码示例

本文整理汇总了Java中com.google.android.imageloader.ImageLoader的典型用法代码示例。如果您正苦于以下问题:Java ImageLoader类的具体用法?Java ImageLoader怎么用?Java ImageLoader使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ImageLoader类属于com.google.android.imageloader包,在下文中一共展示了ImageLoader类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: initialize

import com.google.android.imageloader.ImageLoader; //导入依赖的package包/类
private void initialize() {
    // Create a basic in-memory image cache. This should be replaced with a file
    // response cache when used in production.
    mImageLoader = new ImageLoader(IMG_LOADER_CACHE_SIZE);

    try {
        File httpCacheDir = new File(getCacheDir(), "http");
        Class.forName("android.net.http.HttpResponseCache")
                .getMethod("install", File.class, long.class)
                .invoke(null, httpCacheDir, HTTP_CACHE_SIZE);
    } catch (Exception httpResponseCacheNotAvailable) {
        // Ignore.
    }
}
 
开发者ID:vicfryzel,项目名称:gplus-photohunt-client-android,代码行数:15,代码来源:PhotoHuntApp.java

示例2: onCreate

import com.google.android.imageloader.ImageLoader; //导入依赖的package包/类
@Override
public void onCreate() {
    super.onCreate();
    Log.d(TAG, "[onCreate]");

    sInstance = this;

    JRFileResponseCache jrfrc = new JRFileResponseCache(this);
    ResponseCache.setDefault(jrfrc);
    java.net.ContentHandler bmch = JRFileResponseCache.capture(new JRBitmapContentHandler(), null);
    java.net.ContentHandler pfch = JRFileResponseCache.capture(JRFileResponseCache.sink(), null);
    mImageLoader = new ImageLoader(ImageLoader.DEFAULT_TASK_LIMIT, null, bmch, pfch,
            ImageLoader.DEFAULT_CACHE_SIZE, null);

    /* If the Story class changes, then the Archiver can't load the new stories, which is fine,
        They'll just get re-downloaded/added, but we also have to clear the links hash, so that
        the new stories get added. */
    try {
        ArrayList<Story> loadedStories = Archiver.load(ARCHIVE_STORIES_ARRAY, this);
        mStories.clear();
        mStories.addAll(loadedStories);
        mStoryLinks = Archiver.load(ARCHIVE_STORY_LINKS_HASH, this);
        logd(TAG, "[ctor] loaded " + mStories.size() + " stories from disk");
    } catch (Archiver.LoadException e) {
        mStories.clear();
        mStoryLinks = new HashSet<String>();
        logd(TAG, "[ctor] stories reset");
    }
}
 
开发者ID:dinesh-prodapt,项目名称:samplegit,代码行数:30,代码来源:QuickShare.java

示例3: getImageLoader

import com.google.android.imageloader.ImageLoader; //导入依赖的package包/类
/**
 * @return the imageLoader
 */
public ImageLoader getImageLoader() {
    return mImageLoader;
}
 
开发者ID:vicfryzel,项目名称:gplus-photohunt-client-android,代码行数:7,代码来源:PhotoHuntApp.java

示例4: getImageLoader

import com.google.android.imageloader.ImageLoader; //导入依赖的package包/类
public ImageLoader getImageLoader() {
    return mImageLoader;
}
 
开发者ID:dinesh-prodapt,项目名称:samplegit,代码行数:4,代码来源:QuickShare.java

示例5: getView

import com.google.android.imageloader.ImageLoader; //导入依赖的package包/类
@Override
public View getView(int position, View convertView, ViewGroup parent) {
    View v = convertView;
    if (v == null) {
        v = getInflatedView();
    } else if (v.getTag().equals("DUMMY_ROW")) {
        v = getInflatedView();
    }

    TextView title = (TextView) v.findViewById(R.id.row_story_title);
    ImageView icon = (ImageView) v.findViewById(R.id.row_story_icon);
    TextView text = (TextView) v.findViewById(R.id.row_story_text);
    TextView date = (TextView) v.findViewById(R.id.row_story_date);

    Story story = getItem(position);

    /* This is the row that contains dummy (empty) story, really to be used as a "Refresh"
        button that is click-able/focus-able like other listview rows, and looks nicer than
        a real button. */
    if (position == 0) {
        v.setTag("DUMMY_ROW");

        icon.setVisibility(View.GONE);
        text.setVisibility(View.GONE);
        date.setVisibility(View.GONE);

        title.setText(mRefreshViewText);
        mRefreshView = v;
        title.setGravity(Gravity.CENTER_HORIZONTAL);
    } else {
        if (v == mRefreshView) mRefreshView = null;
        //Log.d(TAG, "[getView] for row " + position + ": " + story.getTitle());

        v.setTag("STORY_ROW");

        title.setGravity(Gravity.LEFT);

        if (story.getImageUrls().isEmpty()) {
            icon.setVisibility(View.GONE);
        } else {
            icon.setVisibility(View.VISIBLE);
            ImageLoader il = mFeedData.getImageLoader();
            ImageLoader.BindResult br = il.bind(this, icon, story.getThumbnailUrl());
            //Log.d(TAG, "bind result: " + br);
        }

        title.setText(story.getTitle());
        text.setText(story.getPlainText());
        date.setText(story.getFormattedDate());
    }

    return v;
}
 
开发者ID:dinesh-prodapt,项目名称:samplegit,代码行数:54,代码来源:FeedSummaryFragment.java


注:本文中的com.google.android.imageloader.ImageLoader类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。