com.nostra13.universalimageloader.core.display.FadeInBitmapDisplayer Java Examples

The following examples show how to use com.nostra13.universalimageloader.core.display.FadeInBitmapDisplayer. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: RequestAdapter.java    From candybar with Apache License 2.0 6 votes vote down vote up
public RequestAdapter(@NonNull Context context, @NonNull List<Request> requests, int spanCount) {
    mContext = context;
    mRequests = requests;
    mTextColorSecondary = ColorHelper.getAttributeColor(mContext,
            android.R.attr.textColorSecondary);
    mTextColorAccent = ColorHelper.getAttributeColor(mContext, R.attr.colorAccent);
    mSelectedItems = new SparseBooleanArray();

    mShowShadow = (spanCount == 1);
    mShowPremiumRequest = Preferences.get(mContext).isPremiumRequestEnabled();
    mShowRegularRequest = Preferences.get(mContext).isRegularRequestLimit();

    mOptions = ImageConfig.getRawDefaultImageOptions();
    mOptions.resetViewBeforeLoading(true);
    mOptions.cacheInMemory(true);
    mOptions.cacheOnDisk(false);
    mOptions.showImageOnFail(R.drawable.ic_app_default);
    mOptions.displayer(new FadeInBitmapDisplayer(700));
}
 
Example #2
Source File: FlowApplication.java    From flow-android with MIT License 6 votes vote down vote up
@Override
public void onCreate() {
    super.onCreate();
    Crashlytics.start(this);

    // Do init here
    FlowAsyncClient.init(getApplicationContext());
    DisplayImageOptions defaultOptions = new DisplayImageOptions.Builder()
            .cacheInMemory(true)
            .cacheOnDisc(true)
            .displayer(new FadeInBitmapDisplayer(500))
            .build();
    ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(getApplicationContext())
            .defaultDisplayImageOptions(defaultOptions)
            .build();
    ImageLoader.getInstance().init(config);

    SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
    if (preferences != null) {
        mIsUserLoggedIn = preferences.getBoolean(IS_USER_LOGGED_IN_KEY, false);
    }

    getMixpanel();
}
 
Example #3
Source File: GlobalConfig.java    From light-novel-library_Wenku8_Android with GNU General Public License v2.0 6 votes vote down vote up
public static void initImageLoader(Context context) {
    UnlimitedDiscCache localUnlimitedDiscCache = new UnlimitedDiscCache(
            new File(GlobalConfig.getFirstStoragePath() + "cache"),
            new File(context.getCacheDir() + File.separator + "imgs"));
    DisplayImageOptions localDisplayImageOptions = new DisplayImageOptions.Builder()
            .resetViewBeforeLoading(true)
            .cacheOnDisk(true)
            .cacheInMemory(true)
            .bitmapConfig(Bitmap.Config.RGB_565)
            .resetViewBeforeLoading(true)
            .displayer(new FadeInBitmapDisplayer(250)).build();
    ImageLoaderConfiguration localImageLoaderConfiguration = new ImageLoaderConfiguration.Builder(context)
            .diskCache(localUnlimitedDiscCache)
            .defaultDisplayImageOptions(localDisplayImageOptions).build();
    ImageLoader.getInstance().init(localImageLoaderConfiguration);
}
 
Example #4
Source File: CategoryController.java    From fdroidclient with GNU General Public License v3.0 6 votes vote down vote up
CategoryController(final Activity activity, LoaderManager loaderManager, View itemView) {
    super(itemView);

    this.activity = activity;
    this.loaderManager = loaderManager;

    appCardsAdapter = new AppPreviewAdapter(activity);

    viewAll = (Button) itemView.findViewById(R.id.view_all_button);
    viewAll.setOnClickListener(onViewAll);

    heading = (TextView) itemView.findViewById(R.id.name);
    image = (FeatureImage) itemView.findViewById(R.id.category_image);
    background = (FrameLayout) itemView.findViewById(R.id.category_background);

    RecyclerView appCards = (RecyclerView) itemView.findViewById(R.id.app_cards);
    appCards.setAdapter(appCardsAdapter);
    appCards.addItemDecoration(new ItemDecorator(activity));

    displayImageOptions = Utils.getDefaultDisplayImageOptionsBuilder()
            .displayer(new FadeInBitmapDisplayer(100, true, true, false))
            .build();
}
 
Example #5
Source File: Application.java    From v2ex-daily-android with Apache License 2.0 6 votes vote down vote up
private void initiImageLoader() {
    DisplayImageOptions options = new DisplayImageOptions.Builder()
            .bitmapConfig(Bitmap.Config.RGB_565)
            .imageScaleType(ImageScaleType.EXACTLY)
            .cacheOnDisc(true)
            .displayer(new FadeInBitmapDisplayer(200))
            .showImageOnLoading(R.drawable.ic_launcher)
            .build();

    File cacheDir;
    if(Environment.getExternalStorageState() == Environment.MEDIA_MOUNTED){
        cacheDir = getExternalFilesDir(Environment.DIRECTORY_PICTURES);
    }else{
        cacheDir = getCacheDir();
    }
    ImageLoaderConfiguration.Builder configBuilder = new ImageLoaderConfiguration.Builder(mContext)
            .threadPoolSize(2)
            .memoryCache(new WeakMemoryCache())
            .denyCacheImageMultipleSizesInMemory()
            .discCache(new UnlimitedDiscCache(cacheDir))
            .defaultDisplayImageOptions(options);
    if(BuildConfig.DEBUG){
        configBuilder.writeDebugLogs();
    }
    ImageLoader.getInstance().init(configBuilder.build());
}
 
Example #6
Source File: ImageDisplay.java    From DroidDLNA with GNU General Public License v3.0 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	setContentView(R.layout.image_display);

	mContext = this;
	options = new DisplayImageOptions.Builder()
			.showImageForEmptyUri(R.drawable.ic_empty)
			.showImageOnFail(R.drawable.ic_error).resetViewBeforeLoading()
			.cacheOnDisc().imageScaleType(ImageScaleType.EXACTLY)
			.bitmapConfig(Bitmap.Config.RGB_565)
			.displayer(new FadeInBitmapDisplayer(300)).build();

	initView();
	initData();
	showImage(mPlayUri);

	addShake();
}
 
Example #7
Source File: MainActivity.java    From MutiPhotoChoser with Mozilla Public License 2.0 6 votes vote down vote up
private void initImageLoader() {
    if (!ImageLoader.getInstance().isInited()) {
        DisplayImageOptions.Builder displayBuilder = new DisplayImageOptions.Builder();
        displayBuilder.cacheInMemory(true);
        displayBuilder.cacheOnDisk(true);
        displayBuilder.showImageOnLoading(com.ns.mutiphotochoser.R.drawable.default_photo);
        displayBuilder.showImageForEmptyUri(com.ns.mutiphotochoser.R.drawable.default_photo);
        displayBuilder.considerExifParams(true);
        displayBuilder.bitmapConfig(Bitmap.Config.RGB_565);
        displayBuilder.imageScaleType(ImageScaleType.EXACTLY);
        displayBuilder.displayer(new FadeInBitmapDisplayer(300));

        ImageLoaderConfiguration.Builder loaderBuilder = new ImageLoaderConfiguration.Builder(getApplication());
        loaderBuilder.defaultDisplayImageOptions(displayBuilder.build());
        loaderBuilder.memoryCacheSize(getMemoryCacheSize());

        try {
            File cacheDir = new File(getExternalCacheDir() + File.separator + CacheConstant.IMAGE_CACHE_DIRECTORY);
            loaderBuilder.diskCache(new LruDiscCache(cacheDir, DefaultConfigurationFactory.createFileNameGenerator(), 500 * 1024 * 1024));
        } catch (IOException e) {
            e.printStackTrace();
        }
        ImageLoader.getInstance().init(loaderBuilder.build());
    }

}
 
Example #8
Source File: MultiImageActivity.java    From commonadapter with MIT License 6 votes vote down vote up
/**
 * 初始化UniversalImageLoader
 */
private void configUniversalImageLoader() {
    DisplayImageOptions defaultOptions = new DisplayImageOptions.Builder()
            .cacheInMemory().cacheOnDisc()
            .bitmapConfig(Bitmap.Config.RGB_565)
            .displayer(new FadeInBitmapDisplayer(500))
            .build();

    ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(this).
            diskCacheFileCount(500)
            .diskCacheSize(50 * 1024 * 1024).
                    imageDownloader(new BaseImageDownloader(this, 10 * 1000, 20 * 1000))
            .memoryCacheSize((int) Runtime.getRuntime().maxMemory() / 8)
            .defaultDisplayImageOptions(defaultOptions).build();
    ImageLoader.getInstance().init(config);
}
 
Example #9
Source File: App.java    From VideoMeeting with Apache License 2.0 6 votes vote down vote up
private void initLib() {
    // 初始化日志功能, 开启/关闭 日志输出
    L.setLogOpen(AppConstant.LOG_OPEN);

    // 初始化自定义异常捕获
    CrashHandler.getInstance().init(this);

    // 初始化ImageLoader
    // 设置图片显示选项
    DisplayImageOptions displayOp = new DisplayImageOptions.Builder()
            .showImageOnLoading(0)// 图片正在加载时显示的背景
            .cacheInMemory(true)// 缓存在内存中
            .cacheOnDisk(true)// 缓存在磁盘中
            .displayer(new FadeInBitmapDisplayer(300))// 显示渐变动画
            .bitmapConfig(Bitmap.Config.RGB_565) // 设置图片的解码类型
            .considerExifParams(true)// 考虑旋转角
            .build();

    ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(
            getApplicationContext()).defaultDisplayImageOptions(displayOp)
            .denyCacheImageMultipleSizesInMemory()// 不解析多种尺寸
            .build();

    ImageLoader.getInstance().init(config);
}
 
Example #10
Source File: Utility.java    From HPlayer with Apache License 2.0 6 votes vote down vote up
private static DisplayImageOptions getDisplayImageOptionsFactory(int resId) {
    if (mOptionsMap.containsKey(resId)) {
        return mOptionsMap.get(resId);
    }
    DisplayImageOptions.Builder builder = new DisplayImageOptions.Builder();
    builder.imageScaleType(ImageScaleType.EXACTLY).cacheOnDisk(true)
            .cacheInMemory(true).bitmapConfig(Bitmap.Config.RGB_565)
            .displayer(new FadeInBitmapDisplayer(300));

    if (resId != 0) {
        builder.showImageOnFail(resId).showImageForEmptyUri(resId)
                .showImageOnLoading(resId);
    }
    mOptions = builder.build();
    mOptionsMap.put(resId, mOptions);
    return mOptions;
}
 
Example #11
Source File: UILKit.java    From XRichText with Apache License 2.0 6 votes vote down vote up
/**
 * 初始化
 *
 * @param context
 */
private UILKit(Context context) {
    File cacheDir = getDiskCacheDir(context, "img");

    ImageLoaderConfiguration.Builder config = new ImageLoaderConfiguration.Builder(context)
            .threadPriority(Thread.NORM_PRIORITY - 2)
            .denyCacheImageMultipleSizesInMemory()
            .memoryCacheSize(10 * 1024 * 1024)
            .diskCache(new UnlimitedDiskCache(cacheDir))
            .diskCacheFileNameGenerator(new Md5FileNameGenerator())
            .diskCacheSize(50 * 1024 * 1024) // 50 MiB
            .tasksProcessingOrder(QueueProcessingType.LIFO);

    ImageLoader.getInstance().init(config.build());



    picOptions = new DisplayImageOptions.Builder()
            .imageScaleType(ImageScaleType.EXACTLY)
            .cacheOnDisk(false).cacheInMemory(false)
            .resetViewBeforeLoading(true)
            .displayer(new FadeInBitmapDisplayer(500)).build();
}
 
Example #12
Source File: RequestAdapter.java    From candybar-library with Apache License 2.0 6 votes vote down vote up
public RequestAdapter(@NonNull Context context, @NonNull List<Request> requests, int spanCount) {
    mContext = context;
    mRequests = requests;
    mTextColorSecondary = ColorHelper.getAttributeColor(mContext,
            android.R.attr.textColorSecondary);
    mTextColorAccent = ColorHelper.getAttributeColor(mContext, R.attr.colorAccent);
    mSelectedItems = new SparseBooleanArray();

    mShowShadow = (spanCount == 1);
    mShowPremiumRequest = Preferences.get(mContext).isPremiumRequestEnabled();

    mOptions = ImageConfig.getRawDefaultImageOptions();
    mOptions.resetViewBeforeLoading(true);
    mOptions.cacheInMemory(true);
    mOptions.cacheOnDisk(false);
    mOptions.showImageOnFail(R.drawable.ic_app_default);
    mOptions.displayer(new FadeInBitmapDisplayer(700));
}
 
Example #13
Source File: WallpapersAdapter.java    From wallpaperboard with Apache License 2.0 6 votes vote down vote up
public WallpapersAdapter(@NonNull Context context, @NonNull List<Wallpaper> wallpapers,
                         boolean isFavoriteMode, boolean isSearchMode) {
    mContext = context;
    mWallpapers = wallpapers;
    mIsFavoriteMode = isFavoriteMode;
    WallpaperBoardApplication.sIsClickable = true;

    if (isSearchMode) {
        mWallpapersAll = new ArrayList<>();
        mWallpapersAll.addAll(mWallpapers);
    }

    mOptions = ImageConfig.getRawDefaultImageOptions();
    mOptions.resetViewBeforeLoading(true);
    mOptions.cacheInMemory(true);
    mOptions.cacheOnDisk(true);
    mOptions.displayer(new FadeInBitmapDisplayer(700));
}
 
Example #14
Source File: App.java    From ChatView with MIT License 6 votes vote down vote up
@Override
public void onCreate() {
    super.onCreate();

    // UNIVERSAL IMAGE LOADER SETUP
    DisplayImageOptions defaultOptions = new DisplayImageOptions.Builder()
            .resetViewBeforeLoading(true)
            .cacheOnDisk(true)
            .cacheInMemory(true)
            .imageScaleType(ImageScaleType.EXACTLY)
            .displayer(new FadeInBitmapDisplayer(300))
            .build();

    ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(getApplicationContext())
            .defaultDisplayImageOptions(defaultOptions)
            .memoryCache(new WeakMemoryCache())
            .diskCacheSize(100 * 1024 * 1024)
            .build();

    ImageLoader.getInstance().init(config);
    // END - UNIVERSAL IMAGE LOADER SETUP
}
 
Example #15
Source File: IconsAdapter.java    From candybar with Apache License 2.0 6 votes vote down vote up
public IconsAdapter(@NonNull Context context, @NonNull List<Icon> icons, boolean search, Fragment fragment) {
    mContext = context;
    mFragment = fragment;
    mIcons = icons;
    mIsShowIconName = mContext.getResources().getBoolean(R.bool.show_icon_name);
    if (search) {
        mIconsAll = new ArrayList<>();
        mIconsAll.addAll(mIcons);
    }

    mOptions = ImageConfig.getRawDefaultImageOptions();
    mOptions.resetViewBeforeLoading(true);
    mOptions.cacheInMemory(true);
    mOptions.cacheOnDisk(false);
    mOptions.displayer(new FadeInBitmapDisplayer(700));
}
 
Example #16
Source File: UserActivity.java    From NewAndroidTwitter with Apache License 2.0 5 votes vote down vote up
@Override
public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) {
	if (loadedImage != null) {
		ImageView imageView = (ImageView) view;
		boolean firstDisplay = !displayedImages.contains(imageUri);
		if (firstDisplay) {
			FadeInBitmapDisplayer.animate(imageView, 500);
			displayedImages.add(imageUri);
		}
	}
}
 
Example #17
Source File: CategoriesAdapter.java    From wallpaperboard with Apache License 2.0 5 votes vote down vote up
public CategoriesAdapter(@NonNull Context context, @NonNull List<Category> categories) {
    mContext = context;
    mCategories = categories;

    mOptions = ImageConfig.getRawDefaultImageOptions();
    mOptions.resetViewBeforeLoading(true);
    mOptions.cacheInMemory(true);
    mOptions.cacheOnDisk(true);
    mOptions.displayer(new FadeInBitmapDisplayer(700));
}
 
Example #18
Source File: BaseActivity.java    From Conquer with Apache License 2.0 5 votes vote down vote up
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    context = this;
    initStatusBar();
    initTheme();
    initLayout();
    userManager = BmobUserManager.getInstance(getApplicationContext());
    manager = BmobChatManager.getInstance(getApplicationContext());
    mApplication = CustomApplication.getInstance();
    currentUser = BmobChatUser.getCurrentUser(context, User.class);
    DisplayMetrics metric = new DisplayMetrics();
    getWindowManager().getDefaultDisplay().getMetrics(metric);
    mScreenWidth = metric.widthPixels;
    mScreenHeight = metric.heightPixels;
    loader = ImageLoader.getInstance();

    option_photo = new DisplayImageOptions.Builder().showImageOnLoading(R.drawable.default_photo)
            .showImageForEmptyUri(R.drawable.default_photo).showImageOnFail(R.drawable.default_photo)
            .cacheInMemory(true).cacheOnDisk(true).considerExifParams(true)
            .bitmapConfig(Bitmap.Config.RGB_565).displayer(new FadeInBitmapDisplayer(200)).build();
    option_pic = new DisplayImageOptions.Builder().showImageOnLoading(R.drawable.pic_loading)
            .showImageForEmptyUri(R.drawable.pic_loading).showImageOnFail(R.drawable.pic_loading)
            .cacheInMemory(true).cacheOnDisk(true).considerExifParams(true)
            .bitmapConfig(Bitmap.Config.RGB_565).displayer(new FadeInBitmapDisplayer(200)).build();
    dbUtils = DbUtils.create(context);
}
 
Example #19
Source File: ImageLoadOptions.java    From Conquer with Apache License 2.0 5 votes vote down vote up
/** 新闻列表中用到的图片加载配置 */
public static DisplayImageOptions getOptions() {
	DisplayImageOptions options = new DisplayImageOptions.Builder()
	// // 设置图片在下载期间显示的图片
	// .showImageOnLoading(R.drawable.small_image_holder_listpage)
	// // 设置图片Uri为空或是错误的时候显示的图片
	// .showImageForEmptyUri(R.drawable.small_image_holder_listpage)
	// // 设置图片加载/解码过程中错误时候显示的图片
	// .showImageOnFail(R.drawable.small_image_holder_listpage)
			.cacheInMemory(true)
			// 设置下载的图片是否缓存在内存中
			.cacheOnDisc(true)
			// 设置下载的图片是否缓存在SD卡中
			.considerExifParams(true).imageScaleType(ImageScaleType.EXACTLY)// 设置图片以如何的编码方式显示
			.bitmapConfig(Bitmap.Config.RGB_565)// 设置图片的解码类型
			// .decodingOptions(android.graphics.BitmapFactory.Options
			// decodingOptions)//设置图片的解码配置
			.considerExifParams(true)
			// 设置图片下载前的延迟
			// .delayBeforeLoading(int delayInMillis)//int
			// delayInMillis为你设置的延迟时间
			// 设置图片加入缓存前,对bitmap进行设置
			// 。preProcessor(BitmapProcessor preProcessor)
			.resetViewBeforeLoading(true)// 设置图片在下载前是否重置,复位
			// .displayer(new RoundedBitmapDisplayer(20))//是否设置为圆角,弧度为多少
			.displayer(new FadeInBitmapDisplayer(100))// 淡入
			.build();

	return options;
}
 
Example #20
Source File: AnimateFirstDisplayListener.java    From WeGit with Apache License 2.0 5 votes vote down vote up
@Override
public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) {
	if (loadedImage != null) {
		ImageView imageView = (ImageView) view;
		boolean firstDisplay = !displayedImages.contains(imageUri);
		if (firstDisplay) {
			FadeInBitmapDisplayer.animate(imageView, 500);
			displayedImages.add(imageUri);
		}
	}
}
 
Example #21
Source File: ImageLoaderUtils.java    From DevUtils with Apache License 2.0 5 votes vote down vote up
/**
 * 获取图片渐变动画加载配置
 * @param options        {@link DisplayImageOptions}
 * @param durationMillis 动画持续时间
 * @return {@link DisplayImageOptions}
 */
public static DisplayImageOptions getFadeInBitmapDisplayer(final DisplayImageOptions options, final int durationMillis) {
    if (options != null) {
        return getBitmapDisplayerOptions(options, new FadeInBitmapDisplayer(durationMillis));
    }
    return options;
}
 
Example #22
Source File: GalleryActivity.java    From MutiPhotoChoser with Mozilla Public License 2.0 5 votes vote down vote up
private void initImageLoader() {
    if (options == null) {
        DisplayImageOptions.Builder displayBuilder = new DisplayImageOptions.Builder();
        displayBuilder.cacheInMemory(true);
        displayBuilder.cacheOnDisk(true);
        displayBuilder.showImageOnLoading(R.drawable.default_photo);
        displayBuilder.showImageForEmptyUri(R.drawable.default_photo);
        displayBuilder.considerExifParams(true);
        displayBuilder.bitmapConfig(Bitmap.Config.RGB_565);
        displayBuilder.imageScaleType(ImageScaleType.EXACTLY);
        displayBuilder.displayer(new FadeInBitmapDisplayer(300));
        options = displayBuilder.build();
    }

    if (!ImageLoader.getInstance().isInited()) {
        ImageLoaderConfiguration.Builder loaderBuilder = new ImageLoaderConfiguration.Builder(getApplication());
        loaderBuilder.memoryCacheSize(getMemoryCacheSize());

        try {
            File cacheDir = new File(getExternalCacheDir() + File.separator + CacheConstant.IMAGE_CACHE_DIRECTORY);
            loaderBuilder.diskCache(new LruDiscCache(cacheDir, DefaultConfigurationFactory.createFileNameGenerator(), 500 * 1024 * 1024));
        } catch (IOException e) {
            e.printStackTrace();
        }
        ImageLoader.getInstance().init(loaderBuilder.build());
    }

}
 
Example #23
Source File: ContentActivity.java    From DroidDLNA with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onLoadingComplete(String imageUri, View view,
		Bitmap loadedImage) {
	if (loadedImage != null) {
		ImageView imageView = (ImageView) view;
		boolean firstDisplay = !displayedImages.contains(imageUri);
		if (firstDisplay) {
			FadeInBitmapDisplayer.animate(imageView, 500);
			displayedImages.add(imageUri);
		}
	}
}
 
Example #24
Source File: ImagePagerFragment.java    From Android-Universal-Image-Loader-Modify with Apache License 2.0 5 votes vote down vote up
ImageAdapter(Context context) {
	inflater = LayoutInflater.from(context);

	options = new DisplayImageOptions.Builder()
			.showImageForEmptyUri(R.drawable.ic_empty)
			.showImageOnFail(R.drawable.ic_error)
			.resetViewBeforeLoading(true)
			.cacheOnDisk(true)
			.imageScaleType(ImageScaleType.EXACTLY)
			.bitmapConfig(Bitmap.Config.RGB_565)
			.considerExifParams(true)
			.displayer(new FadeInBitmapDisplayer(300))
			.build();
}
 
Example #25
Source File: ImageListFragment.java    From Android-Universal-Image-Loader-Modify with Apache License 2.0 5 votes vote down vote up
@Override
public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) {
	if (loadedImage != null) {
		ImageView imageView = (ImageView) view;
		boolean firstDisplay = !displayedImages.contains(imageUri);
		if (firstDisplay) {
			FadeInBitmapDisplayer.animate(imageView, 500);
			displayedImages.add(imageUri);
		}
	}
}
 
Example #26
Source File: MessageChatAdapter.java    From Conquer with Apache License 2.0 5 votes vote down vote up
@Override
public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) {
	if (loadedImage != null) {
		ImageView imageView = (ImageView) view;
		boolean firstDisplay = !displayedImages.contains(imageUri);
		if (firstDisplay) {
			FadeInBitmapDisplayer.animate(imageView, 500);
			displayedImages.add(imageUri);
		}
	}
}
 
Example #27
Source File: SubjectAdapter.java    From snowdream-books-android with Apache License 2.0 5 votes vote down vote up
public SubjectAdapter(Context context, List<Book> list) {
    this.context = context;
    this.list = list;
    inflater = (LayoutInflater) context.getSystemService(Service.LAYOUT_INFLATER_SERVICE);

    language = Locale.getDefault().getLanguage();

    options =  new DisplayImageOptions.Builder()
            .showImageOnLoading(R.drawable.ic_book)
            .showImageForEmptyUri(R.drawable.ic_book)
            .showImageOnFail(R.drawable.ic_book)
            .displayer(new FadeInBitmapDisplayer(500))
            .build();

}
 
Example #28
Source File: Utils.java    From YTPlayer with GNU General Public License v3.0 5 votes vote down vote up
public static void initImageLoader(Context context) {
    DisplayImageOptions options = new DisplayImageOptions.Builder()
            .showImageOnLoading(R.drawable.ic_pulse)
            .showImageForEmptyUri(R.drawable.ic_pulse)
            .showImageOnFail(R.drawable.ic_pulse)
            .imageScaleType(ImageScaleType.IN_SAMPLE_INT)
            .bitmapConfig(Bitmap.Config.ARGB_8888)
            .displayer(new FadeInBitmapDisplayer(500))
            .handler(new Handler()).build();
    ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(context)
            .memoryCache(new WeakMemoryCache()).defaultDisplayImageOptions(options).memoryCacheSizePercentage(13).build();
    ImageLoader.getInstance().init(config);
}
 
Example #29
Source File: Utils.java    From fdroidclient with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Gets the {@link DisplayImageOptions} instance used to configure
 * {@link com.nostra13.universalimageloader.core.ImageLoader} instances
 * used to display app icons.  It lazy loads a reusable static instance.
 */
public static DisplayImageOptions getRepoAppDisplayImageOptions() {
    if (repoAppDisplayImageOptions == null) {
        repoAppDisplayImageOptions = getDefaultDisplayImageOptionsBuilder()
                .showImageOnLoading(R.drawable.ic_repo_app_default)
                .showImageForEmptyUri(R.drawable.ic_repo_app_default)
                .showImageOnFail(R.drawable.ic_repo_app_default)
                .displayer(new FadeInBitmapDisplayer(200, true, true, false))
                .build();
    }
    return repoAppDisplayImageOptions;
}
 
Example #30
Source File: WallpapersAdapter.java    From candybar with Apache License 2.0 5 votes vote down vote up
public WallpapersAdapter(@NonNull Context context, @NonNull List<Wallpaper> wallpapers) {
    mContext = context;
    mWallpapers = wallpapers;
    mIsAutoGeneratedColor = mContext.getResources().getBoolean(
            R.bool.card_wallpaper_auto_generated_color);
    mIsShowName = mContext.getResources().getBoolean(R.bool.wallpaper_show_name_author);

    mOptions = ImageConfig.getRawDefaultImageOptions();
    mOptions.resetViewBeforeLoading(true);
    mOptions.cacheInMemory(true);
    mOptions.cacheOnDisk(true);
    mOptions.displayer(new FadeInBitmapDisplayer(700));
}