网创优客建站品牌官网
为成都网站建设公司企业提供高品质网站建设
热线:028-86922220
成都专业网站建设公司

定制建站费用3500元

符合中小企业对网站设计、功能常规化式的企业展示型网站建设

成都品牌网站建设

品牌网站建设费用6000元

本套餐主要针对企业品牌型网站、中高端设计、前端互动体验...

成都商城网站建设

商城网站建设费用8000元

商城网站建设因基本功能的需求不同费用上面也有很大的差别...

成都微信网站建设

手机微信网站建站3000元

手机微信网站开发、微信官网、微信商城网站...

建站知识

当前位置:首页 > 建站知识

优秀的开源框架学习-创新互联

ButterKnife基本使用 http://www.cnblogs.com/mengdd/archive/2015/06/23/4595973.html

让客户满意是我们工作的目标,不断超越客户的期望值来自于我们对这个行业的热爱。我们立志把好的技术通过有效、简单的方式提供给客户,将通过不懈努力成为客户在信息化领域值得信任、有价值的长期合作伙伴,公司提供的服务项目有:域名申请虚拟主机、营销软件、网站建设、容县网站维护、网站推广。

Android SlidingMenu 使用详解

http://blog.csdn.net/lmj623565791/article/details/36677279

ImageLoader的源码分析:

这个库封装的层次实在是太多了!!!可以借鉴作者是怎么封装类的!!!

DisplayImageOptions  Builder   配置一些参数

ImageLoaderEngine       引擎类

ProcessAndDisplayImageTask

ImageLoadingInfo        存储一些下载相关的信息

。。。

从ImageLoader.getInstance().displayImage这个方法追溯,这个方法可以选传url,p_w_picpath,也可以传

入参数和进度监听者。

1)ImageLoader的实例化采用单例设计模式

2)ImageLoader的初始化init方法会初始化引擎ImageLoaderEngine,并传入DisplayImageOptions参数

 》ImageLoaderEngine封装了一些线程池的操作

 》这个类里还用到FlushedInputStream这个类,FlushedInputStream会避免个别的错误Issue 6066: BitmapFactory.decodeStream() fails if InputStream.skip() does not skip fully

 》类中用同步Map来存储ImageView的缓存key值。

 》submit会将任务提交到线程池

3)判断uri为不为null,为null会将参数DisplayImageOptions中的默认图片设置给ImageView。

 同时会回调监听者的一些方法

 从参数DisplayImageOptions中得到大的图片尺寸

 根据url和图片的大尺寸来生成缓存的key

 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

 大致的思路:

 》在Application里init

  初始化参数DisplayImageOptions并传递给ImageLoaderEngine类。

  ImageLoaderEngine主要是维护了一些线程池,对Runnable任务进行管理。

  任务主要是通过Handler来实现线程间的通讯。

 》在display里解析DisplayImageOptions封装的参数信息

 》判断对url==null作处理

 》获取key

 String memoryCacheKey = MemoryCacheUtils.generateKey(uri, targetSize);

 ++DisplayImageOptions.Builder在初始化build()的时候,如果用户没有设置某些参数,它会自动

 进行一些默认设置,通过DefaultConfigurationFactory这个类。

public ImageLoaderConfiguration build() {
			initEmptyFieldsWithDefaultValues();
			return new ImageLoaderConfiguration(this);
}

 ++initEmptyFieldsWithDefaultValues方法进行的一些主要的初始化操作:

 如diskCache、memoryCache、downloader等,很好地体现了面向对象的编程思想。

private void initEmptyFieldsWithDefaultValues() {
			if (taskExecutor == null) {
				taskExecutor = DefaultConfigurationFactory
						.createExecutor(threadPoolSize, threadPriority, tasksProcessingType);
			} else {
				customExecutor = true;
			}
			if (taskExecutorForCachedImages == null) {
				taskExecutorForCachedImages = DefaultConfigurationFactory
						.createExecutor(threadPoolSize, threadPriority, tasksProcessingType);
			} else {
				customExecutorForCachedImages = true;
			}
			if (diskCache == null) {
				if (diskCacheFileNameGenerator == null) {
					diskCacheFileNameGenerator = DefaultConfigurationFactory.createFileNameGenerator();
				}
				diskCache = DefaultConfigurationFactory
						.createDiskCache(context, diskCacheFileNameGenerator, diskCacheSize, diskCacheFileCount);
			}
			if (memoryCache == null) {
				memoryCache = DefaultConfigurationFactory.createMemoryCache(context, memoryCacheSize);
			}
			if (denyCacheImageMultipleSizesInMemory) {
				memoryCache = new FuzzyKeyMemoryCache(memoryCache, MemoryCacheUtils.createFuzzyKeyComparator());
			}
			if (downloader == null) {
				downloader = DefaultConfigurationFactory.createImageDownloader(context);
			}
			if (decoder == null) {
				decoder = DefaultConfigurationFactory.createImageDecoder(writeLogs);
			}
			if (defaultDisplayImageOptions == null) {
				defaultDisplayImageOptions = DisplayImageOptions.createSimple();
			}
		}
	}

 》根据key从缓存中获取Bitmap

 Bitmap bmp = configuration.memoryCache.get(memoryCacheKey);

 判断缓存中有没有得到Bitmap

 LoadAndDisplayImageTask,从网络上下载图片位于tryLoadBitmap()这个方法当中

 通过BaseImageDecoder这个类的decode方法下载网络图片,通过BaseImageDownloader获得输入流,

 网络请求采用的是HttpURLConnection。

Freco图片加载框架:

1.缓存

在5.0以下系统,Bitmap缓存位于ashmem,这样Bitmap对象的创建和释放将不会引发GC,更少的GC会使你的APP运行得更加流畅。

5.0及其以上系统,相比之下,内存管理有了很大改进,所以Bitmap缓存直接位于Java的heap上。

当应用在后台运行是,该内存会被清空。

2.渐进式JPEG图

Fresco 支持渐进式的网络JPEG图。在开始加载之后,图会从模糊到清晰渐渐呈现。

你可以设置一个清晰度标准,在未达到这个清晰度之前,会一直显示占位图。

渐进式JPEG图仅仅支持网络图。

3.渐进式JPEG图

另外有需要云服务器可以了解下创新互联scvps.cn,海内外云服务器15元起步,三天无理由+7*72小时售后在线,公司持有idc许可证,提供“云服务器、裸金属服务器、高防服务器、香港服务器、美国服务器、虚拟主机、免备案服务器”等云主机租用服务以及企业上云的综合解决方案,具有“安全稳定、简单易用、服务可用性高、性价比高”等特点与优势,专为企业上云打造定制,能够满足用户丰富、多元化的应用场景需求。


文章名称:优秀的开源框架学习-创新互联
标题URL:http://bjjierui.cn/article/ddeegd.html

其他资讯